Free shipping on orders over \$75

# IK and Gait programming

 Print view Share : #at3win #at3winheader h3 { text-align:left !important; } Previous topicNext topic

Page 1 of 1 [ 9 posts ]

Rookie ( offline )
Posts: 18
Posted: 2008-01-28 11:48
 Post subject: IK and Gait programming
Im looking to develop a IK and gait controller for the hexapod im currently building. I have a simple IK solution in place for the legs, where each leg tip can be told to move to a (X,Y,Z) coordinate relative to the base frame of each leg.

Im currently trying to figure out how to build a module which can tie in a gait, the IK and possibly a few other functions, although im having problems trying to figure out exactly how to structure the code. It seems like the logical flow would be combining the gait step with a vector which describes the height, speed and direction of movment, and then also a rotation and then making a movment based on all these criteria, but easier said than done! Can anyone offer and advice or hints as to what to do now? Im using C# on a quad core 2 duo so there is no restrictions on processing power or optimising code for now!

Guru ( offline )
Posts: 4203
Posted: 2008-01-28 16:56
 Post subject: Re: IK and Gait programming
Some thoughts,

Input a vector to get direction and speed. Use joystick XY or a command from a higher level.

Revolve the vector around the leg angles to get corrected vectors.

Add the vector to the current position to get a new position for a foot.

Do IK for each foot to get moves needed for each foot.

Divide up the move as needed into smaller moves for the servos.

For the gait, move three (tripod) legs at a time.

Rotation vectors can be added in the same way.

alshmac wrote:
Im looking to develop a IK and gait controller for the hexapod im currently building. I have a simple IK solution in place for the legs, where each leg tip can be told to move to a (X,Y,Z) coordinate relative to the base frame of each leg.

Im currently trying to figure out how to build a module which can tie in a gait, the IK and possibly a few other functions, although im having problems trying to figure out exactly how to structure the code. It seems like the logical flow would be combining the gait step with a vector which describes the height, speed and direction of movment, and then also a rotation and then making a movment based on all these criteria, but easier said than done! Can anyone offer and advice or hints as to what to do now? Im using C# on a quad core 2 duo so there is no restrictions on processing power or optimising code for now!

I haven't looked at C#, C is enough for me.

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/

Rookie ( offline )
Posts: 18
Posted: 2008-01-30 10:31
 Post subject: Re: IK and Gait programming
Thanks, Im going to try work out a program structure similar to what you said, as thats how i thought it would be the best and quickest to make the program. C# isnt all too bad, just allows for pretty GUI's, and it is a lot quicker to develop in. Im planning to port all of the maths routines as an "engine" for IK and locomotion into ANSI C code once my project is complete.

Expert ( offline )
Posts: 557
Posted: 2008-01-30 16:46
 Post subject: Re: IK and Gait programming
I'm still a little puzzled by the whole IK calculations thing. I was wondering if someone can explain how to calculate for a 3DOF hexapod (CH3-R specifically) with diagrams and sample code perhaps.

I've looked at the program that Powerpod generates, although I'm familiar with trigonometry, what its doing hasn't clicked in my head yet.

Any help would be appreciated...

Guru ( offline )
Posts: 4203
Posted: 2008-01-30 19:08
 Post subject: Re: IK and Gait programming
Hi Tom,

That's gonna take a little time. Basically what is being done in IK is to calculate the angles needed on the leg joints to move to the next foot position. the next position is the vector addition of the joystick vector and the current foot position.

There is a drawing of the IK angles posted on this forum (courtesy Luis).

The leg forms a triangle, and the calculations involve two triangles, as will be seen in the diagram.

The Cosine law and the Pythagorean theorem is used to solve the triangles.

Here's a start.

tom_chang79 wrote:
I'm still a little puzzled by the whole IK calculations thing. I was wondering if someone can explain how to calculate for a 3DOF hexapod (CH3-R specifically) with diagrams and sample code perhaps.

I've looked at the program that Powerpod generates, although I'm familiar with trigonometry, what its doing hasn't clicked in my head yet.

Any help would be appreciated...

http://www.lynxmotion.net/viewtopic.php?t=2534&start=0&postdays=0&postorder=asc&highlight=

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/

Rookie ( offline )
Posts: 18
Posted: 2008-02-13 18:21
 Post subject: Re: IK and Gait programming
I have programmed a vector based engine which creates a tripod gait, and allows for forwards/back/strafing (and any combination), and all scaled to allow different step sizes and speed. Its still in a basic form having only been contemplated last night (and entirely programmed today!) and there is a fair bit of work to be done, a few features to add, but if anyone else is interested in helping me develop it (and my uni lets me release the code, apparently project work belongs to them?!) then I may consider releasing it...Its nothing special, but its another option for people! Its written in C# which is a very freindly language!

Guru ( offline )
Posts: 4203
Posted: 2008-02-13 21:54
 Post subject: Re: IK and Gait programming
That sounds interesting! What University?

How different is C# code? We have a few C programmers here on this forum that I'm sure would like to see it. You might also insider the IK yahool list (below) as a good place to exchange ideas.

alshmac wrote:
I have programmed a vector based engine which creates a tripod gait, and allows for forwards/back/strafing (and any combination), and all scaled to allow different step sizes and speed. Its still in a basic form having only been contemplated last night (and entirely programmed today!) and there is a fair bit of work to be done, a few features to add, but if anyone else is interested in helping me develop it (and my uni lets me release the code, apparently project work belongs to them?!) then I may consider releasing it...Its nothing special, but its another option for people! Its written in C# which is a very freindly language!

We're looking forward to hearing more about it!

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/

Rookie ( offline )
Posts: 18
Posted: 2008-02-14 13:33
 Post subject: Re: IK and Gait programming
Im at currently at Reading University in the UK, final year studying Robotic engineering. The C# code is fairly intuative to read, its similar to C++ I guess but with even more emphasis on being OO, and all the .Net functionality is included with C# (very easy to make great GUI's, easy serial port access etc...).

All in all its a very easy language to quickly prototype an application! I may consider re-writing the code in ANSI C, but not for a while as I have been advised not to add any more to my project untill after exams (when they might consider paying me to develop it further as a show piece for department open days)

However, I will try see if i'm allowed to release what has already been compiled, as soon as it has been marked etc...

Guru ( offline )
Posts: 4203
Posted: 2008-02-14 14:03
 Post subject: Re: IK and Gait programming
Hi,

ANSI C would be my choice, but then after you strip off the Object Orientated stuff, maybe it's close to C anyway! Certainly readable for the basic content. Who knows, maybe I'll learn something about C# as well!

alshmac wrote:
Im at currently at Reading University in the UK, final year studying Robotic engineering. The C# code is fairly intuative to read, its similar to C++ I guess but with even more emphasis on being OO, and all the .Net functionality is included with C# (very easy to make great GUI's, easy serial port access etc...).

All in all its a very easy language to quickly prototype an application! I may consider re-writing the code in ANSI C, but not for a while as I have been advised not to add any more to my project untill after exams (when they might consider paying me to develop it further as a show piece for department open days)

However, I will try see if i'm allowed to release what has already been compiled, as soon as it has been marked etc...

I am a little curious about "bloat". With all the new stuff, everything seems to get much bigger then used to be necessary.

Sounds like a good deal! Getting paid to work on your pet project! But if your Universities work like ours, the work is owned by the public at some point, and available for review. At least that's the way I think it works. Maybe not.

Alan KM6VV

_________________
Visit:
http://groups.yahoo.com/group/SherlineCNC/
http://tech.groups.yahoo.com/group/HexapodRobotIK/

All times are UTC - 5 hours [ DST ]. It is currently 2015-08-29 19:31