LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
okapi::TwoEncoderOdometry Class Reference

#include <twoEncoderOdometry.hpp>

Inheritance diagram for okapi::TwoEncoderOdometry:
okapi::Odometry okapi::ThreeEncoderOdometry

Public Member Functions

 TwoEncoderOdometry (const TimeUtil &itimeUtil, const std::shared_ptr< ReadOnlyChassisModel > &imodel, const ChassisScales &ichassisScales, const std::shared_ptr< Logger > &ilogger=Logger::getDefaultLogger())
 TwoEncoderOdometry.
 
virtual ~TwoEncoderOdometry ()=default
 
void setScales (const ChassisScales &ichassisScales) override
 Sets the drive and turn scales.
 
void step () override
 Do one odometry step.
 
OdomState getState (const StateMode &imode=StateMode::FRAME_TRANSFORMATION) const 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.
 
std::shared_ptr< ReadOnlyChassisModelgetModel () override
 
ChassisScales getScales () override
 
- Public Member Functions inherited from okapi::Odometry
 Odometry ()=default
 Odometry.
 
virtual ~Odometry ()=default
 

Protected Member Functions

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

Protected Attributes

std::shared_ptr< Loggerlogger
 
std::unique_ptr< AbstractRaterate
 
std::unique_ptr< AbstractTimertimer
 
std::shared_ptr< ReadOnlyChassisModelmodel
 
ChassisScales chassisScales
 
OdomState state
 
std::valarray< std::int32_t > newTicks {0, 0, 0}
 
std::valarray< std::int32_t > tickDiff {0, 0, 0}
 
std::valarray< std::int32_t > lastTicks {0, 0, 0}
 
const std::int32_t maximumTickDiff {1000}
 

Detailed Description

Definition at line 18 of file twoEncoderOdometry.hpp.

Constructor & Destructor Documentation

◆ TwoEncoderOdometry()

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

TwoEncoderOdometry.

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

Parameters
itimeUtilThe TimeUtil.
imodelThe chassis model for reading sensors.
ichassisScalesThe chassis dimensions.
iloggerThe logger this instance will log to.

◆ ~TwoEncoderOdometry()

virtual okapi::TwoEncoderOdometry::~TwoEncoderOdometry ( )
virtualdefault

Member Function Documentation

◆ getModel()

std::shared_ptr< ReadOnlyChassisModel > okapi::TwoEncoderOdometry::getModel ( )
overridevirtual
Returns
The internal ChassisModel.

Implements okapi::Odometry.

◆ getScales()

ChassisScales okapi::TwoEncoderOdometry::getScales ( )
overridevirtual
Returns
The internal ChassisScales.

Implements okapi::Odometry.

◆ getState()

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

Returns the current state.

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

Implements okapi::Odometry.

◆ odomMathStep()

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

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

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

Reimplemented in okapi::ThreeEncoderOdometry.

◆ setScales()

void okapi::TwoEncoderOdometry::setScales ( const ChassisScales ichassisScales)
overridevirtual

Sets the drive and turn scales.

Implements okapi::Odometry.

◆ setState()

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

Sets a new state to be the current state.

Parameters
istateThe new state in the given format.
imodeThe mode to treat the input state as.

Implements okapi::Odometry.

◆ step()

void okapi::TwoEncoderOdometry::step ( )
overridevirtual

Do one odometry step.

Implements okapi::Odometry.

Member Data Documentation

◆ chassisScales

ChassisScales okapi::TwoEncoderOdometry::chassisScales
protected

Definition at line 78 of file twoEncoderOdometry.hpp.

◆ lastTicks

std::valarray<std::int32_t> okapi::TwoEncoderOdometry::lastTicks {0, 0, 0}
protected

Definition at line 80 of file twoEncoderOdometry.hpp.

◆ logger

std::shared_ptr<Logger> okapi::TwoEncoderOdometry::logger
protected

Definition at line 74 of file twoEncoderOdometry.hpp.

◆ maximumTickDiff

const std::int32_t okapi::TwoEncoderOdometry::maximumTickDiff {1000}
protected

Definition at line 81 of file twoEncoderOdometry.hpp.

◆ model

std::shared_ptr<ReadOnlyChassisModel> okapi::TwoEncoderOdometry::model
protected

Definition at line 77 of file twoEncoderOdometry.hpp.

◆ newTicks

std::valarray<std::int32_t> okapi::TwoEncoderOdometry::newTicks {0, 0, 0}
protected

Definition at line 80 of file twoEncoderOdometry.hpp.

◆ rate

std::unique_ptr<AbstractRate> okapi::TwoEncoderOdometry::rate
protected

Definition at line 75 of file twoEncoderOdometry.hpp.

◆ state

OdomState okapi::TwoEncoderOdometry::state
protected

Definition at line 79 of file twoEncoderOdometry.hpp.

◆ tickDiff

std::valarray<std::int32_t> okapi::TwoEncoderOdometry::tickDiff {0, 0, 0}
protected

Definition at line 80 of file twoEncoderOdometry.hpp.

◆ timer

std::unique_ptr<AbstractTimer> okapi::TwoEncoderOdometry::timer
protected

Definition at line 76 of file twoEncoderOdometry.hpp.


The documentation for this class was generated from the following file: