Forums
Code question for CARDYNAMICS::ApplyWheelForces - Printable Version

+- Forums (https://www.vdrift.net/Forum)
+-- Forum: Community (https://www.vdrift.net/Forum/forumdisplay.php?fid=3)
+--- Forum: Bugs (https://www.vdrift.net/Forum/forumdisplay.php?fid=7)
+--- Thread: Code question for CARDYNAMICS::ApplyWheelForces (/showthread.php?tid=1540)



Code question for CARDYNAMICS::ApplyWheelForces - LBodnar - 07-31-2011

Code:
    //calculate brake torque
    btScalar wheel_brake_torque = (0 - wheel[i].GetAngularVelocity()) / dt * wheel[i].GetInertia() - wheel_drive_torque + tire_friction_torque;
    if (wheel_brake_torque > 0 && wheel_brake_torque > brake[i].GetTorque())
    {
        wheel_brake_torque = brake[i].GetTorque();
    }
...

What does AngularVelocity / dt * Inertia term represent?

Consider half-braked wheel at constant high speed. In such condition brake force should equal friction force. But Velocity / dt * Inertia will be non-zero, increase with speed and depend on iteration time step. Why is it there?


- NaN - 07-31-2011

Not the most readable piece:
Code:
btScalar dw = 0 - wheel[i].GetAngularVelocity();
btScalar lockup_torque = wheel[i].GetInertia() * dw / dt; // torque to lock a free rotating wheel
btScalar wheel_brake_torque  = lockup_torque - wheel_drive_torque + tire_friction_torque;



- LBodnar - 07-31-2011

NaN Wrote:
Code:
btScalar dw = 0 - wheel[i].GetAngularVelocity();
btScalar lockup_torque = wheel[i].GetInertia() * dw / dt; // torque to lock a free rotating wheel

dw / dt should be angular accelaration, so how come dw = - Velocity?


- NaN - 07-31-2011

Lock up torque, as torque required to lock a free rotating wheel, reduce its angular velocity to zero.