Skip to content

longitudinal: use VehicleModel in limit_accel_in_turns#37540

Open
Dragoadri wants to merge 1 commit intocommaai:masterfrom
Dragoadri:fix/limit-accel-in-turns-use-vehicle-model
Open

longitudinal: use VehicleModel in limit_accel_in_turns#37540
Dragoadri wants to merge 1 commit intocommaai:masterfrom
Dragoadri:fix/limit-accel-in-turns-use-vehicle-model

Conversation

@Dragoadri
Copy link

@Dragoadri Dragoadri commented Mar 3, 2026

Description
limit_accel_in_turns was using a simplified kinematic formula to calculate lateral acceleration:
a_y = v² × angle × DEG_TO_RAD / (steerRatio × wheelbase)
This ignores tire slip (understeer gradient) and road roll, overestimating lateral accel by up to 48% at highway speeds, causing unnecessary longitudinal acceleration limiting in moderate turns.
Fix: use VM.calc_curvature(math.radians(angle), v_ego, roll) * v_ego², consistent with the pattern already used in controlsd.py:79 and latcontrol_torque.py:62.
Resolves the FIXME comment on line 39.
Verification
The process replay shows intentional diffs in plannerd (longitudinalPlan.accels, jerks, speeds). This is expected: limit_accel_in_turns now uses VehicleModel.calc_curvature() instead of the simplified kinematic formula, producing slightly different a_y values in real driving segments.
The new values are more physically accurate as they account for tire slip (understeer gradient) and road roll — consistent with how controlsd.py:79 and latcontrol_torque.py:62 already calculate lateral acceleration.
All other modules (controlsd, card, calibrationd, etc.) show no diffs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant