diff --git a/cereal/car.capnp b/cereal/car.capnp index 01332eb24..db58b3e05 100644 --- a/cereal/car.capnp +++ b/cereal/car.capnp @@ -122,6 +122,7 @@ struct CarEvent @0x9b1657f34caf3ad3 { goatSteerSaturated @125; greenLight @126; holidayActive @127; + laneChangeBlockedLoud @128; leadDeparting @129; radarCanErrorDEPRECATED @15; diff --git a/common/params.cc b/common/params.cc index 78f2e57ef..d7be957b5 100644 --- a/common/params.cc +++ b/common/params.cc @@ -297,6 +297,7 @@ std::unordered_map keys = { {"LockDoors", PERSISTENT}, {"LongitudinalTune", PERSISTENT}, {"LongPitch", PERSISTENT}, + {"LoudBlindspotAlert", PERSISTENT}, {"LowVoltageShutdown", PERSISTENT}, {"ManualUpdateInitiated", PERSISTENT}, {"ModelUI", PERSISTENT}, diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 2e158bf19..0dceb0320 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -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 diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index f97583ff2..95ee96f72 100644 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -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", diff --git a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc index 85009ba0d..67dd716f2 100644 --- a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc +++ b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.cc @@ -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 modifiedCustomAlertsKeys = customAlertsKeys; + if (!hasBSM) { + modifiedCustomAlertsKeys.erase("LoudBlindspotAlert"); + } + toggle->setVisible(modifiedCustomAlertsKeys.find(key.c_str()) != modifiedCustomAlertsKeys.end()); } }); diff --git a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h index 984a252c2..5aa663de0 100644 --- a/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h +++ b/selfdrive/frogpilot/ui/qt/offroad/visual_settings.h @@ -24,7 +24,7 @@ private: void updateToggles(); std::set alertVolumeControlKeys = {"DisengageVolume", "EngageVolume", "PromptDistractedVolume", "PromptVolume", "RefuseVolume", "WarningImmediateVolume", "WarningSoftVolume"}; - std::set customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert"}; + std::set customAlertsKeys = {"GreenLightAlert", "LeadDepartingAlert", "LoudBlindspotAlert"}; std::set customOnroadUIKeys = {"CustomPaths", "DeveloperUI", "FPSCounter", "LeadInfo"}; std::set customThemeKeys = {"CustomColors", "CustomIcons", "CustomSignals", "CustomSounds", "HolidayThemes"}; std::set modelUIKeys = {"DynamicPathWidth", "HideLeadMarker", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};