collapse

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

BaldwinK

  • Member
  • ****
  • B
  • Posts: 22
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
*Gait1.JPG (8.21 kB . 225x213 - viewed 205 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
*Gait2.JPG (4.93 kB . 238x74 - viewed 207 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

The unnamed (yet) quatruped spider project by tinhead
[July 01, 2020, 04:22:11 PM]


"1984 Nixie Time" by 1 what
[May 08, 2020, 01:04:18 AM]


2D Side Scroller Cyberpunk themed by Killer Angel
[February 06, 2020, 06:39:40 AM]


A new wing design for model aircraft / drones by OddBot
[February 06, 2020, 04:42:06 AM]


SDR (Software Defined Radio) by Gareth
[February 02, 2020, 06:15:42 AM]


Circuit Math by ZeroMax
[January 31, 2020, 01:50:18 PM]


NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]


"D" -Pad Workio just like Magic (Will Merlin stay or Go) (part 6 of 7) by Gareth
[December 30, 2019, 09:51:27 AM]


PS4 Joystick Digitals 4,5,6,7,10 - Analog's Lx,Ly,Rx,Ry Workio (part 5 of 7) by Gareth
[December 30, 2019, 09:50:37 AM]


Menu Workio ! (part 4 of 7) by Gareth
[December 30, 2019, 09:49:49 AM]


L1 trigger design Workio (Hori controller) (part 3 of 7) by Gareth
[December 30, 2019, 09:48:50 AM]


Hori aka PS4 Joystick Mappings (part 2 of 7) by Gareth
[December 30, 2019, 09:47:17 AM]


PS4 Single Left-Handed Controller (part 1 of 7) by Gareth
[December 30, 2019, 09:44:58 AM]

* Recent Posts

Re: The unnamed (yet) quatruped spider project by tinhead
[July 01, 2020, 04:22:11 PM]


Re: The unnamed (yet) quatruped spider project by jinx
[July 01, 2020, 04:06:19 PM]


Re: "1984 Nixie Time" by 1 what
[May 08, 2020, 01:04:18 AM]


Re: "1984 Nixie Time" by tomasp
[April 13, 2020, 06:03:28 PM]


Re: 2D Side Scroller Cyberpunk themed by Killer Angel
[February 06, 2020, 06:39:40 AM]


A new wing design for model aircraft / drones by OddBot
[February 06, 2020, 04:42:06 AM]


Re: "1984 Nixie Time" by Gareth
[February 02, 2020, 06:23:01 AM]


Re: SDR (Software Defined Radio) by Gareth
[February 02, 2020, 06:15:42 AM]


Re: SDR (Software Defined Radio) by ZeroMax
[January 31, 2020, 01:54:21 PM]


Re: "1984 Nixie Time" by ZeroMax
[January 31, 2020, 01:52:29 PM]


Circuit Math by ZeroMax
[January 31, 2020, 01:50:18 PM]


Re: 2D Side Scroller Cyberpunk themed by ZeroMax
[January 31, 2020, 01:45:33 PM]


NanOMeter by Protowrxs
[January 01, 2020, 12:59:44 PM]


Re: Investigating the VL53L0X Laser Rangefinder by erco
[December 30, 2019, 10:45:44 PM]


PS4 Single Handed Controller Deployed (part 7 of 7) by Gareth
[December 30, 2019, 09:52:29 AM]