mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-30 19:12:07 +08:00
Subaru: use CANPacker for counter (#25216)
* Subaru: use CANPacker for counter * bump opendbc * bump panda old-commit-hash: 5f021ac1d6b307fae892e2966cb2b2699d2799cb
This commit is contained in:
+1
-1
Submodule opendbc updated: 3fb3f5e821...e2465cc701
+1
-1
Submodule panda updated: e51aa5ebce...1dfee5973b
@@ -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
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user