okapi::IntegratedEncoder class

Base classes

class ContinuousRotarySensor

Constructors, destructors, conversion operators

IntegratedEncoder(const okapi::Motor& imotor)
Integrated motor encoder.
IntegratedEncoder(std::int8_t iport, bool ireversed = false)
Integrated motor encoder.

Public functions

auto get() const -> double override
Get the current sensor value.
auto reset() -> std::int32_t override
Reset the sensor to zero.
auto controllerGet() -> double override
Get the sensor value for use in a control loop.

Protected variables

std::uint8_t port
std::int8_t reversed

Function documentation

okapi::IntegratedEncoder::IntegratedEncoder(const okapi::Motor& imotor)

Integrated motor encoder.

Parameters
imotor The motor to use the encoder from.

Uses the encoder inside the V5 motor.

okapi::IntegratedEncoder::IntegratedEncoder(std::int8_t iport, bool ireversed = false)

Integrated motor encoder.

Parameters
iport The motor's port number in the range [1, 21].
ireversed Whether the encoder is reversed.

Uses the encoder inside the V5 motor.

double okapi::IntegratedEncoder::get() const override

Get the current sensor value.

Returns the current sensor value, or PROS_ERR on a failure.

std::int32_t okapi::IntegratedEncoder::reset() override

Reset the sensor to zero.

Returns 1 on success, PROS_ERR on fail

double okapi::IntegratedEncoder::controllerGet() override

Get the sensor value for use in a control loop.

Returns the current sensor value, or PROS_ERR on a failure.

This method might be automatically called in another thread by the controller.