## ← PID Implementation - Artificial Intelligence for Robotics

• 2 Followers
• 23 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=Ag8H3Iit9j4" data-team="udacity"></div> ``` 5 Languages

Showing Revision 2 created 05/24/2016 by Udacity Robot.

1. What's the intuition?
2. If you drive a car and your normal steering mode leads you to a trajectory far away from the goal,
3. then what I submit you do is you notice over a long period of time you can't get closer.
4. So you start steering more and more the more time goes by to the right to compensate this bias.
5. As a result, when you drive you steer the car this way.
6. To do so, you need a sustained situation of large error.
7. That's measured by the integral or the sum of the crosstrack errors over time.
8. Let's make a new controller where steering is proportional to the crosstrack errors before.
9. It's equally proportional to the differential of the crosstrack error,
10. but now it's also proportional to what's called the integral or the sum
11. of all the crosstrack errors you ever observed.
12. This term is interesting. If we have a constant crosstrack error of, say, 0.8
13. and the sum will increase by 0.8 for each time unit, it'll become larger and larger and larger,
14. and eventually it'll correct the robot's motion.
15. This is called the PID controller.
16. This is the P or the proportional term, the D or the differential term, and the i for integral.
17. P-I-D.
18. Let's implement this, and the integrated crosstrack error
19. is the sum of all crosstrack errors you ever observed.
20. Let's implement this in our code.
21. I give you an integral factor of 0.004.
22. Let's not worry why I picked those. They're actually wisely chosen, as you will see in a minute.
23. But let's run our code and now modify our code to also allow for this parameter over here.