![]() |
VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
|
Public Member Functions | |
gyro (int32_t index, bool calibrate=false, turnType dir=turnType::left) | |
Creates a new gyro object on the port specified in the parameter. | |
bool | installed () |
int32_t | value () |
Gets the angle of the gyro sensor. | |
double | value (rotationUnits units=rotationUnits::deg) |
Gets the angle of the gyro sensor. | |
bool | startCalibration (gyroCalibrationType value=gyroCalibrationType::calNormal, bool waitForCompletion=true) |
Starts recalibration of the gyro. | |
void | calibrate (gyroCalibrationType value=gyroCalibrationType::calNormal, bool waitForCompletion=true) |
bool | isCalibrating () |
Returns true while the gyro sensor is performing a requested recalibration, changing to false once recalibration has completed. | |
void | resetHeading () |
reset the gyro sensor angle to 0 | |
void | resetRotation () |
reset the gyro sensor rotation to 0 | |
void | setHeading (double value, rotationUnits units) |
set the gyro sensor angle to angle | |
void | setRotation (double value, rotationUnits units) |
set the gyro sensor rotation to angle | |
double | angle (rotationUnits units=rotationUnits::deg) |
Gets the angle of the gyro sensor. | |
double | heading (rotationUnits units=rotationUnits::deg) |
Gets the angle of the gyro sensor. | |
double | rotation (rotationUnits units=rotationUnits::deg) |
Gets the absolute angle of the gyro sensor. | |
double | rate (rateUnits units=rateUnits::dps) |
Gets the turn rate of the gyro sensor. | |
void | changed (void(*callback)(void)) |
Calls a function when the gyro sensor value changes. | |
void | setTurnType (turnType dir) |
Set direction for positive angles. | |
turnType | getTurnType () |
Get direction for positive angles. | |
![]() | |
device (int32_t index) | |
IQ_DeviceType | type () |
int32_t | index () |
void | init (int32_t index) |
int32_t | readDigitalPin () |
int32_t | readAnalogPin () |
Additional Inherited Members | |
![]() | |
void | setPollInterval (int32_t value) |
bool | pollValid (bool bSave) |
![]() | |
int16_t | _index |
Definition at line 26 of file vex_gyro.h.
vex::gyro::gyro | ( | int32_t | index, |
bool | calibrate = false, | ||
turnType | dir = turnType::left ) |
Creates a new gyro object on the port specified in the parameter.
port | index to the brain port. |
double vex::gyro::angle | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the angle of the gyro sensor.
units | The measurement unit for the gyro device. |
|
inline |
Definition at line 58 of file vex_gyro.h.
void vex::gyro::changed | ( | void(* | callback )(void) | ) |
Calls a function when the gyro sensor value changes.
callback | A reference to a function. |
turnType vex::gyro::getTurnType | ( | ) |
Get direction for positive angles.
double vex::gyro::heading | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the angle of the gyro sensor.
units | The measurement unit for the gyro device. |
|
virtual |
Reimplemented from vex::device.
bool vex::gyro::isCalibrating | ( | ) |
Returns true while the gyro sensor is performing a requested recalibration, changing to false once recalibration has completed.
double vex::gyro::rate | ( | rateUnits | units = rateUnits::dps | ) |
Gets the turn rate of the gyro sensor.
units | The measurement unit for the gyro device. |
double vex::gyro::rotation | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the absolute angle of the gyro sensor.
units | The measurement unit for the gyro device. |
void vex::gyro::setHeading | ( | double | 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 | ( | double | 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 |
void vex::gyro::setTurnType | ( | turnType | dir | ) |
Set direction for positive angles.
dir | turnType::right or turnType::left |
bool vex::gyro::startCalibration | ( | gyroCalibrationType | value = gyroCalibrationType::calNormal, |
bool | waitForCompletion = true ) |
Starts recalibration of the gyro.
value | (Optional) Sets the amount of calibration time. By default, this parameter is quick. |
waitForCompletion | wait for calibration to complete @motes the IQ startCalibration method will block until calibration is finished. |
|
virtual |
Gets the angle of the gyro sensor.
Reimplemented from vex::device.
double vex::gyro::value | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the angle of the gyro sensor.
units | The measurement unit for the gyro device. |