radarState: check average frequency (#34872)

* always check radarState freq since it polls on modelV2 and sends at a fixed rate

* fine

* can just check this since valid is all_checks on liveTracks, and liveTracks.valid is len(errors) as well

full circle
pull/34873/head
Shane Smiskol 1 month ago committed by GitHub
parent e1eac057ca
commit 811272dc28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      selfdrive/controls/plannerd.py
  2. 4
      selfdrive/selfdrived/selfdrived.py

@ -20,7 +20,7 @@ def main():
longitudinal_planner = LongitudinalPlanner(CP)
pm = messaging.PubMaster(['longitudinalPlan', 'driverAssistance'])
sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'liveParameters', 'radarState', 'modelV2', 'selfdriveState'],
poll='modelV2', ignore_avg_freq=['radarState'])
poll='modelV2')
while True:
sm.update()

@ -80,7 +80,7 @@ class SelfdriveD:
'managerState', 'liveParameters', 'radarState', 'liveTorqueParameters',
'controlsState', 'carControl', 'driverAssistance', 'alertDebug'] + \
self.camera_packets + self.sensor_packets + self.gps_packets,
ignore_alive=ignore, ignore_avg_freq=ignore+['radarState',],
ignore_alive=ignore, ignore_avg_freq=ignore,
ignore_valid=ignore, frequency=int(1/DT_CTRL))
# read params
@ -269,7 +269,7 @@ class SelfdriveD:
self.events.add(EventName.cameraFrameRate)
if not REPLAY and self.rk.lagging:
self.events.add(EventName.selfdrivedLagging)
if len(self.sm['radarState'].radarErrors) or ((not self.rk.lagging or REPLAY) and not self.sm.all_checks(['radarState'])):
if not self.sm.valid['radarState']:
self.events.add(EventName.radarFault)
if not self.sm.valid['pandaStates']:
self.events.add(EventName.usbError)

Loading…
Cancel
Save