GM camera ACC: reliable relay closing (#27164)

* Reliable relay open

* Reliable relay close

* ign in a loop

* fixes

* we need this

* log

* comment to remind me tmrw

* ign fix

* this makes it 2x more reliable, but messyyy

* Revert "this makes it 2x more reliable, but messyyy"

This reverts commit 03401dc4a7.

* revert non-related stuff

* comments, spaces

* a stands for indefinite article

* not applicable for non-camera acc

* something...

* Revert "something..."

This reverts commit de8a158488.

* Update ref_commit
old-commit-hash: 022ef679e6
beeps
Shane Smiskol 2 years ago committed by GitHub
parent fa5dde7192
commit bea6ee6ccb
  1. 9
      selfdrive/car/gm/carcontroller.py
  2. 4
      selfdrive/car/gm/carstate.py
  3. 2
      selfdrive/test/process_replay/ref_commit

@ -50,9 +50,14 @@ class CarController:
# Steering (Active: 50Hz, inactive: 10Hz) # Steering (Active: 50Hz, inactive: 10Hz)
# Attempt to sync with camera on startup at 50Hz, first few msgs are blocked # Attempt to sync with camera on startup at 50Hz, first few msgs are blocked
init_lka_counter = not self.sent_lka_steering_cmd and self.CP.networkLocation == NetworkLocation.fwdCamera init_lka_counter = not self.sent_lka_steering_cmd
# Also send at 50Hz until we're in sync with camera so counters align when relay closes, preventing a fault
# openpilot can subtly drift, so this is activated throughout a drive to stay synced
out_of_sync = self.lka_steering_cmd_counter % 4 != (CS.camera_lka_steering_cmd_counter + 1) % 4
sync_steer = (init_lka_counter or out_of_sync) and self.CP.networkLocation == NetworkLocation.fwdCamera
steer_step = self.params.INACTIVE_STEER_STEP steer_step = self.params.INACTIVE_STEER_STEP
if CC.latActive or init_lka_counter: if CC.latActive or sync_steer:
steer_step = self.params.STEER_STEP steer_step = self.params.STEER_STEP
# Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we just received the # Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we just received the

@ -19,6 +19,7 @@ class CarState(CarStateBase):
self.shifter_values = can_define.dv["ECMPRDNL2"]["PRNDL2"] self.shifter_values = can_define.dv["ECMPRDNL2"]["PRNDL2"]
self.loopback_lka_steering_cmd_updated = False self.loopback_lka_steering_cmd_updated = False
self.pt_lka_steering_cmd_counter = 0 self.pt_lka_steering_cmd_counter = 0
self.camera_lka_steering_cmd_counter = 0
self.buttons_counter = 0 self.buttons_counter = 0
def update(self, pt_cp, cam_cp, loopback_cp): def update(self, pt_cp, cam_cp, loopback_cp):
@ -34,6 +35,7 @@ class CarState(CarStateBase):
self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0 self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0
if self.CP.networkLocation == NetworkLocation.fwdCamera: if self.CP.networkLocation == NetworkLocation.fwdCamera:
self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"] self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
self.camera_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
ret.wheelSpeeds = self.get_wheel_speeds( ret.wheelSpeeds = self.get_wheel_speeds(
pt_cp.vl["EBCMWheelSpdFront"]["FLWheelSpd"], pt_cp.vl["EBCMWheelSpdFront"]["FLWheelSpd"],
@ -113,11 +115,13 @@ class CarState(CarStateBase):
if CP.networkLocation == NetworkLocation.fwdCamera: if CP.networkLocation == NetworkLocation.fwdCamera:
signals += [ signals += [
("AEBCmdActive", "AEBCmd"), ("AEBCmdActive", "AEBCmd"),
("RollingCounter", "ASCMLKASteeringCmd"),
("ACCSpeedSetpoint", "ASCMActiveCruiseControlStatus"), ("ACCSpeedSetpoint", "ASCMActiveCruiseControlStatus"),
("ACCCruiseState", "ASCMActiveCruiseControlStatus"), ("ACCCruiseState", "ASCMActiveCruiseControlStatus"),
] ]
checks += [ checks += [
("AEBCmd", 10), ("AEBCmd", 10),
("ASCMLKASteeringCmd", 10),
("ASCMActiveCruiseControlStatus", 25), ("ASCMActiveCruiseControlStatus", 25),
] ]

@ -1 +1 @@
d795362593d935767c694c652ecb05ab80dd1914 baef183c9602b702756e2fd0781b5d289b61d19a

Loading…
Cancel
Save