Society of Robots - Robot Forum

Software => Software => Topic started by: Admin on March 24, 2009, 11:10:51 PM

Title: SoR Biped Engine (free software to program bipeds)
Post by: Admin on March 24, 2009, 11:10:51 PM
I wrote up some software for anyone to use to program biped robots. If you own an Axon, it'll take you only like ~30 minutes to get a working walking biped robot controlled by your computer.

http://www.societyofrobots.com/sor_biped_engine.shtml (http://www.societyofrobots.com/sor_biped_engine.shtml)

If anyone has more ideas to improve it, or have thoughts on it after trying it out, let me know.

(http://www.societyofrobots.com/images2/sor_biped_engine.png)
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Webbot on April 04, 2009, 12:41:02 PM
Where did you get the mechanical skeleton - buy or make?
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on April 04, 2009, 08:42:14 PM
Where did you get the mechanical skeleton - buy or make?
You mean that picture? That's airman00's biped, its the BRAT (http://www.lynxmotion.com/Category.aspx?CategoryID=97) chassis that by coincidence fits the Axon perfectly.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: superchiku on April 04, 2009, 11:30:56 PM
omg   :o :o :o :o :o $300 for a chassis..
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Razor Concepts on April 04, 2009, 11:42:48 PM
Typical lynxmotion  :P
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: SmAsH on April 04, 2009, 11:48:37 PM
although it does come with 6 servos and an mcu doesnt it? look at how much you pay for other bipeds?
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: superchiku on April 05, 2009, 01:25:43 AM
my bad didnt see it..
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on April 07, 2009, 09:54:19 PM
The new version has been released, v2.

http://www.societyofrobots.com/downloads/SoR_Biped_Engine_v2.00.zip (http://www.societyofrobots.com/downloads/SoR_Biped_Engine_v2.00.zip)

The new version adds speed control and smoothing to better control your biped. It also works great for robot arms, such as on my ERP.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on April 14, 2009, 04:13:54 AM
First of all, nice piece of software. Took me ages to develop something like this in basic for the BasicMicro!

My only complaint is that it seems very tedious to have to compile and re-program the Axon just to change a single servo value because it is slightly out.
I haven't been able to get the RoboRealm software working with the SOR_Axon file so this may already be done, but from what I can tell the servo values I would get  in RoboRealm are not the same as the ones I would put into the gait matrix in the Biped Engine.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on April 14, 2009, 06:15:45 AM
Quote
My only complaint is that it seems very tedious to have to compile and re-program the Axon just to change a single servo value because it is slightly out.
Yeap I'm aware of this, working on it!

I have two more big enhancements for this code coming up in the next ~4 months. The first is an automatic gait generator, and the second modifies your gait in real time to keep balance using sensors.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on April 14, 2009, 09:08:37 PM
I have two more big enhancements for this code coming up in the next ~4 months. The first is an automatic gait generator, and the second modifies your gait in real time to keep balance using sensors.

That would be incredible! If you need anyone to help with testing I would be more than happy to lend a hand :D


About my other question, how do the values obtained in RoboRealm relate to the ones in SOR Biped Engine?
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on April 14, 2009, 09:34:11 PM
About my other question, how do the values obtained in RoboRealm relate to the ones in SOR Biped Engine?
They relate, I just don't know the equation.

Open up Excel and plot the value in RoboRealm vs the value in the Axon code at every ~20 degrees and you'll find a straight line. Then just use excel to give you the equation of that line (right click, and find the option that says show equation).
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on April 17, 2009, 03:05:24 AM
Hey guys,

I'm pleased to announce that I have hacked up Admin's code and made something that will let you modify servo values real time!
I am currently using it to develop gaits for my biped's walking sequence.

By no means is it perfect. In fact it's probably the worst design in terms of OO! but it works :)
If you have any problems or questions let me know and I'll try to help.

Here are the instructions:

1/ Download the gaits.c and control.c file and replace them with your current ones.
        - I would suggest starting up a new project all together so you don't lose your previous work

2/ Compile and upload to your Axon

3/ Run hyperterminal and follow the instruction.

Note: if you look through the first section of control.c you will notice a variable called 'sensitivity'. This value determines how much the servos will move in one increment


Enjoy!

Andrew.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on June 11, 2009, 08:29:33 PM
Hey Admin, any idea when the new version with the rewrite of the timer/PWM functions will be released?
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on June 16, 2009, 11:42:14 AM
Hey Admin, any idea when the new version with the rewrite of the timer/PWM functions will be released?
That rewrite came out a long time ago with the last Axon code release :P


edit: And FYI, a new Biped Engine version release is coming soon. I made it easier to add new gaits, and created more examples too. I also have some demo videos I'll put up soon.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on June 27, 2009, 09:01:07 PM
v2.1 has been released:
http://www.societyofrobots.com/downloads/SoR_Biped_Engine_v2.1.zip (http://www.societyofrobots.com/downloads/SoR_Biped_Engine_v2.1.zip)

Also, I added my gaits_ERP.c from my ERP. It gives a good example of how to use it for programming arms to do stuff.

Still working on that video . . .

Quote
v2.1, June 27th, 2009
better support for multiple gaits with multiple array counts added
float issues solved

v2.0, March 31st, 2009
-gait meshing enabled: avoids jumping between each position
-reverse gait added - just the inverse of the forward gait
-home position had a bug in v1, effectively multiplied home by 2x
-added *_count variable to help people mod gait array
-changed all gait variables to long signed int, to avoid bugs from people modifying code


v1.0, March 25th, 2009
basic biped engine written, tested on ERP
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on June 27, 2009, 09:55:19 PM
Looks good! Looking forward to giving the new version a go

Can you maybe explain why it is necessary to have so much repetition with the code?
For example in your gaits_ERP code you have 4 individual gaits that each need a method and an array of robot poses.

Why not just have a method called biped_move something like this:
Code: [Select]
biped_move(int head, int left_arm, int right_arm..... etc)and the method would tell the servos to move to the required positions. Then making a new gate would be as simple as:

Code: [Select]
void dance_routine(int speed)
{
    biped_move(head_pos, left_arm_pos, right_arm_pos .....etc); /pos1
    biped_move(head_pos, left_arm_pos, right_arm_pos .....etc); /pos2
    biped_move(head_pos, left_arm_pos, right_arm_pos .....etc); /pos3
    ...
}

this would mean you could minimise the memory required to store the arrays for each gate.
Not sure about other people's walking gaits, but mine are made up of 30-40 poses usually.

I'm sure there is an advantage to having the motions stored in arrays, but it would put my mind at ease if you could explain them :)


Andrew
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on June 27, 2009, 10:27:22 PM
Hmmmm yea you're right, too much repetition. I'll have to think about it for the next version I guess!

Quote
Not sure about other people's walking gaits, but mine are made up of 30-40 poses usually.

I'm sure there is an advantage to having the motions stored in arrays, but it would put my mind at ease if you could explain them
30-40?! :o

You see, with my biped engine, you don't need more than ~10 for a gait! The intermediate points are automatically calculated depending on the speed given for smooth motion. Change one datapoint, all the others automatically adjust. Storing it all in arrays was the most efficient way of organizing and accessing the data.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on June 27, 2009, 11:37:41 PM
You see, with my biped engine, you don't need more than ~10 for a gait! The intermediate points are automatically calculated depending on the speed given for smooth motion. Change one datapoint, all the others automatically adjust. Storing it all in arrays was the most efficient way of organizing and accessing the data.

Hmmmm... I'm not quite sure what you are trying to say in this paragraph. When using your Biped Engine I don't see any intermediate points being calculated.
The reason mine are 30-40 long is because your software seemed to just make the servos move to their positions at max servo speed. The 'speed' variable seems to only be related to the delay till the next robot pose. This is why I needed to 'interpolate' the robot poses required for walking to make one continuous smooth motion.
Realistically I only have 9 poses in the walking gate.

Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on June 28, 2009, 07:12:54 AM
Oh, then you were using v1 of the code?! v1 didn't do the interpolation, where v2 does.

Give it another try with v2.1 using just 9 poses.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on June 29, 2009, 07:13:04 AM
I can't believe I wasted so much time interpolating! That is a great idea. it makes life so much easier  ;D
I'm 100% sure I downloaded v2.00 and it didn't come with this functionality... Not sure what happened there.

Another thing that I would love to see integrated into the biped engine would be some kind of variable array start and end positions.
Let me explain...

When I'm creating walking sequences there is some initial starting poses needed to get the robot into a position so that I can just run the walk sequence in a loop to achieve multiple steps. Now the problem comes when I change from the start_walk poses to the walk poses. My robot jolts around and the motion does not look smooth. But once he is going its all good.
So, If I could define the start and end points to the array so the first few poses might be related to start_walk and are only called the first time round the loop and there are some end_walk poses related to stopping the robot that are only called when the robot is finishing walking, I think the overall motion will be improved drastically. It would also mean I wouldn't need to have so many different sequences defined.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on June 29, 2009, 07:37:31 AM
That last comment I made I just implemented myself. It works really well!!! Way better than I expected.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on August 21, 2009, 12:25:13 PM
I'm finishing up v3.0 to the gait engine. It is easier to use than v2 and allows for more control of your gait.

Also, it has a beta for a new algorithm I wrote that modifies your gait in real-time based on sensor data. For example, if it starts to fall over while walking, it'll adjust the gait to re-balance without stopping.

It allows for both hardware and software PWM controlled servos simultaneosly.

Lastly, it has automatic gait creation capabilities. You hardcore just two gaits, and it'll create any new gait in real-time for you.

I'll explain more when the code gets released. The beta will be out in ~2 weeks, but the final probably not for another month or two.


Quote
When I'm creating walking sequences there is some initial starting poses needed to get the robot into a position so that I can just run the walk sequence in a loop to achieve multiple steps. Now the problem comes when I change from the start_walk poses to the walk poses. My robot jolts around and the motion does not look smooth. But once he is going its all good.
Quote
That last comment I made I just implemented myself.
I'm guessing you made it as two separate gaits? One followed by the other?

Ever got video of your robot using it? I'll upload my video someday . . . lol
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on August 22, 2009, 03:21:47 AM
Nice! I'm looking forward to it  ;D
I'm keen to see how you will be grabbing sensor data in real time without multi-threading.

Hardware and Software PWM control? Is this maybe for use with non-digital servos? My robot is kindof a combination of the two at the moment and the analogue ones aren't working...

Lastly, it has automatic gait creation capabilities. You hardcore just two gaits, and it'll create any new gait in real-time for you.

This sounds interesting. I'll be keen to hear more about it when you do a release.

I'm guessing you made it as two separate gaits? One followed by the other?

Nope. I did it a lot simpler I think  :D
Code: [Select]
void walk_forward(int speed, int num_steps)
{
int start = 0;
int end = forward_count; //set to last pose in continuous walk sequence


for (repetitions = 0 ; repetitions < num_steps ; repetitions++)
{
for (i = start ; i < end ; i++)
{
//to test a particular position, uncomment i
//and set it to a particular value
//i=0;

//send each command several times
for (j=0;j<speed;j++)
{
//j=0;//for testing particular kinematics points

calculate_per(speed, forward_count);

head=forward_head[i]*per_a + forward_head[next]*per_b;
...
right_elbow=forward_right_elbow[i]*per_a + forward_right_elbow[next]*per_b;

biped_move();
}
}

start = 8; //position where the walk gate repeats itself
}
}

(also need to change "next = start" instead of making it equal to 0)

so you pretty much just change the start point of the walking gait based on whether you are completing more than one continuous walk cycle. Make sense?
I actually tried the method you mentioned (two gaits) but the transition between the gates was too noticeable.

I should totally get around to making a short video of my progress...


Andrew.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on August 22, 2009, 03:39:48 AM
My biped.

[youtube]http://www.youtube.com/watch?v=LIPtz6sEs00[/youtube]
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on August 22, 2009, 10:30:56 AM
Quote
Hardware and Software PWM control? Is this maybe for use with non-digital servos? My robot is kindof a combination of the two at the moment and the analogue ones aren't working...
The analogue servos need to be sent a command about 3x as often as the digital. Are you sending commands often enough?

Quote
so you pretty much just change the start point of the walking gait based on whether you are completing more than one continuous walk cycle. Make sense?
oh! well, v3 will be even better ;D
(but I probably won't get it perfect till v4)

Quote
I'm keen to see how you will be grabbing sensor data in real time without multi-threading.
Nope, no multi-threading needed. It goes into the main loop, checking at every interpolated step.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on August 26, 2009, 05:36:04 AM
The analogue servos need to be sent a command about 3x as often as the digital. Are you sending commands often enough?
Is there an easy way to account for this within the biped engine?

Nope, no multi-threading needed. It goes into the main loop, checking at every interpolated step.
Cool. I must say I have my doubts about whether this will cause any delay issues in the stances.

Hurry up and get it finished so I can test it out!  ;D
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on August 26, 2009, 08:28:42 AM
The analogue servos need to be sent a command about 3x as often as the digital. Are you sending commands often enough?
Is there an easy way to account for this within the biped engine?
Well, you just need to measure how often you send a pulse. Either use the timers, or test it with an oscope. Some people use interrupts to control servos.

Quote
Hurry up and get it finished so I can test it out!  ;D
I'll do my best! Would you like to be a beta tester? The caveat is I can't promise it'll work, but it'll get you the code weeks/months earlier.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on August 26, 2009, 07:04:56 PM
I'll do my best! Would you like to be a beta tester? The caveat is I can't promise it'll work, but it'll get you the code weeks/months earlier.
That would be great! The assignments are piling up so the sooner the better... hopefully I will get a chance to actually play with it
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on October 08, 2009, 03:51:22 AM
Yo Admin, what's happening with the latest release? Any news?
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on October 08, 2009, 05:35:51 AM
I'm still fine tuning it. And actually I've been using it on almost a daily basis now for my robot fish.

I haven't had time to port it to my ERP, so it has a lot of fish related code mixed in. Tell you what, if I quickly fix it up without testing or instructions, are you willing to work with it? 95% chance there'll be no bugs, and the comments in the code should make it easy to figure out.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on October 08, 2009, 05:54:54 AM
Done! I'm keen to get a look at your ideas.
Send it over ! ;D
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on November 02, 2009, 08:20:52 AM
I think it'll take me a bit longer to get it ready. I have several important deadlines for stuff that I need to get done as first priority.

At the *latest* I'll have it done by xmas break.
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: Admin on December 11, 2009, 10:05:32 PM
klims, I just sent you the v3.0 alpha version with instructions.

If anyone else wants it, let me know. Be aware instructions are minimal at the moment, so you'd be better to wait for beta if you are a "slow" programmer :P
Title: Re: SoR Biped Engine (free software to program bipeds)
Post by: klims on December 15, 2009, 01:07:46 AM
Thanks for that Admin. I'll be checking it out real soon  ;D