From 63817ce7db081482b2f7b9f3322823d7b9d08f25 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Thu, 6 Aug 2026 21:46:25 -0500 Subject: [PATCH] Fix lateral test initialization --- selfdrive/controls/lib/latcontrol_torque.py | 20 ++++++++++---------- selfdrive/controls/tests/test_latcontrol.py | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/selfdrive/controls/lib/latcontrol_torque.py b/selfdrive/controls/lib/latcontrol_torque.py index 7bc6b972b..7c7f80d57 100644 --- a/selfdrive/controls/lib/latcontrol_torque.py +++ b/selfdrive/controls/lib/latcontrol_torque.py @@ -97,16 +97,6 @@ class LatControlTorque(LatControl): self.prev_desired_lateral_accel = 0.0 self.starpilot_lateral_state = custom.StarPilotLateralState.new_message() - def _clear_starpilot_lateral_state(self): - self.starpilot_lateral_state.active = False - self.starpilot_lateral_state.frictionThreshold = 0.0 - self.starpilot_lateral_state.frictionScale = 0.0 - self.starpilot_lateral_state.feedforward = 0.0 - self.starpilot_lateral_state.frictionJerk = 0.0 - self.starpilot_lateral_state.frictionJerkDeadzone = 0.0 - self.starpilot_lateral_state.lowSpeedFactor = 0.0 - self.starpilot_lateral_state.unwindDetected = False - self.is_bolt = CP.carFingerprint in BOLT_CARS self.is_bolt_2022_2023 = CP.carFingerprint in BOLT_2022_2023_CARS self.is_bolt_2018_2021 = CP.carFingerprint in BOLT_2018_2021_CARS @@ -179,6 +169,16 @@ class LatControlTorque(LatControl): if self.use_bolt_ki_multiplier and self.torque_ki_mult > 0.0 and self.torque_ki_mult != 1.0: self.pid._k_i = [self.pid._k_i[0], [k * self.torque_ki_mult for k in self.pid._k_i[1]]] + def _clear_starpilot_lateral_state(self): + self.starpilot_lateral_state.active = False + self.starpilot_lateral_state.frictionThreshold = 0.0 + self.starpilot_lateral_state.frictionScale = 0.0 + self.starpilot_lateral_state.feedforward = 0.0 + self.starpilot_lateral_state.frictionJerk = 0.0 + self.starpilot_lateral_state.frictionJerkDeadzone = 0.0 + self.starpilot_lateral_state.lowSpeedFactor = 0.0 + self.starpilot_lateral_state.unwindDetected = False + def update_live_torque_params(self, latAccelFactor, latAccelOffset, friction): if self.is_palisade: latAccelFactor *= PALISADE_BASE_LAT_ACCEL_FACTOR_MULT diff --git a/selfdrive/controls/tests/test_latcontrol.py b/selfdrive/controls/tests/test_latcontrol.py index 104c87e74..c46cf5c25 100644 --- a/selfdrive/controls/tests/test_latcontrol.py +++ b/selfdrive/controls/tests/test_latcontrol.py @@ -129,7 +129,7 @@ class TestLatControl: highway_center = get_center_chatter_friction_jerk_deadzone(25.0, 0.0) highway_curve = get_center_chatter_friction_jerk_deadzone(25.0, 0.6) - assert low_speed_center == pytest.approx(0.08) + assert low_speed_center == pytest.approx(0.096) assert highway_center == pytest.approx(0.18) assert highway_curve == pytest.approx(0.0)