Autonomous errors

When running my autonomous It starts just spinning and not following the commands given
void autonomous(void){

Drivetrain.drive(forward);

wait(.2,seconds);

Shooter.spin(forward);

Drivetrain.drive(reverse);

wait(1,seconds);

Drivetrain.turn(left);

wait(2,seconds);

Drivetrain.drive(forward);

Drivetrain.turn(left);

wait(1,seconds);

Shooter.setVelocity(100, percent);

Pusher.setVelocity(100,percent);

Shooter.spin(reverse);

wait(4,seconds);

Pusher.spin(reverse);

wait(2,seconds);

Pusher.spin(forward);

wait(4,seconds);

Pusher.spin(reverse);

wait(2,seconds);

Pusher.spin(forward);

wait(2,seconds);

Pusher.spin(reverse);

wait(2,seconds);

Pusher.spin(forward);

wait(4,seconds);

Pusher.stop();

Shooter.stop();

}

make sure your drivetrain is configured properly. Does opcontrol behave correctly?

yeah in tele it works properly but i dont understand why it does that I will show a ss of my code

A reason that it could be happening is that your motors are in the wrong ports. Check that they are, and if they aren’t, fix it and test again. Otherwise, this is an interesting issue, and that’s the only thing I can think of right now.

Try putting a 5 second wait function before everything else. Does it wait the 5 seconds?

1 Like

I’m not sure why, but on another note, I think it would be significantly easier with commands like spinFor, driveFor, or turnFor, as they are easier to implement and require less lines of code.

1 Like