mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-09-23 16:03:54 +08:00
Toyota: match dash set speed (#25649)
* toyota: match set speed from dash
* Use unit bit
* Use RSA2
* flip this
* Universal unit signal, set vEgoCluster
* remove this and bump opendbc
* detect if car interface sets cluster fields
* revert
* needs to be cp
* UI_SPEED is actually always in kph?
* forgot to actually convert it
* same in onroad
* try conv factor only for imperial
* Seems like UI_SPEED is not the UI speed at all
* the dash might floor it
* same openpilot behavior
* bump
* ego speed factor is dynamic across speeds, handle Lexus exceptions with
diff msg
* remove test, bump opendbc
* secret formula
* secret formula v2
* 1.03 is sufficient
* try short press
* bump opendbc
* surely this can be cleaned up
surely this can be cleaned up
* use filter
* redo factors
* try UI_SPEED again with a factor
try UI_SPEED again with a factor
* dash applies hysteresis to speed. this matches pretty well, but not exactly
* match only set speed
* clean up
* clean up
clean up
* Update ref_commit
* update refs
Co-authored-by: Willem Melching <willem.melching@gmail.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 80533d6c03
This commit is contained in:
+1
-1
Submodule opendbc updated: 8c634615c5...83d4cb9fd8
@@ -90,9 +90,17 @@ class CarState(CarStateBase):
|
||||
if self.CP.carFingerprint in (CAR.LEXUS_IS, CAR.LEXUS_RC):
|
||||
ret.cruiseState.available = cp.vl["DSU_CRUISE"]["MAIN_ON"] != 0
|
||||
ret.cruiseState.speed = cp.vl["DSU_CRUISE"]["SET_SPEED"] * CV.KPH_TO_MS
|
||||
cluster_set_speed = cp.vl["PCM_CRUISE_ALT"]["UI_SET_SPEED"]
|
||||
else:
|
||||
ret.cruiseState.available = cp.vl["PCM_CRUISE_2"]["MAIN_ON"] != 0
|
||||
ret.cruiseState.speed = cp.vl["PCM_CRUISE_2"]["SET_SPEED"] * CV.KPH_TO_MS
|
||||
cluster_set_speed = cp.vl["PCM_CRUISE_SM"]["UI_SET_SPEED"]
|
||||
|
||||
# UI_SET_SPEED is always non-zero when main is on, hide until first enable
|
||||
if ret.cruiseState.speed != 0:
|
||||
is_metric = cp.vl["BODY_CONTROL_STATE_2"]["UNITS"] in (1, 2)
|
||||
conversion_factor = CV.KPH_TO_MS if is_metric else CV.MPH_TO_MS
|
||||
ret.cruiseState.speedCluster = cluster_set_speed * conversion_factor
|
||||
|
||||
cp_acc = cp_cam if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) else cp
|
||||
|
||||
@@ -147,6 +155,7 @@ class CarState(CarStateBase):
|
||||
("DOOR_OPEN_RR", "BODY_CONTROL_STATE"),
|
||||
("SEATBELT_DRIVER_UNLATCHED", "BODY_CONTROL_STATE"),
|
||||
("PARKING_BRAKE", "BODY_CONTROL_STATE"),
|
||||
("UNITS", "BODY_CONTROL_STATE_2"),
|
||||
("TC_DISABLED", "ESP_CONTROL"),
|
||||
("BRAKE_HOLD_ACTIVE", "ESP_CONTROL"),
|
||||
("STEER_FRACTION", "STEER_ANGLE_SENSOR"),
|
||||
@@ -154,6 +163,7 @@ class CarState(CarStateBase):
|
||||
("CRUISE_ACTIVE", "PCM_CRUISE"),
|
||||
("CRUISE_STATE", "PCM_CRUISE"),
|
||||
("GAS_RELEASED", "PCM_CRUISE"),
|
||||
("UI_SET_SPEED", "PCM_CRUISE_SM"),
|
||||
("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR"),
|
||||
("STEER_TORQUE_EPS", "STEER_TORQUE_SENSOR"),
|
||||
("STEER_ANGLE", "STEER_TORQUE_SENSOR"),
|
||||
@@ -168,12 +178,14 @@ class CarState(CarStateBase):
|
||||
("LIGHT_STALK", 1),
|
||||
("BLINKERS_STATE", 0.15),
|
||||
("BODY_CONTROL_STATE", 3),
|
||||
("BODY_CONTROL_STATE_2", 2),
|
||||
("ESP_CONTROL", 3),
|
||||
("EPS_STATUS", 25),
|
||||
("BRAKE_MODULE", 40),
|
||||
("WHEEL_SPEEDS", 80),
|
||||
("STEER_ANGLE_SENSOR", 80),
|
||||
("PCM_CRUISE", 33),
|
||||
("PCM_CRUISE_SM", 1),
|
||||
("STEER_TORQUE_SENSOR", 50),
|
||||
]
|
||||
|
||||
@@ -187,7 +199,9 @@ class CarState(CarStateBase):
|
||||
if CP.carFingerprint in (CAR.LEXUS_IS, CAR.LEXUS_RC):
|
||||
signals.append(("MAIN_ON", "DSU_CRUISE"))
|
||||
signals.append(("SET_SPEED", "DSU_CRUISE"))
|
||||
signals.append(("UI_SET_SPEED", "PCM_CRUISE_ALT"))
|
||||
checks.append(("DSU_CRUISE", 5))
|
||||
checks.append(("PCM_CRUISE_ALT", 1))
|
||||
else:
|
||||
signals.append(("MAIN_ON", "PCM_CRUISE_2"))
|
||||
signals.append(("SET_SPEED", "PCM_CRUISE_2"))
|
||||
|
||||
@@ -1 +1 @@
|
||||
e1c189b002a179763fa34f24e5d96f2b2d0c4c49
|
||||
915309019fef256512ee30cf92cfae2e479dd04e
|
||||
Reference in New Issue
Block a user