controlsd: save lat_plan.dPathPoints to local variable (#23462)

old-commit-hash: 2d08f8b318
commatwo_master
Dean Lee 3 years ago committed by GitHub
parent 7276bf8197
commit df63cf059a
  1. 7
      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)

Loading…
Cancel
Save