Subaru signals update (#20956)

* switch to opendbc subaru-signals-2021-05-19

* update carstate signals to match dbc, rename fake_button to cruise_button

* Revert "switch to opendbc subaru-signals-2021-05-19"

This reverts commit f88d6ddcf5.

* bump opendbc

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
pull/20959/head
martinl 2021-05-19 05:39:09 +03:00 committed by GitHub
parent ffc3a6b8d8
commit 587060bd92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 22 deletions

@ -1 +1 @@
Subproject commit ec2a7dcf2fb3550c30ab6be32577547e0247c7ca
Subproject commit e3cb276afe07344303a7abc6fa05b06990dcb586

View File

@ -10,7 +10,7 @@ class CarController():
self.es_distance_cnt = -1
self.es_accel_cnt = -1
self.es_lkas_cnt = -1
self.fake_button_prev = 0
self.cruise_button_prev = 0
self.steer_rate_limited = False
self.packer = CANPacker(DBC[CP.carFingerprint]['pt'])
@ -48,19 +48,19 @@ class CarController():
# 1 = main, 2 = set shallow, 3 = set deep, 4 = resume shallow, 5 = resume deep
# disengage ACC when OP is disengaged
if pcm_cancel_cmd:
fake_button = 1
cruise_button = 1
# turn main on if off and past start-up state
elif not CS.out.cruiseState.available and CS.ready:
fake_button = 1
cruise_button = 1
else:
fake_button = CS.button
cruise_button = CS.cruise_button
# unstick previous mocked button press
if fake_button == 1 and self.fake_button_prev == 1:
fake_button = 0
self.fake_button_prev = fake_button
if cruise_button == 1 and self.cruise_button_prev == 1:
cruise_button = 0
self.cruise_button_prev = cruise_button
can_sends.append(subarucan.create_es_throttle_control(self.packer, fake_button, CS.es_accel_msg))
can_sends.append(subarucan.create_es_throttle_control(self.packer, cruise_button, CS.es_accel_msg))
self.es_accel_cnt = CS.es_accel_msg["Counter"]
else:

View File

@ -63,14 +63,13 @@ class CarState(CarStateBase):
cp.vl["BodyInfo"]['DOOR_OPEN_RL'],
cp.vl["BodyInfo"]['DOOR_OPEN_FR'],
cp.vl["BodyInfo"]['DOOR_OPEN_FL']])
ret.steerError = cp.vl["Steering_Torque"]['Steer_Error_1'] == 1
if self.car_fingerprint in PREGLOBAL_CARS:
ret.steerError = cp.vl["Steering_Torque"]["LKA_Lockout"] == 1
self.button = cp_cam.vl["ES_CruiseThrottle"]["Button"]
self.cruise_button = cp_cam.vl["ES_CruiseThrottle"]["Cruise_Button"]
self.ready = not cp_cam.vl["ES_DashStatus"]["Not_Ready_Startup"]
self.es_accel_msg = copy.copy(cp_cam.vl["ES_CruiseThrottle"])
else:
ret.steerError = cp.vl["Steering_Torque"]['Steer_Error_1'] == 1
ret.steerWarning = cp.vl["Steering_Torque"]['Steer_Warning'] == 1
ret.cruiseState.nonAdaptive = cp_cam.vl["ES_DashStatus"]['Conventional_Cruise'] == 1
self.es_distance_msg = copy.copy(cp_cam.vl["ES_Distance"])
@ -85,6 +84,7 @@ class CarState(CarStateBase):
# sig_name, sig_address, default
("Steer_Torque_Sensor", "Steering_Torque", 0),
("Steering_Angle", "Steering_Torque", 0),
("Steer_Error_1", "Steering_Torque", 0),
("Cruise_On", "CruiseControl", 0),
("Cruise_Activated", "CruiseControl", 0),
("Brake_Pedal", "Brake_Pedal", 0),
@ -127,13 +127,8 @@ class CarState(CarStateBase):
("BSD_RCTA", 17),
]
if CP.carFingerprint in PREGLOBAL_CARS:
if CP.carFingerprint not in PREGLOBAL_CARS:
signals += [
("LKA_Lockout", "Steering_Torque", 0),
]
else:
signals += [
("Steer_Error_1", "Steering_Torque", 0),
("Steer_Warning", "Steering_Torque", 0),
]
@ -170,17 +165,17 @@ class CarState(CarStateBase):
("Cruise_Activated", "ES_CruiseThrottle", 0),
("Signal2", "ES_CruiseThrottle", 0),
("Brake_On", "ES_CruiseThrottle", 0),
("DistanceSwap", "ES_CruiseThrottle", 0),
("Distance_Swap", "ES_CruiseThrottle", 0),
("Standstill", "ES_CruiseThrottle", 0),
("Signal3", "ES_CruiseThrottle", 0),
("CloseDistance", "ES_CruiseThrottle", 0),
("Close_Distance", "ES_CruiseThrottle", 0),
("Signal4", "ES_CruiseThrottle", 0),
("Standstill_2", "ES_CruiseThrottle", 0),
("ES_Error", "ES_CruiseThrottle", 0),
("Cruise_Fault", "ES_CruiseThrottle", 0),
("Signal5", "ES_CruiseThrottle", 0),
("Counter", "ES_CruiseThrottle", 0),
("Signal6", "ES_CruiseThrottle", 0),
("Button", "ES_CruiseThrottle", 0),
("Cruise_Button", "ES_CruiseThrottle", 0),
("Signal7", "ES_CruiseThrottle", 0),
]