VCS V5 Encoder Autonomous


#1

Hello,
I wanted to use the built in V5 encoder values for skills and competition autonomous. I was wondering what the best way to do this is, because I am currently using speed and time for autonomous and it is very inaccurate and inconsistent. So if anyone else is using Vex Coding Studio and the built in encoders for autonomous, could you give me some info along with possibly some sample code? Thanks.


#2

VEX wrote some ‘Example Programs’, the following are about how to make your robot drive forward, backward, and turn right/left. They describe how to use specific rotations instead of ‘time’.

You’ll want to figure out how to use startRotateFor and rotateFor, which allow you to tell the robot to go a specific number of wheel rotations. This will be more accurate than using time.

Example Programs

https://help.vex.com/article/68-vcs-example-program-vex-c-v5-clawbot-driving-forward-and-backward
https://help.vex.com/article/75-vcs-example-program-vex-c-v5-clawbot-turning-left-and-right

VCS Command Reference:

https://help.vexcodingstudio.com/#cpp/namespacevex/classvex_1_1motor/rotateFor
https://help.vexcodingstudio.com/#cpp/namespacevex/classvex_1_1motor/startRotateFor

It will help you if you learn the difference between blocking and non-blocking functions:

https://help.vex.com/article/120-how-to-use-blocking-vs-non-blocking-code