okapi::OffsetableControllerInput class

Base classes

template<typename T>
class ControllerInput

Constructors, destructors, conversion operators

OffsetableControllerInput(const std::shared_ptr<ControllerInput<double>>& iinput) explicit
A ControllerInput which can be tared to change the zero position.
~OffsetableControllerInput() virtual

Public functions

auto controllerGet() -> double override
Get the sensor value for use in a control loop.
void tarePosition() virtual
Sets the "absolute" zero position of this controller input to its current position.

Protected variables

std::shared_ptr<ControllerInput<double>> input
double offset

Function documentation

okapi::OffsetableControllerInput::OffsetableControllerInput(const std::shared_ptr<ControllerInput<double>>& iinput) explicit

A ControllerInput which can be tared to change the zero position.

Parameters
iinput The ControllerInput to reference.

double okapi::OffsetableControllerInput::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.

void okapi::OffsetableControllerInput::tarePosition() virtual

Sets the "absolute" zero position of this controller input to its current position.

This does nothing if the underlying controller input returns PROS_ERR.