Pause lateral control with turn signal

Added toggle to pause lateral control when a turn signal is active below a set speed.
This commit is contained in:
FrogAi
2024-02-27 16:34:47 -07:00
parent 1fa53eb8b2
commit 1a33c93961
5 changed files with 14 additions and 2 deletions

View File

@@ -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():