VEX V5 C++ API
|
Inherits vex::drivetrain.
Public Member Functions | |
smartdrive (motor_group &l, motor_group &r, vex::gyro &g, double wheelTravel=319.1764, double trackWidth=292.1, double wheelBase=130, distanceUnits unit=distanceUnits::mm, double externalGearRatio=1.0) | |
smartdrive (vex::motor &l, vex::motor &r, vex::gyro &g, double wheelTravel=319.1764, double trackWidth=292.1, double wheelBase=130, distanceUnits unit=distanceUnits::mm, double externalGearRatio=1.0) | |
smartdrive (motor_group &l, motor_group &r, vex::inertial &g, double wheelTravel=319.1764, double trackWidth=292.1, double wheelBase=130, distanceUnits unit=distanceUnits::mm, double externalGearRatio=1.0) | |
smartdrive (vex::motor &l, vex::motor &r, vex::inertial &g, double wheelTravel=319.1764, double trackWidth=292.1, double wheelBase=130, distanceUnits unit=distanceUnits::mm, double externalGearRatio=1.0) | |
~smartdrive () | |
void | setTurnThreshold (double t) |
bool | turnToHeading (double angle, rotationUnits units, bool waitForCompletion=true) |
Turn on the motors and rotate to a heading at the default velocity. More... | |
void | startTurnToHeading (double angle, rotationUnits units) |
Start turning to a given heading without blocking the user program. More... | |
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. More... | |
void | startTurnToHeading (double angle, rotationUnits units, double velocity, velocityUnits units_v) |
Start turning to a given heading without blocking the user program. More... | |
bool | turnToRotation (double angle, rotationUnits units, bool waitForCompletion=true) |
Turn on the motors and rotate to an angle at the default velocity. More... | |
void | startTurnToRotation (double angle, rotationUnits units) |
Start turning to a given rotation without blocking the user program. More... | |
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. More... | |
void | startTurnToRotation (double angle, rotationUnits units, double velocity, velocityUnits units_v) |
Start turning to a given rotation without blocking the user program. More... | |
virtual bool | turnFor (turnType dir, double angle, rotationUnits units, bool waitForCompletion=true) |
Turn on the motors and rotate an angle at the default velocity. More... | |
virtual bool | turnFor (double angle, rotationUnits units, bool waitForCompletion=true) |
Turn on the motors and rotate an angle at the default velocity. More... | |
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. More... | |
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. More... | |
virtual void | startTurnFor (double angle, rotationUnits angleUnit) |
Start turning the drivetrain for a given angle. More... | |
virtual void | startTurnFor (turnType dir, double angle, rotationUnits angleUnit) |
Start turning the drivetrain for a given angle. More... | |
virtual void | startTurnFor (double angle, rotationUnits angleUnit, double velocity, velocityUnits velUnit) |
Start turning the drivetrain for a given angle at a given velocity. More... | |
virtual void | startTurnFor (turnType dir, double angle, rotationUnits angleUnit, float velocity, velocityUnits velUnit) |
Start turning the drivetrain for a given angle at a given velocity. More... | |
double | heading (rotationUnits units=rotationUnits::deg) |
Gets the heading (angle) of the gyro/inertial sensor. More... | |
void | setHeading (double value, rotationUnits units) |
set the gyro/inertial sensor heading to angle More... | |
double | rotation (rotationUnits units=rotationUnits::deg) |
Gets the rotation (absolute angle) of the gyro/inertial sensor. More... | |
void | setRotation (double value, rotationUnits units) |
set the gyro/inertial sensor rotation to angle More... | |
bool | isTurning () |
Checks to see if the turnToHeading, turnToRotation or turnFor function is still running. More... | |
virtual bool | isMoving () |
Checks to see if any of the motors are rotating to a specific target. More... | |
Public Member Functions inherited from vex::drivetrain | |
drivetrain (motor_group &leftMotors, motor_group &rightMotors, double wheelTravel=319.1764, double trackWidth=292.1, double wheelBase=130, distanceUnits unit=distanceUnits::mm, double externalGearRatio=1.0) | |
Creates a new drivetrain object. More... | |
drivetrain (vex::motor &leftMotor, vex::motor &rightMotor, double wheelTravel=319.1764, double trackWidth=292.1, double wheelBase=130, distanceUnits unit=distanceUnits::mm, double externalGearRatio=1.0) | |
~drivetrain () | |
void | setGearRatio (double ratio) |
Sets the external gear ratio of the drivetrain. More... | |
void | setDriveVelocity (double velocity, velocityUnits units) |
Sets the velocity of the drive based on the parameters set in the command. This command will not run the motors. Any subsequent call that does not contain a specified motor velocity will use this value. More... | |
void | setDriveVelocity (double velocity, percentUnits units) |
void | setTurnVelocity (double velocity, velocityUnits units) |
Sets the turn velocity of the drive based on the parameters set in the command. This command will not run the motor. More... | |
void | setTurnVelocity (double velocity, percentUnits units) |
void | setTimeout (double time, timeUnits units) |
Sets the timeout for the drivetrain. If the drivetrain does not reach its' commanded position prior to the completion of the timeout, the motors will stop. More... | |
double | timeout (timeUnits units) |
bool | didTimeout () |
void | setStopping (brakeType mode) |
Sets the stopping mode of the motor group by passing a brake mode as a parameter. More... | |
void | drive (directionType dir) |
Turns the motors on, and drive in the specified direction. More... | |
void | drive (directionType dir, double velocity, velocityUnits units) |
Turn on the motors and drive in the specified direction and a specified velocity. More... | |
bool | driveFor (double distance, distanceUnits units, bool waitForCompletion=true) |
Turn on the motors and drive a distance at the default velocity. More... | |
bool | driveFor (directionType dir, double distance, distanceUnits units, bool waitForCompletion=true) |
Turn on the motors and drive a distance at a specified velocity. More... | |
bool | driveFor (double distance, distanceUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true) |
Turn on the motors and drive a distance at a specified velocity. More... | |
bool | driveFor (directionType dir, double distance, distanceUnits units, double velocity, velocityUnits units_v, bool waitForCompletion=true) |
Turn on the motors and drive a distance at a specified velocity. More... | |
void | startDriveFor (double distance, distanceUnits distUnit) |
Start driving a distance at a pre-set velocity. More... | |
void | startDriveFor (directionType dir, double distance, distanceUnits distUnit) |
Start driving a distance at a pre-set velocity. More... | |
void | startDriveFor (double distance, distanceUnits distUnit, double velocity, velocityUnits velUnit) |
Start driving a distance at a specified velocity. More... | |
void | startDriveFor (directionType dir, double distance, distanceUnits distUnit, float velocity, velocityUnits velUnit) |
Start driving a distance at a specified velocity. More... | |
void | turn (turnType dir) |
Turns the motors on, and rotate in the specified direction. More... | |
void | turn (turnType dir, double velocity, velocityUnits units) |
Turns the motors on, and rotate in the specified direction and a specified velocity. More... | |
void | arcade (double drivePower, double turnPower, percentUnits units=percentUnits::pct) |
Drive in arcade mode, normally corresponding to two controller joystick axis values. More... | |
bool | isDone (void) |
Checks to see if all the motor are done rotating to a specific target. More... | |
void | stop () |
Stops the drive using the default brake mode. More... | |
void | stop (brakeType mode) |
Stops the drive using a specified brake mode. More... | |
double | velocity (velocityUnits units) |
Gets the average velocity of the drivetrain;. More... | |
double | velocity (percentUnits units) |
double | current (currentUnits units=currentUnits::amp) |
Gets the total current of the drivetrain;. More... | |
double | power (powerUnits units=powerUnits::watt) |
Gets the average power of the drivetrain;. More... | |
double | torque (torqueUnits units=torqueUnits::Nm) |
Gets the average torque of the drivetrain;. More... | |
double | efficiency (percentUnits units=percentUnits::pct) |
Gets the average efficiency of the drivetrain;. More... | |
double | temperature (percentUnits units) |
Gets the average temperature of the drivetrain;. More... | |
Additional Inherited Members | |
Protected Attributes inherited from vex::drivetrain | |
double | _turnVelocity |
velocityUnits | _turnVelUnit |
vex::smartdrive::smartdrive | ( | motor_group & | l, |
motor_group & | r, | ||
vex::gyro & | g, | ||
double | wheelTravel = 319.1764 , |
||
double | trackWidth = 292.1 , |
||
double | wheelBase = 130 , |
||
distanceUnits | unit = distanceUnits::mm , |
||
double | externalGearRatio = 1.0 |
||
) |
vex::smartdrive::smartdrive | ( | vex::motor & | l, |
vex::motor & | r, | ||
vex::gyro & | g, | ||
double | wheelTravel = 319.1764 , |
||
double | trackWidth = 292.1 , |
||
double | wheelBase = 130 , |
||
distanceUnits | unit = distanceUnits::mm , |
||
double | externalGearRatio = 1.0 |
||
) |
vex::smartdrive::smartdrive | ( | motor_group & | l, |
motor_group & | r, | ||
vex::inertial & | g, | ||
double | wheelTravel = 319.1764 , |
||
double | trackWidth = 292.1 , |
||
double | wheelBase = 130 , |
||
distanceUnits | unit = distanceUnits::mm , |
||
double | externalGearRatio = 1.0 |
||
) |
vex::smartdrive::smartdrive | ( | vex::motor & | l, |
vex::motor & | r, | ||
vex::inertial & | g, | ||
double | wheelTravel = 319.1764 , |
||
double | trackWidth = 292.1 , |
||
double | wheelBase = 130 , |
||
distanceUnits | unit = distanceUnits::mm , |
||
double | externalGearRatio = 1.0 |
||
) |
vex::smartdrive::~smartdrive | ( | ) |
void vex::smartdrive::setTurnThreshold | ( | double | t | ) |
bool vex::smartdrive::turnToHeading | ( | double | angle, |
rotationUnits | units, | ||
bool | waitForCompletion = true |
||
) |
Turn on the motors and rotate to a heading at the default velocity.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
|
inline |
Start turning to a given heading without blocking the user program.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
bool vex::smartdrive::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.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
units_v | The measurement unit for the velocity value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
|
inline |
Start turning to a given heading without blocking the user program.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
units_v | The measurement unit for the velocity value. |
bool vex::smartdrive::turnToRotation | ( | double | angle, |
rotationUnits | units, | ||
bool | waitForCompletion = true |
||
) |
Turn on the motors and rotate to an angle at the default velocity.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
|
inline |
Start turning to a given rotation without blocking the user program.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
bool vex::smartdrive::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.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
units_v | The measurement unit for the velocity value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
|
inline |
Start turning to a given rotation without blocking the user program.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
units_v | The measurement unit for the velocity value. |
|
virtual |
Turn on the motors and rotate an angle at the default velocity.
dir | Sets the direction to turn. |
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
Reimplemented from vex::drivetrain.
|
virtual |
Turn on the motors and rotate an angle at the default velocity.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
Reimplemented from vex::drivetrain.
|
virtual |
Turn on the motors and rotate an angle at a specified velocity.
dir | Sets the direction to turn. |
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
units_v | The measurement unit for the velocity value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
Reimplemented from vex::drivetrain.
|
virtual |
Turn on the motors and rotate an angle at a specified velocity.
angle | Sets the angle to turn. |
units | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
units_v | The measurement unit for the velocity value. |
waitForCompletion | (Optional) If true, your program will wait until the motor reaches the target rotational value. If false, the program will continue after calling this function. By default, this parameter is true. |
Reimplemented from vex::drivetrain.
|
virtual |
Start turning the drivetrain for a given angle.
angle | Sets the angle to turn. |
angleUnit | The measurement unit for the angle value. |
Reimplemented from vex::drivetrain.
|
virtual |
Start turning the drivetrain for a given angle.
dir | Direction to turn in, left or right. |
angle | Sets the angle to turn. |
angleUnit | The measurement unit for the angle value. |
Reimplemented from vex::drivetrain.
|
virtual |
Start turning the drivetrain for a given angle at a given velocity.
angle | Sets the angle to turn. |
angleUnit | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
velUnit | The measurement unit for the velocity value. |
Reimplemented from vex::drivetrain.
|
virtual |
Start turning the drivetrain for a given angle at a given velocity.
dir | Direction to turn in, left or right. |
angle | Sets the angle to turn. |
angleUnit | The measurement unit for the angle value. |
velocity | Sets the amount of velocity. |
velUnit | The measurement unit for the velocity value. |
Reimplemented from vex::drivetrain.
double vex::smartdrive::heading | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the heading (angle) of the gyro/inertial sensor.
units | The measurement unit for the gyro device. |
void vex::smartdrive::setHeading | ( | double | value, |
rotationUnits | units | ||
) |
set the gyro/inertial sensor heading to angle
value | The new heading for the gyro |
units | The rotation unit for the angle |
double vex::smartdrive::rotation | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the rotation (absolute angle) of the gyro/inertial sensor.
units | The measurement unit for the gyro device. |
void vex::smartdrive::setRotation | ( | double | value, |
rotationUnits | units | ||
) |
set the gyro/inertial sensor rotation to angle
value | The new absolute angle for the gyro |
units | The rotation unit for the angle |
bool vex::smartdrive::isTurning | ( | ) |
Checks to see if the turnToHeading, turnToRotation or turnFor function is still running.
|
virtual |
Checks to see if any of the motors are rotating to a specific target.
Reimplemented from vex::drivetrain.