openpilot icon indicating copy to clipboard operation
openpilot copied to clipboard

Toyota: Prolonged low speed lateral oscillation

Open ntegan1 opened this issue 3 years ago • 4 comments

Describe the bug

This is an instance of steering oscillation commonly experienced when driving tssp corolla at low speeds (20->35mph).

https://user-images.githubusercontent.com/3820605/186998526-4404dbbe-1ecd-45ef-bbab-e99b05373967.mp4

(segment 9) image

segments 10 and 11 also display oscillating torque output/steering angle.

Which car does this affect?

Toyota Corolla 2017

Provide a route where the issue occurs

a152dad3c3368320|2022-08-26--15-36-30--9

openpilot version

38eb19bf04a5b6498cc38377796134205f0ee725

Additional info

latcontrol torque error equations

setpoint = desired_curvature * vego^2 + desired_curvature * low_speed_factor
setpoint = desired_curvature * (vego^2 + low_speed_factor)
measurement = actual_curvature * (vego^2 + low_speed_factor)

==>

error = (desired_curvature - actual_curvature) * (vego^2 + low_speed_factor)

error is difference in curvature multiplied by vego^2 + low_speed_factor

graph of vego^2 + low_speed_factor

https://www.wolframalpha.com/input?i=y+%3D+piecewise%5B%7B%7B500%2C+x+%3C+10%7D%2C+%7B800+-+30x%2C+x+%3C+20%7D%2C+%7B200%2C+x+%3E+20%7D%7D%5D+%2B+x%5E2

y = piecewise[{{500, x < 10}, {800 - 30x, x < 20}, {200, x > 20}}] + x^2

ntegan1 avatar Aug 26 '22 22:08 ntegan1

Loving the use of the clipping feature!

sshane avatar Aug 26 '22 23:08 sshane

discord user sunny68 seems to be experiencing something similar (HKG i think) https://1drv.ms/v/s!AunEjGlrWjRakCQ8T0fshxa3KtSn

#tuning https://discord.com/channels/469524606043160576/574796986822295569/1014285718073380926

ntegan1 avatar Aug 31 '22 17:08 ntegan1

friction / 3.

some drives on a152dad3c3368320|2022-09-01 with ~1/3 friction code here seem to have less oscillation. feels smoother but doesn't want to turn as hard into sharper low speed curves as it needs to, so car ends up floating toward the double yellow lines/other lane and goes over occasionally (controller accuracy issue?).

-TOYOTA COROLLA 2017: [3.117154369115421, 1.8438132575043773, 0.12289685869250652]
+TOYOTA COROLLA 2017: [3.117154369115421, 1.8438132575043773, 0.04289685869250652]

Discord user suggests

In my 2010 Corolla, which has a similar steering setup to the 2017. I use MAX_LAT=3.6 FRICTION=0.032 and steer_actuator_delay=0.3875

will try out soon

edit: a152dad3c3368320|2022-09-02--11-53-20 code here

these values are too extreme

less drastic tuning changes

many good routes after that one with friction .052 and steerActuatorDelay 0.24

e.g. a152dad3c3368320|2022-09-02--13-05-45 code here ==>

~ 1/2 friction reduces oscillation

ntegan1 avatar Sep 02 '22 12:09 ntegan1

Is this still an issue?

adeebshihadeh avatar Nov 16 '22 05:11 adeebshihadeh

@ntegan1 any updates?

sshane avatar Nov 29 '22 09:11 sshane

Is this still an issue?

Missed this. Much better!

Torque control is so good

ntegan1 avatar Nov 29 '22 18:11 ntegan1