August 31, 2016

Can you explain how to use PID controller to follow that path?

I few months ago I wrote an article about the Hybrid A Star pathfinding algorithm for self-driving cars. It turned out to be a popular article, and someone asked in the comments section: "Can you explain how to use PID controller to follow that path?" And the answer is: yes I can!

PID controller is a technique to minimize an error you have. If you have a self-driving car, this error is the length of the difference between the car's actual position and the position it should have. This error is called Cross Track Error, or just CTE:

The math is simple and you just need a few lines of code to make it work, but the technique is not commonly known among those who haven't taken a course in control technology. I took a course in control technology, but I forgot about the PID controller, only to rediscover it last year when I took a course in self-driving cars.

The PID controller consists of three parts: the P, the I, and the D. I made a video to explain why you need the P and the D, and you only need the I in real-life if there's an error in the technology you have. There aren't many errors in the computer so you will not notice why you need the I in the video:

This was just a tiny introduction, but I've written an entire tutorial on how you can write your own PID controller in Unity (with C#): Minimize an error with a PID controller.

No comments:

Post a Comment