controlsd: alert on cruise mismatch for >1s (#22841)

* controlsd: alert on cruise mismatch for >1s

* bump cereal

* update refs

* bump allowed soundd cpu

* bump cereal
This commit is contained in:
Adeeb Shihadeh
2021-11-10 13:01:42 -08:00
committed by GitHub
parent c5d6b85c90
commit 035bc0c20f
5 changed files with 18 additions and 6 deletions
+1 -1
Submodule cereal updated: 4d93775f7e...c2761bdbd8
+11 -3
View File
@@ -147,6 +147,7 @@ class Controls:
self.v_cruise_kph = 255
self.v_cruise_kph_last = 0
self.mismatch_counter = 0
self.cruise_mismatch_counter = 0
self.can_error_counter = 0
self.last_blinker_frame = 0
self.saturated_count = 0
@@ -260,9 +261,7 @@ class Controls:
if log.PandaState.FaultType.relayMalfunction in pandaState.faults:
self.events.add(EventName.relayMalfunction)
if not self.sm['liveParameters'].valid:
self.events.add(EventName.vehicleModelInvalid)
# Check for HW or system issues
if len(self.sm['radarState'].radarErrors):
self.events.add(EventName.radarFault)
elif not self.sm.valid["pandaStates"]:
@@ -277,6 +276,8 @@ class Controls:
else:
self.logged_comm_issue = False
if not self.sm['liveParameters'].valid:
self.events.add(EventName.vehicleModelInvalid)
if not self.sm['lateralPlan'].mpcSolutionValid:
self.events.add(EventName.plannerError)
if not self.sm['liveLocationKalman'].sensorsOK and not NOSENSOR:
@@ -290,6 +291,13 @@ class Controls:
if log.PandaState.FaultType.relayMalfunction in pandaState.faults:
self.events.add(EventName.relayMalfunction)
# Check for mismatch between openpilot and car's PCM
cruise_mismatch = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise)
self.cruise_mismatch_counter = self.cruise_mismatch_counter + 1 if cruise_mismatch else 0
if self.cruise_mismatch_counter > int(1. / DT_CTRL):
self.events.add(EventName.cruiseMismatch)
# Check for FCW
stock_long_is_braking = self.enabled and not self.CP.openpilotLongitudinalControl and CS.aEgo < -1.5
model_fcw = self.sm['modelV2'].meta.hardBrakePredicted and not CS.brakePressed and not stock_long_is_braking
planner_fcw = self.sm['longitudinalPlan'].fcw and self.enabled
+4
View File
@@ -301,6 +301,10 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
Priority.LOWER, VisualAlert.none, AudibleAlert.none, .2),
},
EventName.cruiseMismatch: {
ET.PERMANENT: ImmediateDisableAlert("openpilot failed to cancel cruise"),
},
# Some features or cars are marked as community features. If openpilot
# detects the use of a community feature it switches to dashcam mode
# until these features are allowed using a toggle in settings.
+1 -1
View File
@@ -1 +1 @@
0ee2d1f6b658ecb823212827f5fd6b996f143119
e1ac1b89b7c6638c5777f1e8db368d264e0de8e6
+1 -1
View File
@@ -112,7 +112,7 @@ def check_cpu_usage(first_proc, last_proc):
cpu_usage = cpu_time / dt * 100.
if cpu_usage > max(normal_cpu_usage * 1.15, normal_cpu_usage + 5.0):
# cpu usage is high while playing sounds
if proc_name == "./_soundd" and cpu_usage < 25.:
if proc_name == "./_soundd" and cpu_usage < 65.:
continue
result += f"Warning {proc_name} using more CPU than normal\n"
r = False