VEX V5 C++ API
|
Use the rotation class to control absolute encoder devices. More...
Inherits vex::device.
Public Member Functions | |
rotation (int32_t index, bool reverse=false) | |
Creates a new rotation object on the port specified. More... | |
~rotation () | |
bool | installed () |
int32_t | value () |
void | setReversed (bool value) |
Sets the encoder mode to "reverse", position and angle will change in the opposite direction. More... | |
double | angle (rotationUnits units=rotationUnits::deg) |
Gets the angle of the absolute encoder. More... | |
void | resetPosition (void) |
Resets the value of the absolute encoder to zero. More... | |
void | setPosition (double value, rotationUnits units) |
Sets the value of the absolute encoder to the value specified in the parameter. More... | |
double | position (rotationUnits units) |
Gets the current position of the absolute encoder. More... | |
double | velocity (velocityUnits units) |
Gets the current velocity of the absolute encoder. More... | |
![]() | |
device () | |
device (int32_t index) | |
~device () | |
V5_DeviceType | type () |
void | init (int32_t index) |
Protected Member Functions | |
int32_t | status () |
Additional Inherited Members | |
![]() | |
int32_t | _index |
Use the rotation class to control absolute encoder devices.
vex::rotation::rotation | ( | int32_t | index, |
bool | reverse = false |
||
) |
Creates a new rotation object on the port specified.
index | The port index for this rotation sensor. The index is zero-based. |
reverse | If set to true, the encoder counts in reverse |
vex::rotation::~rotation | ( | ) |
|
virtual |
Reimplemented from vex::device.
|
virtual |
Reimplemented from vex::device.
void vex::rotation::setReversed | ( | bool | value | ) |
Sets the encoder mode to "reverse", position and angle will change in the opposite direction.
value | If set to true, the encoder counts in reverse |
double vex::rotation::angle | ( | rotationUnits | units = rotationUnits::deg | ) |
Gets the angle of the absolute encoder.
units | The measurement unit for the encoder device. |
void vex::rotation::resetPosition | ( | void | ) |
Resets the value of the absolute encoder to zero.
void vex::rotation::setPosition | ( | double | value, |
rotationUnits | units | ||
) |
Sets the value of the absolute encoder to the value specified in the parameter.
value | Sets the current position of the absolute encoder. |
units | The measurement unit for the position value. |
double vex::rotation::position | ( | rotationUnits | units | ) |
Gets the current position of the absolute encoder.
units | The measurement unit for the position. |
double vex::rotation::velocity | ( | velocityUnits | units | ) |
Gets the current velocity of the absolute encoder.
units | The measurement unit for the velocity. |
|
protected |