PID Implementation in C++
From Self-Driving Car Engineer Nanodegree Program
The goal of this project to implement PID controller in C++. The parameters of PID were tuned to achieve the fastest speed in the simulator track as shown above.
Two PID controllers were used, one to control the steering of the car and other one to control the throttle of the car
Background:
For Parameter Tuning, I implemented the twiddle algorithm. Since the twiddle algorithm recursively finds the parameters, it takes a long time to converge especially when each iteration takes up to 30 seconds of driving partially around the track.
Instead I switched to manually tuning. First, I tuned for the steering controller. P and D parameters were trained first. After figuring out the broad range of the values they were narrowed down to maximize the smoothness of the drive. Then the value of I controller was included and tuned.
Afterwards I tuned the parameters for the speed controller using a similar approach.
./install-mac.sh
or ./install-ubuntu.sh
.e94b6e1
, i.e.Some function signatures have changed in v0.14.x. See this PR for more details.
git clone https://github.com/uWebSockets/uWebSockets
cd uWebSockets
git checkout e94b6e1
mkdir build && cd build
cmake .. && make
./pid
.