ABS Brain
A simulation of a car attempting a stopping maneuver from 100 km/h on dry, wet, ice, and patchy roads. A slip rule and one uncalibrated neural net hold the grip peak to avoid wheel lock inefficiency.
Overview
The traditional “panic brake slam” at 100 km/h locks the wheels, and the car slides 50.8 m on dry, 76.5 m on wet, and 305.0 m on ice. A classic slip rule with one tune cuts that to 42.3 m, 57.9 m, and 231.6 m. A small neural net that gets no surface label matches the best-tuned rule everywhere—42.3 m, 55.8 m, 221.8 m—and holds parity on seeded ice-patch roads where fixed bands mistune.
The simulation setup is simple: pick a controller and a road, then press “Run Simulation.” The top-view car runs west to east over asphalt drawn per condition, with blue bands where the ice patches lie. Below, a brake bar shows live torque and a countdown shows meters left. The grip curve shows the live operating point hunting the peak. The verdict names the winner and carries the numbers.
Task
One task: a straight-line stop. The headline numbers use 100 km/h; the slider covers 20–120 km/h.
- Mass: quarter car, 400 kg, wheel inertia 1.0 kg·m², radius 0.31 m.
- Grip: Burckhardt curves per surface. Peaks: dry ~1.17 at 0.17 slip, wet ~0.80 at 0.13, ice ~0.19 at 0.06. Full-lock slide values sit well below each peak, which is why locking loses.
- Patchy road: dry base with seeded ice patches (benchmark seeds 55, 66, 77).
- Brakes: first-order lag with a 0.02 s time constant; 2000 N·m cap, enough to lock the wheels on every surface.
- Score: braking distance from pedal hit to 0.5 m/s plus a formula tail. Reaction time is excluded.
Method
One wheel, two speeds, one torque. Each millisecond:
- Read the wheel slip versus car speed, clamped past standstill.
- Look up grip on the Burckhardt curve for the surface under the wheel.
- Command torque: full torque for No ABS, pump-hold-dump around the peak for Classic, net output for NN Brain.
The controller monitors slip ratio—how much slower the wheel spins than a free-rolling wheel at the same road speed. The classic rule (traditional ABS system) carries hysteresis per calibration: dump (reduce braking torque) past 0.18 (0.09 on ice), pump (increase braking torque) below 0.13 (0.05 on ice), hold (keep the current torque) when slip falls between the two thresholds. The net takes an 8-step history of normalized speed, slip, and torque; this gives it some short-term history rather than just a snapshot of the current state. These are processed through a 24-12-1 (24 inputs, 12 hidden neurons, 1 output) tanh net and return a torque step at the same 100 Hz rate. The neural net observes the same torque limits, including the maximum allowable braking torque—preventing the neural network from winning by applying more braking force; and it is passed no explicit label such as dry asphalt, wet road, or ice. Instead, it must infer the appropriate response.
Why One Net Instead of Three Rules
A shipped ABS holds one tune per car, not per road, and mistunes where grip surprises it: dry bands on uniform ice need 231.6 m where ice bands need 221.1 m. The net closes that gap to 221.4 m with no tune to pick. Training imitates a perfect-knowledge oracle — bands switched by true surface — on uniform and patchy tracks, then the label is thrown away: the deployed net infers grip from history alone. The trainer lives in slip-happens, a standalone repo; the site ships only its weights as JSON — fetched lazily, validated by ID, never bundled.
Widget Parts
| Part | Value |
|---|---|
| Model | Single-wheel longitudinal, Burckhardt grip, patch segments by distance, 1 ms semi-implicit Euler |
| Classic | Slip hysteresis, one calibration per stop, 100 Hz commands |
| Net | 24-12-1 tanh MLP on 8-step history, frozen snapshot abs-brain-nn/1, forward only |
| Draw | Canvas 2D top view, sprite car, brake bar plus countdown, 4.5 s playback |
| Sample end | Ice 305.0 → 231.6 m one-tune classic, 221.4 m net with no label |
What I Learned
Why did evolution search fail before cloning worked?
Because 300 generations of evolution strategies never left the starting band: any perturbation broke the tuned hysteresis and the lock penalty buried the gradient under cliffs. Imitating the oracle step by step reached parity in one supervised run. Method choice is the project when the landscape is a spike.
Why does the classic barely beat locked before tuning?
Because the first rates were lopsided: dump at 8000 N·m/s against pump at 3000. The wheel spent the stop under-braked and finished near locked distance. Symmetric 6000 N·m/s rates with a tighter band fixed it at once. Rate shape is ABS design in threshold control.
Why does ice peak so much earlier?
The Burckhardt fit puts the ice peak near 0.06 slip against 0.17 on dry. One band for all surfaces either chatters on dry or locks on ice. Per-surface bands are not tuning garnish; they follow the curves. The net’s whole job is living without them.
Honest Limits
Single wheel, straight line, Burckhardt grip fits. Score is braking distance from pedal hit to 0.5 m/s plus a formula tail, with no reaction time. Numbers report one frozen snapshot, not a fixed law. Patchy benchmarks use shared seeds. The trainer lives outside this repo; the site ships weights only.
References
- Bosch. 2019. Automotive Handbook. 10th ed. Bentley Publishers.
- Burckhardt, Manfred. 1991. Fahrwerktechnik: Radschlupf-Regelsysteme. Vogel.
- MathWorks. n.d. “Model an Anti-Lock Braking System.” Accessed October 5, 2026. https://www.mathworks.com/help/simulink/slref/modeling-an-anti-lock-braking-system.html
- Sutton, Richard S., and Andrew G. Barto. 2018. Reinforcement Learning: An Introduction. 2nd ed. MIT Press.