Green light alert
Added toggle to alert the user when a red light turns to green.
This commit is contained in:
@@ -19,6 +19,7 @@ struct FrogPilotDeviceState @0xaedffd8f31e7b55d {
|
|||||||
|
|
||||||
enum FrogPilotEvents @0xf35cc4560bbf6ec2 {
|
enum FrogPilotEvents @0xf35cc4560bbf6ec2 {
|
||||||
frogSteerSaturated @0;
|
frogSteerSaturated @0;
|
||||||
|
greenLight @1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FrogPilotLateralPlan @0xda96579883444c35 {
|
struct FrogPilotLateralPlan @0xda96579883444c35 {
|
||||||
@@ -30,6 +31,7 @@ struct FrogPilotLongitudinalPlan @0x80ae746ee2596b11 {
|
|||||||
conditionalExperimental @1 :Bool;
|
conditionalExperimental @1 :Bool;
|
||||||
desiredFollowDistance @2 :Int16;
|
desiredFollowDistance @2 :Int16;
|
||||||
distances @3 :List(Float32);
|
distances @3 :List(Float32);
|
||||||
|
redLight @4 :Bool;
|
||||||
safeObstacleDistance @5 :Int16;
|
safeObstacleDistance @5 :Int16;
|
||||||
safeObstacleDistanceStock @6 :Int16;
|
safeObstacleDistanceStock @6 :Int16;
|
||||||
stoppedEquivalenceFactor @11 :Int16;
|
stoppedEquivalenceFactor @11 :Int16;
|
||||||
|
|||||||
@@ -253,6 +253,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"FrogPilotTogglesUpdated", PERSISTENT},
|
{"FrogPilotTogglesUpdated", PERSISTENT},
|
||||||
{"GasRegenCmd", PERSISTENT},
|
{"GasRegenCmd", PERSISTENT},
|
||||||
{"GoatScream", PERSISTENT},
|
{"GoatScream", PERSISTENT},
|
||||||
|
{"GreenLightAlert", PERSISTENT},
|
||||||
{"LaneLinesWidth", PERSISTENT},
|
{"LaneLinesWidth", PERSISTENT},
|
||||||
{"LateralTune", PERSISTENT},
|
{"LateralTune", PERSISTENT},
|
||||||
{"LeadInfo", PERSISTENT},
|
{"LeadInfo", PERSISTENT},
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ class Controls:
|
|||||||
fire_the_babysitter = self.params.get_bool("FireTheBabysitter")
|
fire_the_babysitter = self.params.get_bool("FireTheBabysitter")
|
||||||
mute_dm = fire_the_babysitter and self.params.get_bool("MuteDM")
|
mute_dm = fire_the_babysitter and self.params.get_bool("MuteDM")
|
||||||
|
|
||||||
|
self.stopped_for_light_previously = False
|
||||||
|
|
||||||
ignore = self.sensor_packets + ['testJoystick']
|
ignore = self.sensor_packets + ['testJoystick']
|
||||||
if SIMULATION:
|
if SIMULATION:
|
||||||
ignore += ['driverCameraState', 'managerState']
|
ignore += ['driverCameraState', 'managerState']
|
||||||
@@ -448,6 +450,15 @@ class Controls:
|
|||||||
if self.sm['modelV2'].frameDropPerc > 20:
|
if self.sm['modelV2'].frameDropPerc > 20:
|
||||||
self.events.add(EventName.modeldLagging)
|
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):
|
def data_sample(self):
|
||||||
"""Receive data from sockets and update carState"""
|
"""Receive data from sockets and update carState"""
|
||||||
|
|
||||||
@@ -964,6 +975,8 @@ class Controls:
|
|||||||
frog_sounds = custom_sounds == 1
|
frog_sounds = custom_sounds == 1
|
||||||
self.goat_scream = self.params.get_bool("GoatScream") and frog_sounds
|
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")
|
longitudinal_tune = self.params.get_bool("LongitudinalTune")
|
||||||
self.sport_plus = self.params.get_int("AccelerationProfile") == 3 and longitudinal_tune
|
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.),
|
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.),
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
BIN
selfdrive/frogpilot/assets/toggle_icons/icon_green_light.png
Normal file
BIN
selfdrive/frogpilot/assets/toggle_icons/icon_green_light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -105,6 +105,7 @@ class FrogPilotPlanner:
|
|||||||
|
|
||||||
frogpilotLongitudinalPlan.conditionalExperimental = self.cem.experimental_mode
|
frogpilotLongitudinalPlan.conditionalExperimental = self.cem.experimental_mode
|
||||||
frogpilotLongitudinalPlan.distances = self.x_desired_trajectory.tolist()
|
frogpilotLongitudinalPlan.distances = self.x_desired_trajectory.tolist()
|
||||||
|
frogpilotLongitudinalPlan.redLight = bool(self.cem.red_light_detected)
|
||||||
|
|
||||||
frogpilotLongitudinalPlan.safeObstacleDistance = mpc.safe_obstacle_distance
|
frogpilotLongitudinalPlan.safeObstacleDistance = mpc.safe_obstacle_distance
|
||||||
frogpilotLongitudinalPlan.stoppedEquivalenceFactor = mpc.stopped_equivalence_factor
|
frogpilotLongitudinalPlan.stoppedEquivalenceFactor = mpc.stopped_equivalence_factor
|
||||||
|
|||||||
@@ -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.", ""},
|
{"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"},
|
{"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"},
|
{"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.", ""},
|
{"AccelerationPath", "Acceleration Path", "Visualize the car's intended acceleration or deceleration with a color-coded path.", ""},
|
||||||
|
|||||||
Reference in New Issue
Block a user