Toyota: fix learning bad offsets for some models (#23810)

* Update carstate.py

* comments

* use initializing

* bump opendbc

* bool

* check both

* bump opendbc

* and on TSS-P the initializing bit isn't set
This commit is contained in:
Shane Smiskol
2022-02-26 00:54:35 -08:00
committed by GitHub
parent 8344f3c087
commit a1875ac6f0
2 changed files with 4 additions and 4 deletions
+1 -1
Submodule opendbc updated: 46a942d679...f475c355a6
+3 -3
View File
@@ -19,7 +19,6 @@ class CarState(CarStateBase):
# On cars with cp.vl["STEER_TORQUE_SENSOR"]["STEER_ANGLE"]
# the signal is zeroed to where the steering angle is at start.
# Need to apply an offset as soon as the steering angle measurements are both received
self.needs_angle_offset = True
self.accurate_steer_angle_seen = False
self.angle_offset = FirstOrderFilter(None, 60.0, DT_CTRL, initialized=False)
@@ -58,8 +57,8 @@ class CarState(CarStateBase):
ret.steeringAngleDeg = cp.vl["STEER_ANGLE_SENSOR"]["STEER_ANGLE"] + cp.vl["STEER_ANGLE_SENSOR"]["STEER_FRACTION"]
torque_sensor_angle_deg = cp.vl["STEER_TORQUE_SENSOR"]["STEER_ANGLE"]
# Some newer models have a more accurate angle measurement in the TORQUE_SENSOR message. Use if non-zero
if abs(torque_sensor_angle_deg) > 1e-3:
# On some cars, the angle measurement is non-zero while initializing
if abs(torque_sensor_angle_deg) > 1e-3 and not bool(cp.vl["STEER_TORQUE_SENSOR"]["STEER_ANGLE_INITIALIZING"]):
self.accurate_steer_angle_seen = True
if self.accurate_steer_angle_seen:
@@ -151,6 +150,7 @@ class CarState(CarStateBase):
("STEER_TORQUE_DRIVER", "STEER_TORQUE_SENSOR"),
("STEER_TORQUE_EPS", "STEER_TORQUE_SENSOR"),
("STEER_ANGLE", "STEER_TORQUE_SENSOR"),
("STEER_ANGLE_INITIALIZING", "STEER_TORQUE_SENSOR"),
("TURN_SIGNALS", "BLINKERS_STATE"),
("LKA_STATE", "EPS_STATUS"),
("AUTO_HIGH_BEAM", "LIGHT_STALK"),