Cleaner lane change alerts (#21857)

* less is more

* small

* remove HUD warnings

* update ref

* safe

* update refs

* update again

Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
pull/21733/head
HaraldSchafer 4 years ago committed by GitHub
parent d74def61f8
commit aa689176fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      selfdrive/controls/lib/events.py
  2. 18
      selfdrive/debug/cycle_alerts.py
  3. 2
      selfdrive/test/process_replay/ref_commit

@ -481,34 +481,34 @@ EVENTS: Dict[int, Dict[str, Union[Alert, Callable[[Any, messaging.SubMaster, boo
EventName.preLaneChangeLeft: {
ET.WARNING: Alert(
"Steer Left to Start Lane Change",
"Monitor Other Vehicles",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75),
"Steer Left to Start Lane Change Once Safe",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1, alert_rate=0.75),
},
EventName.preLaneChangeRight: {
ET.WARNING: Alert(
"Steer Right to Start Lane Change",
"Monitor Other Vehicles",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1, alert_rate=0.75),
"Steer Right to Start Lane Change Once Safe",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1, alert_rate=0.75),
},
EventName.laneChangeBlocked: {
ET.WARNING: Alert(
"Car Detected in Blindspot",
"Monitor Other Vehicles",
AlertStatus.userPrompt, AlertSize.mid,
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.chimePrompt, .1, .1, .1),
"",
AlertStatus.userPrompt, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.chimePrompt, .1, .1, .1),
},
EventName.laneChange: {
ET.WARNING: Alert(
"Changing Lane",
"Monitor Other Vehicles",
AlertStatus.normal, AlertSize.mid,
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.none, .0, .1, .1),
"Changing Lanes",
"",
AlertStatus.normal, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.none, .0, .1, .1),
},
EventName.steerSaturated: {

@ -24,16 +24,13 @@ def cycle_alerts(duration=2000, is_metric=False):
sm = messaging.SubMaster(['deviceState', 'pandaState', 'roadCameraState', 'modelV2', 'liveCalibration',
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman'])
controls_state = messaging.pub_sock('controlsState')
deviceState = messaging.pub_sock('deviceState')
idx, last_alert_millis = 0, 0
pm = messaging.PubMaster(['controlsState', 'pandaState', 'deviceState'])
events = Events()
AM = AlertManager()
frame = 0
idx, last_alert_millis = 0, 0
while 1:
if frame % duration == 0:
idx = (idx + 1) % len(alerts)
@ -50,7 +47,6 @@ def cycle_alerts(duration=2000, is_metric=False):
dat = messaging.new_message()
dat.init('controlsState')
dat.controlsState.alertText1 = AM.alert_text_1
dat.controlsState.alertText2 = AM.alert_text_2
dat.controlsState.alertSize = AM.alert_size
@ -58,14 +54,18 @@ def cycle_alerts(duration=2000, is_metric=False):
dat.controlsState.alertBlinkingRate = AM.alert_rate
dat.controlsState.alertType = AM.alert_type
dat.controlsState.alertSound = AM.audible_alert
controls_state.send(dat.to_bytes())
pm.send('controlsState', dat)
dat = messaging.new_message()
dat.init('deviceState')
dat.deviceState.started = True
deviceState.send(dat.to_bytes())
pm.send('deviceState', dat)
dat = messaging.new_message()
dat.init('pandaState')
dat.pandaState.ignitionLine = True
pm.send('pandaState', dat)
frame += 1
time.sleep(0.01)
if __name__ == '__main__':

@ -1 +1 @@
658824c1198bd9e4c2b2c6d1c9de9bcae04c7057
dd32c3e4f189e08e2bb20fcf3c0c16116077a959
Loading…
Cancel
Save