go_away

Author Topic: Understanding the guts of WebbotLib GaitDesigner/player  (Read 562 times)

0 Members and 1 Guest are viewing this topic.

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 742
  • Helpful? 23
  • Nuclear Engineer Roboticist
Understanding the guts of WebbotLib GaitDesigner/player
« on: September 29, 2012, 09:59:31 AM »
This is probably a question only Webbot knows the answer to...

I'm wanting to play around with dynamically scaling gaits created with GaitDesigner.  I'm pretty sure gaitRunnerSetDelta() is not sufficient for this.

In looking at the internal code, I could follow the math... But I'm stuck with not knowing what exactly the first six parameters in
Code: [Select]
MAKE_G8_LIMB_POSITION(cubeX,cubeY, squareX,squareY, timeX, timeY, startY)are for.  These values are mysteriously generated by GaitDesigner and don't seem to be actual squares/cubes of numbers...  It would be useful to know what algorithm is being implemented, as well (cubic spline interpolation maybe? bezier curves?)

Thanks!

I

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,121
  • Helpful? 108
Re: Understanding the guts of WebbotLib GaitDesigner/player
« Reply #1 on: September 30, 2012, 05:24:48 AM »
Gait Designer http://webbot.org.uk/iPoint/44.page

gaitRunnerSetDelta() adds an offset rather than a scale - ie it could be used to modify the ankle joint to keep the robot upright when on a slope.

If you just want to scale the output amount then cant you just multiply the resultant DRIVE_SPEED by a scale factor? Or are you trying to scale 'time' as well?

How does it work? Haha - you are asking me to give away my trade secrets........... :o

The gait runner uses Bezier curves. Each curve has a start point, and end point and two control points that effect the curve. In Gait Designer you can change the view so that these control points are displayed. Assume the points are called 's' (start), 'e' (end), 'c1' (control point 1) and 'c2' (control point 2). To calculate a point along the curve at time 't' (where t is a value between 0 and 1) then the equation is:
(t*t*t)*(3*(c1 - c2) + e - s)  +  (t*t)*(3*(s-2*c1+c2)) + t*3*(c1 - s) + s

so: if t=0 then the answer is 's' (the start). if t=1 then the answer is 'e' (the end)

If you split the above equation at the '+' signs then you will see that first part is based on time cubed, then time squared, then time and finally it just offsets by the start point. Hence the names - 'cube', 'square', 'time' and start.
Next you will notice that the first 3 parts have values based on the points and are therefore constant. So Gait Designer pre-calculates these and stores them in the MAKE_G8_LIMB_POSITION data.
Finally: you will notice that this limb position only stores the Y value of the start point and not the X value. Why? Well the X value is given by (ie 'is the same as') the start time of the curve stored elsewhere. No point storing in twice.

The next problem is that 't' above represents the time (between 0 and 1) spent travelling along the curve. But in our case the x axis represents elapsed time (ie time since power turned on). So we know what 'x' is - its the time since this curve started - but we don't know what 't' on the curve is. You will therefore see an iterative loop: that keeps guessing 't' until the solved equation gives the correct 'x' value. Now we have got 't' we can solve for 'y' (the amount of limb movement).

In reality each animation is made by stitching several curves together. So given an 'x' value it first has to work out which curve has: curveStartX<= x <=curveEndX. Now it knows which curve - it can use the iterative approach mentioned above to solve for 'y'.





Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline GertlexTopic starter

  • Supreme Robot
  • *****
  • Posts: 742
  • Helpful? 23
  • Nuclear Engineer Roboticist
Re: Understanding the guts of WebbotLib GaitDesigner/player
« Reply #2 on: September 30, 2012, 11:17:42 AM »
If you just want to scale the output amount then cant you just multiply the resultant DRIVE_SPEED by a scale factor? Or are you trying to scale 'time' as well?
This... is exactly what I need.  Evidently I trapped my thought processes into a corner...
Quote
How does it work? Haha - you are asking me to give away my trade secrets........... :o
:D
I greatly appreciate the explanation of your trade secrets.
I

 


Get Your Ad Here