Skip to content

This is a PID controller steering an autonomous vehicle across a racetrack.

Notifications You must be signed in to change notification settings

Peterschuellermann/PID-Controller

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PID Controller

This is a PID controller steering an autonomous vehicle across a racetrack. You can see it in action here.

Effects of each of the PID parameters

A PID controller is a simple way to control the steering of a vehicle across a predefined trajectory. It uses three parameters to calculate the required steering angle:

  • P, the proportional part of the equation. This component increases the steering more the further away the vehicle is from the trajectory, i.e. the higher its cross track error (CTE) is.
  • I, the integral part of the equation. The integral is used to move the vehicle closer to the trajectory when both P and D combined let the car steer across a tangential path. It also influences how fast the car can approach its target trajectory.
  • D is the derivative part of the equation. Its calculated by the difference of the current CTE and the previous CTE. The derivative component is used to keep a vehicle that has found the trajectory close to it by reducing the rate of change in the CTE.

The final hyper parameters

For my final results i used:

  • P: -0.2
  • I: -0.01
  • D: -30.0

I arrived at these values by starting at some values that successfully allowed the vehicle to complete a full round in the simulator (-0.25, 0.0 and -0.75) and then slowly altered them to make the round smoother and more reliable. Using the final parameters, the car can complete the course on full throttle. Driving on full throttle is unfortunately only possible on a strong computer, as I learned when recording the video, which required me to reduce the throttle to 50%. Aforementioned is due to lag caused by the recording and the program not being able to calculate the steering angle as often, which causes the vehicle to steer wildly across the course.

Dependencies

There's an experimental patch for windows in this PR

Basic Build Instructions

  1. Clone this repo.
  2. Make a build directory: mkdir build && cd build
  3. Compile: cmake .. && make
  4. Run it: ./pid.

Tips for setting up your environment can be found here

Editor Settings

We've purposefully kept editor configuration files out of this repo in order to keep it as simple and environment agnostic as possible. However, we recommend using the following settings:

  • indent using spaces
  • set tab width to 2 spaces (keeps the matrices in source code aligned)

Code Style

This project uses Google's C.

About

This is a PID controller steering an autonomous vehicle across a racetrack.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages