mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-09 19:39:00 +08:00
rename enableCruise -> pcmCruise (#21546)
old-commit-hash: cb7e96f99d59cc56ac532d4b5e08e03c013cf946
This commit is contained in:
+1
-1
Submodule cereal updated: b372ab3ae1...2f64d4902e
@@ -20,7 +20,7 @@ class CarInterface(CarInterfaceBase):
|
||||
ret = CarInterfaceBase.get_std_params(candidate, fingerprint)
|
||||
ret.carName = "gm"
|
||||
ret.safetyModel = car.CarParams.SafetyModel.gm
|
||||
ret.enableCruise = False # stock cruise control is kept off
|
||||
ret.pcmCruise = False # stock cruise control is kept off
|
||||
|
||||
# GM port is a community feature
|
||||
# TODO: make a port that uses a car harness and it only intercepts the camera
|
||||
|
||||
@@ -104,7 +104,7 @@ class CarController():
|
||||
|
||||
# Never send cancel command if we never enter cruise state (no cruise if pedal)
|
||||
# Cancel cmd causes brakes to release at a standstill causing grinding
|
||||
pcm_cancel_cmd = pcm_cancel_cmd and CS.CP.enableCruise
|
||||
pcm_cancel_cmd = pcm_cancel_cmd and CS.CP.pcmCruise
|
||||
|
||||
# *** rate limit after the enable check ***
|
||||
self.brake_last = rate_limit(brake, self.brake_last, -2., DT_CTRL)
|
||||
|
||||
@@ -135,14 +135,14 @@ class CarInterface(CarInterfaceBase):
|
||||
# WARNING: THIS DISABLES AEB!
|
||||
ret.openpilotLongitudinalControl = Params().get_bool("DisableRadar")
|
||||
|
||||
ret.enableCruise = not ret.openpilotLongitudinalControl
|
||||
ret.pcmCruise = not ret.openpilotLongitudinalControl
|
||||
ret.communityFeature = ret.openpilotLongitudinalControl
|
||||
else:
|
||||
ret.safetyModel = car.CarParams.SafetyModel.hondaNidec
|
||||
ret.enableGasInterceptor = 0x201 in fingerprint[0]
|
||||
ret.openpilotLongitudinalControl = True
|
||||
|
||||
ret.enableCruise = not ret.enableGasInterceptor
|
||||
ret.pcmCruise = not ret.enableGasInterceptor
|
||||
ret.communityFeature = ret.enableGasInterceptor
|
||||
|
||||
if candidate == CAR.CRV_5G:
|
||||
@@ -509,7 +509,7 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.buttonEvents = buttonEvents
|
||||
|
||||
# events
|
||||
events = self.create_common_events(ret, pcm_enable=self.CP.enableCruise)
|
||||
events = self.create_common_events(ret, pcm_enable=self.CP.pcmCruise)
|
||||
if self.CS.brake_error:
|
||||
events.add(EventName.brakeUnavailable)
|
||||
if self.CS.brake_hold and self.CS.CP.openpilotLongitudinalControl:
|
||||
@@ -517,12 +517,12 @@ class CarInterface(CarInterfaceBase):
|
||||
if self.CS.park_brake:
|
||||
events.add(EventName.parkBrake)
|
||||
|
||||
if self.CP.enableCruise and ret.vEgo < self.CP.minEnableSpeed:
|
||||
if self.CP.pcmCruise and ret.vEgo < self.CP.minEnableSpeed:
|
||||
events.add(EventName.belowEngageSpeed)
|
||||
|
||||
# it can happen that car cruise disables while comma system is enabled: need to
|
||||
# keep braking if needed or if the speed is very low
|
||||
if self.CP.enableCruise and not ret.cruiseState.enabled \
|
||||
if self.CP.pcmCruise and not ret.cruiseState.enabled \
|
||||
and (c.actuators.brake <= 0. or not self.CP.openpilotLongitudinalControl):
|
||||
# non loud alert if cruise disables below 25mph as expected (+ a little margin)
|
||||
if ret.vEgo < self.CP.minEnableSpeed + 2.:
|
||||
@@ -537,7 +537,7 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
# do enable on both accel and decel buttons
|
||||
if b.type in [ButtonType.accelCruise, ButtonType.decelCruise] and not b.pressed:
|
||||
if not self.CP.enableCruise:
|
||||
if not self.CP.pcmCruise:
|
||||
events.add(EventName.buttonEnable)
|
||||
|
||||
# do disable on button down
|
||||
|
||||
@@ -69,12 +69,11 @@ class CarInterfaceBase():
|
||||
ret.steerMaxV = [1.]
|
||||
ret.minSteerSpeed = 0.
|
||||
|
||||
# stock ACC by default
|
||||
ret.enableCruise = True
|
||||
ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this
|
||||
ret.pcmCruise = True # openpilot's state is tied to the PCM's cruise state on most cars
|
||||
ret.minEnableSpeed = -1. # enable is done by stock ACC, so ignore this
|
||||
ret.steerRatioRear = 0. # no rear steering, at least on the listed cars aboveA
|
||||
ret.gasMaxBP = [0.]
|
||||
ret.gasMaxV = [.5] # half max brake
|
||||
ret.gasMaxV = [.5] # half max brake
|
||||
ret.brakeMaxBP = [0.]
|
||||
ret.brakeMaxV = [1.]
|
||||
ret.openpilotLongitudinalControl = False
|
||||
|
||||
@@ -356,9 +356,9 @@ class Controls:
|
||||
self.v_cruise_kph_last = self.v_cruise_kph
|
||||
|
||||
# if stock cruise is completely disabled, then we can use our own set speed logic
|
||||
if not self.CP.enableCruise:
|
||||
if not self.CP.pcmCruise:
|
||||
self.v_cruise_kph = update_v_cruise(self.v_cruise_kph, CS.buttonEvents, self.enabled)
|
||||
elif self.CP.enableCruise and CS.cruiseState.enabled:
|
||||
elif self.CP.pcmCruise and CS.cruiseState.enabled:
|
||||
self.v_cruise_kph = CS.cruiseState.speed * CV.MS_TO_KPH
|
||||
|
||||
# decrease the soft disable timer at every step, as it's reset on
|
||||
@@ -507,7 +507,7 @@ class Controls:
|
||||
CC.actuators = actuators
|
||||
|
||||
CC.cruiseControl.override = True
|
||||
CC.cruiseControl.cancel = not self.CP.enableCruise or (not self.enabled and CS.cruiseState.enabled)
|
||||
CC.cruiseControl.cancel = not self.CP.pcmCruise or (not self.enabled and CS.cruiseState.enabled)
|
||||
if self.joystick_mode and self.sm.rcv_frame['testJoystick'] > 0 and self.sm['testJoystick'].buttons[0]:
|
||||
CC.cruiseControl.cancel = True
|
||||
|
||||
@@ -516,7 +516,7 @@ class Controls:
|
||||
# brake discount removes a sharp nonlinearity
|
||||
brake_discount = (1.0 - clip(actuators.brake * 3., 0.0, 1.0))
|
||||
speed_override = max(0.0, (self.LoC.v_pid + CS.cruiseState.speedOffset) * brake_discount)
|
||||
CC.cruiseControl.speedOverride = float(speed_override if self.CP.enableCruise else 0.0)
|
||||
CC.cruiseControl.speedOverride = float(speed_override if self.CP.pcmCruise else 0.0)
|
||||
CC.cruiseControl.accelOverride = float(self.CI.calc_accel_override(CS.aEgo, self.a_target,
|
||||
CS.vEgo, self.v_target))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user