Autonomous Coding

I am trying to code a simple autonomous program that just moves forward as a start. This is what I have so far:

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

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

The wheels are just spazzing and going different directions, can someone tell me what I am doing wrong?

What wheels are going in what directions? Break down your problem into pieces and it becomes more manageable. The problem “the wheels are going crazy” is not a manageable problem, but “the front left wheel is going the wrong way” is manageable, and easily fixed.

1 Like

The two on the right are going forward and the two on the left are going backward. It was my last code that had the wheels messing up really bad. I don’t know how to make it go forward or how to get it to for a longer period of time without messing it all up.

So the right wheels are going the wrong way when told to go in reverse. Easy fix. Reverse the right motors wherever you’re configuring them.

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