diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 3231e3072..9a5c70aee 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -196,6 +196,7 @@ class Controls: self.onroad_distance_pressed = False self.openpilot_crashed_triggered = False self.previous_traffic_mode = False + self.speed_check = False self.update_toggles = False self.display_timer = 0 @@ -583,7 +584,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.always_on_lateral_active) and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \ + CC.latActive = (self.active or self.always_on_lateral_active) and self.speed_check and not CS.steerFaultTemporary and not CS.steerFaultPermanent and \ (not standstill or self.joystick_mode) CC.longActive = self.enabled and not self.events.contains(ET.OVERRIDE_LONGITUDINAL) and self.CP.openpilotLongitudinalControl @@ -930,6 +931,7 @@ class Controls: self.always_on_lateral_active &= CS.cruiseState.available self.always_on_lateral_active &= self.frogpilot_toggles.always_on_lateral self.always_on_lateral_active &= driving_gear + self.always_on_lateral_active &= self.speed_check self.always_on_lateral_active &= not (self.frogpilot_toggles.always_on_lateral_lkas and self.sm['frogpilotCarState'].alwaysOnLateralDisabled) self.always_on_lateral_active &= not (CS.brakePressed and CS.vEgo < self.frogpilot_toggles.always_on_lateral_pause_speed) or CS.standstill @@ -962,6 +964,10 @@ class Controls: else: self.params.put_bool_nonblocking("ExperimentalMode", not self.experimental_mode) + self.speed_check = CS.vEgo >= self.frogpilot_toggles.pause_lateral_below_speed + self.speed_check |= self.frogpilot_toggles.pause_lateral_below_signal and not (CS.leftBlinker or CS.rightBlinker) + self.speed_check |= CS.standstill + FPCC = custom.FrogPilotCarControl.new_message() FPCC.alwaysOnLateral = self.always_on_lateral_active