Making autonomous run off of rotations rather than time

We have been working on an autonomous, and it works decently; however, we are experiencing reliability issues. While running the same code, it will hit the angle perfectly and drive towards the corner, but other times it will over/undershoot the mark and miss.

I believe this is due to the fact that our autonomous actions run for a specific amount of time (vex::task::sleep(1000); , for example) rather than a certain number of rotations.

I would like to convert these commands from time to rotations, but I have not found any resources detailing how to do this.

I was hoping if I could have help with this.

Thank you.

motor.spinFor(distance,units); is a common one but if you want to play with the rotations itself you can get the return from the motor with motor.position(units);

1 Like

I posted an example on how I use it on a different thread

This thread has other information you might find useful as well.

1 Like