Spinning in Autonomous

I am trying to make my robot spin right while in autonomous, but everytime it gets the that part of the code it just stops. Can someone help me with what is wrong? It is my first time coding autonmous so pretty much any information could be valuable to me. I have already tried looking up similar codes and cannot find anything wrong with mine. I am using the most recent version of VexCode Text on v5 motors.

FrontLeftDriveMotor.setVelocity(30, velocityUnits::pct);
FrontRightDriveMotor.setVelocity(30, velocityUnits::pct);
BackLeftDriveMotor.setVelocity(30, velocityUnits::pct);
BackRightDriveMotor.setVelocity(30, velocityUnits::pct);
ClawMotor1.setVelocity(75, velocityUnits::pct);
ClawMotor2.setVelocity(75, velocityUnits::pct);

FrontLeftDriveMotor.rotateFor(-1, rotationUnits::rev, false);
FrontRightDriveMotor.rotateFor(1, rotationUnits::rev, false);
BackLeftDriveMotor.rotateFor(1, rotationUnits::rev, false);
BackRightDriveMotor.rotateFor(-1, rotationUnits::rev);

FrontLeftDriveMotor.rotateFor(1.5, rotationUnits::rev, false);
FrontRightDriveMotor.rotateFor(1.5, rotationUnits::rev, false);
BackLeftDriveMotor.rotateFor(1.5, rotationUnits::rev, false);
BackRightDriveMotor.rotateFor(1.5, rotationUnits::rev);

ClawMotor1.rotateFor(1000, rotationUnits::deg, false);
ClawMotor2.rotateFor(-1000, rotationUnits::deg, false);

ArmMotorRight.rotateFor(0.2, rotationUnits::rev, false);
ArmMotorLeft.rotateFor(0.2, rotationUnits::rev);

FrontLeftDriveMotor.rotateFor(2.5, rotationUnits::rev, false);
FrontRightDriveMotor.rotateFor(-2.5, rotationUnits::rev, false);
BackLeftDriveMotor.rotateFor(-2.5, rotationUnits::rev, false);
BackRightDriveMotor.rotateFor(2.5, rotationUnits::rev);

It is the last four lines that are the ones not working. I included my whole autonomous program so far in case any of the other sections help with it.

Looks like the Front Left and Back Left motors are moving towards each other as are the Front Right and Back Right. Unless this is a Mecanum/X-Drive, you’ll likely observe the robot fixed in place but hear the motors attempting to rotate.

What happens if you pick the robot up off the ground (being careful to avoid the arm and claw - maybe put it on some cubes so the wheels don’t touch the ground)? Do the last four lines move the motors?


After you figure out correct rotation direction for the turn like @Mentor_355v said, please, take a look at this topic:

You may need to add a setTimeout() call to ensure it never gets stuck with rotateFor().

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.