Autonomous not functioning properly

My team is having difficulties with running our autonomous program. The issue is that one version of our autonomous is not running properly, and instead of going forward and picking up cubes, it simply moves our cube tray forward one inch and stops. A safer version of our autonomous that we have been running has been functioning properly, where all it does is go forward and come back. We have inspected the file, and cannot determine what the problem in our newer autonomous is. Does anyone have a solution for this issue? Thank you in advance.

This is our autonomous program.
void autonomous(void) {
// User control code here, inside the loop

RightArm.rotateFor(360, rotationUnits::deg, 95, velocityUnits::pct, false);
LeftArm.rotateFor(-360, rotationUnits::deg, 95, velocityUnits::pct);

RightArm.rotateFor(-360, rotationUnits::deg, 75, velocityUnits::pct, false);
LeftArm.rotateFor(360, rotationUnits::deg, 75, velocityUnits::pct);

RightChassis.rotateFor(-360, rotationUnits::deg, 50, velocityUnits::pct, false);
LeftChassis.rotateFor(360, rotationUnits::deg, 50, velocityUnits::pct, false);
RightIntake.rotateFor(-1400, rotationUnits::deg, 70, velocityUnits::pct, false);
LeftIntake.rotateFor(1400, rotationUnits::deg, 70, velocityUnits::pct);
//right - left +
RightChassis.rotateFor(225, rotationUnits::deg, 50, velocityUnits::pct, false);
LeftChassis.rotateFor(225, rotationUnits::deg, 50, velocityUnits::pct);

RightChassis.rotateFor(-380, rotationUnits::deg, 50, velocityUnits::pct, false);
LeftChassis.rotateFor(380, rotationUnits::deg, 50, velocityUnits::pct, false);
RightIntake.rotateFor(-1700, rotationUnits::deg, 70, velocityUnits::pct, false);
LeftIntake.rotateFor(1700, rotationUnits::deg, 70, velocityUnits::pct);

//RightChassis.rotateFor(225, rotationUnits::deg, 50, velocityUnits::pct, false);
//LeftChassis.rotateFor(225, rotationUnits::deg, 50, velocityUnits::pct);

}

We use a different format but i can still suggest that you take pictures of the current one and then create a new one. how long does that program take and sometimes it might help to reset your computer and robot and download. hope it gets fixed

Are there any mechanical issues preventing motors from moving the specified amounts? If you were to remove the shafts from the motors, does the program run as expected?

Given the symmetry of the code you posted above, take a look at the motor_group class. It may cut your code in half, and simplify the waitForCompletion flags.

Another suggestion is to comment your code better so that outsiders know what the intent of each movement is. Nothing in the code above implies anything about a cube tray, so it is hard to match your description of the problem to the code you posted.

3 Likes

You should try to put your code in functions.
void nameTheFunction(input){
Commands
}

1 Like