Green light alert

Added toggle to alert the user when a red light turns to green.
This commit is contained in:
FrogAi
2024-01-12 22:39:30 -07:00
parent 7151cd1c56
commit 57ebaa1656
7 changed files with 26 additions and 0 deletions

View File

@@ -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

View File

@@ -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.),
},
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@@ -105,6 +105,7 @@ class FrogPilotPlanner:
frogpilotLongitudinalPlan.conditionalExperimental = self.cem.experimental_mode
frogpilotLongitudinalPlan.distances = self.x_desired_trajectory.tolist()
frogpilotLongitudinalPlan.redLight = bool(self.cem.red_light_detected)
frogpilotLongitudinalPlan.safeObstacleDistance = mpc.safe_obstacle_distance
frogpilotLongitudinalPlan.stoppedEquivalenceFactor = mpc.stopped_equivalence_factor

View File

@@ -18,6 +18,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
{"LeadInfo", "Lead Info and Logics", "Get detailed information about the vehicle ahead, including speed and distance, and the logic behind your following distance.", ""},
{"DriverCamera", "Driver Camera On Reverse", "Show the driver's camera feed when you shift to reverse.", "../assets/img_driver_face_static.png"},
{"GreenLightAlert", "Green Light Alert", "Get an alert when a traffic light changes from red to green.", "../frogpilot/assets/toggle_icons/icon_green_light.png"},
{"ModelUI", "Model UI", "Personalize how the model's visualizations appear on your screen.", "../assets/offroad/icon_calibration.png"},
{"AccelerationPath", "Acceleration Path", "Visualize the car's intended acceleration or deceleration with a color-coded path.", ""},