Society of Robots - Robot Forum

Software => Software => Topic started by: klims on April 13, 2009, 07:43:40 AM

Title: SOR Biped Engine problems
Post by: klims on April 13, 2009, 07:43:40 AM
Hey guys,

I've been trying to use the biped engine files to get my biped up and running with the Axon MCU, but I'm having a few problems...

The software only has one servo for head rotation, but my robot has both pan and tilt.
When I try to copy the code in the file and make new variables for a tilt head servo the program seems to go mental. It stops responding to hyperterminal and eventually it causes the MCU status light to flash, which I think means its resetting.

Any idea why this is happening? I have been messing around with the code and it almost feels like the MCU is running out of variables...


Another question about the Engine, why do the leg servos lock when I turn the MCU on but not the arms?


thanks for your help guys,
Andrew.
Title: Re: SOR Biped Engine problems
Post by: Admin on April 13, 2009, 08:33:32 AM
Quote
The software only has one servo for head rotation, but my robot has both pan and tilt.
The code was written to be easy to reverse engineer. Just see how I did the other servos and imitate it. I bet it'll take you 10 minutes to figure it out, and another 15 to add your own code.

Quote
When I try to copy the code in the file and make new variables for a tilt head servo the program seems to go mental. It stops responding to hyperterminal and eventually it causes the MCU status light to flash, which I think means its resetting.
When you remove your code, does it work again? Does the resetting happen with all the servos attached? If so, you probably have a voltage problem.

Quote
it almost feels like the MCU is running out of variables...
When you compile the code it'll tell you how much memory you have left. It'll probably say you are using less than 40%.

Quote
Another question about the Engine, why do the leg servos lock when I turn the MCU on but not the arms?
What servos are you using? Digital servos lock when given power.
Title: Re: SOR Biped Engine problems
Post by: klims on April 13, 2009, 08:24:08 PM
The code is definitely easy to reverse engineer. I thought I understood it till I tried to add my own code and it broke.
Thinking that I had accidentally deleted something from somewhere I started again from scratch but I'm still having the same problems.

I have narrowed down the problem to this bit of code:

//long signed int forward_head_tilt[7]=      {100,150,200,150,100,0,-100};

When uncommented it causes the program to reset.
I have made the necessary changes to hardware.c


I seriously doubt its a voltage problem. I'm running 3600mAh of LiPo power through a 15A UBEC.
Also I disconnected the head servos and i'm still having the same problem.

I have digital servos in the legs. I never knew that they lock when powered :)

Yep your right. I'm only using about 40%
Title: Re: SOR Biped Engine problems
Post by: Admin on April 14, 2009, 12:06:58 AM
Hmmmm I don't see how that line would cause a reset . . . can you show us all code that was added?
Title: Re: SOR Biped Engine problems
Post by: klims on April 14, 2009, 03:10:21 AM
So the only files that I have changed are:

gaits.c
Axon.c
hardware.c

I'll attach the files, but I haven't really modified much.

In gaits.c I have changed the head variables to head_pan and added a head_tilt variable with associated code, as reverse engineered.

In Axon.c I have added the line #include "gaits.c"

In hardware.c I have changed the the head port to head_pan and added the line #define head_tilt( position ) servo(PORTA,1,position) for the extra servo


In the grand scheme of things I guess I don't need both pan and tilt just yet, but its annoying me that I don't understand why it doesn't work. So Admin if you have more pressing issues don't worry about this.


Andrew.
Title: Re: SOR Biped Engine problems
Post by: klims on April 14, 2009, 07:02:09 AM
I'm at a loss. Anything I do in any file seems to break the code! It just gets stuck in the reset loop.

Admin please help! I will attach my code that breaks the Axon as compiled by me. If you get a chance please upload it to your Axon and tell me if it works. If it doesn't maybe you could re-compile on your machine and try again.
Actually, could anyone with an Axon give this a try for me if they have some time?

Sorry but I have had to cut a few files from the folder to get it under the 500kb mark. You need to add the bootloader to the folder
Title: Re: SOR Biped Engine problems
Post by: Admin on April 14, 2009, 10:46:22 AM
I looked at your modifications (the code in the post before you posted the .zip file). I didn't see anything unusual . . .

Quote
I'm at a loss. Anything I do in any file seems to break the code! It just gets stuck in the reset loop.
Start back with the basic unmodified Axon code. See if that still works. Better yet, just upload one of the test .hex files.

I'd really like to say this is a low battery problem . . .
Title: Re: SOR Biped Engine problems
Post by: klims on April 14, 2009, 08:41:20 PM
I'd really like to say this is a low battery problem . . .
I wish it was as simple as a a low battery problem. I have unplugged all the servos and connected the Axon directly to a battery to ensure it is not a battery problem.

Start back with the basic unmodified Axon code. See if that still works. Better yet, just upload one of the test .hex files.
Yep all the code you have written works fine. It's only when I make significant changes to the code that it breaks. And by significant I mean more than about 5-10 lines of code.
I have started from scratch a number of times thinking that that might solve my problem, but no luck.


Can someone please try to upload my code to their Axon and tell me if the status light blinks?
If so maybe you could re-compile and try again.
    - the zip file I posted is missing the bootloader so you would need to add that to the folder.


Thanks for the help guys
Andrew.
Title: Re: SOR Biped Engine problems
Post by: klims on April 15, 2009, 03:34:40 AM
Not that I understand what is happening, but if I put a lot of delays around the place and comment out the "rprintf("\r\nSystem Warming Up");" it seems to work.

While the problem is not fixed at least I can write some code! :D


Thanks for all the help Admin!



Andrew.
Title: Re: SOR Biped Engine problems
Post by: Admin on April 15, 2009, 03:54:34 AM
If you ever figure it out let me know.

I use the code on my ERP (12 servos) and a customer of mine is using it on his biped without problems.
Title: Re: SOR Biped Engine problems
Post by: klims on April 15, 2009, 03:58:30 AM
No worries :)

How many servos is your customer running? Is he running the same biped shown in the tutorial of the Biped Engine?

If anyone gets around to loading up the code I posted earlier on their Axon please let me know. I would love to find out if its a problem with my hardware or a software problem.



Andrew.
Title: Re: SOR Biped Engine problems
Post by: Admin on April 15, 2009, 04:05:03 AM
How many servos is your customer running? Is he running the same biped shown in the tutorial of the Biped Engine?
Actually, the code was customized specifically for his biped. So the exact servos as specified in the code. For my ERP I had to modify it a bit. I also extended the gait arrays to [20] instead of the biped [7]. I haven't yet decided what the optimal number of steps in a gait array should be, but figured 7 is a bare minimum. After using the code for awhile, let me know your thoughts on it.

Quote
If anyone gets around to loading up the code I posted earlier on their Axon please let me know. I would love to find out if its a problem with my hardware or a software problem.
Remind me in ~3 weeks, and if you haven't solved it by then and no one else has tested it for you, I'll try your code out on my Axon. I'm pretty stressed out with my workload right now and won't be programming an Axon again until then :P
Title: Re: SOR Biped Engine problems
Post by: klims on April 17, 2009, 01:24:18 AM
HOORAY!!!!!!!!!!! :D

It was the timers all along!

As soon as I commented out these boys all was good.
timer2Init();
timer3Init();
timer4Init();
timer5Init();

Admin: which timers do I actually need? Through trial and error I figured out I needed the 0 and 1. What are the others for?


Andrew.
Title: Re: SOR Biped Engine problems
Post by: Admin on April 24, 2009, 08:17:30 AM
Which Axon code version were you using?
Title: Re: SOR Biped Engine problems
Post by: klims on April 24, 2009, 08:27:14 AM
Axon_Source_012609
Title: Re: SOR Biped Engine problems
Post by: Admin on May 30, 2009, 11:06:10 AM
Do this:

Code: [Select]
// initialize the timer system (comment out ones you don't want)
  init_timer0(TIMER_CLK_1024);
  init_timer1(TIMER_CLK_64);
  init_timer2(TIMER2_CLK_64);
  init_timer3(TIMER_CLK_64);
  init_timer4(TIMER_CLK_64);

The latest version had an entire rewrite of the timer/PWM functions.

(apologies for the late reply)
Title: Re: SOR Biped Engine problems
Post by: klims on June 11, 2009, 08:32:16 PM
Thanks for that Admin. I'll give it a go :)
Title: Re: SOR Biped Engine problems
Post by: klims on June 18, 2009, 02:31:14 AM
No luck Admin. I tried to insert the code you posted but there are a few variables missing.
I guess I will just wait for the new revision of the code.
Title: Re: SOR Biped Engine problems
Post by: Admin on June 18, 2009, 04:22:31 AM
Which variables?
Title: Re: SOR Biped Engine problems
Post by: klims on June 19, 2009, 02:46:26 AM
It said the timer clock variables had not been declared, as in the variables inside the brackets.
Where have you declared them?
Title: Re: SOR Biped Engine problems
Post by: Admin on June 19, 2009, 06:45:36 AM
You should initialize them, then. :P

Check to make sure you updated *all* code, including in axon.c. The timer initialization function names changed, which I'm betting is your problem.
Title: Re: SOR Biped Engine problems
Post by: klims on June 19, 2009, 11:48:58 PM
Champion! Seems to have fixed all the problems I was having with the timers :D

Once I upgraded to the beta version source code it worked. Thanks Admin
Title: Re: SOR Biped Engine problems
Post by: Admin on June 20, 2009, 04:08:46 PM
Oh, and when you get your biped running (or shuffling), post up vid!

I don't own a biped, so all I have to demonstrate it on is my ERP (of which video hasn't been uploaded yet).
Title: Re: SOR Biped Engine problems
Post by: klims on June 21, 2009, 04:04:11 AM
Yeah for sure.
Probably the wrong place to be talking about this, but can anyone tell me if there is an easy way/place to post info about projects?

Admin: would love to see some way of having projects attached to a user account so I could update projects I am working on (photos, text and possibly video) and others could view.
Title: Re: SOR Biped Engine problems
Post by: Admin on June 21, 2009, 09:21:35 AM
Member Tutorials is the best place to put a project, but has to be in an educational format :P
Then you can link to it in your forum signature.