phoenixgarage.org

 Robotics: Udacity CS373 - Programming A Robotic Car - Week 5/Unit 5
Posted on 2012-05-20 @ 16:33:31 by r00t - Read the parent: Udacity CS373 - Programming A Robotic Car - Week 4/Unit 4

Another unit down, and one final unit to go! This week's unit was surprisingly easy, compared to others (especially last week's). It's focus was on more motion planning, with an emphasis on generating smooth paths, and control using a PID algorithm. For the final homework, we had to make a virtual "car" drive itself around an oval racetrack. While I was doing this, my car managed to kill several spectators before I finally got it under control!

In this unit, we basically learned how to take a path, as generated by a planner that used discrete methods, and run it through a "smoother" that utilized gradient descent to "round out" corners, and generate a more natural path that a real car could take. Basically, it looks like this:


Path Smoothing Visualization
Questions or Comments?

Once we have such a "smoothed" path, we can then use a method called a PID controller (which stands for Proportional-Integral-Derivative), to allow us to "steer" the car along the path, and keep it on the path within a very small margin of error. We learned how to implement one of these controllers, and how each of the terms involved (the proportional, the integral, and the derivative) affects the output of the controller. Changing one or more of these terms could result in either a stable path following, or cause the "robot" to completely veer off course:


PID Parameter Optimization
Questions or Comments?

(the above image courtesy of code by Daniel Neville !!! spoiler alert !!!)

The greatest problem, though, in "tuning" such a controller (and one which there is a ton of literature out there on how to do), is coming up with those parameters. In this unit, we learned about a method which Professor Thrun termed "Twiddle", which we implemented. This method depends on the function (whose parameters we are trying to come up with) to output an error value. Using this error value, Twiddle is able to tweak each parameter until all of the parameters are "just right", so that the function will return the absolute lowest error score. This isn't a perfect solution (it is subject to getting stuck in local minima, among other possible problems), but it is very simple to implement.

After learning about PID control, we jumped into the homework, and things for me went fairly well, until I got to the last problem. In this problem, we had to simulate a car racing around an oval track of a given dimension, using PID control. I ended up spending a couple of hours thinking about it; most of my car paths in the beginning looked like this:


CS373 Drunken Sailor
Questions or Comments?

All over the infield and in the stands, too! After some careful thought (as well as outputting not just the orientation of the car, but the steering angle and the error value as well), I finally got my car back on course:


CS373 Watch Her Go!
Questions or Comments?

Much better! Though I felt that, by this point, my car probably looked like the winner of a demolition derby, limping across the finish line with wobbly wheels and belching smoke out the rear...

Next week, we bring it all together in Unit 6, essentially implementing SLAM (Simultaneous Localization and Mapping); this is the basis for any robot that needs to be able to navigate an unfamiliar environment, whether that is a home, an office, or the street.

Share This Article

    

Questions or Comments?

If you have any questions or comments about this article, please contact me...

Referencing Articles:
0 comment(s) posted
Post New Thread