From 76dc74787b7a0174374633df897772cf0793f38c Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 21 Mar 2024 21:31:22 -0400 Subject: [PATCH] controlsd: fix steer saturation premature warning (#31909) fix last actuators old-commit-hash: 4ecbaa41fae93d13fd0de805e216b670541a0084 --- selfdrive/controls/controlsd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index e6f91130b9..72f1514d88 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -143,6 +143,7 @@ class Controls: self.logged_comm_issue = None self.not_running_prev = None self.steer_limited = False + self.last_actuators = car.CarControl.Actuators.new_message() self.desired_curvature = 0.0 self.experimental_mode = False self.personality = self.read_personality_param() @@ -620,7 +621,7 @@ class Controls: undershooting = abs(lac_log.desiredLateralAccel) / abs(1e-3 + lac_log.actualLateralAccel) > 1.2 turning = abs(lac_log.desiredLateralAccel) > 1.0 good_speed = CS.vEgo > 5 - max_torque = abs(actuators.steer) > 0.99 + max_torque = abs(self.last_actuators.steer) > 0.99 if undershooting and turning and good_speed and max_torque: lac_log.active and self.events.add(EventName.steerSaturated) elif lac_log.saturated: @@ -727,6 +728,7 @@ class Controls: if not self.CP.passive and self.initialized: self.card.controls_update(CC) + self.last_actuators = CO.actuatorsOutput if self.CP.steerControlType == car.CarParams.SteerControlType.angle: self.steer_limited = abs(CC.actuators.steeringAngleDeg - CO.actuatorsOutput.steeringAngleDeg) > \ STEER_ANGLE_SATURATION_THRESHOLD