[ODE] Fail to make a proper car's orientation via adding torque to its chassis

Jon Watte (ODE) hplus-ode at mindcontrol.org
Tue Jul 31 02:14:58 MST 2007


If you will add real ground at some point, your model will be entirely 
wrong. The way a car turns is because of its contact with the ground 
(which comes from simulated wheels). You turn by changing the way the 
wheels want to slide/roll (the friction in the rolling direction is 
zero; the friction in the side direction is big).

Cheers,

          / h+


Dmitry Medvedev wrote:
>  Hello, everybody.
>
>  I have a simple floating in vacuum car( just a chassis, no wheels) and orthogonal view on the XY-plane. The steering force move the car in the goal point in XY-plane (chassis->addForce() is used). I know that it is unwise to directly set car's orientation via setRotation(), so I am trying to use addTorque() instead with no success like the following:
>   T = I * dw/dt = I * (w2 - w1) / dt
>   w2 = (theta2 - theta1) / dt
>   theta2 = atan2f(mHeading.y, mHeading.x);
>   theta2 = atan2f(mOldHeading.y, mOldHeading.x);  
>  
> T - torque (0, 0, Tz) as rotation take place in XY- plane only.
> I - XY inertia component, is found from ODE like mChassis->getInertiaMatrix()[2*4 + 2]
> w1, w2 - angular velocities in i-1 and i steps accordingly
> theta1, theta2 - car's heading angles in i-1 and i steps accordingly 
> mHeading = normalised(linearVelocity()) - vector2D
>  
> So, the aim is to find the amount of torque to add every time step to turn a car, so its orientation match new linear velocity direction. What could be wrong here or is any better approach to set car's orientation with addTorque() else?
>
>  Thank you.
>
>  In practice my car sometimes turn in wrong direction. 
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
>
>
>   


More information about the ODE mailing list