RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::Odometry Class Referenceabstract

Tracks the robot's pose on the field from its sensors. More...

#include <Odometry.hpp>

Inheritance diagram for rz::Odometry:
rz::Component rz::ThreeEncoderOdometry rz::TwoEncoderImuOdometry rz::TwoEncoderOdometry

Public Member Functions

const Pose & pose () const noexcept
void setPose (const Pose &pose) noexcept
 Sets where the robot is now, e.g. its starting position at the start of autonomous. distance() is unchanged.
Sensor< Rotation > & heading () noexcept
 The heading on the field (the pose's rotation), counterclockwise positive.
Sensor< Length > & distance () noexcept
 How far the robot has driven along its own forward axis in total; driving backward counts down.
Public Member Functions inherited from rz::Component
 Component (const Component &)=delete
Component & operator= (const Component &)=delete
 Component (Component &&)=delete
Component & operator= (Component &&)=delete
virtual ~Component ()
std::string_view name () const noexcept
 Used in log and error messages.

Protected Member Functions

 Odometry (std::string_view name)
virtual Twist displacement ()=0
 How the robot moved in its own frame since the previous tick.
Protected Member Functions inherited from rz::Component
 Component (std::string_view name)

Additional Inherited Members

Static Public Member Functions inherited from rz::Component
static Task runAll ()
 Runs the loop of every component constructed so far, in construction order, until cancelled. rz::robot runs it; tests without rz::robot run it alongside their script.

Detailed Description

Tracks the robot's pose on the field from its sensors.

Runs at sensorsUpdated(), so everything waiting for estimatorsUpdated() sees this tick's pose. Each tick the subclass measures how the robot moved in its own frame (x forward, y left, counterclockwise positive), and that is applied along a constant-curvature arc.

Wheels are distance sensors, usually TrackingWheels: a wheel that rolls forward counts up when the robot drives forward, and one that rolls sideways counts up when it moves left.

Besides the pose, it provides its heading and the distance driven as sensors, for controllers that only need one of them (a turn needs the heading, driving a distance needs the distance).

Constructor & Destructor Documentation

◆ Odometry()

rz::Odometry::Odometry ( std::string_view name)
inlineexplicitprotected

Member Function Documentation

◆ displacement()

virtual Twist rz::Odometry::displacement ( )
nodiscardprotectedpure virtual

How the robot moved in its own frame since the previous tick.

Implemented in rz::ThreeEncoderOdometry, rz::TwoEncoderImuOdometry, and rz::TwoEncoderOdometry.

◆ distance()

Sensor< Length > & rz::Odometry::distance ( )
inlinenodiscardnoexcept

How far the robot has driven along its own forward axis in total; driving backward counts down.

◆ heading()

Sensor< Rotation > & rz::Odometry::heading ( )
inlinenodiscardnoexcept

The heading on the field (the pose's rotation), counterclockwise positive.

◆ pose()

const Pose & rz::Odometry::pose ( ) const
inlinenodiscardnoexcept

◆ setPose()

void rz::Odometry::setPose ( const Pose & pose)
inlinenoexcept

Sets where the robot is now, e.g. its starting position at the start of autonomous. distance() is unchanged.


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