TORCS  1.3.9
The Open Racing Car Simulator
differential.cpp File Reference
#include "sim.h"
Include dependency graph for differential.cpp:

Go to the source code of this file.

Functions

static tdble applyBrakeToSpinVel (tdble spinVel, tdble brkTq, tdble inertia)
 Integrate wheel/axle brake torque for one simulation step. More...
 
void SimDifferentialConfig (void *hdle, const char *section, tDifferential *differential)
 
void SimDifferentialReConfig (tCar *car, int index)
 
static void updateSpool (tCar *car, tDifferential *differential, int first)
 
void SimDifferentialUpdate (tCar *car, tDifferential *differential, int first)
 

Function Documentation

◆ applyBrakeToSpinVel()

static tdble applyBrakeToSpinVel ( tdble  spinVel,
tdble  brkTq,
tdble  inertia 
)
static

Integrate wheel/axle brake torque for one simulation step.

This helper encapsulates the common brake integration logic used in both spool and split-differential update paths.

Behavior details preserved from the original inline code:

  • Brake torque opposes the current rotation sign (SIGN(spinVel)).
  • If one integration step would cross through zero, the speed is clamped exactly to zero instead of changing sign.
  • If speed is exactly zero and braking requests a negative step (possible because SIGN(0) is positive), the step is suppressed to keep standstill.
Parameters
[in]spinVelCurrent angular speed.
[in]brkTqPositive brake torque magnitude for this axis.
[in]inertiaEffective rotational inertia used for integration.
Returns
Updated angular speed after applying brake integration for dt.

Definition at line 41 of file differential.cpp.

◆ SimDifferentialConfig()

void SimDifferentialConfig ( void *  hdle,
const char *  section,
tDifferential differential 
)

Definition at line 56 of file differential.cpp.

Here is the call graph for this function:

◆ SimDifferentialReConfig()

void SimDifferentialReConfig ( tCar car,
int  index 
)

Definition at line 87 of file differential.cpp.

Here is the call graph for this function:

◆ SimDifferentialUpdate()

void SimDifferentialUpdate ( tCar car,
tDifferential differential,
int  first 
)

Definition at line 167 of file differential.cpp.

Here is the call graph for this function:

◆ updateSpool()

static void updateSpool ( tCar car,
tDifferential differential,
int  first 
)
static

Definition at line 135 of file differential.cpp.

Here is the call graph for this function: