CAN receive error is a comm issue (#23362)

pull/23345/head
Adeeb Shihadeh 3 years ago committed by GitHub
parent 162460ebd8
commit 1e41f4723b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      selfdrive/controls/controlsd.py

@ -150,7 +150,7 @@ class Controls:
self.v_cruise_kph_last = 0
self.mismatch_counter = 0
self.cruise_mismatch_counter = 0
self.can_error_counter = 0
self.can_rcv_error_counter = 0
self.last_blinker_frame = 0
self.saturated_count = 0
self.distance_traveled = 0
@ -253,7 +253,7 @@ class Controls:
LaneChangeState.laneChangeFinishing]:
self.events.add(EventName.laneChange)
if self.can_rcv_error or not CS.canValid:
if not CS.canValid:
self.events.add(EventName.canError)
for i, pandaState in enumerate(self.sm['pandaStates']):
@ -273,7 +273,7 @@ class Controls:
self.events.add(EventName.radarFault)
elif not self.sm.valid["pandaStates"]:
self.events.add(EventName.usbError)
elif not self.sm.all_alive_and_valid():
elif not self.sm.all_alive_and_valid() or self.can_rcv_error:
self.events.add(EventName.commIssue)
if not self.logged_comm_issue:
invalid = [s for s, valid in self.sm.valid.items() if not valid]
@ -378,7 +378,7 @@ class Controls:
# Check for CAN timeout
if not can_strs:
self.can_error_counter += 1
self.can_rcv_error_counter += 1
self.can_rcv_error = True
else:
self.can_rcv_error = False
@ -663,7 +663,7 @@ class Controls:
controlsState.cumLagMs = -self.rk.remaining * 1000.
controlsState.startMonoTime = int(start_time * 1e9)
controlsState.forceDecel = bool(force_decel)
controlsState.canErrorCounter = self.can_error_counter
controlsState.canErrorCounter = self.can_rcv_error_counter
if self.joystick_mode:
controlsState.lateralControlState.debugState = lac_log

Loading…
Cancel
Save