VEX V5 C++ API
|
Use this class when programming with a gyro sensor. More...
Inherits vex::__tridevice, and vex::guido.
Public Member Functions | |
gyro (triport::port &port) | |
Creates a new gyro object on the port specified in the parameter. More... | |
~gyro () | |
int32_t | value (analogUnits units) |
Gets the value of the gyro sensor. More... | |
double | value (rotationUnits units) |
Gets the value of the gyro sensor. More... | |
int32_t | value (percentUnits units) |
Gets the value of the gyro sensor. More... | |
void | startCalibration (int32_t value=0) |
Starts recalibration of the gyro. Note that the gyro is automatically calibrated when the constructor is called. More... | |
bool | isCalibrating () |
Returns true while the gyro sensor is performing a requested recalibration, changing to false once recalibration has completed. More... | |
void | resetHeading () |
reset the gyro sensor angle to 0 More... | |
void | resetRotation () |
reset the gyro sensor absolute angle to 0 More... | |
void | setHeading (double value, rotationUnits units) |
reset the gyro sensor angle to angle More... | |
double | heading (rotationUnits units=rotationUnits::deg) |
Gets the angle of the gyro sensor. More... | |
double | rotation (rotationUnits units=rotationUnits::deg) |
Gets the rotation (absolute angle) of the gyro sensor. More... | |
void | setRotation (double value, rotationUnits units) |
set the gyro sensor rotation to angle More... | |
![]() | |
virtual | ~guido () |
Use this class when programming with a gyro sensor.
vex::gyro::gyro | ( | triport::port & | port | ) |
Creates a new gyro object on the port specified in the parameter.
port | A reference to a three wire port. |
vex::gyro::~gyro | ( | ) |
int32_t vex::gyro::value | ( | analogUnits | units | ) |
Gets the value of the gyro sensor.
units | The measurement unit for the gyro device. |
double vex::gyro::value | ( | rotationUnits | units | ) |
Gets the value of the gyro sensor.
units | The measurement unit for the gyro device. |
|
inline |
Gets the value of the gyro sensor.
units | The measurement unit for the gyro device. |
void vex::gyro::startCalibration | ( | int32_t | value = 0 | ) |
Starts recalibration of the gyro. Note that the gyro is automatically calibrated when the constructor is called.
value | (Optional) Sets the amount of calibration time. By default, this parameter is zero. |
|
virtual |
Returns true while the gyro sensor is performing a requested recalibration, changing to false once recalibration has completed.
Implements vex::guido.
void vex::gyro::resetHeading | ( | ) |
reset the gyro sensor angle to 0
void vex::gyro::resetRotation | ( | ) |
reset the gyro sensor absolute angle to 0
|
virtual |
reset the gyro sensor angle to angle
value | The new heading for the gyro |
units | The rotation unit for the angle |
Implements vex::guido.
|
virtual |
Gets the angle of the gyro sensor.
units | The measurement unit for the gyro device. |
Implements vex::guido.
|
virtual |
Gets the rotation (absolute angle) of the gyro sensor.
units | The measurement unit for the gyro device. |
Implements vex::guido.
|
virtual |
set the gyro sensor rotation to angle
value | The new absolute angle for the gyro |
units | The rotation unit for the angle |
Implements vex::guido.