Autonomous help


#1

My autonomous is when plugged into an autonomous switch will not run correctly. One side of the wheels will just run by itself. If you have any ideas please let me know. Thanks
Here is my autonomous:

#include “robot-config.h”
int main() {
while (1)
//First Flag
RightWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
task ::sleep(1750);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);
RightWheelMotor.spin(directionType ::rev,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::rev,75,velocityUnits ::pct);
task ::sleep(1000);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);
RightWheelMotor.spin(directionType ::rev,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
task ::sleep(900);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);
RightWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
task ::sleep(2000);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);
//Second Flag
RightWheelMotor.spin(directionType ::rev,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::rev,75,velocityUnits ::pct);
task ::sleep(1000);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);
FlipperMotor.spin(directionType::rev,75,velocityUnits ::pct);
task ::sleep(500);
FlipperMotor.stop(brakeType ::brake);
task ::sleep(300);
RightWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
task ::sleep(1000);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);
RightWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::rev,75,velocityUnits ::pct);
task ::sleep(900);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);
FlipperMotor.spin(directionType::fwd,75,velocityUnits ::pct);
task ::sleep(500);
FlipperMotor.stop(brakeType ::brake);
task ::sleep(300);
RightWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
LeftWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);
task ::sleep(2000);
RightWheelMotor.stop(brakeType ::brake);
LeftWheelMotor.stop(brakeType ::brake);
task ::sleep(300);


#2

Ummmm idk if this is the problem… but I think you forgot curly braces from the while loop to the end.


#3

That’s definitely the problem. What’s written here is equivalent to:


while (1) RightWheelMotor.spin(directionType ::fwd,75,velocityUnits ::pct);

Nothing else ever gets called.