diff --git a/opendbc_repo b/opendbc_repo index b68fab9ea..91fd70341 160000 --- a/opendbc_repo +++ b/opendbc_repo @@ -1 +1 @@ -Subproject commit b68fab9ea4052213f8bfc1b80832ac8d4e798c8b +Subproject commit 91fd70341e550805c30c76006cbd281cf7e7d5bc diff --git a/selfdrive/car/car_specific.py b/selfdrive/car/car_specific.py index b741e916c..3db9a8c88 100644 --- a/selfdrive/car/car_specific.py +++ b/selfdrive/car/car_specific.py @@ -82,7 +82,7 @@ class CarSpecificEvents: events = self.create_common_events(CS, CS_prev) if self.CP.openpilotLongitudinalControl: - if CS.cruiseState.standstill and not (CS.brakePressed or self.CP.autoResumeSng): + if CS.cruiseState.standstill and not CS.brakePressed: events.add(EventName.resumeRequired) if CS.vEgo < self.CP.minEnableSpeed: events.add(EventName.belowEngageSpeed) @@ -103,18 +103,30 @@ class CarSpecificEvents: if CS.vEgo < self.CP.minEnableSpeed and not (CS.standstill and CS.brake >= 20 and self.CP.networkLocation == NetworkLocation.fwdCamera): events.add(EventName.belowEngageSpeed) - if CS.cruiseState.standstill: + if CS.cruiseState.standstill and not self.CP.autoResumeSng: events.add(EventName.resumeRequired) + if CS.vEgo < self.CP.minSteerSpeed: + events.add(EventName.belowSteerSpeed) + + if (self.CP.flags & GMFlags.CC_LONG) and CS.vEgo < self.CP.minEnableSpeed and CS.cruiseState.enabled: + events.add(EventName.speedTooLow) elif self.CP.brand == 'volkswagen': events = self.create_common_events(CS, CS_prev, extra_gears=[GearShifter.eco, GearShifter.sport, GearShifter.manumatic], pcm_enable=self.CP.pcmCruise) + # Low speed steer alert hysteresis logic + if (self.CP.minSteerSpeed - 1e-3) > VWCarControllerParams.DEFAULT_MIN_STEER_SPEED and CS.vEgo < (self.CP.minSteerSpeed + 1.): + self.low_speed_alert = True + elif CS.vEgo > (self.CP.minSteerSpeed + 2.): + self.low_speed_alert = False + if self.low_speed_alert: + events.add(EventName.belowSteerSpeed) + if self.CP.openpilotLongitudinalControl: if CS.vEgo < self.CP.minEnableSpeed + 0.5: events.add(EventName.belowEngageSpeed) - if ((CC.enabled and CS.vEgo < self.CP.minEnableSpeed) or - ((self.CP.flags & GMFlags.CC_LONG) and CS.vEgo < self.CP.minEnableSpeed and CS.cruiseState.enabled)): + if CC.enabled and CS.vEgo < self.CP.minEnableSpeed: events.add(EventName.speedTooLow) # TODO: this needs to be implemented generically in carState struct diff --git a/selfdrive/car/cruise.py b/selfdrive/car/cruise.py index 4906bb84c..055f13331 100644 --- a/selfdrive/car/cruise.py +++ b/selfdrive/car/cruise.py @@ -49,7 +49,7 @@ class VCruiseHelper(VCruiseHelperSP): self.v_cruise_kph_last = self.v_cruise_kph if CS.cruiseState.available: - if not self.CP.pcmCruise: + if self.gm_cc_only or not self.CP.pcmCruise: # if stock cruise is completely disabled, then we can use our own set speed logic self._update_v_cruise_non_pcm(CS, enabled, is_metric) self.v_cruise_cluster_kph = self.v_cruise_kph @@ -135,8 +135,8 @@ class VCruiseHelper(VCruiseHelperSP): initial_experimental_mode = experimental_mode and not dynamic_experimental_control initial = V_CRUISE_INITIAL_EXPERIMENTAL_MODE if initial_experimental_mode else V_CRUISE_INITIAL - if ((any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents) and self.v_cruise_initialized) - or (self.gm_cc_only and resume_prev_button)): + if (any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents) + and self.v_cruise_initialized or (self.gm_cc_only and resume_prev_button)): self.v_cruise_kph = self.v_cruise_kph_last else: self.v_cruise_kph = int(round(np.clip(CS.vEgo * CV.MS_TO_KPH, initial, V_CRUISE_MAX)))