Society of Robots - Robot Forum

Software => Software => Topic started by: KurtEck on February 07, 2010, 10:57:18 AM

Title: DeBrat - AxonII based Lynxmotion biped Brat
Post by: KurtEck on February 07, 2010, 10:57:18 AM
I thought since I have mentioned this project in a few other threads, I would give it it's own thread.  Over the last little bit I have been having fun programming in C again.  My current project is to use webbotlib and develop some code for one of my Brats.  I have been having lots of fun.

Currently I have the brat walking using a multiple servo move function set that I wrote.  I basically tell a group of servos to go from where they are now to a new location in some set time like 500ms and this code takes care of updating all of the servos currently at every 50ms, such that all of the servos arrive at their end points at the specified time.  I am currently using webbotlib's scheduler functions for this.

I can control the robot using either a lynxmotion wireless PS2 controller or using a XBEE based remote control the there are several threads up on Lynxmotion.

My latest update was to use some new functionality that was added to webbotlib in 14a that allows you to update the underlying data (center point...) of the servo.  With this I have code that if you hold down the axon2 button while powering up the brat will go into a config mode that allows me to use the USB serial port to adjust the servos.  When I am done I save away this information on the EEPROM of the AXon2 and this data is used each time I power up the brat. 

There is more information including a picture and a zip file containing a checkpoint of my code up on a thread on the lynxmotion forum: http://www.lynxmotion.net/viewtopic.php?f=7&t=5876&p=59489#p59489 (http://www.lynxmotion.net/viewtopic.php?f=7&t=5876&p=59489#p59489)

Having fun! :D

Kurt
Title: Re: DeBrat - AxonII based Lynxmotion biped Brat
Post by: Hertz32 on February 07, 2010, 11:11:05 AM
nice m8 8)
keep us updated ;D
Title: Re: DeBrat - AxonII based Lynxmotion biped Brat
Post by: Admin on February 07, 2010, 08:21:33 PM
Quote
I basically tell a group of servos to go from where they are now to a new location in some set time like 500ms and this code takes care of updating all of the servos currently at every 50ms, such that all of the servos arrive at their end points at the specified time.  I am currently using webbotlib's scheduler functions for this.
Hmmmmm my biped engine doesn't use the scheduler, I'm gonna have to look into this . . . will probably need to write a Biped Engine v4 after I finish testing v3.

Quote
My latest update was to use some new functionality that was added to webbotlib in 14a that allows you to update the underlying data (center point...) of the servo.  With this I have code that if you hold down the axon2 button while powering up the brat will go into a config mode that allows me to use the USB serial port to adjust the servos.  When I am done I save away this information on the EEPROM of the AXon2 and this data is used each time I power up the brat.
I do something very similar.

Look at angle_finder.h in my ERP code:
http://www.societyofrobots.com/downloads/ERP_code_020110.zip (http://www.societyofrobots.com/downloads/ERP_code_020110.zip)

I basically just the keyboard to find the center, or any position, and it'll output it by hyperterminal. Then I just copy/paste the positions into my code.
Title: Re: DeBrat - AxonII based Lynxmotion biped Brat
Post by: KurtEck on February 07, 2010, 09:56:01 PM
Quote
I basically tell a group of servos to go from where they are now to a new location in some set time like 500ms and this code takes care of updating all of the servos currently at every 50ms, such that all of the servos arrive at their end points at the specified time.  I am currently using webbotlib's scheduler functions for this.
Hmmmmm my biped engine doesn't use the scheduler, I'm gonna have to look into this . . . will probably need to write a Biped Engine v4 after I finish testing v3.
Yep, I first wrote it to run as something I call from my main function, then I changed it to run on it's own timer, but then "webbotlib" suggested that I convert to the scheduler, which is working well.  I have tried to make it semi independent of being for the BIPED and you can start up multiple different moves, but if the servos overlap each other the last call wins...
The code still needs to be cleaned up and better comments, etc, but it is working OK for my own use.

If I were doing this completely from scratch I would probably merge some of the functionality  with the servo class for the software servos and only use the scheduler for PWM servos.  That is when the servo timer happens and the servo pulse is output, the code could then update the pulse width for the next cycle...

So far it appears to working OK for the 7 hardware PWM servos  Maybe soon I will pick up another board and try it on a hex with 18 servos with some of them software generated and then see how well it really works.

My code also has functions to setup a sequence of moves.  The moves are defined in 10ths of a degree for each of the servos (in the order Right Ankle, Knee, Hip, Left Ankle, Knee, Hip) and time in mS.  So for example the code to getup from the front, looks something like:
Code: [Select]
static CMLSD1 s_cmlsd1_UpFromFront = {6, {
         {   0,   0,   0,  0,   0,   0, 500},
         {   0, 900, 450,  0, 900, 450, 500},
         { 400, 900,-370,  0, 900, 450, 500},
         {   0, 900,-650,  0, 900,-650, 500},
         {   0, 900,-650,  0, 900,-650, -300}, // Was a pause 300 may put in something special for this...
{  0,   0,   0,   0,   0,   0,1000}}};
My code is not very accurate on angles as I have not refined how the DRIVE_SPEED values are calculated from the specified angles...  I am now considering converting the values from these values to either DRIVE_SPEED values which are more direct or ... Will see, some of this will depend on my next step, which may be to add my own sequencer or to make it emulate something like an SSC32.  That way I can build sequences with a program running on the PC... will see where I end up :)

I do something very similar.

Look at angle_finder.h in my ERP code:
I basically just the keyboard to find the center, or any position, and it'll output it by hyperterminal. Then I just copy/paste the positions into my code.

Yep saw that, look great :).  Just thought it would be fun to implement my own and I figure I would more likely fix my servo positions if I could do it on the fly without having to rebuild and download... 

Kurt