diff --git a/common/params.cc b/common/params.cc index d12ee2c..619d9f3 100644 --- a/common/params.cc +++ b/common/params.cc @@ -325,6 +325,7 @@ std::unordered_map keys = { {"OSMDownloadProgress", CLEAR_ON_MANAGER_START}, {"PathEdgeWidth", PERSISTENT}, {"PathWidth", PERSISTENT}, + {"PauseLateralOnSignal", PERSISTENT}, {"PreferredSchedule", PERSISTENT}, {"PromptVolume", PERSISTENT}, {"PromptDistractedVolume", PERSISTENT}, diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 92aba6d..503fc6e 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -756,6 +756,8 @@ class Controls: # Gear Check self.driving_gear = CS.gearShifter not in (GearShifter.neutral, GearShifter.park, GearShifter.reverse, GearShifter.unknown) + signal_check = not ((CS.leftBlinker or CS.rightBlinker) and CS.vEgo < self.pause_lateral_on_signal and not CS.standstill) + # Always on lateral self.FPCC.alwaysOnLateral |= CS.cruiseState.enabled or self.always_on_lateral_main self.FPCC.alwaysOnLateral &= self.always_on_lateral @@ -768,7 +770,7 @@ class Controls: # Check which actuators can be enabled standstill = CS.vEgo <= max(self.CP.minSteerSpeed, MIN_LATERAL_CONTROL_SPEED) or CS.standstill - CC.latActive = (self.active or self.FPCC.alwaysOnLateral) and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \ + CC.latActive = (self.active or self.FPCC.alwaysOnLateral) and signal_check and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \ (not standstill or self.joystick_mode) and not self.openpilot_crashed CC.longActive = self.enabled and not self.events.contains(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl and not self.openpilot_crashed @@ -1104,6 +1106,7 @@ class Controls: self.lane_detection_width = self.params.get_int("LaneDetectionWidth") * (1 if self.is_metric else CV.FOOT_TO_METER) / 10 if self.lane_detection else 0 quality_of_life = self.params.get_bool("QOLControls") + self.pause_lateral_on_signal = self.params.get_int("PauseLateralOnSignal") * (CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS) if quality_of_life else 0 self.frogpilot_variables.reverse_cruise_increase = quality_of_life and self.params.get_bool("ReverseCruise") def main(): diff --git a/selfdrive/frogpilot/assets/toggle_icons/icon_pause_lane.png b/selfdrive/frogpilot/assets/toggle_icons/icon_pause_lane.png new file mode 100644 index 0000000..4f521a5 Binary files /dev/null and b/selfdrive/frogpilot/assets/toggle_icons/icon_pause_lane.png differ diff --git a/selfdrive/frogpilot/ui/control_settings.cc b/selfdrive/frogpilot/ui/control_settings.cc index 829b779..38e7c5e 100644 --- a/selfdrive/frogpilot/ui/control_settings.cc +++ b/selfdrive/frogpilot/ui/control_settings.cc @@ -53,6 +53,7 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil {"DisableOnroadUploads", "Disable Onroad Uploads", "Prevent large data uploads when onroad.", ""}, {"HigherBitrate", "Higher Bitrate Recording", "Increases the quality of the footage uploaded to comma connect.", ""}, {"NavChill", "Navigate on Chill Mode", "Allows cars without longitudinal support to navigate. Allows navigation without experimental mode.", ""}, + {"PauseLateralOnSignal", "Pause Lateral On Turn Signal Below", "Temporarily disable lateral control during turn signal use below the set speed.", ""}, {"ReverseCruise", "Reverse Cruise Increase", "Reverses the 'long press' functionality when increasing the max set speed. Useful to increase the max speed quickly.", ""}, }; @@ -281,6 +282,8 @@ FrogPilotControlsPanel::FrogPilotControlsPanel(SettingsWindow *parent) : FrogPil } }); toggle = qolToggle; + } else if (param == "PauseLateralOnSignal") { + toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 99, std::map(), this, false, " mph"); } else if (param == "ReverseCruise") { std::vector reverseCruiseToggles{"ReverseCruiseUI"}; std::vector reverseCruiseNames{tr("Control Via UI")}; @@ -388,29 +391,34 @@ void FrogPilotControlsPanel::updateMetric() { params.putIntNonBlocking("CESpeedLead", std::nearbyint(params.getInt("CESpeedLead") * speedConversion)); params.putIntNonBlocking("LaneDetectionWidth", std::nearbyint(params.getInt("LaneDetectionWidth") * distanceConversion)); params.putIntNonBlocking("MTSCLimit", std::nearbyint(params.getInt("MTSCLimit") * speedConversion)); + params.putIntNonBlocking("PauseLateralOnSignal", std::nearbyint(params.getInt("PauseLateralOnSignal") * speedConversion)); params.putIntNonBlocking("StoppingDistance", std::nearbyint(params.getInt("StoppingDistance") * distanceConversion)); } FrogPilotParamValueControl *laneWidthToggle = static_cast(toggles["LaneDetectionWidth"]); FrogPilotParamValueControl *mtscLimitToggle = static_cast(toggles["MTSCLimit"]); + FrogPilotParamValueControl *pauseLateralToggle = static_cast(toggles["PauseLateralOnSignal"]); FrogPilotParamValueControl *stoppingDistanceToggle = static_cast(toggles["StoppingDistance"]); if (isMetric) { laneWidthToggle->updateControl(0, 30, " meters", 10); mtscLimitToggle->updateControl(0, 99, " kph"); + pauseLateralToggle->updateControl(0, 150, " kph"); stoppingDistanceToggle->updateControl(0, 5, " meters"); } else { laneWidthToggle->updateControl(0, 100, " feet", 10); mtscLimitToggle->updateControl(0, 99, " mph"); + pauseLateralToggle->updateControl(0, 99, " mph"); stoppingDistanceToggle->updateControl(0, 10, " feet"); } laneWidthToggle->refresh(); mtscLimitToggle->refresh(); + pauseLateralToggle->refresh(); stoppingDistanceToggle->refresh(); previousIsMetric = isMetric; diff --git a/selfdrive/frogpilot/ui/control_settings.h b/selfdrive/frogpilot/ui/control_settings.h index 031697c..3aa7209 100644 --- a/selfdrive/frogpilot/ui/control_settings.h +++ b/selfdrive/frogpilot/ui/control_settings.h @@ -44,7 +44,7 @@ private: std::set lateralTuneKeys = {"ForceAutoTune", "NNFF"}; std::set longitudinalTuneKeys = {"AccelerationProfile", "DecelerationProfile", "AggressiveAcceleration", "StoppingDistance"}; std::set mtscKeys = {"DisableMTSCSmoothing", "MTSCAggressiveness", "MTSCCurvatureCheck", "MTSCLimit"}; - std::set qolKeys = {"DisableOnroadUploads", "HigherBitrate", "NavChill", "ReverseCruise"}; + std::set qolKeys = {"DisableOnroadUploads", "HigherBitrate", "NavChill", "PauseLateralOnSignal", "ReverseCruise"}; std::set speedLimitControllerKeys = {}; std::set speedLimitControllerControlsKeys = {}; std::set speedLimitControllerQOLKeys = {};