So I am programming functions to move our team’s robot in autonomous, and basically I want to move the robot a certain amount of rotations forward but wait for the motors to finish spinning before starting the next task. I think VCS and VexCode there’s something like startRotateTo vs rotateTo but I can’t find that in PROS.
Currently I do not have a robot to download to and test this, and my main point of concern is the while loop. So .get_position says that it gets absolute encoder units, but what if I want to rotate past 360 degrees? Would the while loop just never be satisfied because if the motor passes 360 degrees, it would start over from 1?
Any tips would be greatly appreciated! I am planning to use the new IMU when our team gets it, so that might help get around this issue.
This function simply sets the target for the motor, it does not block program execution until the movement finishes. The example code shows how to block until a movement is finished.
Oh… Ok I will try that. Also, when the .get_position says it’s the absolute encoder value, does that mean like absolute as in it will just keep on counting upwards, or does it mean from 0-360 and it’ll start over from 0 after 1 rotation?
Notice that “position” is of type “double” so it can be very large. The count in encoder units is not limited to 1 rotation. So if 360 encoder counts is 1 rotation then 720 is 2 rotations, etc.