okapi::ADIMotor class

Base classes

template<typename T>
class ControllerOutput

Constructors, destructors, conversion operators

ADIMotor(std::uint8_t iport, bool ireverse = false, const std::shared_ptr<Logger>& logger = Logger::getDefaultLogger())
A motor in an ADI port.
ADIMotor(std::pair<std::uint8_t, std::uint8_t> iports, bool ireverse = false, const std::shared_ptr<Logger>& logger = Logger::getDefaultLogger())
A motor in an ADI port.

Public functions

void moveVoltage(std::int8_t ivoltage) const virtual
Set the voltage to the motor.
void controllerSet(double ivalue) override
Writes the value of the controller output.

Protected variables

std::uint8_t smartPort
std::uint8_t port
std::int8_t reversed

Function documentation

okapi::ADIMotor::ADIMotor(std::uint8_t iport, bool ireverse = false, const std::shared_ptr<Logger>& logger = Logger::getDefaultLogger())

A motor in an ADI port.

Parameters
iport The ADI port number ([1, 8], [a, h], [A, H]).
ireverse Whether the motor is reversed.
logger The logger that initialization warnings will be logged to.
auto mtr = ADIMotor('A');
auto reversedMtr = ADIMotor('A', true);

okapi::ADIMotor::ADIMotor(std::pair<std::uint8_t, std::uint8_t> iports, bool ireverse = false, const std::shared_ptr<Logger>& logger = Logger::getDefaultLogger())

A motor in an ADI port.

Parameters
iports The ports the motor is plugged in to in the order {smart port, motor port}. The smart port is the smart port number ([1, 21]). The motor port is the ADI port number ([1, 8], [a, h], [A, H]).
ireverse Whether the motor is reversed.
logger The logger that initialization warnings will be logged to.
auto mtr = ADIMotor({1, 'A'}, false);
auto reversedMtr = ADIMotor({1, 'A'}, true);

void okapi::ADIMotor::moveVoltage(std::int8_t ivoltage) const virtual

Set the voltage to the motor.

Parameters
ivoltage voltage in the range [-127, 127].

void okapi::ADIMotor::controllerSet(double ivalue) override

Writes the value of the controller output.

Parameters
ivalue the controller's output in the range [-1, 1]

This method might be automatically called in another thread by the controller. The range of input values is expected to be [-1, 1].