Skip to content

Commit

Permalink
Torque control: max torque warning (commaai#25018)
Browse files Browse the repository at this point in the history
* New steer torque warning

* typo
  • Loading branch information
haraschax authored and rjsmith1999 committed Jul 12, 2022
1 parent d63e05c commit fdc36cc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions selfdrive/controls/controlsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def update_events(self, CS):
self.events.add(EventName.commIssue)
elif not self.sm.all_freq_ok():
self.events.add(EventName.commIssueAvgFreq)
else: # invalid or can_rcv_error.
else: # invalid or can_rcv_error.
self.events.add(EventName.commIssue)

if not self.logged_comm_issue:
Expand Down Expand Up @@ -588,7 +588,14 @@ def state_control(self, CS):
lac_log.saturated = abs(actuators.steer) >= 0.9

# Send a "steering required alert" if saturation count has reached the limit
if lac_log.active and lac_log.saturated and not CS.steeringPressed:
if lac_log.active and not CS.steeringPressed and self.CP.lateralTuning.which() == 'torque':
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(self.last_actuators.steer) > 0.99
if undershooting and turning and good_speed and max_torque:
self.events.add(EventName.steerSaturated)
elif lac_log.active and lac_log.saturated and not CS.steeringPressed:
dpath_points = lat_plan.dPathPoints
if len(dpath_points):
# Check if we deviated from the path
Expand Down

0 comments on commit fdc36cc

Please sign in to comment.