From df63cf059a9977f3e4f4b38a8835dcb0ba87be7c Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 10 Jan 2022 18:27:31 +0800 Subject: [PATCH] controlsd: save lat_plan.dPathPoints to local variable (#23462) old-commit-hash: 2d08f8b318641ee4e6d53ca736358c7a2d533b5d --- selfdrive/controls/controlsd.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 83907910d6..e3f85d3e39 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -537,11 +537,12 @@ class Controls: if (lac_log.saturated and not CS.steeringPressed) or \ (self.saturated_count > STEER_ANGLE_SATURATION_TIMEOUT): - if len(lat_plan.dPathPoints): + dpath_points = lat_plan.dPathPoints + if len(dpath_points): # Check if we deviated from the path # TODO use desired vs actual curvature - left_deviation = actuators.steer > 0 and lat_plan.dPathPoints[0] < -0.20 - right_deviation = actuators.steer < 0 and lat_plan.dPathPoints[0] > 0.20 + left_deviation = actuators.steer > 0 and dpath_points[0] < -0.20 + right_deviation = actuators.steer < 0 and dpath_points[0] > 0.20 if left_deviation or right_deviation: self.events.add(EventName.steerSaturated)