
Re: anything about programing a robot
Hi tindra,
Your first method will work to certain degree, but will probably have pretty low accuracy because your vehicle's velocity is not going to be perfectly maintained.
Your second method is the standard approach. Usually people use sensors called rotary encoders to measure wheel rotations. These sensors produce a defined number of electrical pulses per revolution, and so you can count the number of pulses (either using a programmable microcontroller or you could build your own simple counter circuit) to determine how far the vehicle has gone. If you don't need much resolution, you can build your own cheap encoder by attaching an
encoder wheel pattern to your wheel, then using an
optical reflectance sensor to detect the transitions from black to white to black as the wheel goes around.
Here's a page on using ROBOTC with an Arduino and encoders to do measured movement.
If you don't have to travel very far (maybe 100 meters or less), another - very low-tech - option would be to attach one end of string to a spool on your wheel axle, and the other end to the lever of a knife switch. As your vehicle travels, it will wind up the string; when it has wound up all the string, it will pull the knife switch, disconnecting the electricity from your motor.
Cheers,
--Ryan