The vehicle whose acceleration is being calculated
The speed the vehicle wants to travel at (m/s)
Speed of the vehicle ahead, or null if no leader
Bumper-to-bumper gap to the leader (m), or null
Current simulation configuration
The acceleration to apply (m/s²), clamped to [-maxDecel, maxAccel]
Compute the longitudinal acceleration a vehicle should apply using the Intelligent Driver Model (IDM).
The model balances a free-road acceleration term (desire to reach the preferred speed) against an interaction term (desire to maintain a safe following distance from the leader).