Subaru: universal signal for ACC speed units (#21995)

* Change ACC Speed Units signals for Global and Pre-Global

* Use Dash_State UNITS signal for Preglobal

* Change Subaru Preglobal to use Dash_State2 UNITS signal

* bump opendbc

* cleanup

* update refs

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: d3113fe01a
commatwo_master
martinl 4 years ago committed by GitHub
parent a02ecc02c4
commit c3d2766744
  1. 2
      opendbc
  2. 18
      selfdrive/car/subaru/carstate.py
  3. 2
      selfdrive/test/process_replay/ref_commit

@ -1 +1 @@
Subproject commit 3afceadb847346feb30d96506f482f536e36281d
Subproject commit 78c639f813430d422bc04d06ac78242c3475bed6

@ -51,11 +51,8 @@ class CarState(CarStateBase):
ret.cruiseState.available = cp.vl["CruiseControl"]["Cruise_On"] != 0
ret.cruiseState.speed = cp_cam.vl["ES_DashStatus"]["Cruise_Set_Speed"] * CV.KPH_TO_MS
# UDM Forester, Legacy: mph = 0
if self.car_fingerprint in [CAR.FORESTER_PREGLOBAL, CAR.LEGACY_PREGLOBAL] and cp.vl["Dash_State"]["Units"] == 0:
ret.cruiseState.speed *= CV.MPH_TO_KPH
# EDM Global: mph = 1, 2; All Outback: mph = 1, UDM Forester: mph = 7
elif self.car_fingerprint not in [CAR.FORESTER_PREGLOBAL, CAR.LEGACY_PREGLOBAL] and cp.vl["Dash_State"]["Units"] in [1, 2, 7]:
if (self.car_fingerprint in PREGLOBAL_CARS and cp.vl["Dash_State2"]["UNITS"] == 1) or \
(self.car_fingerprint not in PREGLOBAL_CARS and cp.vl["Dashlights"]["UNITS"] == 1):
ret.cruiseState.speed *= CV.MPH_TO_KPH
ret.seatbeltUnlatched = cp.vl["Dashlights"]["SEATBELT_FL"] == 1
@ -100,7 +97,6 @@ class CarState(CarStateBase):
("DOOR_OPEN_FL", "BodyInfo", 1),
("DOOR_OPEN_RR", "BodyInfo", 1),
("DOOR_OPEN_RL", "BodyInfo", 1),
("Units", "Dash_State", 1),
("Gear", "Transmission", 0),
]
@ -112,7 +108,6 @@ class CarState(CarStateBase):
("Wheel_Speeds", 50),
("Transmission", 100),
("Steering_Torque", 50),
("Dash_State", 1),
("BodyInfo", 1),
]
@ -130,6 +125,7 @@ class CarState(CarStateBase):
if CP.carFingerprint not in PREGLOBAL_CARS:
signals += [
("Steer_Warning", "Steering_Torque", 0),
("UNITS", "Dashlights", 0),
]
checks += [
@ -137,6 +133,14 @@ class CarState(CarStateBase):
("BodyInfo", 10),
("CruiseControl", 20),
]
else:
signals += [
("UNITS", "Dash_State2", 0),
]
checks += [
("Dash_State2", 1),
]
if CP.carFingerprint == CAR.FORESTER_PREGLOBAL:
checks += [

@ -1 +1 @@
9f181202bbd6c64330bf4903ec265a179201057c
858ebd51d52e76edf61190014337df299a7e6374
Loading…
Cancel
Save