commaai / openpilot

openpilot is an operating system for robotics. Currently, it upgrades the driver assistance system in 275+ supported cars.
https://comma.ai/openpilot
MIT License
49.02k stars 8.94k forks source link

Toyota RAV4 TSS2: enable torque control #30056

Open sshane opened 10 months ago

sshane commented 10 months ago

For TSS2 RAV4, we check the EPS FW version to use two different versions. However, from the online lat accel factors learned, it appears that the check doesn't totally make sense. We check if the FW version has a length code of b'\x02' (0R platform code) or a whitelisted version (platform code 42), however b'8965B42181\x00\x00\x00\x00\x00\x00' doesn't match all the 0R lat accels. The lat accels within the 0R platform code also seem to be split on the EPS sub version (and also within the same version):

Note that this may be noisy since torqued doesn't publish filtered lat accels if not using torque control

42 platform code, 181 sub version A 0R platform code version
image image

However, when plotting by the fwdCamera FW version, the split is not as bimodal as seen above with the EPS FW versions:

42 platform code, 181 sub version A 0R platform code version
image image

https://github.com/commaai/openpilot/blob/425fa316d15e45595ecdd7d394ee28d7fb84e214/selfdrive/car/toyota/interface.py#L131-L138

It seems like we can set a median lat accel and friction and let torqued handle the rest.


Noticed while checking the lateral tuning difference for the Toyota fuzzy FP PR (https://github.com/commaai/openpilot/pull/28641)

sshane commented 10 months ago

Here is the 2022 RAV4s (hybrid and ICE) with just one fwdCamera version (we still check the outdated FW version for them):

image