Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GM: fix possible steering message counter duplication #27281

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions selfdrive/car/gm/carcontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def update(self, CC, CS, now_nanos):
if not self.sent_lka_steering_cmd or out_of_sync:
steer_step = self.params.STEER_STEP

if CS.loopback_lka_steering_cmd_updated:
self.lka_steering_cmd_counter += 1
if CS.loopback_lka_steering_cmd_msgs != 0:
self.lka_steering_cmd_counter += CS.loopback_lka_steering_cmd_msgs
self.sent_lka_steering_cmd = True

# Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we
Expand Down
4 changes: 2 additions & 2 deletions selfdrive/car/gm/carstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self, CP):
super().__init__(CP)
can_define = CANDefine(DBC[CP.carFingerprint]["pt"])
self.shifter_values = can_define.dv["ECMPRDNL2"]["PRNDL2"]
self.loopback_lka_steering_cmd_updated = False
self.loopback_lka_steering_cmd_msgs = 0
self.loopback_lka_steering_cmd_ts_nanos = 0
self.pt_lka_steering_cmd_counter = 0
self.cam_lka_steering_cmd_counter = 0
Expand All @@ -33,7 +33,7 @@ def update(self, pt_cp, cam_cp, loopback_cp):
self.moving_backward = pt_cp.vl["EBCMWheelSpdRear"]["MovingBackward"] != 0

# Variables used for avoiding LKAS faults
self.loopback_lka_steering_cmd_updated = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"]) > 0
self.loopback_lka_steering_cmd_msgs = len(loopback_cp.vl_all["ASCMLKASteeringCmd"]["RollingCounter"])
self.loopback_lka_steering_cmd_ts_nanos = loopback_cp.ts_nanos["ASCMLKASteeringCmd"]["RollingCounter"]
if self.CP.networkLocation == NetworkLocation.fwdCamera:
self.pt_lka_steering_cmd_counter = pt_cp.vl["ASCMLKASteeringCmd"]["RollingCounter"]
Expand Down