Inspiration

In FSAE endurance the battery has to last 22 laps. Coasting before a braking zone saves energy for very little lap time, but the driver needs to know when to do it. The challenge gave us the judges' simulator, test.py, and logged stints from a real car. We wanted a cue that scores well on the official scorer and that a real person could follow.

What it does

Our code answers one question ten times a second: should the driver lift now? The function is step(telemetry, track) and returns {"lift_cue": 0 | 1}. When the cue is on, the car coasts.

We trained four neural networks to make that call, each for a different driver. Model 1 neural scores 76.97 out of 85 on the five public stints in the official test.py, and every safety gate passes. Never cueing scores 48.22, and on two of the stints it fails the 2 % charge and 392 V gates.

Stint Model 1 neural
ds1 unmanaged 73.73
ds2 lift and coast 80.51
ds3 hard push 75.52
ds4 noisy, high resistance 80.46
ds5 time optimal 74.46

The file we submitted, team_submission.py, is the hand-built Model 1 that the network learned from. It scores 76.92 on the same stints.

How we built it

Each network starts from a hand-built teacher that prices every row:

$$ \text{value} = \text{energy saved} + \text{lift-window credit} - p \times \text{seconds lost} $$

The price \( p \) is the exchange rate between battery and lap time, re-fitted every lap by replaying the last lap with a set of candidate prices. The teacher also keeps a safety shield: a forced lift when pack voltage is predicted to come close to the 392 V cutoff, a guard for the 2 % charge gate, and a last-resort limp-home cue.

Then we trained the networks in PyTorch:

  • Behaviour cloning. The network learns the teacher's per-row cue from 42 to 50 features the teacher computes, such as the learned price, the energy budget, lap memory and, for Models 2 and 4, the learned driver delays. The teacher's own decision is not an input.
  • DAgger (Models 2 to 4). The network drives, and the teacher labels the states the network actually reaches, so it learns to recover from its own mistakes.
  • Evolution strategies. For Models 1 and 3 we then tuned all the weights on the score with the perfect driver, with antithetic weight perturbations and Adam, on fresh generated stints, and kept the best checkpoint on held-out stints.
  • Run time. Weights are fixed during a stint and run in NumPy. The safety shield stays as code on top of the network.

The official scorer assumes a driver who follows every switch of the light instantly. We built our own simulated driver with reaction delays of 0.3 to 0.6 s, missed cues of 1 to 7 % and a shortest possible lift, using numbers from published reaction-time studies. Each network plans for a different driver:

Network Plans for Official score Our simulated typical driver
Model 1 neural a perfect driver 76.97 51.46
Model 2 neural a late driver who misses cues; it learns the delay and lifts earlier 75.81 73.43
Model 3 neural a light a human can follow: at most 12 lift blocks a lap 75.61 63.87
Model 4 neural both 75.36 72.70

The simulated-driver column is our own test on the five public stints, not an official score.

We also built a driver display. The lamp goes dark the moment the brake is touched, bridges short gaps so it does not strobe, and keeps battery and voltage warnings on separate steady lamps. It drives an ESP32 steering-wheel unit over Web Serial, and a 3D race viewer replays every stint from the judges' own simulator.

Challenges we ran into

  • The best cue for the scorer flickers. On low-charge stints Model 1 switches the light between brake taps, more than 1,600 times a stint. The scorer's driver follows that, and a person cannot. Limiting the light to blocks a human can follow costs 1.4 to 1.6 official points (Model 3 and 4 neural against Model 1 neural).
  • Training on the score is slow and noisy. Evolution strategies gained on Models 1 and 3 but found no validated gain on Models 2 and 4, so those ship as their behaviour-cloned networks.
  • Telling stints apart early. The hard-push stint looks like a low-charge stint for the first 7 laps. Waiting to be sure cost more on the other stints than it gained.
  • Late drivers and the voltage gate. With our simulated drivers, every model broke the voltage gate on a few generated stints where the perfect driver stays clear, so we do not call any model human-robust.
  • Staying honest about the hidden stint. It counts 2.5 times and nobody has seen it, so we avoided tuning to the five public files.

Accomplishments that we're proud of

  • 76.97 / 85 on the official scorer from a trained network, against 48.22 for never cueing, with every gate passed.
  • Four trained networks, each planning for a different driver, all evaluated on the official scorer and on our simulated driver.
  • A live 3D demo: on ds5 the no-cue car hits the 392 V cutoff on lap 21, and the networks finish.

What we learned

  • A small network copied from a good teacher, then tuned on the real score, can match or beat the teacher.
  • A scorer that assumes a perfect driver rewards cues no human can follow. Planning for the human costs official points and wins them back once a person drives.

What's next for this project

  • A perfect-driver fallback for Models 2 and 4: drive like Model 1 while the driver follows the light without delay, and switch back the moment they slip.
  • A haptic throttle pedal that pushes back at the lift point, so the driver feels the cue sooner than they see it.
  • Testing the display with a real driver, so the simulated-driver numbers can be checked.
Share this project:

Updates

Submission history