## ← 05-21 Pd Controller

• 1 Follower
• 31 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=kVYy2kjZjhA" data-team="udacity"></div> ``` 3 Languages

Showing Revision 1 created 06/29/2012 by Amara Bot.

1. The basic next question is is there a way to void the overshoot?
2. It would be nice if we could do this, because driving in an oscillating car is no fun.
3. In fact, it makes you really seasick, believe me.
4. I've been in this car for months on end when we prepared for the Darpa Grand Challenge.
5. The trick is called "PD-control."
6. In PD-control my steering alpha is no just related to the crosstrack error by virtue
7. by virtue of the gain parameter tau p,
8. but also to the temporal derivative of the crosstrack error.
9. What this means is that when the car has turned enough to reduce the crosstrack error,
10. it won't just go shooting for the x axis,
11. but it will notice that it's already reducing the error.
12. The error is becoming smaller over time. It counter steers. It steers up again.
13. This will allow it to gracefully approach our target trajectory,
14. assuming appropriate settings of our differential gain--tau d versus the proportional gain tau p.
15. How do you compute this derivative over here?
16. Well, at time t this is the same as the crosstrack error at time t minus the crosstrack error
17. at time t minus 1 divided by the time span between t and t minus 1.
18. In our code, we assume delta t equals 1, so so we can omit this.
19. The difference of the current crosscheck error and the previous one is this term over here.
20. We now control not just in proportion to the error itself but also to this difference
21. of the error using a second constant tau d.
22. Let's implement this. Now I give the run command two parameters--param1 and param2.
23. I want you to implement a controller that varies the steering direction proportionally
24. according to parameter 1, and differentially proportionally to parameter 2.
25. Again, run for 100 time steps and see what happens.
26. When I run my new controller with proportionality parameter of 0.2
27. and the differentiation one is 3.0.
28. Then, I get a sequence of y values that converge much more gently to 0.
29. Miraculously, as time goes on, they really go down to 0 and stay at 0,
30. which we didn't achieve for the proportional controller.
31. Please write that routine so we can test it.