Subaru: use CANPacker for counter (#25216)

* Subaru: use CANPacker for counter

* bump opendbc

* bump panda
old-commit-hash: 5f021ac1d6b307fae892e2966cb2b2699d2799cb
This commit is contained in:
Adeeb Shihadeh
2022-07-19 17:21:07 -07:00
committed by GitHub
parent 6ca9144357
commit 2750e0b70b
5 changed files with 13 additions and 15 deletions
+1 -1
Submodule opendbc updated: 3fb3f5e821...e2465cc701
+1 -1
Submodule panda updated: e51aa5ebce...1dfee5973b
+6 -6
View File
@@ -49,7 +49,7 @@ class CarController:
# *** alerts and pcm cancel ***
if self.CP.carFingerprint in PREGLOBAL_CARS:
if self.es_distance_cnt != CS.es_distance_msg["Counter"]:
if self.es_distance_cnt != CS.es_distance_msg["COUNTER"]:
# 1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 = resume deep
# disengage ACC when OP is disengaged
if pcm_cancel_cmd:
@@ -66,16 +66,16 @@ class CarController:
self.cruise_button_prev = cruise_button
can_sends.append(subarucan.create_preglobal_es_distance(self.packer, cruise_button, CS.es_distance_msg))
self.es_distance_cnt = CS.es_distance_msg["Counter"]
self.es_distance_cnt = CS.es_distance_msg["COUNTER"]
else:
if self.es_distance_cnt != CS.es_distance_msg["Counter"]:
if self.es_distance_cnt != CS.es_distance_msg["COUNTER"]:
can_sends.append(subarucan.create_es_distance(self.packer, CS.es_distance_msg, pcm_cancel_cmd))
self.es_distance_cnt = CS.es_distance_msg["Counter"]
self.es_distance_cnt = CS.es_distance_msg["COUNTER"]
if self.es_lkas_cnt != CS.es_lkas_msg["Counter"]:
if self.es_lkas_cnt != CS.es_lkas_msg["COUNTER"]:
can_sends.append(subarucan.create_es_lkas(self.packer, CS.es_lkas_msg, CC.enabled, hud_control.visualAlert, hud_control.leftLaneVisible, hud_control.rightLaneVisible, hud_control.leftLaneDepart, hud_control.rightLaneDepart))
self.es_lkas_cnt = CS.es_lkas_msg["Counter"]
self.es_lkas_cnt = CS.es_lkas_msg["COUNTER"]
new_actuators = actuators.copy()
new_actuators.steer = self.apply_steer_last / self.p.STEER_MAX
+3 -3
View File
@@ -173,7 +173,7 @@ class CarState(CarStateBase):
("Standstill_2", "ES_Distance"),
("Cruise_Fault", "ES_Distance"),
("Signal5", "ES_Distance"),
("Counter", "ES_Distance"),
("COUNTER", "ES_Distance"),
("Signal6", "ES_Distance"),
("Cruise_Button", "ES_Distance"),
("Signal7", "ES_Distance"),
@@ -188,7 +188,7 @@ class CarState(CarStateBase):
("Cruise_Set_Speed", "ES_DashStatus"),
("Conventional_Cruise", "ES_DashStatus"),
("Counter", "ES_Distance"),
("COUNTER", "ES_Distance"),
("Signal1", "ES_Distance"),
("Cruise_Fault", "ES_Distance"),
("Cruise_Throttle", "ES_Distance"),
@@ -206,7 +206,7 @@ class CarState(CarStateBase):
("Cruise_Resume", "ES_Distance"),
("Signal6", "ES_Distance"),
("Counter", "ES_LKAS_State"),
("COUNTER", "ES_LKAS_State"),
("LKAS_Alert_Msg", "ES_LKAS_State"),
("Signal1", "ES_LKAS_State"),
("LKAS_ACTIVE", "ES_LKAS_State"),
+2 -4
View File
@@ -8,13 +8,12 @@ def create_steering_control(packer, apply_steer, frame, steer_step):
idx = (frame / steer_step) % 16
values = {
"Counter": idx,
"LKAS_Output": apply_steer,
"LKAS_Request": 1 if apply_steer != 0 else 0,
"SET_1": 1
}
return packer.make_can_msg("ES_LKAS", 0, values)
return packer.make_can_msg("ES_LKAS", 0, values, idx)
def create_steering_status(packer, apply_steer, frame, steer_step):
return packer.make_can_msg("ES_LKAS_State", 0, {})
@@ -72,13 +71,12 @@ def create_preglobal_steering_control(packer, apply_steer, frame, steer_step):
idx = (frame / steer_step) % 8
values = {
"Counter": idx,
"LKAS_Command": apply_steer,
"LKAS_Active": 1 if apply_steer != 0 else 0
}
values["Checksum"] = subaru_preglobal_checksum(packer, values, "ES_LKAS")
return packer.make_can_msg("ES_LKAS", 0, values)
return packer.make_can_msg("ES_LKAS", 0, values, idx)
def create_preglobal_es_distance(packer, cruise_button, es_distance_msg):