My partner and I met outside of class to fix up and figure out our line follower. Since we now understood that we needed to create a sweeping motion, it did not take too long to get our code written and our robot tracking!
|
Our Final Program |
We chose to write this code so that our robot would follow just one edge of the line of tape. This meant that our robot changed direction as soon as its light sensor detected the near edge of the line of tape, as opposed to waiting to sense the floor again on the other side of the tape before switching directions. We created the sweeping motion by constantly alternating the powering and braking of the two motors. As the picture of our program shows, each swap was spurred by the change in brightness brought on by switching from the tape to the floor, which we determined occurred between brightnesses of 33 and 34. We also lowered the power of each motor to 25%. These lower powers gave the LED sensor more time to read and process light values--when the power was too high, the light values didn't process in time, and our line follower often missed parts of the line. Since our left wheel powered up first while the right wheel braked, one definite constraint of our line follower was that it needed to be placed on the left side of the line in order to track successfully. As long as we started our line follower on the left side of the line, however, it did a great job of following the line--even successfully navigating relatively sharp angles!
Our successful line follower! Slightly slow, but definitely steady!
No comments:
Post a Comment