This is the first term I played with. In short, the P factor determines how sharp the vehicle turns. A higher value makes the vehicle turn faster.
Below is a video of a scenario where the P factor is too high.
You can see the vehicle's turn rate is excessive.
The Integral factor dampens the steering angle based on the cumulative error (cte). This includes the sum of positive and negative values, which means that pendulum-esque movements of the vehicle (as views from above) decreases this adjustment.
Below is a video of a scenario where the I factor is too high.
The differential controller aims to smooth out the steering angle based on the change in cte. As the vehicle gets closer the the ground truth (the cte value decreases), the steering angle will become less acute.
Having a large D value will make the vehicle become too excited to get back on track, which will make it overshoot the ground truth mark.
This was done manually, my C++ expertise was not on the level to dynamically tune the parameters on the fly. The steps can also be found in the main.cpp script, but here was what I experienced:
- I started with PID = [2.9, 10.3, 0.5], which was taken as is from the lessons. It was way too extreme, the vehichle took super sharp turns and couldn't 'stick' to the groud truth.
- After that I decreased the P factor to 0.3: [0.3, 10.3, 0.5]. This did not have the desired change. The vehicle still turned too sharply.
- Next step was to decrease the I value so that the vehicle is less sensitive the the cumulative errors. [0.3, 1.0, 0.5]
- This kept the vehicle on the road at least, but the sporadic left/ right turning was not desired [0.3, 0.1, 0.5]
- Decreasing I even more: [0.3, .001, 0.5]
- Did not have the desired effect, need to decreasse D [0.3, .001, 0.05]
- Close, but still too jerky: [0.03, .0005, 0.015]
- This works