The Openpilot Community needs your help to continue to keep opc.ai's lights on and support the path to Workbench v0.2. With only a one person crew and without commercial funding it's not always financially feasible to fund these services out of pocket. Please consider becoming a Patreon supporter of the Openpilot Community project and receive exclusive perks and benefits!
Become a patreon Learn more Maybe Later
DISCLAIMER: This website is maintained by openpilot users and contributors. The content found here (including Workbench and Oppey the Bot) are not approved, supported, affiliated or funded by Comma.ai, Inc. Please DO NOT contact Comma.ai, Inc. staff about these things as they WILL NOT provide support. For support on openpilot, opc.ai, oppey, workbench, etc. please contact a community member on Discord.
The Definitive Tuning Guide (WIP)
The first time you drive with OpenPilot is awesome. The car seemingly takes a new life of its own, intelligent and agile, reading the lane lines and keeping you centered in the lane. You might think to yourself, "This is the future and I'm at the forefront of it!"
However, about a week later once you've gotten to thinking about the way it drives, you might notice that the steering wheel twitches and jerks to stay centered, causing the car to jostle you slightly while you head down a straight path. As one of the first people of a small group of drivers porting the Toyota Highlander, it became obvious that it wasn't just a bigger RAV4.
Although fairly smooth at highway speeds, my Highlander was twitchy at 30mph speeds. It would saw the wheel back and forth between -5 degrees and +5 degrees on a straight road. So I set off into the code to find out how it works. Because it is a closed-loop PI controller, parameters can be tuned to optimize it.
So the problem I was having was big changes from a LH adjustment to a RH adjustment. It's not that the car was bouncing off the left hand and right hand lines, it was just too aggressive in turning the wheel for each adjustment. I was using the engineering UI that shows the actual steering angle versus the desired steering angle. I was noticing that the desired angle was changing smoothly but the actual angle seemed to change with a delay.
In robotics, time delays (also referred to as latencies) are tough to get rid of. Things like the speed of sensors, analog to digital processors, mechanical linkages, the software routine architecture, the communications protocols used, and even the thicknesses of greases used in mechanical components all add up to cause a time delay between an input to a robotic system and an actual output. So in my case, the steering angle might be - 2 degrees while the desired angle is +2 degrees. In the case of my Highlander, it was ending up measuring around 200ms.
[how to measure in cabana]
So I set out to adjust parameters. Others have done some tuning but it was largely trial and error. And although some of this could be tuned automatically in software, it's not on the list of comma's priorities at this time. It's also very hard for an automated tuning model to work with different car makes and models. Even the same model year car with different actuators could behave very differently and require significantly different tunes.
The first thing I noticed is that the parameters I was using carried over from the Toyota RAV4. In PI controllers, the P stands for proportional.
ret.steerActuatorDelay = 0.seemed to change with