RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::Pose Class Reference

Rigid-body pose in SE(2) with unit-safe position and rotation. More...

#include <Pose.hpp>

Public Member Functions

constexpr Pose () noexcept=default
 Constructs the identity pose at the origin with zero heading.
 Pose (const Point &point, const Rotation &rotation) noexcept
 Constructs from a point and rotation.
 Pose (Length x, Length y, const Rotation &rotation) noexcept
 Constructs from Cartesian components and a rotation.
 Pose (Length x, Length y, Angle angle) noexcept
 Constructs from Cartesian components and an angle.
const Point & getPoint () const noexcept
 Access the position.
const Rotation & getRotation () const noexcept
 Access the heading.
Length X () const noexcept
 X position (meters).
Length Y () const noexcept
 Y position (meters).
Angle Theta () const noexcept
 Heading angle (radians, in (-π, π]).
Pose transformBy (const Transform &rhs) const noexcept
 Applies a rigid transform to this pose (pose ⊕ transform).
Transform relativeTo (const Pose &rhs) const noexcept
 Computes the transform that takes rhs into *this (rhs ⊖ this).
Pose exp (const Twist &rhs) const noexcept
 SE(2) exponential map: integrates a body-frame twist.
Twist log (const Pose &rhs) const noexcept
 SE(2) logarithmic map: body-frame twist from this pose to rhs.
bool isApprox (const Pose &rhs) const noexcept
 Approximate equality of both position and heading.

Detailed Description

Rigid-body pose in SE(2) with unit-safe position and rotation.

Pose stores a 2D position (Point, meters) and a heading (Rotation, radians). It provides composition relative to a Transform, relative transforms between poses, and SE(2) exponential / logarithmic maps for integrating small twists or extracting differential motion.

Headings are right-handed, counter-clockwise about +Z, normalized to (-180, 180] degrees.

Constructor & Destructor Documentation

◆ Pose() [1/4]

rz::Pose::Pose ( )
constexprdefaultnoexcept

Constructs the identity pose at the origin with zero heading.

◆ Pose() [2/4]

rz::Pose::Pose ( const Point & point,
const Rotation & rotation )
noexcept

Constructs from a point and rotation.

Parameters
pointPosition in meters.
rotationHeading (normalized to (-π, π]).

◆ Pose() [3/4]

rz::Pose::Pose ( Length x,
Length y,
const Rotation & rotation )
noexcept

Constructs from Cartesian components and a rotation.

Parameters
xX coordinate (meters).
yY coordinate (meters).
rotationHeading (normalized to (-π, π]).

◆ Pose() [4/4]

rz::Pose::Pose ( Length x,
Length y,
Angle angle )
noexcept

Constructs from Cartesian components and an angle.

Parameters
xX coordinate (meters).
yY coordinate (meters).
angleHeading angle (radians), normalized to (-π, π].

Member Function Documentation

◆ exp()

Pose rz::Pose::exp ( const Twist & rhs) const
noexcept

SE(2) exponential map: integrates a body-frame twist.

For a small body-frame twist (dX, dY, dTheta), returns this ⊕ Exp(dX, dY, dTheta). Uses a small-angle approximation for |dTheta| < 1e-9 to maintain numerical stability.

Parameters
rhsBody-frame twist.
Returns
New pose after applying the twist.

◆ getPoint()

const Point & rz::Pose::getPoint ( ) const
noexcept

Access the position.

◆ getRotation()

const Rotation & rz::Pose::getRotation ( ) const
noexcept

Access the heading.

◆ isApprox()

bool rz::Pose::isApprox ( const Pose & rhs) const
noexcept

Approximate equality of both position and heading.

Parameters
rhsOther pose.
Returns
true if points are within 1e-9 m and headings within 1e-9 rad.

◆ log()

Twist rz::Pose::log ( const Pose & rhs) const
noexcept

SE(2) logarithmic map: body-frame twist from this pose to rhs.

Computes Log(transform), where transform = rhs.relativeTo(*this). Uses a stable formula with a small-angle branch for |dTheta| < 1e-9.

Parameters
rhsTarget pose.
Returns
Body-frame twist that approximately maps *this to rhs.

◆ relativeTo()

Transform rz::Pose::relativeTo ( const Pose & rhs) const
noexcept

Computes the transform that takes rhs into *this (rhs ⊖ this).

Parameters
rhsReference pose to measure from.
Returns
Transform such that rhs.transformBy(result) == *this.

◆ Theta()

Angle rz::Pose::Theta ( ) const
noexcept

Heading angle (radians, in (-π, π]).

◆ transformBy()

Pose rz::Pose::transformBy ( const Transform & rhs) const
noexcept

Applies a rigid transform to this pose (pose ⊕ transform).

Equivalent to: rotate the transform’s translation by this pose’s heading, then translate, and add the headings.

Parameters
rhsTransform to apply in this pose’s local frame.
Returns
Resulting pose.

◆ X()

Length rz::Pose::X ( ) const
noexcept

X position (meters).

◆ Y()

Length rz::Pose::Y ( ) const
noexcept

Y position (meters).


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