[ODE] AMotorUser dilemma

Royce Mitchell III royce3 at ev1.net
Sun Jan 11 23:52:16 MST 2004


We have robots in our game that are motivated via 4 "casters".

These casters are spheres attached to the main body via Ball joints.

Here's my motor setup code:

dAMotorJoint* motor = new dAMotorJoint ( world ):
motor->attach ( *obj[i].body, *wheel );
motor->setMode ( dAMotorUser );
motor->setNumAxes ( 3 );

const int rel = 1;

motor->setAxis ( 0, rel, 1, 0, 0 );
motor->setParam ( dParamVel, 0 );
motor->setParam ( dParamFMax, 0.1 );

motor->setAxis ( 1, rel, 0, 1, 0 );
motor->setParam ( dParamVel2, 0 );
motor->setParam ( dParamFMax2, 0.1 );

motor->setAxis ( 2, rel, 0, 0, 1 );
motor->setParam ( dParamVel3, 0 );
motor->setParam ( dParamFMax3, 0.1 );

the idea is the first two axes can be used in combination to spin the
caster in any direction I want. By setting particular settings between
each of the 4 casters, I can accomplish forward/reverse/lateral and
rotational motion, as required.

The third axis is of little use to me, except I created it to prevent
motion on that axis.

Anyways, the problem I'm having is that I thought a rel=1 would cause
the motor's axis to stay aligned with the robot's body. For some
reason, this is not the case, but it is world-aligned. If I tell it to
spin all 4 motors' X axes positive, then my robot always goes North
instead of forward. In order to rotate the robot, I would have to
constantly adjust the motor's velocities as the robot turns.
Otherwise, it only travels about 80 degrees and then quits, based on
the rotation parameters I'm throwing at it.

Is there something I'm missing :(  Is there a way to accomplish what I
want without having to do a bunch of matrix transformations and
constantly recalculating my velocities?

Thanks,

Royce Mitchell III



More information about the ODE mailing list