Result
CarND-Controls-PID
Self-Driving Car Engineer Nanodegree Program
Reflection
Effect of the P, I, D Components.
-
Proportional (P): Makes the car steer towards the CTE. It is achieved by multiplying the CTE by P values. It will never reach the CTE but will oscillate around it, resulting in an unsecure behaviour. If the value is too high, we would observe the car swerve around. That's the reason to use I and D temrs.
-
Integral (I): Briefly, compensates the systematic bias which prevents the P-D controller from reaching the center line. This is achieved acumulating the value of the surface between the car position and the CTE over time, and multipying this value by the I coefficient.
-
Differential (D): This part of the controller corrects for the error from the previous state. This way the Proportional controller can have a lower value and the remaining correction is done by the Derivative controller. This leads to smoother steering.
Final hyperparameters.
For Parameter Tuning, I used the twiddle algorithm. Since the twiddle algorithm recursively finds the parameters, it takes a long time to converge. Instead I switched to manually tuning for getting a closer result to make the process faster.
After figuring out the broad range of the values they were narrowed down to maximize the smoothness of the drive. Afterwards I tuned the parameters for the speed controller using a similar approach.
Final Steer | Final Throttle | |
---|---|---|
P | 0.06 | 0.5 |
I | 0.00174 | 0.002 |
D | 1.8 | 10 |
Result of Each Compenent
P | PD | PID |
Dependencies
- cmake >= 3.5
- All OSes: click here for installation instructions
- make >= 4.1(mac, linux), 3.81(Windows)
- Linux: make is installed by default on most Linux distros
- Mac: install Xcode command line tools to get make
- Windows: Click here for installation instructions
- gcc/g++ >= 5.4
- Linux: gcc / g++ is installed by default on most Linux distros
- Mac: same deal as make - [install Xcode command line tools]((https://developer.apple.com/xcode/features/)
- Windows: recommend using MinGW
- uWebSockets
- Run either
./install-mac.sh
or./install-ubuntu.sh
. - If you install from source, checkout to commit
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
- Run either
- Simulator. You can download these from the project intro page in the classroom.
Fellow students have put together a guide to Windows set-up for the project here if the environment you have set up for the Sensor Fusion projects does not work for this project. There's also an experimental patch for windows in this PR.
Basic Build Instructions
- Clone this repo.
- Make a build directory:
mkdir build && cd build
- Compile:
cmake .. && make
- Run it:
./pid
.
Tips for setting up your environment can be found here
Code Style
Please (do your best to) stick to Google's C++ style guide.