Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug in cartire.cpp CARTIRE::PacejkaMz
08-15-2011, 06:18 PM,
#1
Bug in cartire.cpp CARTIRE::PacejkaMz
The intention of friction_coeff is to scale the total result therefore its early application to D is problematic because D itself is used in calculation of B.
Code:
    // peak factor
    btScalar D = (c[1] * Fz + c[2]) * Fz * friction_coeff;

    // stiffness factor
    btScalar B = (c[3] * Fz * Fz + c[4] * Fz) * (1.0 - c[6] * btFabs(gamma)) * exp (-c[5] * Fz) / (c[0] * D);  // <-----
...
    // self-aligning torque
    btScalar Mz = D * sin(c[0] * atan(B * S - E * (B * S - atan(B * S)))) + Sv;

Should be

Code:
    // peak factor
    btScalar D = (c[1] * Fz + c[2]) * Fz;

    // stiffness factor
    btScalar B = (c[3] * Fz * Fz + c[4] * Fz) * (1.0 - c[6] * btFabs(gamma)) * exp (-c[5] * Fz) / (c[0] * D);
...
    // self-aligning torque
    btScalar Mz = friction_coeff * D * sin(c[0] * atan(B * S - E * (B * S - atan(B * S)))) + Sv;
Reply
08-16-2011, 05:49 PM,
#2
 
Maybe it is intended? But I think you are right. It should be at least be similar to Fx, Fy. I'll push a fix.
Reply
08-16-2011, 06:49 PM,
#3
 
NaN Wrote:Maybe it is intended? But I think you are right. It should be at least be similar to Fx, Fy. I'll push a fix.
It looks like a bug. At low angles Mz ~ B * D so if D ~ friction_coeff and B ~ 1/friction_coeff then friction_coeff is cancelled out and that is exactly how it feels. There was no difference in feel over grass or tarmac.

I think Sv should be scaled down as well. I.e. consider non-friction surface with friction_coeff = 0. I assume Mz should be zero rather then Sv.

Code:
Mz = friction_coeff * (D * ... + Sv);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)