|
|
|
@ -52,9 +52,9 @@ class Controls: |
|
|
|
|
|
|
|
|
|
self.sm = sm |
|
|
|
|
if self.sm is None: |
|
|
|
|
self.sm = messaging.SubMaster(['thermal', 'health', 'model', 'liveCalibration', 'frontFrame', |
|
|
|
|
self.sm = messaging.SubMaster(['thermal', 'health', 'model', 'liveCalibration', 'ubloxRaw', |
|
|
|
|
'dMonitoringState', 'plan', 'pathPlan', 'liveLocationKalman', |
|
|
|
|
'ubloxRaw']) |
|
|
|
|
'frame', 'frontFrame']) |
|
|
|
|
|
|
|
|
|
self.can_sock = can_sock |
|
|
|
|
if can_sock is None: |
|
|
|
@ -211,12 +211,6 @@ class Controls: |
|
|
|
|
if not self.sm['liveLocationKalman'].sensorsOK and not NOSENSOR: |
|
|
|
|
if self.sm.frame > 5 / DT_CTRL: # Give locationd some time to receive all the inputs |
|
|
|
|
self.events.add(EventName.sensorDataInvalid) |
|
|
|
|
if not self.sm.alive['ubloxRaw'] and (self.sm.frame > 10. / DT_CTRL) and not SIMULATION: |
|
|
|
|
self.events.add(EventName.gpsMalfunction) |
|
|
|
|
elif not self.sm['liveLocationKalman'].gpsOK and (self.distance_traveled > 1000): |
|
|
|
|
# Not show in first 1 km to allow for driving out of garage. This event shows after 5 minutes |
|
|
|
|
if not (SIMULATION or NOSENSOR): # TODO: send GPS in carla |
|
|
|
|
self.events.add(EventName.noGps) |
|
|
|
|
if not self.sm['pathPlan'].paramsValid: |
|
|
|
|
self.events.add(EventName.vehicleModelInvalid) |
|
|
|
|
if not self.sm['liveLocationKalman'].posenetOK: |
|
|
|
@ -231,11 +225,19 @@ class Controls: |
|
|
|
|
self.events.add(EventName.relayMalfunction) |
|
|
|
|
if self.sm['plan'].fcw: |
|
|
|
|
self.events.add(EventName.fcw) |
|
|
|
|
if not self.sm.alive['frontFrame'] and (self.sm.frame > 5 / DT_CTRL) and not SIMULATION: |
|
|
|
|
self.events.add(EventName.cameraMalfunction) |
|
|
|
|
|
|
|
|
|
if self.sm['model'].frameDropPerc > 20 and not SIMULATION: |
|
|
|
|
self.events.add(EventName.modeldLagging) |
|
|
|
|
# TODO: fix simulator |
|
|
|
|
if not SIMULATION: |
|
|
|
|
if not NOSENSOR: |
|
|
|
|
if not self.sm.alive['ubloxRaw'] and (self.sm.frame > 10. / DT_CTRL): |
|
|
|
|
self.events.add(EventName.gpsMalfunction) |
|
|
|
|
elif not self.sm['liveLocationKalman'].gpsOK and (self.distance_traveled > 1000): |
|
|
|
|
# Not show in first 1 km to allow for driving out of garage. This event shows after 5 minutes |
|
|
|
|
self.events.add(EventName.noGps) |
|
|
|
|
if not self.sm.all_alive(['frame', 'frontFrame']) and (self.sm.frame > 5 / DT_CTRL): |
|
|
|
|
self.events.add(EventName.cameraMalfunction) |
|
|
|
|
if self.sm['model'].frameDropPerc > 20: |
|
|
|
|
self.events.add(EventName.modeldLagging) |
|
|
|
|
|
|
|
|
|
# Only allow engagement with brake pressed when stopped behind another stopped car |
|
|
|
|
if CS.brakePressed and self.sm['plan'].vTargetFuture >= STARTING_TARGET_SPEED \ |
|
|
|
|