Lead departing alert
Added toggle to enable an alert when the lead vehicle starts to depart.
This commit is contained in:
@@ -121,6 +121,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
|
|||||||
frogSteerSaturated @122;
|
frogSteerSaturated @122;
|
||||||
greenLight @123;
|
greenLight @123;
|
||||||
holidayActive @124;
|
holidayActive @124;
|
||||||
|
leadDeparting @126;
|
||||||
|
|
||||||
radarCanErrorDEPRECATED @15;
|
radarCanErrorDEPRECATED @15;
|
||||||
communityFeatureDisallowedDEPRECATED @62;
|
communityFeatureDisallowedDEPRECATED @62;
|
||||||
|
|||||||
@@ -280,6 +280,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"HolidayThemes", PERSISTENT},
|
{"HolidayThemes", PERSISTENT},
|
||||||
{"LaneLinesWidth", PERSISTENT},
|
{"LaneLinesWidth", PERSISTENT},
|
||||||
{"LateralTune", PERSISTENT},
|
{"LateralTune", PERSISTENT},
|
||||||
|
{"LeadDepartingAlert", PERSISTENT},
|
||||||
{"LeadInfo", PERSISTENT},
|
{"LeadInfo", PERSISTENT},
|
||||||
{"LongitudinalTune", PERSISTENT},
|
{"LongitudinalTune", PERSISTENT},
|
||||||
{"LongPitch", PERSISTENT},
|
{"LongPitch", PERSISTENT},
|
||||||
|
|||||||
@@ -182,6 +182,8 @@ class Controls:
|
|||||||
self.previously_enabled = False
|
self.previously_enabled = False
|
||||||
self.stopped_for_light_previously = False
|
self.stopped_for_light_previously = False
|
||||||
|
|
||||||
|
self.previous_lead_distance = 0
|
||||||
|
|
||||||
ignore = self.sensor_packets + ['testJoystick']
|
ignore = self.sensor_packets + ['testJoystick']
|
||||||
if SIMULATION:
|
if SIMULATION:
|
||||||
ignore += ['driverCameraState', 'managerState']
|
ignore += ['driverCameraState', 'managerState']
|
||||||
@@ -554,6 +556,20 @@ class Controls:
|
|||||||
if green_light:
|
if green_light:
|
||||||
self.events.add(EventName.greenLight)
|
self.events.add(EventName.greenLight)
|
||||||
|
|
||||||
|
# Lead departing alert
|
||||||
|
if self.lead_departing_alert and self.sm.frame % 50 == 0:
|
||||||
|
lead = self.sm['radarState'].leadOne
|
||||||
|
lead_distance = lead.dRel
|
||||||
|
lead_departing = lead_distance - self.previous_lead_distance > 0.5 and self.previous_lead_distance != 0 and CS.standstill
|
||||||
|
self.previous_lead_distance = lead_distance
|
||||||
|
|
||||||
|
lead_departing &= not CS.gasPressed
|
||||||
|
lead_departing &= lead.vLead > 1
|
||||||
|
lead_departing &= self.driving_gear
|
||||||
|
|
||||||
|
if lead_departing:
|
||||||
|
self.events.add(EventName.leadDeparting)
|
||||||
|
|
||||||
def data_sample(self):
|
def data_sample(self):
|
||||||
"""Receive data from sockets and update carState"""
|
"""Receive data from sockets and update carState"""
|
||||||
|
|
||||||
@@ -1042,6 +1058,7 @@ class Controls:
|
|||||||
|
|
||||||
custom_alerts = self.params.get_bool("CustomAlerts")
|
custom_alerts = self.params.get_bool("CustomAlerts")
|
||||||
self.green_light_alert = custom_alerts and self.params.get_bool("GreenLightAlert")
|
self.green_light_alert = custom_alerts and self.params.get_bool("GreenLightAlert")
|
||||||
|
self.lead_departing_alert = custom_alerts and self.params.get_bool("LeadDepartingAlert")
|
||||||
|
|
||||||
custom_theme = self.params.get_bool("CustomTheme")
|
custom_theme = self.params.get_bool("CustomTheme")
|
||||||
custom_sounds = self.params.get_int("CustomSounds") if custom_theme else 0
|
custom_sounds = self.params.get_int("CustomSounds") if custom_theme else 0
|
||||||
|
|||||||
8
selfdrive/controls/lib/events.py
Executable file → Normal file
8
selfdrive/controls/lib/events.py
Executable file → Normal file
@@ -1002,6 +1002,14 @@ EVENTS: Dict[int, Dict[str, Union[Alert, AlertCallbackType]]] = {
|
|||||||
EventName.holidayActive: {
|
EventName.holidayActive: {
|
||||||
ET.PERMANENT: holiday_alert,
|
ET.PERMANENT: holiday_alert,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
EventName.leadDeparting: {
|
||||||
|
ET.PERMANENT: Alert(
|
||||||
|
"Lead departed",
|
||||||
|
"",
|
||||||
|
AlertStatus.frogpilot, AlertSize.small,
|
||||||
|
Priority.MID, VisualAlert.none, AudibleAlert.prompt, 3.),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
|||||||
|
|
||||||
{"CustomAlerts", "Custom Alerts", "Enable custom alerts for various logic or situational changes.", "../frogpilot/assets/toggle_icons/icon_green_light.png"},
|
{"CustomAlerts", "Custom Alerts", "Enable custom alerts for various logic or situational changes.", "../frogpilot/assets/toggle_icons/icon_green_light.png"},
|
||||||
{"GreenLightAlert", "Green Light Alert", "Get an alert when a traffic light changes from red to green.", ""},
|
{"GreenLightAlert", "Green Light Alert", "Get an alert when a traffic light changes from red to green.", ""},
|
||||||
|
{"LeadDepartingAlert", "Lead Departing Alert", "Get an alert when your lead vehicle starts departing when you're at a standstill.", ""},
|
||||||
|
|
||||||
{"CustomUI", "Custom Onroad UI", "Customize the Onroad UI with some additional visual functions.", "../assets/offroad/icon_road.png"},
|
{"CustomUI", "Custom Onroad UI", "Customize the Onroad UI with some additional visual functions.", "../assets/offroad/icon_road.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.", ""},
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ private:
|
|||||||
void updateToggles();
|
void updateToggles();
|
||||||
|
|
||||||
std::set<QString> alertVolumeControlKeys = {"EngageVolume", "DisengageVolume", "RefuseVolume", "PromptVolume", "PromptDistractedVolume", "WarningSoftVolume", "WarningImmediateVolume"};
|
std::set<QString> alertVolumeControlKeys = {"EngageVolume", "DisengageVolume", "RefuseVolume", "PromptVolume", "PromptDistractedVolume", "WarningSoftVolume", "WarningImmediateVolume"};
|
||||||
std::set<QString> customAlertsKeys = {"GreenLightAlert"};
|
std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert"};
|
||||||
std::set<QString> customOnroadUIKeys = {"AccelerationPath", "AdjacentPath", "BlindSpotPath", "FPSCounter", "LeadInfo"};
|
std::set<QString> customOnroadUIKeys = {"AccelerationPath", "AdjacentPath", "BlindSpotPath", "FPSCounter", "LeadInfo"};
|
||||||
std::set<QString> customThemeKeys = {"HolidayThemes", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds"};
|
std::set<QString> customThemeKeys = {"HolidayThemes", "CustomColors", "CustomIcons", "CustomSignals", "CustomSounds"};
|
||||||
std::set<QString> modelUIKeys = {"DynamicPathWidth", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};
|
std::set<QString> modelUIKeys = {"DynamicPathWidth", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};
|
||||||
|
|||||||
Reference in New Issue
Block a user