[ODE] hexapod walking example

Adam Rotaru adam_rotaru at yahoo.com
Thu Dec 27 17:09:02 2001


  Those who are interested in using ODE to simulate
articulated
creatures might be interested in my first little
attempt, and,
might be able to help me with some problems I'm
having.
  I wanted to create a simple articulated body with
locomotion.
I created a simple hexapod bug, with three pairs of
legs.
Each leg consist of two segments.  I apply torques at
the joints to
support the body.  I also programmed a simple pattern
of torques
to create a simple walking.  The desired position of
each leg is
modified according to the pattern, and torques are
applied
proprtional to the deviation from the desired
position.
The resulting gait is quite awkward, but the bug moves
forward!

Source, screenshots and a movie available at:
http://www.geocities.com/adam_rotaru/tmp/ode/

  Here are my small problems:

- I had to apply large torques to support the weight
of the body.
However, when a leg is unsupported, it moves very
quickly due to
the large torques.  Sometimes the bug falls apart,
which I attribute
to the large torques.  Smaller steps help here.

- I had to use large friction coefficients (1.3),
otherwise the legs
slip on the ground when pushing backwards.  The legs
often slip even
now.  Also, largish friction sometimes causes a hind
leg to get stuck
to the ground, when touching the ground box and the
ground simultaneously
(this can be seen in the movie too).
Making the simulation step smaller worses this
problem.

- I don't understand the ERP and CFM parameters for
contacts, but I
found to help in making the simulation more stable.  I
use these values
for collisions, without knowing why:

  contact[i].surface.mode = dContactSoftERP |
dContactSoftCFM |
    dContactSlip1 | dContactSlip2;
  contact[i].surface.mu = 1.3;
  contact[i].surface.slip1 = 0.1;
  contact[i].surface.slip2 = 0.1;
  contact[i].surface.soft_erp = 0.5;
  contact[i].surface.soft_cfm = 0.3;

- I need to use around 80 simulation steps per walk
cycle for an
acceptably stable simulation.

- Sometimes the simulation goes astray.

The bug works, but something goes wrong quite often. 
Usually it
walks only a few body lengths before exploding.  I
tried to
adjust various parameters (simulation step, walk cycle
length, friction,
etc.), but couldn't get rid of all problems.

Some other observations:

- I tried to use joint stops and motors instead of
torques, but that proved
to be to weak: the legs kept extending beyond the set
limits under the
weight of the body.  With very large Fmax values the
simulation became unstable.

- I wanted to use a Hinge2 joint between the first
segments and body.
However, Hinge2 does not have accessor functions for
the current angle
around the second axis.  Now I use two Hinge1 joints,
and a small (dummy)
segment between them.

- My walking code is unstable when the bug is upside
down.
If this happens, the but explodes (this is definitely
a problem of my code).

  Any comments welcome!
  cheers,
    Adam



__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com