Skip to content

Encoders

Encoder

Constructor

There are no constructors for this class. It is only used to inherit from.

Methods

These methods are available to all classes that inherit from this class.

GetEncoderRawTicks

Returns the raw ticks from the encoder.

Example
double ticks = encoder->GetEncoderRawTicks();

GetEncoderTickVelocity

Returns the velocity of the encoder in ticks per second.

Example
double velocity = encoder->GetEncoderTickVelocity();

ZeroEncoder

Zeros the encoder.

Example
encoder->ZeroEncoder();

SetEncoderPosition

Sets the encoder position.

Example
encoder->SetEncoderPosition(0);

SetEncoderOffset

Sets the encoder offset.

Example
encoder->SetEncoderOffset(0);

GetEncoderTicks

Returns the encoder ticks.

Example
double ticks = encoder->GetEncoderTicks();

GetEncoderTicksPerRotation

Returns the encoder ticks per rotation.

Example
double ticksPerRotation = encoder->GetEncoderTicksPerRotation();

SetReduction

Sets the reduction of the encoder.

Example
encoder->SetReduction(1);

GetEncoderPosition

Returns the encoder position.

Example
units::radian_t position = encoder->GetEncoderPosition();

GetEncoderDistance

Returns the encoder distance.

Example
double distance = encoder->GetEncoderDistance();

GetEncoderAngularVelocity

Returns the encoder angular velocity.

Example
units::radians_per_second_t velocity = encoder->GetEncoderAngularVelocity();

DigitalEncoder

Constructor

wom::DigitalEncoder(int channelA, int channelB, double ticksPerRotation, double reduction = 1)

Example

wom::DigitalEncoder *encoder = new wom::DigitalEncoder(0, 1, 4096);

CANSparkMaxEncoder

Constructor

wom::CANSparkMaxEncoder(rev::CANSparkMax *controller, double reduction = 1)

Example

wom::CANSparkMaxEncoder *encoder = new wom::CANSparkMaxEncoder(&controller);

TalonFXEncoder

Constructor

wom::TalonFXEncoder(ctre::phoenix::motorcontrol::can::TalonFX *controller, double reduction = 1)

Example

wom::TalonFXEncoder *encoder = new wom::TalonFXEncoder(&controller);

TalonSRXEncoder

Constructor

wom::TalonSRXEncoder(ctre::phoenix::motorcontrol::can::TalonSRX *controller, double ticksPerRotation, double reduction = 1);

Example

wom::TalonSRXEncoder *encoder = new wom::TalonSRXEncoder(&controller, 4096);

DutyCycleEncoder

Constructor

wom::DutyCycleEncoder(int channel, double ticksPerRotation = 1, double reduction = 1)

Example

wom::DutyCycleEncoder *encoder = new wom::DutyCycleEncoder(0, 4096);

CanEncoder

Constructor

wom::CanEncoder(int deviceNumber, double ticksPerRotation = 4095, double reduction = 1, std::string name = "Drivebase")

Example

wom::CanEncoder *encoder = new wom::CanEncoder(0, 4096);