[ODE] Re: Bad wheels

Paul Vint pvint at cfbtrenton.com
Fri Feb 11 08:59:27 MST 2005


The way I handle mine is similar to yours, with two exceptions:

1. call the steering loop every cycle - regardless of whether any steering 
input is gathered from the user (No steering input would mean one of two 
things, depending on how you define the controls: either it means "hold last 
position", or "centre the steering")

2. I do: dReal v = m_steer - dJointGetHinge2Angle1(wheel1id); for *each* 
wheel.

I had the same trouble as you, and changing my code so that it checked the 
angle of each wheel individually, and then calculating a velocity for each 
wheel cleared it up for me.

HTH

- Paul Vint


> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On
> Behalf Of THD
> Sent: Thursday, February 10, 2005 1:19 PM
> To: ODE at q12.org
> Subject: [ODE] bad wheels
>
> hello, I've got problems with my vehicle-steering in ODE
>
> 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.
>
> As you see beneath I ty to solve it setting
> dParamLoStop/dParamHiStop, but it doesn't seem to help...
>
>  This piece of code is called every frame:
> (m_isSteering is a bool checking if the steering keys are
> down, m_steer is float that increases if I press the steering keys.)
>
>
> if(m_isSteering == false)
> {
>   m_steer = 0.0f;
>   dJointSetHinge2Param (wheel1id, dParamLoStop, 0);
>   dJointSetHinge2Param (wheel1id, dParamHiStop, 0);
>   dJointSetHinge2Param (wheel2id, dParamLoStop, 0);
>   dJointSetHinge2Param (wheel2id, dParamHiStop, 0); } else {
>   dReal v = m_steer - dJointGetHinge2Angle1(wheel1id);
>   if (v > 0.1f)
>     v = 0.1f;
>   if (v < -0.1f)
>     v = -0.1f;
>   v *= 10.0f;
>
>   dJointSetHinge2Param (wheel1id, dParamVel, v);
>   dJointSetHinge2Param (wheel1id, dParamFMax, 0.2f);
>   dJointSetHinge2Param (wheel1id, dParamLoStop, -0.5f);
>   dJointSetHinge2Param (wheel1id, dParamHiStop, 0.5f);
>   dJointSetHinge2Param (wheel1id, dParamFudgeFactor, 0.1f);
>
>   dJointSetHinge2Param (wheel2id, dParamVel, v);
>   dJointSetHinge2Param (wheel2id, dParamFMax, 0.2f);
>   dJointSetHinge2Param (wheel2id, dParamLoStop, -0.5f);
>   dJointSetHinge2Param (wheel2id, dParamHiStop, 0.5f);
>   dJointSetHinge2Param (wheel2id, dParamFudgeFactor, 0.1f); }
>
>
> Shouldn't this work?
> Anyone who got any better steering-"algoritm" or suggestion?
>
> /Sepultang




More information about the ODE mailing list