JME - Application Documentation
    Preparing search index...
    • 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).

      Parameters

      • vehicle: Vehicle

        The vehicle whose acceleration is being calculated

      • desiredSpeed: number

        The speed the vehicle wants to travel at (m/s)

      • leaderSpeed: number | null

        Speed of the vehicle ahead, or null if no leader

      • gap: number | null

        Bumper-to-bumper gap to the leader (m), or null

      • cfg: SimConfig

        Current simulation configuration

      Returns number

      The acceleration to apply (m/s²), clamped to [-maxDecel, maxAccel]