GM camera ACC: cancel after delay (#26197)

* add delay to GM camera ACC cancel to avoid FCW and cruise fault

* we can revert brake pressed threshold now

* bump panda

* add proper threshold

* bump

* bujmp panda
pull/26205/head
Shane Smiskol 3 years ago committed by GitHub
parent dba8e8ec0e
commit 6efd2c3de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      panda
  2. 10
      selfdrive/car/gm/carcontroller.py
  3. 7
      selfdrive/car/gm/carstate.py

@ -1 +1 @@
Subproject commit d51dd496cbdc8665928af40247582bc62dba1f2a Subproject commit 2db69bc94120a3c10f39cdedc9d83315f9ba801e

@ -10,6 +10,9 @@ from selfdrive.car.gm.values import DBC, CanBus, CarControllerParams, CruiseButt
VisualAlert = car.CarControl.HUDControl.VisualAlert VisualAlert = car.CarControl.HUDControl.VisualAlert
NetworkLocation = car.CarParams.NetworkLocation NetworkLocation = car.CarParams.NetworkLocation
# Camera cancels up to 0.1s after brake is pressed, ECM allows 0.5s
CAMERA_CANCEL_DELAY_FRAMES = 10
class CarController: class CarController:
def __init__(self, dbc_name, CP, VM): def __init__(self, dbc_name, CP, VM):
@ -20,6 +23,7 @@ class CarController:
self.apply_brake = 0 self.apply_brake = 0
self.frame = 0 self.frame = 0
self.last_button_frame = 0 self.last_button_frame = 0
self.cancel_counter = 0
self.lka_steering_cmd_counter = 0 self.lka_steering_cmd_counter = 0
self.sent_lka_steering_cmd = False self.sent_lka_steering_cmd = False
@ -111,9 +115,13 @@ class CarController:
can_sends += gmcan.create_adas_keepalive(CanBus.POWERTRAIN) can_sends += gmcan.create_adas_keepalive(CanBus.POWERTRAIN)
else: else:
# While car is braking, cancel button causes ECM to enter a soft disable state with a fault status.
# A delayed cancellation allows camera to cancel and avoids a fault when user depresses brake quickly
self.cancel_counter = self.cancel_counter + 1 if CC.cruiseControl.cancel else 0
# Stock longitudinal, integrated at camera # Stock longitudinal, integrated at camera
if (self.frame - self.last_button_frame) * DT_CTRL > 0.04: if (self.frame - self.last_button_frame) * DT_CTRL > 0.04:
if CC.cruiseControl.cancel: if self.cancel_counter > CAMERA_CANCEL_DELAY_FRAMES:
self.last_button_frame = self.frame self.last_button_frame = self.frame
can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CS.buttons_counter, CruiseButtons.CANCEL)) can_sends.append(gmcan.create_buttons(self.packer_pt, CanBus.CAMERA, CS.buttons_counter, CruiseButtons.CANCEL))

@ -55,12 +55,7 @@ class CarState(CarStateBase):
# To avoid a cruise fault we need to match the ECM's brake pressed signal and threshold # To avoid a cruise fault we need to match the ECM's brake pressed signal and threshold
# https://static.nhtsa.gov/odi/tsbs/2017/MC-10137629-9999.pdf # https://static.nhtsa.gov/odi/tsbs/2017/MC-10137629-9999.pdf
ret.brake = pt_cp.vl["ECMAcceleratorPos"]["BrakePedalPos"] ret.brake = pt_cp.vl["ECMAcceleratorPos"]["BrakePedalPos"]
if self.CP.networkLocation != NetworkLocation.fwdCamera: ret.brakePressed = ret.brake >= 8
ret.brakePressed = ret.brake >= 8
else:
# While car is braking, cancel button causes ECM to enter a soft disable state with a fault status.
# Match ECM threshold at a standstill to allow the camera to cancel earlier
ret.brakePressed = ret.brake >= 20
# Regen braking is braking # Regen braking is braking
if self.CP.transmissionType == TransmissionType.direct: if self.CP.transmissionType == TransmissionType.direct:

Loading…
Cancel
Save