Green light alert
Added toggle to alert the user when a red light turns to green.
This commit is contained in:
@@ -82,6 +82,8 @@ class Controls:
|
||||
fire_the_babysitter = self.params.get_bool("FireTheBabysitter")
|
||||
mute_dm = fire_the_babysitter and self.params.get_bool("MuteDM")
|
||||
|
||||
self.stopped_for_light_previously = False
|
||||
|
||||
ignore = self.sensor_packets + ['testJoystick']
|
||||
if SIMULATION:
|
||||
ignore += ['driverCameraState', 'managerState']
|
||||
@@ -448,6 +450,15 @@ class Controls:
|
||||
if self.sm['modelV2'].frameDropPerc > 20:
|
||||
self.events.add(EventName.modeldLagging)
|
||||
|
||||
# Green light alert
|
||||
if self.green_light_alert and self.enabled:
|
||||
stopped_for_light = self.sm['frogpilotLongitudinalPlan'].redLight and CS.standstill
|
||||
green_light = not stopped_for_light and self.stopped_for_light_previously
|
||||
self.stopped_for_light_previously = stopped_for_light
|
||||
|
||||
if green_light and not CS.gasPressed:
|
||||
self.events.add(FrogPilotEventName.greenLight)
|
||||
|
||||
def data_sample(self):
|
||||
"""Receive data from sockets and update carState"""
|
||||
|
||||
@@ -964,6 +975,8 @@ class Controls:
|
||||
frog_sounds = custom_sounds == 1
|
||||
self.goat_scream = self.params.get_bool("GoatScream") and frog_sounds
|
||||
|
||||
self.green_light_alert = self.params.get_bool("GreenLightAlert")
|
||||
|
||||
longitudinal_tune = self.params.get_bool("LongitudinalTune")
|
||||
self.sport_plus = self.params.get_int("AccelerationProfile") == 3 and longitudinal_tune
|
||||
|
||||
|
||||
@@ -975,6 +975,14 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
|
||||
Priority.LOW, VisualAlert.steerRequired, AudibleAlert.warningSoft, 2.),
|
||||
},
|
||||
|
||||
FrogPilotEventName.greenLight: {
|
||||
ET.PERMANENT: Alert(
|
||||
"Light turned green",
|
||||
"",
|
||||
AlertStatus.frogpilot, AlertSize.small,
|
||||
Priority.LOW, VisualAlert.none, AudibleAlert.prompt, 3.),
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user