4#include "RaidZeroLib/api/Geometry/Pose.hpp"
5#include "RaidZeroLib/api/Geometry/Rotation.hpp"
6#include "RaidZeroLib/api/Geometry/Twist.hpp"
7#include "RaidZeroLib/api/Hardware/Sensor.hpp"
8#include "RaidZeroLib/api/Runtime/Component.hpp"
27 [[nodiscard]]
const Pose&
pose() const noexcept {
return pose_; }
46 class HeadingEstimate final :
public Sensor<Rotation> {
48 explicit HeadingEstimate(
const Odometry& odometry) : odometry(odometry) {}
49 [[nodiscard]]
bool connected()
const override {
return true; }
58 class DistanceEstimate final :
public Sensor<Length> {
60 explicit DistanceEstimate(
const Odometry& odometry) : odometry(odometry) {}
61 [[nodiscard]]
bool connected()
const override {
return true; }
64 [[nodiscard]]
Length raw()
const override {
return odometry.distance_; }
74 HeadingEstimate headingSensor{*
this};
75 DistanceEstimate distanceSensor{*
this};
std::string_view name() const noexcept
Used in log and error messages.
Definition Component.hpp:30
Component(const Component &)=delete
Tracks the robot's pose on the field from its sensors.
Definition Odometry.hpp:25
void setPose(const Pose &pose) noexcept
Sets where the robot is now, e.g. its starting position at the start of autonomous....
Definition Odometry.hpp:31
Sensor< Length > & distance() noexcept
How far the robot has driven along its own forward axis in total; driving backward counts down.
Definition Odometry.hpp:37
virtual Twist displacement()=0
How the robot moved in its own frame since the previous tick.
Sensor< Rotation > & heading() noexcept
The heading on the field (the pose's rotation), counterclockwise positive.
Definition Odometry.hpp:34
Odometry(std::string_view name)
Definition Odometry.hpp:40
const Pose & pose() const noexcept
Definition Odometry.hpp:27
Rigid-body pose in SE(2) with unit-safe position and rotation.
Definition Pose.hpp:20
const Rotation & getRotation() const noexcept
Access the heading.
Immutable planar rotation about the Z axis.
Definition Rotation.hpp:16
A reading from hardware, or computed from other sensors.
Definition Sensor.hpp:25
virtual Rotation raw() const=0
virtual bool connected() const=0
Differential motion (twist) in SE(2) space.
Definition Twist.hpp:16
corral::Task< T > Task
Lazy: nothing runs until it is co_awaited.
Definition Task.hpp:17
au::QuantityD< au::Meters > Length
Definition Units.hpp:9
Definition DriverControl.hpp:11