14#ifndef VEX_DRIVETRAIN_EXT_CLASS_H
15#define VEX_DRIVETRAIN_EXT_CLASS_H
27 smartdrive(
vex::motor &l,
vex::motor &r,
vex::gyro &g,
double wheelTravel=200,
double trackWidth=200,
double wheelBase=50, distanceUnits unit=distanceUnits::mm,
double externalGearRatio = 1.0 );
31 void setTurnThreshold(
double t );
32 void setTurnConstant(
double kp );
34 smartdrive & setTurnDirectionReverse(
bool value );
43 bool turnToHeading(
double angle, rotationUnits units,
bool waitForCompletion=
true );
54 bool turnToHeading(
double angle, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
63 bool turnToRotation(
double angle, rotationUnits units,
bool waitForCompletion=
true );
74 bool turnToRotation(
double angle, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
84 virtual bool turnFor( turnType dir,
double angle, rotationUnits units,
bool waitForCompletion=
true );
86 virtual bool turnFor(
double angle, rotationUnits units,
bool waitForCompletion=
true );
98 virtual bool turnFor( turnType dir,
double angle, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
100 virtual bool turnFor(
double angle, rotationUnits units,
double velocity, velocityUnits units_v,
bool waitForCompletion=
true );
114 double heading( rotationUnits units = rotationUnits::deg );
121 double rotation( rotationUnits units = rotationUnits::deg );
147 bool _eventsInitialized;
148 double _turnThreshold;
150 double _turningVelocity;
151 velocityUnits _turningVelocityUnits;
153 turnType _turnPositive;
154 turnType _turnNegative;
156 static void _gyropoll(
void *arg );
158 bool _testForCompletionGyro();
159 bool _waitForCompletionGyro();
161 enum class tEventType {
double velocity(velocityUnits units)
Gets the average velocity of the drivetrain;.
Use the motor class to control motor devices.
bool turnToHeading(double angle, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
Turn on the motors and rotate to a heading at a specified velocity.
virtual bool turnFor(double angle, rotationUnits units, bool waitForCompletion=true)
Turn on the motors and rotate an angle at the default velocity.
virtual bool turnFor(turnType dir, double angle, rotationUnits units, bool waitForCompletion=true)
Turn on the motors and rotate an angle at the default velocity.
bool turnToRotation(double angle, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
Turn on the motors and rotate to an angle at a specified velocity.
virtual bool turnFor(double angle, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
Turn on the motors and rotate an angle at a specified velocity.
double heading(rotationUnits units=rotationUnits::deg)
Gets the heading (angle) of the gyro sensor.
bool isTurning()
Checks to see if the turnToHeading, turnToRotation or turnFor function is still running.
void setHeading(double value, rotationUnits units)
set the gyro sensor heading to angle
double rotation(rotationUnits units=rotationUnits::deg)
Gets the rotation (absolute angle) of the gyro sensor.
bool turnToHeading(double angle, rotationUnits units, bool waitForCompletion=true)
Turn on the motors and rotate to a heading at the default velocity.
bool turnToRotation(double angle, rotationUnits units, bool waitForCompletion=true)
Turn on the motors and rotate to an angle at the default velocity.
virtual bool turnFor(turnType dir, double angle, rotationUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true)
Turn on the motors and rotate an angle at a specified velocity.
virtual bool isMoving()
Checks to see if any of the motors are rotating to a specific target.
void setRotation(double value, rotationUnits units)
set the gyro sensor rotation to angle
Bumper switch device class