How would I change the units in my autonomous functions from revolutions to degrees, and how would I change my parameters from rotations to seconds? And how would I make two autonomous functions run at the same time?
Here is my code:
void driving(double rotations, int speed)
{
leftFront.rotateFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, false); //deg vs rev
leftBack.rotateFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, false);
rightFront.rotateFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, false);
rightBack.rotateFor(rotations, rotationUnits::rev, speed, velocityUnits::pct);
}
void turnRight(double turnDistance, int speed) {
leftFront.rotateFor(-(turnDistance), rotationUnits::rev, speed, velocityUnits::pct, false);
leftBack.rotateFor(-(turnDistance), rotationUnits::rev, speed, velocityUnits::pct, false);
rightFront.rotateFor(turnDistance, rotationUnits::rev, speed, velocityUnits::pct, false);
rightBack.rotateFor((turnDistance), rotationUnits::rev, speed, velocityUnits::pct, true);
}
void turnLeft(double turnDistance, int speed) {
leftFront.rotateFor((turnDistance), rotationUnits::rev, speed, velocityUnits::pct, false);
leftBack.rotateFor(turnDistance, rotationUnits::rev, speed, velocityUnits::pct, false);
rightFront.rotateFor(-(turnDistance), rotationUnits::rev, speed, velocityUnits::pct, false);
rightBack.rotateFor(-turnDistance, rotationUnits::rev, speed, velocityUnits::pct, true);
}
void spin(double rotations, int speed) //seconds?
{
rolltake.rotateFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, false);
}
void flywheel(double rotations, int speed) //seconds?
{
flywheel1.rotateFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, false);
flywheel2.rotateFor(rotations, rotationUnits::rev, speed, velocityUnits::pct, false);
}
Here how would I make these two lines of code run at the same time given the information above?
flywheel(400, 90);
spin(400, 90);