Autonomous Help Needed

Hey, my autonomous isn’t working. It doesn’t do anything. What’s wrong with my code??

void autonomous( void ) {

vex::rotationUnits rotations = vex::rotationUnits::rev;

while (1){

int howMany = 4;
RightDrive.startRotateFor(howMany, rotations);
howMany = 4;
LeftDrive.rotateFor(howMany, rotations);


howMany = -5;
RightIntake.startRotateFor(howMany, rotations);
howMany = 5;
LeftIntake.rotateFor(howMany, rotations);

vex::task::sleep(1000);


howMany = -4;
RightDrive.startRotateFor(howMany, rotations);
howMany = -4;
LeftDrive.rotateFor(howMany, rotations);


vex::task::sleep(500);


howMany = 3;
RightDrive.startRotateFor(howMany, rotations);
howMany = -1;
LeftDrive.rotateFor(howMany, rotations);



howMany = 2;
RightDrive.startRotateFor(howMany, rotations);
howMany = 2;
LeftDrive.rotateFor(howMany, rotations);

vex::task::sleep(500);

howMany = 4;
Tray.startRotateFor(howMany, rotations);

vex::task::sleep(500);

howMany = -2;
RightDrive.startRotateFor(howMany, rotations);
howMany = -2;
LeftDrive.rotateFor(howMany, rotations);
}

}

This is probably not the main issue, but you shouldn’t have your autonomous in a while loop. That would cause it to keep repeating, which is great for driver control, but not so good for auton. Does your code compile okay? VexCode isn’t giving you any errors right?

2 Likes

Code should only have one infinitely repeating loop
Void Automous should not need an additional infinite loop. Your auton doesn’t need to go forever and when auton goes to disable on field control this could cause an issue

okay, so i removed my auton from the while loop. It still doesnt work.

void autonomous( void ) {

vex::rotationUnits rotations = vex::rotationUnits::rev;

while (1){

int howMany = 4;
RightDrive.startRotateFor(howMany, rotations);
howMany = 4;
LeftDrive.rotateFor(howMany, rotations);


howMany = -5;
RightIntake.startRotateFor(howMany, rotations);
howMany = 5;
LeftIntake.rotateFor(howMany, rotations);

vex::task::sleep(1000);


howMany = -4;
RightDrive.startRotateFor(howMany, rotations);
howMany = -4;
LeftDrive.rotateFor(howMany, rotations);


vex::task::sleep(500);


howMany = 3;
RightDrive.startRotateFor(howMany, rotations);
howMany = -1;
LeftDrive.rotateFor(howMany, rotations);



howMany = 2;
RightDrive.startRotateFor(howMany, rotations);
howMany = 2;
LeftDrive.rotateFor(howMany, rotations);

vex::task::sleep(500);

howMany = 4;
Tray.startRotateFor(howMany, rotations);

vex::task::sleep(500);

howMany = -2;
RightDrive.startRotateFor(howMany, rotations);
howMany = -2;
LeftDrive.rotateFor(howMany, rotations);
}

It still doesn’t work for some reason. :(((

the code posted shows a while loop
are you sure its gone?
also do you have preauton in the code as well?
#include vex.h?

I do not believe rotation units are an object that you can initialize, so I would suggest potentially replacing

RightDrive.startRotateFor(howMany, rotations);

to

RightDrive.startRotateFor(howMany, vex::rotationUnits::rev);
2 Likes