[ODE] bad wheels
Jon Watte
hplus-ode at mindcontrol.org
Tue Feb 15 10:12:32 MST 2005
> My vehicle is a box with 4 spheres as wheels (hinge2-jointed), it's
> driving on a trimesh. My problem is steering. Sometimes the left wheel
> locks steering full left, sometimes the wheels steer in different
> direction, also problem increases when I drive faster.
Do you set the constraints twice? If not, you have to, because of an
ordering problem (ODE won't let lostop and histop ever conflict).
I submitted a patch to fix this, but it seemed to have been dropped
on the floor.
Add the lines with "+":
> if(m_isSteering == false)
> {
> m_steer = 0.0f;
> dJointSetHinge2Param (wheel1id, dParamLoStop, 0);
> dJointSetHinge2Param (wheel1id, dParamHiStop, 0);
+ dJointSetHinge2Param (wheel1id, dParamLoStop, 0);
> dJointSetHinge2Param (wheel2id, dParamLoStop, 0);
> dJointSetHinge2Param (wheel2id, dParamHiStop, 0);
+ dJointSetHinge2Param (wheel2id, dParamLoStop, 0);
> }
> dJointSetHinge2Param (wheel1id, dParamVel, v);
> dJointSetHinge2Param (wheel1id, dParamFMax, 0.2f);
> dJointSetHinge2Param (wheel1id, dParamLoStop, -0.5f);
> dJointSetHinge2Param (wheel1id, dParamHiStop, 0.5f);
> dJointSetHinge2Param (wheel1id, dParamFudgeFactor, 0.1f);
> Shouldn't this work?
> Anyone who got any better steering-"algoritm" or suggestion?
That's the wrong way of doing it. You want to set LoStop and
HiStop to be the same, and to be the angle at which you want to
turn. Further, a force of 0.2 is usually quite small -- for a
body of mass 1, that'll only accelerate it to 0.2 units per
second per second. (But, as I said, you don't want to be doing
this anyway).
There's some steering code in the Carworld sample, which you
can likely crib. It also does the thing where the inner wheel
turns more than the outer wheel, which is crucial.
http://www.mindcontrol.org/~hplus/carworld/
Cheers,
/ h+
More information about the ODE
mailing list