Does drivertrain::turn turn 90 degrees?Or turn until drivertrain:: stop is executed?
I want to turn in a specified direction forever until drivertrain:: stop is executed.What should I do?
If I rember correctly it should turn in the specified direction until told to stop.
DriveTrain::turn should turn until given a way to stop. An example would be how I used to program Autons.
EX.
Drivetrain.setVelocity(100, pct);
waitUntil(inertial.heading(90, deg);
Drivetrain.turn
this is if your drivetrain was using an inertial sensor to stop the turn for example.
Correct me if I’m wrong, but if you said turn 90 degrees wouldn’t it turn 90 degrees each time you press the joystick.
According to the drivetrain manual pages there are several flavors of the function:
void vex::drivetrain::turn(turnType dir)
void vex::drivetrain::turn(turnType dir, double velocity, velocityUnits units)
bool vex::drivetrain::turnFor(double angle, rotationUnits units, bool waitForCompletion=true)
bool vex::drivetrain::turnFor(turnType dir, double angle, rotationUnits units, bool waitForCompletion=true)
bool vex::drivetrain::turnFor(double angle, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
bool vex::drivetrain::turnFor(turnType dir, double angle, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
While the turn
functions will start rotation in certain direction and will stop only when later commanded, the turnFor
functions take angle
argument and if waitForCompletion=true will return only after rotation was completed. You should also call setTimeout() to make sure it doesn’t hang there if it couldn’t reach the angle.