Skip to content

Commit 09cd0b4

Browse files
authored
GM camera ACC: reliable relay open init (#27163)
Reliable relay open
1 parent 4c2f8ed commit 09cd0b4

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

selfdrive/car/gm/carcontroller.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def update(self, CC, CS):
6363
elif (self.frame - self.last_steer_frame) >= steer_step:
6464
# Initialize ASCMLKASteeringCmd counter using the camera until we get a msg on the bus
6565
if init_lka_counter:
66-
self.lka_steering_cmd_counter = CS.camera_lka_steering_cmd_counter + 1
66+
self.lka_steering_cmd_counter = CS.pt_lka_steering_cmd_counter + 1
6767

6868
if CC.latActive:
6969
new_steer = int(round(actuators.steer * self.params.STEER_MAX))

selfdrive/car/gm/carstate.py

+11-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def __init__(self, CP):
1818
can_define = CANDefine(DBC[CP.carFingerprint]["pt"])
1919
self.shifter_values = can_define.dv["ECMPRDNL2"]["PRNDL2"]
2020
self.loopback_lka_steering_cmd_updated = False
21-
self.camera_lka_steering_cmd_counter = 0
21+
self.pt_lka_steering_cmd_counter = 0
2222
self.buttons_counter = 0
2323

2424
def update(self, pt_cp, cam_cp, loopback_cp):
@@ -33,7 +33,7 @@ def update(self, pt_cp, cam_cp, loopback_cp):
3333
# Variables used for avoiding LKAS faults
3434
self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0
3535
if self.CP.networkLocation == NetworkLocation.fwdCamera:
36-
self.camera_lka_steering_cmd_counter = cam_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
36+
self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
3737

3838
ret.wheelSpeeds = self.get_wheel_speeds(
3939
pt_cp.vl["EBCMWheelSpdFront"]["FLWheelSpd"],
@@ -113,13 +113,11 @@ def get_cam_can_parser(CP):
113113
if CP.networkLocation == NetworkLocation.fwdCamera:
114114
signals += [
115115
("AEBCmdActive", "AEBCmd"),
116-
("RollingCounter", "ASCMLKASteeringCmd"),
117116
("ACCSpeedSetpoint", "ASCMActiveCruiseControlStatus"),
118117
("ACCCruiseState", "ASCMActiveCruiseControlStatus"),
119118
]
120119
checks += [
121120
("AEBCmd", 10),
122-
("ASCMLKASteeringCmd", 10),
123121
("ASCMActiveCruiseControlStatus", 25),
124122
]
125123

@@ -180,6 +178,15 @@ def get_can_parser(CP):
180178
("ECMAcceleratorPos", 80),
181179
]
182180

181+
# Used to read back last counter sent to PT by camera
182+
if CP.networkLocation == NetworkLocation.fwdCamera:
183+
signals += [
184+
("RollingCounter", "ASCMLKASteeringCmd"),
185+
]
186+
checks += [
187+
("ASCMLKASteeringCmd", 0),
188+
]
189+
183190
if CP.transmissionType == TransmissionType.direct:
184191
signals.append(("RegenPaddle", "EBCMRegenPaddle"))
185192
checks.append(("EBCMRegenPaddle", 50))

0 commit comments

Comments
 (0)