Vehicles
Brakes and Handbrake
Applies normalized service-brake and handbrake inputs through separate per-wheel torque limits.
The Boolean brake and handbrake wheel options select useful default torques; explicit max torque values remain authoritative.
Per-wheel configuration#
| Field | Default | Meaning |
|---|---|---|
| brake | true | Defaults max_brake_torque to 1500 when true, otherwise 0. |
| max_brake_torque | 1500 or 0 | Non-negative service-brake torque. |
| handbrake | false | Defaults max_handbrake_torque to 4000 when true, otherwise 0. |
| max_handbrake_torque | 4000 or 0 | Non-negative handbrake torque. |
car.add_wheel(-0.8, -1.4, -0.2, {
brake: true,
max_brake_torque: 1800,
handbrake: true,
max_handbrake_torque: 4500
});Runtime#
car.set_brake(brake); // clamped to 0..1
car.set_handbrake(handbrake); // clamped to 0..1- A non-zero global brake input has no effect on a wheel whose corresponding maximum torque is zero.
- Service brake is normally configured on all wheels; handbrake is commonly rear-only.
- Braking performance also depends on tyre contact, load, friction and chassis mass.
Verified operation contracts#
These contracts distinguish units, return values, errors and lifetime according to the current implementation. Check results: false, 0 and undefined can mean different things for different methods.
| Symbol / owner | Signature | Operation contract |
|---|---|---|
| JoltVehicle.set_brake | JoltVehicle.set_brake(value) | Built live vehicle; Boolean. Throttle/steering clamp -1..1, brake/handbrake 0..1. Single setters preserve other inputs; set_inputs defaults brakes to 0. |
| JoltVehicle.set_handbrake | JoltVehicle.set_handbrake(value) | Built live vehicle; Boolean. Throttle/steering clamp -1..1, brake/handbrake 0..1. Single setters preserve other inputs; set_inputs defaults brakes to 0. |