Class ESCModule
Electronic stability control. Measures body sideslip and brakes the wheels on the outside of the slide to counter the yaw moment, scaling the command with slip excess and speed.
Inherited Members
Namespace: NWH.VehiclePhysics2.Modules.ESC
Assembly: NWH.VehiclePhysics2.dll
Syntax
[Serializable]
public class ESCModule : VehicleComponent
Remarks
Needs left/right wheel pairs. Single-track vehicles get no useful correction and should leave it disabled. Braking is routed through Brakes, which must be active.
Fields
baseBrakeTorque
Base brake torque in Nm for a correction. Multiplied by intensity and slip excess to get the torque actually applied.
Declaration
[Tooltip("Base torque applied to wheels")]
public float baseBrakeTorque
Field Value
| Type | Description |
|---|---|
| float |
intensity
Global multiplier on every ESC correction. Useful band is 1-30; below 1 barely corrects.
Declaration
[Tooltip("Intensity of ESC correction")]
public float intensity
Field Value
| Type | Description |
|---|---|
| float |
interventionThreshold
Sideslip angle in degrees, between the velocity vector and vehicle forward, below which ESC does not intervene. Command grows from zero at this angle, it does not step in.
Declaration
[Tooltip("Minimum angle (degrees) before ESC activates")]
public float interventionThreshold
Field Value
| Type | Description |
|---|---|
| float |
minimumSpeed
Minimum vehicle speed in m/s for ESC to run. Keeps it out of parking and tight turns, where the slip angle is noise.
Declaration
[FormerlySerializedAs("lowerSpeedThreshold")]
[Tooltip("Minimum speed (m/s) for ESC to activate")]
public float minimumSpeed
Field Value
| Type | Description |
|---|---|
| float |
speedMultiplier
Intensity multiplier at speed. Lerps linearly from 1x at standstill to this value at 50 m/s (180 km/h) and holds there.
Declaration
[Tooltip("Intervention strength increase at higher speeds")]
public float speedMultiplier
Field Value
| Type | Description |
|---|---|
| float |
steeringCompensation
Steering angle is multiplied by this to give a symmetric sideslip allowance, so a driver steering into a slide is not fought. 0 treats all slip as unintended; raising it can only make ESC less intrusive.
Declaration
[Tooltip("How much to compensate for steering input")]
public float steeringCompensation
Field Value
| Type | Description |
|---|---|
| float |
Methods
VC_FixedUpdate(float)
Fixed-timestep update for forces, torques and other physics work. Called from VehicleController.FixedUpdate(), and only while the component is active.
Declaration
public override void VC_FixedUpdate(float DeltaTime)
Parameters
| Type | Name | Description |
|---|---|---|
| float | DeltaTime | Time elapsed since last FixedUpdate in seconds |
Overrides
VC_Initialize()
One-time setup, once per vehicle startup and after the VehicleController reference is set. Sets state.initialized on completion; an override that fails must leave it false.
Declaration
protected override void VC_Initialize()