VEXcode turnFor deadband

In my autonomous, I am attempting to use the turnFor command. However, when I run it, the robot just turns infinitely in a circle. However, if I print the drivetrain heading to the screen, it is accurate. Is there something that I am missing? Also, Is there a way to set a deadband on the turning so that it doesn’t have to be exactly precise?
Also, for reference, this is my code:

//Gyroscope-Based Turning Function
void gyroturn (double powerpct, int amount, bool end)
{Drivetrain.turnFor(amount, degrees, (powerpct*2), rpm, true);}

Any of the following:

  • Wrap the code in [code]…[/code] tags
  • Wrap the code in triple backtiks (```)
  • In the edit window, highlight the code and click the </> button.
1 Like

It is because you have rpm but you’re inputting degrees?
Either try switching rpm to dps or input revolutions

RPM is the speed of the motors while degrees is the distance to turn.

oh ok

charrrrrrrrrrrrrrr

Are you sure you are passing correct arguments to vex::drivetrain::turnFor() function?

Help says first parameter is direction type.
https://www.robotmesh.com/docs/vexv5-cpp/html/classvex_1_1drivetrain.html

boo turnFor (turnType dir, double angle, rotationUnits angleUnit, bool waitForCompletion=true)

boolturnFor (turnType dir, double angle, rotationUnits angleUnit, double velocity, velocityUnits velUnit, bool waitForCompletion=true)