camera malfunction alert (#2391)

* camera malfunction alert

* bump cereal

* fix process replay

* ugh, needs refactor
albatross
Adeeb Shihadeh 2020-10-22 16:28:54 -07:00 committed by GitHub
parent 2a6765580c
commit 88b956528e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 9 deletions

2
cereal

@ -1 +1 @@
Subproject commit 7128f46571c9a2cafb350f13e8dcaf28d0f4134d
Subproject commit b39fb46a72aa26b3220ea7d78476fede39ca361e

View File

@ -52,7 +52,7 @@ class Controls:
self.sm = sm
if self.sm is None:
self.sm = messaging.SubMaster(['thermal', 'health', 'model', 'liveCalibration',
self.sm = messaging.SubMaster(['thermal', 'health', 'model', 'liveCalibration', 'frontFrame',
'dMonitoringState', 'plan', 'pathPlan', 'liveLocationKalman'])
self.can_sock = can_sock
@ -236,7 +236,9 @@ class Controls:
if self.sm['plan'].fcw:
self.events.add(EventName.fcw)
if self.sm['model'].frameDropPerc > 1 and (not SIMULATION):
self.events.add(EventName.modeldLagging)
self.events.add(EventName.modeldLagging)
if not self.sm.alive['frontFrame']:
self.events.add(EventName.cameraMalfunction)
# Only allow engagement with brake pressed when stopped behind another stopped car
if CS.brakePressed and self.sm['plan'].vTargetFuture >= STARTING_TARGET_SPEED \
@ -456,7 +458,7 @@ class Controls:
self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid))
force_decel = (self.sm['dMonitoringState'].awarenessStatus < 0.) or \
(self.state == State.softDisabling)
(self.state == State.softDisabling)
steer_angle_rad = (CS.steeringAngle - self.sm['pathPlan'].angleOffset) * CV.DEG_TO_RAD

View File

@ -472,6 +472,10 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
ET.PERMANENT: NormalPermanentAlert("Fan Malfunction", "Contact Support"),
},
EventName.cameraMalfunction: {
ET.PERMANENT: NormalPermanentAlert("Camera Malfunction", "Contact Support"),
},
# ********** events that affect controls state transitions **********
EventName.pcmEnable: {

View File

@ -112,7 +112,7 @@ class Plant():
Plant.logcan = messaging.pub_sock('can')
Plant.sendcan = messaging.sub_sock('sendcan')
Plant.model = messaging.pub_sock('model')
Plant.frame_pub = messaging.pub_sock('frame')
Plant.front_frame = messaging.pub_sock('frontFrame')
Plant.live_params = messaging.pub_sock('liveParameters')
Plant.live_location_kalman = messaging.pub_sock('liveLocationKalman')
Plant.health = messaging.pub_sock('health')
@ -162,7 +162,7 @@ class Plant():
def close(self):
Plant.logcan.close()
Plant.model.close()
Plant.frame_pub.close()
Plant.front_frame.close()
Plant.live_params.close()
Plant.live_location_kalman.close()
@ -393,7 +393,7 @@ class Plant():
if publish_model and self.frame % 5 == 0:
md = messaging.new_message('model')
cal = messaging.new_message('liveCalibration')
fp = messaging.new_message('frame')
fp = messaging.new_message('frontFrame')
md.model.frameId = 0
for x in [md.model.path, md.model.leftLane, md.model.rightLane]:
x.points = [0.0]*50
@ -425,7 +425,7 @@ class Plant():
# fake values?
Plant.model.send(md.to_bytes())
Plant.cal.send(cal.to_bytes())
Plant.frame_pub.send(fp.to_bytes())
Plant.front_frame.send(fp.to_bytes())
Plant.logcan.send(can_list_to_can_capnp(can_msgs))

View File

@ -221,7 +221,7 @@ CONFIGS = [
pub_sub={
"can": ["controlsState", "carState", "carControl", "sendcan", "carEvents", "carParams"],
"thermal": [], "health": [], "liveCalibration": [], "dMonitoringState": [], "plan": [], "pathPlan": [], "gpsLocation": [], "liveLocationKalman": [],
"model": [], "frame": [],
"model": [], "frontFrame": [],
},
ignore=["logMonoTime", "valid", "controlsState.startMonoTime", "controlsState.cumLagMs"],
init_callback=fingerprint,