VEX IQ C++ API
|
Gyro sensor device class. More...
Inherits vex::device.
Public Member Functions | |
gyro (int32_t index, bool calibrate=true) | |
Creates a new gyro object on the port specified in the parameter. More... | |
~gyro () | |
void | startCalibration (gyroCalibrationType type=gyroCalibrationType::quick, bool waitForCompletion=true) |
Starts recalibration of the gyro. 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 rotation to 0 More... | |
void | setHeading (float value, rotationUnits units) |
set the gyro sensor angle to angle More... | |
void | setRotation (float value, rotationUnits units) |
set the gyro sensor rotation to angle More... | |
float | heading (rotationUnits units=rotationUnits::deg) |
Gets the angle of the gyro sensor. More... | |
float | rotation (rotationUnits units=rotationUnits::deg) |
Gets the absolute angle of the gyro sensor. More... | |
float | rate (rateUnits units=rateUnits::dps) |
Gets the turn rate of the gyro sensor. More... | |
![]() | |
device (int32_t index) | |
~device () | |
Additional Inherited Members | |
![]() | |
int32_t | _index |
Gyro sensor device class.
vex::gyro::gyro | ( | int32_t | index, |
bool | calibrate = true |
||
) |
Creates a new gyro object on the port specified in the parameter.
index | to the brain port. |
calibrate | start calibrating the gyro |
|
inline |
void vex::gyro::startCalibration | ( | gyroCalibrationType | type = gyroCalibrationType::quick , |
bool | waitForCompletion = true |
||
) |
Starts recalibration of the gyro.
type | (Optional) Sets the amount of calibration time. By default, this parameter is quick. |
waitForCompletion | wait for calibration to complete |
bool vex::gyro::isCalibrating | ( | ) |
Returns true while the gyro sensor is performing a requested recalibration, changing to false once recalibration has completed.
|
inline |
reset the gyro sensor angle to 0
|
inline |
reset the gyro sensor rotation to 0
void vex::gyro::setHeading | ( | float | value, |
rotationUnits | units | ||
) |
set the gyro sensor angle to angle
value | The new heading for the gyro |
units | The rotation unit for the heading |
void vex::gyro::setRotation | ( | float | value, |
rotationUnits | units | ||
) |
set the gyro sensor rotation to angle
value | The new absolute angle for the gyro |
units | The rotation unit for the angle |
float vex::gyro::heading | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the angle of the gyro sensor.
units | The measurement unit for the gyro device. |
float vex::gyro::rotation | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the absolute angle of the gyro sensor.
units | The measurement unit for the gyro device. |
float vex::gyro::rate | ( | rateUnits | units = rateUnits::dps | ) |
Gets the turn rate of the gyro sensor.
units | The measurement unit for the gyro device. |