mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 22:23:56 +08:00
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 03401dc4a705cfacbe5a7048d95dccb6fa80d57f.
* revert non-related stuff
* comments, spaces
* a stands for indefinite article
* not applicable for non-camera acc
* something...
* Revert "something..."
This reverts commit de8a158488efd5ef257434fbc3c55aefff800cb7.
* Update ref_commit
old-commit-hash: 022ef679e6
This commit is contained in:
@@ -50,9 +50,14 @@ class CarController:
|
||||
|
||||
# Steering (Active: 50Hz, inactive: 10Hz)
|
||||
# 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
|
||||
if CC.latActive or init_lka_counter:
|
||||
if CC.latActive or sync_steer:
|
||||
steer_step = self.params.STEER_STEP
|
||||
|
||||
# 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.loopback_lka_steering_cmd_updated = False
|
||||
self.pt_lka_steering_cmd_counter = 0
|
||||
self.camera_lka_steering_cmd_counter = 0
|
||||
self.buttons_counter = 0
|
||||
|
||||
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
|
||||
if self.CP.networkLocation == NetworkLocation.fwdCamera:
|
||||
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(
|
||||
pt_cp.vl["EBCMWheelSpdFront"]["FLWheelSpd"],
|
||||
@@ -113,11 +115,13 @@ class CarState(CarStateBase):
|
||||
if CP.networkLocation == NetworkLocation.fwdCamera:
|
||||
signals += [
|
||||
("AEBCmdActive", "AEBCmd"),
|
||||
("RollingCounter", "ASCMLKASteeringCmd"),
|
||||
("ACCSpeedSetpoint", "ASCMActiveCruiseControlStatus"),
|
||||
("ACCCruiseState", "ASCMActiveCruiseControlStatus"),
|
||||
]
|
||||
checks += [
|
||||
("AEBCmd", 10),
|
||||
("ASCMLKASteeringCmd", 10),
|
||||
("ASCMActiveCruiseControlStatus", 25),
|
||||
]
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
d795362593d935767c694c652ecb05ab80dd1914
|
||||
baef183c9602b702756e2fd0781b5d289b61d19a
|
||||
|
||||
Reference in New Issue
Block a user