#include <custom_encoder.h>
Inherits vex::encoder.
|
| CustomEncoder (vex::triport::port &port, double ticks_per_rev) |
|
void | setRotation (double val, vex::rotationUnits units) |
|
void | setPosition (double val, vex::rotationUnits units) |
|
double | rotation (vex::rotationUnits units) |
|
double | position (vex::rotationUnits units) |
|
double | velocity (vex::velocityUnits units) |
|
A wrapper class for the vex encoder that allows the use of 3rd party encoders with different tick-per-revolution values.
◆ CustomEncoder()
CustomEncoder::CustomEncoder |
( |
vex::triport::port & | port, |
|
|
double | ticks_per_rev ) |
Construct an encoder with a custom number of ticks
- Parameters
-
port | the triport port on the brain the encoder is plugged into |
ticks_per_rev | the number of ticks the encoder will report for one revolution |
◆ position()
double CustomEncoder::position |
( |
vex::rotationUnits | units | ) |
|
get the position that the encoder is at
- Parameters
-
units | the unit we want the return value to be in |
- Returns
- the position of the encoder in the units specified
◆ rotation()
double CustomEncoder::rotation |
( |
vex::rotationUnits | units | ) |
|
get the rotation that the encoder is at
- Parameters
-
units | the unit we want the return value to be in |
- Returns
- the rotation of the encoder in the units specified
◆ setPosition()
void CustomEncoder::setPosition |
( |
double | val, |
|
|
vex::rotationUnits | units ) |
sets the stored position of the encoder. Any further movements will be from this value
- Parameters
-
val | the numerical value of the position we are setting to |
units | the unit of val |
◆ setRotation()
void CustomEncoder::setRotation |
( |
double | val, |
|
|
vex::rotationUnits | units ) |
sets the stored rotation of the encoder. Any further movements will be from this value
- Parameters
-
val | the numerical value of the angle we are setting to |
units | the unit of val |
◆ velocity()
double CustomEncoder::velocity |
( |
vex::velocityUnits | units | ) |
|
get the velocity that the encoder is moving at
- Parameters
-
units | the unit we want the return value to be in |
- Returns
- the velocity of the encoder in the units specified
The documentation for this class was generated from the following files: