Adaptive Cruise Control (ACC) is an ADAS feature that maintains a user-set cruise speed while automatically slowing for a lead vehicle. The effective target speed is the minimum of the cruise-speed setpoint and the speed needed to keep a safe following distance.
The controller runs on the vehicle and uses simulation data about nearby traffic to select a lead vehicle, then applies longitudinal control through the brake and throttle pedals. Leader detection scans nearby map objects, filters candidates by position, heading, and corridor overlap, and tracks the most relevant vehicle ahead. Longitudinal control uses a kinematic follow law with dynamic headway, leader-acceleration feedforward, and comfort deceleration limits. Pedal commands are produced by online throttle and brake models that map desired longitudinal acceleration to actuator inputs.
standStillDistance + speedHeadwayGain × leadSpeed). A gap-error term adjusts the desired speed relative to the leader. When closing too fast inside the desired gap, the controller demands the deceleration needed to fit within the remaining distance.speed — desired cruise speed in m/sdebugFlag — if true, ACC logs debug samples and writes a CSV file named accLog to AppData/Local/BeamNG.tech/<current version> on unload. The CSV includes target speed, ego speed, leader state, acceleration targets, and throttle/brake commands. Defaults to false.ACC is a vehicle Lua extension. The following commands can be used inside the vlua code or in-game Lua console (open with Ctrl + @ or `).
extensions.tech_ACC.load(speed, debugFlag) — Loads and starts ACC on the current vehicle. If speed is omitted, the current vehicle speed is used.
extensions.tech_ACC.changeSpeed(speed) — Changes the cruise-speed setpoint while ACC is loaded.
extensions.tech_ACC.unload() — Unloads ACC and releases ADAS pedal control.
ACC is exposed through the vehicle API. For details, see the BeamNGpy documentation .
For a practical example, see the ACC test example in the BeamNGpy repository.
These functions are used by vehicle platooning:
extensions.tech_ACC.setLeaderMode(mode) — "auto" (default) or "external"extensions.tech_ACC.setExternalLeader(objectId, leadSpeed, leadAccel) — follow a specific object with supplied leader kinematicsextensions.tech_ACC.clearExternalLeader() — return to automatic leader selectionextensions.tech_ACC.setDriverOverrideCallback(callback) — optional callback invoked when the driver overrides with the brake pedalWas this article helpful?