|
|
|
@ -30,7 +30,6 @@ class CarController: |
|
|
|
|
self.cancel_counter = 0 |
|
|
|
|
|
|
|
|
|
self.lka_steering_cmd_counter = 0 |
|
|
|
|
self.sent_lka_steering_cmd = False |
|
|
|
|
self.lka_icon_status_last = (False, False) |
|
|
|
|
|
|
|
|
|
self.params = CarControllerParams(self.CP) |
|
|
|
@ -59,19 +58,17 @@ class CarController: |
|
|
|
|
# - 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.cam_lka_steering_cmd_counter + 1) % 4 |
|
|
|
|
if not self.sent_lka_steering_cmd or out_of_sync: |
|
|
|
|
if CS.loopback_lka_steering_cmd_ts_nanos == 0 or out_of_sync: |
|
|
|
|
steer_step = self.params.STEER_STEP |
|
|
|
|
|
|
|
|
|
if CS.loopback_lka_steering_cmd_updated: |
|
|
|
|
self.lka_steering_cmd_counter += 1 |
|
|
|
|
self.sent_lka_steering_cmd = True |
|
|
|
|
self.lka_steering_cmd_counter += 1 if CS.loopback_lka_steering_cmd_updated else 0 |
|
|
|
|
|
|
|
|
|
# Avoid GM EPS faults when transmitting messages too close together: skip this transmit if we |
|
|
|
|
# received the ASCMLKASteeringCmd loopback confirmation too recently |
|
|
|
|
last_lka_steer_msg_ms = (now_nanos - CS.loopback_lka_steering_cmd_ts_nanos) * 1e-6 |
|
|
|
|
if (self.frame - self.last_steer_frame) >= steer_step and last_lka_steer_msg_ms > MIN_STEER_MSG_INTERVAL_MS: |
|
|
|
|
# Initialize ASCMLKASteeringCmd counter using the camera until we get a msg on the bus |
|
|
|
|
if not self.sent_lka_steering_cmd: |
|
|
|
|
if CS.loopback_lka_steering_cmd_ts_nanos == 0: |
|
|
|
|
self.lka_steering_cmd_counter = CS.pt_lka_steering_cmd_counter + 1 |
|
|
|
|
|
|
|
|
|
if CC.latActive: |
|
|
|
|