I'm reviewing some ideas for a series of 8 one hour sessions in Robot C for NXT at a high school computer programming camp. My 9 year old wanted in on the fun and this video is the result. :)
The line following algorithm is based on the excellent discussion here:
http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html
The maze solution is an evolutionary step in the motion planning lessons I am planning. First is timed motions, then motor coordinated motions, measured motions (loop until destination reached), simple overshoot correction, and finally using PID encoder targets.
How do you get the robot to go so smoothly on the line. the one i programmed went back and forth scanning while going on the line.
.?
godsrunner1 8 months ago
@godsrunner1 Hi! There's a link in the video description. The secret is to use some extra programming to create a PID controller. The basic idea is to control how much you turn based on how bright the light the sensor sees is.
Most basic line follower programs turn one way on "dark" and the other on "light". A PID controller knows "dark" and "light", and calculates different turn strengths for the shades of gray in between. That's the "P" part. The "I" and "D" parts help fine tune the result.
emajekral 8 months ago
@emajekral
I used RobotC to write the program. I know C pretty well so it didn't take long. The hard part for me was getting the right values for the "P", "I", and "D" controls in the program. This is called "tuning". There are some tuning suggestions in the link in the video description.
Good luck!
emajekral 8 months ago