commaai / panda

code powering the comma.ai panda
MIT License
1.5k stars 744 forks source link

Toyota LTA: fix the way the torque `sample_t`'s are used #1948

Open sshane opened 2 months ago

sshane commented 2 months ago

The problem is how the safety was using the torque samples to enforce the torque winddown. To avoid erroneous blocked messages from panda getting a steer torque message before openpilot, we used the minimum of the last few values which provides tolerance. But this doesn't work if the torque oscillates heavily above the threshold, like when going over a pot hole.

After the oscillation, openpilot tries to enable torque correctly, but panda still thinks that torque is high since it isn't using the latest value, only the min.

image

8494c69d3c710e81/00000019--7c84cbf43c/11