Welcome to Robot Rebels, an online robot maker community.

Register today to post your projects, ask questions, share knowledge and meet like-minded people from around the world.

The Community

Author Topic: Gait Creation Using Excel  (Read 119 times)


  • Member
  • ****
  • B
  • Posts: 11
Gait Creation Using Excel
« on: June 08, 2017, 01:41:11 PM »
This is a tricky subject to put words around so let’s start with a diagram:

*Gait1.JPG (8.21 kB . 225x213 - viewed 22 times)

This is a ‘stick figure’ representation of a robot hind leg. Perhaps a cat with thigh, shin and elongated foot controlled by three servo motors at the hip, knee and heel. If we know the three motor angles and the three ‘bone’ lengths then we could calculate and somehow display the diagram.

Excel is good at processing lots of maths and can easily graph most things but I didn’t realise it could also draw this. It was right under my nose all the time calling itself a scatter chart to compare x,y pairs.

So easy then to set up a spreadsheet to compute and display how high the bot will ride and where ground contact will be made. Thigh length times the sine of the hip angle gives the x co-ordinate at the knee etc.

The attached .xls file sheet “Steps” shows how this can produce a series of frames. The macro ‘spinner button’ will step through one pace of a walking gait pattern that I prepared earlier.

Of course I had to enter each angle and make adjustments until the height and ground contact were exactly right for each ‘frame' of the sequence. During the ‘driving phase’ the contact point will be on the ground. Starting in front of the hip it will move smoothly backwards to propel the bot forward. Then it will lift off the ground and move forward ready to start the process again.

Later perhaps, it is seen to be riding too high to be stable so the height needs to be reduced by a couple of centimetres and the process re-worked.

Only 60 angles to redo!

Wouldn’t it be nice if the spreadsheet could do this for us?

Surely we already have the definition of the system: the segment lengths, angles and their limits, the shape with the knee at the front and not behind etc. We have what might be called the ‘kinematics’ of the system.

What we really want is to turn the answer into the question. If the ground contact is 44mm in front of the hip and bot rides 173mm above the ground then what are the three angles?

Inverse Kinematics

Learned papers are written on this subject. It would take a lot of coffee before I could attempt to follow the maths of rapidly and efficiently calculating how best to reach the ‘target’ location.

So what. Excel isn’t going to do it in real time anyway so perhaps we can just try something and see what happens.

The sheet titled “IK” has the same equations and the same graph plus a macro button. To view the macro code use Alt F11 and note that it is version 2003.

The leg arrangement is a sort of ‘Z’ shape which can raise and lower the toe position without moving backwards or forwards. So the angle p would mainly influence the target x position whilst angles h and k between them would mainly influence the target y position. A good starting point then is to hover with the toes in line with the hip.

The macro then decides if the angles must be increased or decreased by one degree at a time. Angles h and k are changed alternately. A test is made to see if the new calculated x,y position is within range of the target. Within 1.5mm seems to work.

The process iterates until either the target value or a servo limit is reached. The bot height is still a variable so we could knock 2cm off the height and recompute now with no effort. The y-axis can be altered to put the hip at the right height to display the toes on zero.

The principles used within these tools should help with other leg shapes too.

Making It More Fun (or just more complicated)

I tend to stretch things (including me) to find their limits so the third sheet defines the question in this form:

*Gait2.JPG (4.93 kB . 238x74 - viewed 20 times)

Here we see the cyclic movement of the toes, on the ground pushing backwards then arcing up and forward ready to start on the ground again.

This time the macro takes each toe position x,y pair in turn and computes the leg parameters to achieve it. These are displayed as a moving sequence of frames allowing us to see what our bot might do even before we make anything. Use Escape then End to stop the display.

The output values are calculated once and placed at the right. The CSV strings are prepared in two parts to copy and paste into a lookup table.

The display is 2D but there seems no reason why the macro should not compute movement in the z plane. A cat will place a paw under the body centre line to keep balance. A motor angle at the hip for adduction can be included in the computation but the 3D display is more challenging.

And for homework: link four (or more) leg calculations in the correct phase then plot the footfall, highlighting where the COM falls outside a triangle of support.

*Gait Creation.xls


* Search

* Recent Topics

Great selection by jinx
[August 18, 2017, 06:12:17 AM]

all metal hotend by jinx
[August 18, 2017, 06:08:36 AM]

stars by exploremore
[August 18, 2017, 01:15:44 AM]

PCB mill by ossipee
[August 17, 2017, 06:09:13 PM]

AGM by ossipee
[August 15, 2017, 06:03:19 PM]

Backlash by jinx
[August 14, 2017, 10:49:52 AM]

HF x2 mill un boxing by Impala
[August 13, 2017, 12:49:54 AM]

Re-writing robotics by PerceptualRobots
[August 11, 2017, 03:53:10 PM]

3D Printed Full size Humanoid by DangerousThing
[August 07, 2017, 02:09:23 AM]

Fun Fact by Impala
[August 06, 2017, 01:04:13 AM]

big vice by jinx
[August 04, 2017, 03:32:25 AM]

Cyclopis radiator by jinx
[August 03, 2017, 10:10:03 AM]

CAD learning by tinhead
[August 02, 2017, 03:03:50 AM]

lathe cutting off by jinx
[August 01, 2017, 11:05:54 AM]

HAD "Show us your Roboto" contest by Gareth
[July 31, 2017, 09:54:36 AM]

* Recent Posts

Re: Great selection by jinx
[August 18, 2017, 06:12:17 AM]

Re: all metal hotend by jinx
[August 18, 2017, 06:08:36 AM]

Re: stars by exploremore
[August 18, 2017, 01:15:44 AM]

Great selection by exploremore
[August 18, 2017, 01:04:16 AM]

PCB mill by ossipee
[August 17, 2017, 06:09:13 PM]

Re: all metal hotend by Bajdi
[August 17, 2017, 07:41:20 AM]

Re: AGM by ossipee
[August 15, 2017, 06:03:19 PM]

Re: AGM by danphobic_
[August 15, 2017, 05:03:46 PM]

Re: AGM by danphobic_
[August 15, 2017, 04:59:28 PM]

Re: AGM by jinx
[August 15, 2017, 03:12:15 AM]

Re: AGM by ossipee
[August 14, 2017, 07:19:51 PM]

Re: AGM by 1 what
[August 14, 2017, 06:59:36 PM]

Backlash by jinx
[August 14, 2017, 10:49:52 AM]

Re: AGM by jinx
[August 14, 2017, 05:30:58 AM]

Re: AGM by ossipee
[August 13, 2017, 07:10:01 PM]