RIT VEXU Core API
Loading...
Searching...
No Matches
CustomEncoder Class Reference

#include <custom_encoder.h>

Inherits vex::encoder.

Public Member Functions

 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)
 

Detailed Description

A wrapper class for the vex encoder that allows the use of 3rd party encoders with different tick-per-revolution values.

Constructor & Destructor Documentation

◆ CustomEncoder()

CustomEncoder::CustomEncoder ( vex::triport::port & port,
double ticks_per_rev )

Construct an encoder with a custom number of ticks

Parameters
portthe triport port on the brain the encoder is plugged into
ticks_per_revthe number of ticks the encoder will report for one revolution

Member Function Documentation

◆ position()

double CustomEncoder::position ( vex::rotationUnits units)

get the position that the encoder is at

Parameters
unitsthe 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
unitsthe 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
valthe numerical value of the position we are setting to
unitsthe 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
valthe numerical value of the angle we are setting to
unitsthe unit of val

◆ velocity()

double CustomEncoder::velocity ( vex::velocityUnits units)

get the velocity that the encoder is moving at

Parameters
unitsthe 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: