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

#include <custom_encoder.h>

Public Member Functions

 CustomEncoder (vex::triport::port &port, double ticks_per_rev)
void setRotation (units::Angle val)
void setPosition (units::Angle val)
units::Angle rotation ()
units::Angle position ()
units::AngularVelocity velocity ()

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()

units::Angle CustomEncoder::position ( )

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()

units::Angle CustomEncoder::rotation ( )

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 ( units::Angle val)

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 ( units::Angle val)

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()

units::AngularVelocity CustomEncoder::velocity ( )

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: