# [ODE] Re: I have buckling joints with 4 wheeled vehicle

Denes Nagymathe denes at invictus.hu
Fri Jun 10 09:17:44 MST 2005

```Hi,

I faced the same problem when i played around with ODE. The problem is that
ODE measures the hinge angles in the current time frame (the start of the
step), but when the wheels are spinning fast enough, the resulting
correction torque points to a wrong direction (because it's based on the
angles at the start of the frame, but the wheel has already turned away).
My solution was to 'hack' (or let's call it 'improve' :) the hinge2 joint
to extrapolate the wheel orientation, and use this 'future' orientation
instead of the current to measure hinge angles. It looks like this:

...
//  HINGE2_GET_AXIS_INFO (q,s,c);
//by Denes: use _extrapolated_ orientation
dVector3 ax1,ax2;
{
dReal b2q[4], dq[4];
dMatrix3 b2R;
dWtoDQ (joint->node[1].body->avel,joint->node[1].body->q,dq);
for (int j=0; j<4; j++) b2q[j] = joint->node[1].body->q[j] +
0.5*dq[j]/info->fps;
dNormalize4 (b2q);
dQtoR (b2q,b2R);
dMULTIPLY0_331 (ax1,joint->node[0].body->R,joint->axis1);
dMULTIPLY0_331 (ax2,b2R,joint->axis2);
dCROSS (q,=,ax1,ax2);
s = dSqrt (q[0]*q[0] + q[1]*q[1] + q[2]*q[2]);
c = dDOT (ax1,ax2);
}
...

(The original HINGE2_GET_AXIS_INFO call in hinge2GetInfo2() is commented
out, and my code is inserted.)
Using a large ERP also helps a bit, so using the two together gave the best
results for me.

Denes

```