Skip to main content
emobility.academy
PhDACC, AEB & longitudinalResearch About 16 weeksADAS & AUTOSAR

Learning Human-Like Car-Following Behaviour for ACC

Learn human car-following behaviour from naturalistic driving data and driving-simulator sessions, and use it to build an ACC that feels natural while keeping hard safety limits. Learned models are compared with classical car-following models and a conventional ACC on accuracy, safety and comfort.

Tools: Python · MATLAB

Learning Human-Like Car-Following Behaviour for ACC: Students studying an electric car with DIYguru trainers in the workshop
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

Drivers often find ACC unnatural: it may brake too early, accelerate too slowly or keep gaps that invite cut-ins, so many switch it off. Human drivers adapt their following style to traffic, speed and road type. Learning this behaviour from data could make ACC more acceptable, but learned models can also learn unsafe habits and behave unpredictably outside their training data. Combining learned style with guaranteed safety is a research problem with practical relevance.

Objectives

  • Extract car-following episodes from naturalistic data and from driving-simulator sessions.
  • Calibrate classical car-following models such as IDM and Gipps as baselines.
  • Train learned car-following models, for example a neural network or Gaussian process.
  • Wrap the learned model in a safety layer that enforces minimum gap and deceleration limits.
  • Evaluate imitation accuracy, safety, comfort and behaviour outside the training distribution.

What you need

Tools and toolboxes

  • Python — Data extraction, model training, evaluation and plotting.
  • PyTorch — Training neural car-following models such as feed-forward and recurrent networks.
  • MATLAB and Simulink — Closed-loop simulation of the learned ACC with the safety layer against classical controllers, and Stateflow for mode logic.
  • CARLA — A driving-simulator environment in which volunteers drive car-following scenarios with a steering wheel and pedals.
  • ONNX (optional) — Exporting the trained model so it can be called from Simulink for closed-loop tests.

Software

  • Python 3 with PyTorch, NumPy, pandas and scikit-learn
  • Waymo Open Dataset tools
  • CARLA simulator
  • MATLAB, Simulink and Stateflow
  • ONNX Runtime (optional)

Extra parts and data

  • Gaming steering wheel and pedal set — Needed for volunteers to drive car-following scenarios in CARLA, giving controlled human data in situations the public data does not cover.
  • Workstation with a discrete GPU — CARLA needs a capable GPU for smooth real-time driving sessions.

Key concepts

Car-following model
A model that gives the follower's acceleration from its speed, the gap and the relative speed to the leader. IDM and Gipps are classical examples with a few interpretable parameters.
Behaviour cloning
Training a model to reproduce recorded human actions from the same inputs. It is simple but can drift into unseen states when run in closed loop.
Closed-loop evaluation
Testing a learned model by letting it drive in simulation, not just predicting the next acceleration. Small prediction errors can accumulate into unrealistic or unsafe behaviour.
Safety layer
A filter that checks the learned acceleration against safety constraints, such as a minimum time gap and maximum deceleration, and overrides it when needed.

Step-by-step guide

  1. 1

    Frame questions and ethics

    Write the research questions: can a learned model imitate human car-following more accurately than calibrated IDM and Gipps models, and does a safety layer keep it safe without destroying the human-like feel? Plan the simulator study with informed consent, anonymised data and approval from your institute's ethics committee if required. State that no learned controller will be tested on public roads, only in simulation.

    Checkpoint: A research plan with questions, metrics, data sources and the ethics arrangements for simulator sessions.

  2. 2

    Extract naturalistic car-following episodes

    From the Waymo Open Dataset motion data, identify episodes where one vehicle follows another in the same lane for at least 10 to 15 seconds. Compute gap, speeds, relative speed and follower acceleration at a fixed rate, smoothing positions before differentiating. Filter out lane changes and implausible values. Split by scenario, not by time step, into training, validation and test sets, so the same episode never appears in two sets.

    Checkpoint: A cleaned episode dataset with summary statistics and a scenario-level split.

  3. 3

    Collect simulator data

    In CARLA, build following scenarios with a scripted lead vehicle: steady following, stop-and-go, lead braking and cut-ins, on urban and highway maps. Recruit volunteer drivers to drive with a steering wheel and pedals after a practice session. Log gap, speeds and accelerations at a fixed rate. Keep each driver's data separate so you can study individual styles and test generalisation to new drivers.

    Checkpoint: Simulator logs from several drivers with per-driver summaries of gap and acceleration.

  4. 4

    Calibrate classical baselines

    Calibrate IDM and Gipps parameters for each dataset by minimising the error between simulated and recorded gap over whole episodes, not one-step acceleration error, using an optimiser such as SciPy's differential evolution. Calibrate both a global set and per-driver sets for the simulator data. Report calibrated parameters with their ranges and check they are physically plausible. Repeat calibration from several starting points to check the optimum is stable.

    Checkpoint: Calibrated IDM and Gipps parameters with closed-loop gap error on validation episodes.

  5. 5

    Train learned models

    Train a feed-forward network on current gap, speed and relative speed, and a recurrent network (LSTM or GRU) on a short history of these, both predicting follower acceleration. Use the validation set for early stopping and hyperparameter choice. Optionally fit a Gaussian process for uncertainty estimates. Record training settings and seeds so every model can be reproduced exactly. Normalise inputs with training-set statistics only, and keep the test set untouched until the final evaluation.

    Checkpoint: Trained models with one-step prediction error on validation data compared with the baselines.

  6. 6

    Evaluate in closed loop

    For every test episode, replay the recorded leader trajectory and let each model drive the follower in simulation from the recorded initial state. Compare simulated gap and speed with the recorded human trajectory using RMSE of gap and speed. Also count collisions, gaps below a safety threshold and unrealistic accelerations. Closed-loop testing often reverses one-step rankings, so report both. Report results for naturalistic and simulator data separately.

    Checkpoint: Closed-loop gap and speed RMSE and safety counts for all models on the test set.

  7. 7

    Design the safety layer

    Wrap the learned model's acceleration with a safety filter: compute the acceleration bound that keeps a minimum time gap under a worst-case lead deceleration assumption, and clip the learned output to it and to comfort limits. Optionally implement it as a simple quadratic programme that stays as close as possible to the learned output while meeting constraints. Log every intervention.

    Checkpoint: The filtered learned controller shows zero collisions in closed-loop tests, with interventions logged.

  8. 8

    Integrate into an ACC simulation

    Export the learned model to ONNX and call it from Simulink, or reimplement the network in a MATLAB Function block. Combine it with the safety layer and Stateflow mode logic for speed and following modes. Run the same scenario library as for a conventional constant time-gap ACC, including cut-ins and hard braking, at several speeds. Check that the Simulink outputs match Python outputs on the same inputs before running the library, so any difference later comes from the closed loop and not from export errors.

    Checkpoint: The learned ACC runs in Simulink on the scenario library with the safety layer active.

  9. 9

    Compare behaviour and comfort

    Compare learned ACC, IDM-based ACC and conventional ACC on human-likeness (closed-loop error against held-out human trajectories), safety (minimum gap and TTC), comfort (RMS jerk) and safety-layer intervention rate. Optionally ask simulator volunteers to ride along in a passive mode and rate naturalness, recording ratings without implying any statistical claim beyond your sample. Use the same scenarios, seeds and safety limits for every controller in the comparison.

    Checkpoint: A comparison table across controllers with human-likeness, safety, comfort and intervention rate.

  10. 10

    Test outside the training data

    Test the models on situations missing or rare in training: higher speeds, very short cut-ins, a stationary vehicle ahead and a lead vehicle reversing slightly. Record how often the safety layer must intervene and whether the learned model behaves erratically. This shows the risk of learned controllers and justifies the safety layer. Compare with IDM, whose simple structure usually extrapolates more predictably, and describe each erratic case with plots of gap and acceleration.

    Checkpoint: Out-of-distribution results with intervention rates and examples of erratic behaviour.

  11. 11

    Write up the research

    Present the data extraction, simulator study, baselines, learned models, closed-loop evaluation, safety layer, ACC integration and out-of-distribution tests. Discuss whether human-like behaviour is desirable when humans also follow too closely, and where the safety layer limits imitation. Release code and processed episode lists where dataset terms allow. State clearly which results come from naturalistic data and which from the simulator, since simulator driving can differ from real driving. Include the consent and anonymisation procedure in an appendix.

    Checkpoint: Thesis chapters with closed-loop results, safety analysis and released code.

Testing & validation

  • Calibrated IDM and Gipps baselines with closed-loop error on validation episodes.
  • Closed-loop gap and speed RMSE for learned models on held-out data.
  • Zero collisions with the safety layer, with intervention rate reported.
  • Comfort and safety metrics compared with conventional ACC.
  • Behaviour and intervention rate in out-of-distribution scenarios.

Expected results

A learned, human-like car-following ACC with a safety layer, evaluated in closed loop against classical models and conventional ACC, with a clear account of its imitation accuracy, safety and limits.

Research angle for your PhD

Research questions: does a learned car-following model reproduce human behaviour in closed loop better than calibrated IDM and Gipps, and how much of that human-likeness survives a safety layer with hard constraints? Metrics: closed-loop gap and speed RMSE, minimum TTC, RMS jerk, intervention rate and out-of-distribution behaviour. Baselines: IDM, Gipps and conventional ACC. A study that combines naturalistic data with controlled simulator data and reports closed-loop rather than one-step results, with released code, is suitable for a conference or journal paper.

Take it further

  • Personalise the ACC to an individual driver's style with a small amount of their data.
  • Use inverse reinforcement learning to learn a reward instead of cloning actions.
  • Add lane-change and cut-in prediction from neighbouring vehicles.
  • Study driver acceptance with a larger simulator panel.

Viva and review questions

Why evaluate in closed loop rather than on next-step prediction?

In closed loop the model's errors change its future inputs, so small errors can accumulate; a model with low one-step error can still drift into unrealistic gaps.

Why is a safety layer needed?

Learned models can copy unsafe human habits and behave unpredictably outside their training data, so hard constraints on gap and deceleration must be enforced separately.

Why split data by episode rather than by time step?

Time steps within an episode are strongly correlated, so splitting by step lets the model see almost the same data in training and testing, giving optimistic results.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 ADAS & AUTOSAR projects