Louder blindspot alert

Added toggle to enable a louder alert when a vehicle is detected in your blindspot when changing lanes.
This commit is contained in:
FrogAi
2024-04-10 19:27:47 -07:00
parent 20c1aee7ec
commit ebfb8976b2
6 changed files with 21 additions and 2 deletions
+1
View File
@@ -122,6 +122,7 @@ struct CarEvent @0x9b1657f34caf3ad3 {
goatSteerSaturated @125;
greenLight @126;
holidayActive @127;
laneChangeBlockedLoud @128;
leadDeparting @129;
radarCanErrorDEPRECATED @15;
+1
View File
@@ -297,6 +297,7 @@ std::unordered_map<std::string, uint32_t> keys = {
{"LockDoors", PERSISTENT},
{"LongitudinalTune", PERSISTENT},
{"LongPitch", PERSISTENT},
{"LoudBlindspotAlert", PERSISTENT},
{"LowVoltageShutdown", PERSISTENT},
{"ManualUpdateInitiated", PERSISTENT},
{"ModelUI", PERSISTENT},
+5 -1
View File
@@ -292,7 +292,10 @@ class Controls:
direction = self.sm['modelV2'].meta.laneChangeDirection
if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
(CS.rightBlindspot and direction == LaneChangeDirection.right):
self.events.add(EventName.laneChangeBlocked)
if self.loud_blindspot_alert:
self.events.add(EventName.laneChangeBlockedLoud)
else:
self.events.add(EventName.laneChangeBlocked)
else:
if direction == LaneChangeDirection.left:
self.events.add(EventName.preLaneChangeLeft)
@@ -967,6 +970,7 @@ class Controls:
custom_alerts = self.params.get_bool("CustomAlerts")
self.green_light_alert = custom_alerts and self.params.get_bool("GreenLightAlert")
self.lead_departing_alert = custom_alerts and self.params.get_bool("LeadDepartingAlert")
self.loud_blindspot_alert = custom_alerts and self.params.get_bool("LoudBlindspotAlert")
custom_theme = self.params.get_bool("CustomTheme")
custom_sounds = self.params.get_int("CustomSounds") if custom_theme else 0
+8
View File
@@ -1011,6 +1011,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
ET.PERMANENT: holiday_alert,
},
EventName.laneChangeBlockedLoud: {
ET.WARNING: Alert(
"Car Detected in Blindspot",
"",
AlertStatus.userPrompt, AlertSize.small,
Priority.LOW, VisualAlert.none, AudibleAlert.warningSoft, .1),
},
EventName.leadDeparting: {
ET.PERMANENT: Alert(
"Lead departed",
@@ -17,6 +17,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
{"CustomAlerts", tr("Custom Alerts"), tr("Enable custom alerts for openpilot events."), "../frogpilot/assets/toggle_icons/icon_green_light.png"},
{"GreenLightAlert", tr("Green Light Alert"), tr("Get an alert when a traffic light changes from red to green."), ""},
{"LeadDepartingAlert", tr("Lead Departing Alert"), tr("Get an alert when the lead vehicle starts departing when at a standstill."), ""},
{"LoudBlindspotAlert", tr("Loud Blindspot Alert"), tr("Enable a louder alert for when a vehicle is detected in the blindspot when attempting to change lanes."), ""},
{"CustomUI", tr("Custom Onroad UI"), tr("Customize the Onroad UI."), "../assets/offroad/icon_road.png"},
{"DeveloperUI", tr("Developer UI"), tr("Get various detailed information of what openpilot is doing behind the scenes."), ""},
@@ -73,6 +74,10 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
for (auto &[key, toggle] : toggles) {
std::set<QString> modifiedCustomAlertsKeys = customAlertsKeys;
if (!hasBSM) {
modifiedCustomAlertsKeys.erase("LoudBlindspotAlert");
}
toggle->setVisible(modifiedCustomAlertsKeys.find(key.c_str()) != modifiedCustomAlertsKeys.end());
}
});
@@ -24,7 +24,7 @@ private:
void updateToggles();
std::set<QString> alertVolumeControlKeys = {"DisengageVolume", "EngageVolume", "PromptDistractedVolume", "PromptVolume", "RefuseVolume", "WarningImmediateVolume", "WarningSoftVolume"};
std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert"};
std::set<QString> customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert"};
std::set<QString> customOnroadUIKeys = {"CustomPaths", "DeveloperUI", "FPSCounter", "LeadInfo"};
std::set<QString> customThemeKeys = {"CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "HolidayThemes"};
std::set<QString> modelUIKeys = {"DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};