Vex Pros Autonomaus, Motors won't Run

I am new to pros, and I recently created a very simple autonomous using the claw bot tutorial. However whenever I click timed run on the controller, none of the motors move. I am curious as to why this is happening?

void autonomous(){

pros::Motor left_front_motor(1);
pros::Motor left_back_motor(2);
pros::Motor right_front_motor(3,true);
pros::Motor right_back_motor(4,true);

// This reverses the motor

left_back_motor.move_relative(1000, 100);
right_back_motor.move_relative(1000, 100);

try tare it first. also, why is there a delay(2) block? the function auton is only called once unlike a while loop. a delay is only required in while loops.

I was having this same problem but how would you tare it.

As @Eden pointed out, the autonomous function is only called once. Also:

  • move_relative tells the motor to move by a given amount, but doesn’t wait for that movement to finish
  • when autonomous ends, (I think) all motors are turned off automatically
  • pros::delay uses units of milliseconds

Put these together, and you actually are turning the motors on*, but only for 2 milliseconds, so it’s unsurprising that you don’t see a result.

If you want to give the motors longer to reach the target (say, 2 seconds, which I think is what you were trying to do), then you’ll need to change the delay to pros::delay(2000);. Once you have this working, I’d recommend seeing if you can wait only until the motor gets close enough to the target position, by checking the motor’s position.

Hope this helps!

* Note because I know someone will call me out on it: new instructions are only sent from the V5 brain to the motor every 10 milliseconds, so if you “only turn the motor on for 2 miliseconds”, then it probably didn’t turn on at all.

1 Like