[ODE] My brainless virtual creatures

Rob Leclerc leclerc at cpsc.ucalgary.ca
Mon Apr 21 18:48:02 2003


Pete,

Not bad. Here is some advice:

1. You probably want to limit the range of freedom for the joints. This
gives you much smaller search space.

2. Give him a fitness of -1 if the body part touches the ground. Just
make a geometry for the plane and test to see if the body geom touches
the plane geom. There is a function in nearCallback (?) that checks for
the CD. This is what I use:

/**
 * Is the body part touching the ground?
 */
dContact contact;
contact.surface.mode = 0;
contact.surface.mu = 0.1;
contact.surface.mu2 = 0;
return (dCollide (geom1,geom2,0,&contact.geom,sizeof(dContactGeom)));

3. A motorized povit in the middle of the spine may help. I had to go
with three for mine

4. You may want to power your joint based on the distance you are from
desired angle. This may be difficult if you are not using NN's. I didn't
look at your code, but If you want to use the NN I have, it is pretty
simple. Just specify the number of input neurons, output neurons and
neurons in the middle layer. Then, just add values scaled to [-1,1] to
the input layer, have it calculate, and then pull the values off the
output layer to run the motors.

/**
 * Code to actuate a joint
 */
for(i = 0; i < NUM_ACTIVE_JOINTS; i++)
{    dJointSetHingeParam (joint[i],dParamFMax, MAX_MOTOR_STR);
     double relPosition = dJointGetHingeAngle(joint[i]);
     double diff = (relPosition) - (newOutput[i]);
     dJointSetHingeParam (joint[i],dParamVel, -diff * MAX_MOTOR_VEL);
     dJointSetHingeParam (joint[i],dParamFudgeFactor,0.1);
}

I put up a link to a zipfile which has the all the code. You can get it
at: (www.cpsc.ucalgary.ca/~leclerc/) Make sure you get the ODE one and
not the Vortex code I have up.

Best,
RDL



-----Original Message-----
From: ode-admin@q12.org [mailto:ode-admin@q12.org] On Behalf Of Pete
Graves
Sent: Monday, April 21, 2003 7:30 PM
To: ode@q12.org
Subject: [ODE] My brainless virtual creatures


I've seen a lot posted about virtual creatures recently, and thought
share 
what I've done so far. It's very basic compared with what else I've seen

posted, but I hoped to get some comments and advice.

A genetic algorithm is used to evolve a set of parameters for the phase,

offset, and amplitude of sine waves controlling motor velocity for each
of 
the creature's 4 legs (instead of evolving a neural net, which is
probably 
much better). The fitness function measures the distance each creature 
travels from the start point within a set time.

I'm quite new to C++, and I'm still struggling with getting my head
around 
the physics involved. I've uploaded a windows executable and source code
at 
http://www.geocities.com/pete_gravesathotmail/

The best bits to look at are in Creature.cpp and Simulation.cpp. I
haven't 
yet had much luck with evolving successful locomotion - the best I've
got is 
creatures evolved to throw themselves about.

I think I need to re-examine how I have chosen to cross-over chromosomes

(single-point cross-over), which ends up just copying some legs from one

parent, and some from the other, and trying it again.

Any advice will be very much appreciated! Especially from people using
ODE 
for similar projects.

Pete.


_________________________________________________________________
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

_______________________________________________
ODE mailing list
ODE@q12.org
http://q12.org/mailman/listinfo/ode

-----Original Message-----
From: ode-admin@q12.org [mailto:ode-admin@q12.org] On Behalf Of Pete
Graves
Sent: Monday, April 21, 2003 7:30 PM
To: ode@q12.org
Subject: [ODE] My brainless virtual creatures


I've seen a lot posted about virtual creatures recently, and thought
share 
what I've done so far. It's very basic compared with what else I've seen

posted, but I hoped to get some comments and advice.

A genetic algorithm is used to evolve a set of parameters for the phase,

offset, and amplitude of sine waves controlling motor velocity for each
of 
the creature's 4 legs (instead of evolving a neural net, which is
probably 
much better). The fitness function measures the distance each creature 
travels from the start point within a set time.

I'm quite new to C++, and I'm still struggling with getting my head
around 
the physics involved. I've uploaded a windows executable and source code
at 
http://www.geocities.com/pete_gravesathotmail/

The best bits to look at are in Creature.cpp and Simulation.cpp. I
haven't 
yet had much luck with evolving successful locomotion - the best I've
got is 
creatures evolved to throw themselves about.

I think I need to re-examine how I have chosen to cross-over chromosomes

(single-point cross-over), which ends up just copying some legs from one

parent, and some from the other, and trying it again.

Any advice will be very much appreciated! Especially from people using
ODE 
for similar projects.

Pete.


_________________________________________________________________
Use MSN Messenger to send music and pics to your friends 
http://www.msn.co.uk/messenger

_______________________________________________
ODE mailing list
ODE@q12.org
http://q12.org/mailman/listinfo/ode