Hey, My teams robot will run code up until there is a turn and then it stops. Any thoughts?
It helps a lot if you post code when you’re asking people to help you debug it.
This is my code for turning the robot.
LeftMotor.startRotateFor(300,rotationUnits::deg,100,velocityUnits::pct);
LeftMotor2.startRotateFor(300,rotationUnits::deg,100,velocityUnits::pct);
RightMotor.startRotateFor(-300,rotationUnits::deg,100,velocityUnits::pct);
RightMotor2.startRotateFor(-300,rotationUnits::deg,100,velocityUnits::pct);
while(LeftMotor.isSpinning()||RightMotor.isSpinning())
task::sleep(100);
I think your while loop is stopping it turning.
Try:
LeftMotor.startRotateFor(300,rotationUnits::deg,100,velocityUnits::pct);
LeftMotor2.startRotateFor(300,rotationUnits::deg,100,velocityUnits::pct);
RightMotor.startRotateFor(-300,rotationUnits::deg,100,velocityUnits::pct);
RightMotor2.rotateFor(-300,rotationUnits::deg,100,velocityUnits::pct);
I would try the same thing as suggested by @percy888
You may have these in your code, not sure, but you need to bracket your task::sleep(100) command with { } to complete your while loop. You may be getting straight to the sleep command.