Forums

Full Version: Bug in cartire.cpp CARTIRE::PacejkaMz
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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;
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.
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);