My team doesn’t have many of the sensors some of the more advanced teams do. We have the basic Bumper and Limit switch, and line followers, things like that. But what I wanted to know:
“Is there any way to get the motors to spin a certain number of revolutions?”
Because I want to program my robot to move a certain distance, turn, and move a little farther to get to a goal post. So we would prefer not to have to measure how far the bot goes in a certain time to figure out where it would end up on the field.
Being able to set a certain number of revolutions would allow us to be specific on where it ends up.
Does anyone know if it is possible to program this?
My suggestion was :
If you have a limit switch, it is possible to make an encoder. It won’t be extremely precise, but it will get the job done. Take a gear, and screw small standoffs around the circumference at even intervals. Then put this gear on the shaft that drives your motor. Position a limit switch so that it clicks every time a standoff is pushed into it, and then is released when that standoff has passed. Of course, it’s easier to buy encoders or ultrasonics, but this will work if you’re desperate. Ask me if I haven’t been clear or you need the code.
There are examples of code for optical encoders in both EasyC and RobotC, look there first. There are also lots of other posts you can find by searching on term “encoder” in the forum search.
Vex encoders have ~90 tick per revolution. If you mount it directly on the wheel shaft of a 4" wheel, you’ll get about 7 ticks per 1 inch of travel.
If you already have chain drive to the front wheels, you can often add a smaller idler sprocket on the encoder shaft. Using a smaller sprocket on the encoder shaft will give higher effective resolution, and vv.
Re your point, an easier homebrew encoder with just one standoff per revolution of 4" wheel provides 1 tick per ~12 inch of travel, which is hardly enough to be useful. It might work if you prep your robot by rotating the wheels so the encoder is pressed, set the robot at the final position, and then roll the robot backwards to your starting position: Now the tick will be at the final location, (more or less.)