okapi::TwoEncoderOdometry class

Base classes

class Odometry

Derived classes

class ThreeEncoderOdometry

Constructors, destructors, conversion operators

TwoEncoderOdometry(const TimeUtil& itimeUtil, const std::shared_ptr<ReadOnlyChassisModel>& imodel, const ChassisScales& ichassisScales, const std::shared_ptr<Logger>& ilogger = Logger::getDefaultLogger())
TwoEncoderOdometry.
~TwoEncoderOdometry() defaulted virtual

Public functions

void setScales(const ChassisScales& ichassisScales) override
Sets the drive and turn scales.
void step() override
Do one odometry step.
auto getState(const StateMode& imode = StateMode::FRAME_TRANSFORMATION) const -> OdomState override
Returns the current state.
void setState(const OdomState& istate, const StateMode& imode = StateMode::FRAME_TRANSFORMATION) override
Sets a new state to be the current state.
auto getModel() -> std::shared_ptr<ReadOnlyChassisModel> override
auto getScales() -> ChassisScales override

Protected functions

auto odomMathStep(const std::valarray<std::int32_t>& itickDiff, const QTime& ideltaT) -> OdomState virtual
Does the math, side-effect free, for one odom step.

Protected variables

std::shared_ptr<Logger> logger
std::unique_ptr<AbstractRate> rate
std::unique_ptr<AbstractTimer> timer
std::shared_ptr<ReadOnlyChassisModel> model
ChassisScales chassisScales
OdomState state
std::valarray<std::int32_t> newTicks
std::valarray<std::int32_t> tickDiff
std::valarray<std::int32_t> lastTicks
const std::int32_t maximumTickDiff

Function documentation

okapi::TwoEncoderOdometry::TwoEncoderOdometry(const TimeUtil& itimeUtil, const std::shared_ptr<ReadOnlyChassisModel>& imodel, const ChassisScales& ichassisScales, const std::shared_ptr<Logger>& ilogger = Logger::getDefaultLogger())

TwoEncoderOdometry.

Parameters
itimeUtil The TimeUtil.
imodel The chassis model for reading sensors.
ichassisScales The chassis dimensions.
ilogger The logger this instance will log to.

Tracks the movement of the robot and estimates its position in coordinates relative to the start (assumed to be (0, 0, 0)).

OdomState okapi::TwoEncoderOdometry::getState(const StateMode& imode = StateMode::FRAME_TRANSFORMATION) const override

Returns the current state.

Parameters
imode The mode to return the state in.
Returns The current state in the given format.

void okapi::TwoEncoderOdometry::setState(const OdomState& istate, const StateMode& imode = StateMode::FRAME_TRANSFORMATION) override

Sets a new state to be the current state.

Parameters
istate The new state in the given format.
imode The mode to treat the input state as.

std::shared_ptr<ReadOnlyChassisModel> okapi::TwoEncoderOdometry::getModel() override

Returns The internal ChassisModel.

ChassisScales okapi::TwoEncoderOdometry::getScales() override

Returns The internal ChassisScales.

OdomState okapi::TwoEncoderOdometry::odomMathStep(const std::valarray<std::int32_t>& itickDiff, const QTime& ideltaT) virtual protected

Does the math, side-effect free, for one odom step.

Parameters
itickDiff The tick difference from the previous step to this step.
ideltaT The time difference from the previous step to this step.
Returns The newly computed OdomState.