Quote:
Originally Posted by dShad
B)Encoder/Autonomous - I was also asked to try to make an autonomous program that goes forward for 4inches and kicks then goes forward 40inches and kick. For one is this possible? If so how would go about getting the encoder data and then setting it to run 4inches > kick > move 40 inches forward > kick > finish.
|
If you are using a relative encoder like the optical one from the KoP, and you are using autonomous independent:
- read and store the encoder count
- set motors to move forward at the desired speed
- poll the encoder count in a loop until it indicates a value that corresponds to a change of position of 4 inches
- kick the ball
- poll the encoder count in a loop until it indicates a value that corresponds to a change of position (from the original saved value) of 44 inches
- kick the ball
- stop the motors
~