Represents a 2D pose containing translational and rotational elements.
More...
#include <frc/geometry/Pose2d.h>
Represents a 2D pose containing translational and rotational elements.
◆ Pose2d() [1/3]
constexpr frc::Pose2d::Pose2d |
( |
| ) |
|
|
constexprdefault |
Constructs a pose at the origin facing toward the positive X axis.
◆ Pose2d() [2/3]
Constructs a pose with the specified translation and rotation.
- Parameters
-
translation | The translational component of the pose. |
rotation | The rotational component of the pose. |
◆ Pose2d() [3/3]
constexpr frc::Pose2d::Pose2d |
( |
units::meter_t |
x, |
|
|
units::meter_t |
y, |
|
|
Rotation2d |
rotation |
|
) |
| |
|
constexpr |
Constructs a pose with x and y translations instead of a separate Translation2d.
- Parameters
-
x | The x component of the translational component of the pose. |
y | The y component of the translational component of the pose. |
rotation | The rotational component of the pose. |
◆ Exp()
Obtain a new Pose2d from a (constant curvature) velocity.
See https://file.tavsys.net/control/controls-engineering-in-frc.pdf section 10.2 "Pose exponential" for a derivation.
The twist is a change in pose in the robot's coordinate frame since the previous pose update. When the user runs exp() on the previous known field-relative pose with the argument being the twist, the user will receive the new field-relative pose.
"Exp" represents the pose exponential, which is solving a differential equation moving the pose forward in time.
- Parameters
-
twist | The change in pose in the robot's coordinate frame since the previous pose update. For example, if a non-holonomic robot moves forward 0.01 meters and changes angle by 0.5 degrees since the previous pose update, the twist would be Twist2d{0.01_m, 0_m, 0.5_deg}. |
- Returns
- The new pose of the robot.
◆ Log()
Returns a Twist2d that maps this pose to the end pose.
If c is the output of a.Log(b), then a.Exp(c) would yield b.
- Parameters
-
end | The end pose for the transformation. |
- Returns
- The twist that maps this to end.
◆ Nearest() [1/2]
Pose2d frc::Pose2d::Nearest |
( |
std::initializer_list< Pose2d > |
poses | ) |
const |
Returns the nearest Pose2d from a collection of poses.
- Parameters
-
poses | The collection of poses. |
- Returns
- The nearest Pose2d from the collection.
◆ Nearest() [2/2]
Pose2d frc::Pose2d::Nearest |
( |
std::span< const Pose2d > |
poses | ) |
const |
Returns the nearest Pose2d from a collection of poses.
- Parameters
-
poses | The collection of poses. |
- Returns
- The nearest Pose2d from the collection.
◆ operator*()
constexpr Pose2d frc::Pose2d::operator* |
( |
double |
scalar | ) |
const |
|
constexpr |
Multiplies the current pose by a scalar.
- Parameters
-
- Returns
- The new scaled Pose2d.
◆ operator+()
Transforms the pose by the given transformation and returns the new transformed pose.
[x_new] [cos, -sin, 0][transform.x]
[y_new] += [sin, cos, 0][transform.y]
[t_new] [ 0, 0, 1][transform.t]
- Parameters
-
other | The transform to transform the pose by. |
- Returns
- The transformed pose.
◆ operator-()
Returns the Transform2d that maps the one pose to another.
- Parameters
-
other | The initial pose of the transformation. |
- Returns
- The transform that maps the other pose to the current pose.
◆ operator/()
constexpr Pose2d frc::Pose2d::operator/ |
( |
double |
scalar | ) |
const |
|
constexpr |
Divides the current pose by a scalar.
- Parameters
-
- Returns
- The new scaled Pose2d.
◆ operator==()
bool frc::Pose2d::operator== |
( |
const Pose2d & |
| ) |
const |
|
default |
Checks equality between this Pose2d and another object.
◆ RelativeTo()
Pose2d frc::Pose2d::RelativeTo |
( |
const Pose2d & |
other | ) |
const |
Returns the current pose relative to the given pose.
This function can often be used for trajectory tracking or pose stabilization algorithms to get the error between the reference and the current pose.
- Parameters
-
other | The pose that is the origin of the new coordinate frame that the current pose will be converted into. |
- Returns
- The current pose relative to the new origin pose.
◆ Rotation()
constexpr const Rotation2d & frc::Pose2d::Rotation |
( |
| ) |
const |
|
inlineconstexpr |
Returns the underlying rotation.
- Returns
- Reference to the rotational component of the pose.
◆ TransformBy()
Transforms the pose by the given transformation and returns the new pose.
See + operator for the matrix multiplication performed.
- Parameters
-
other | The transform to transform the pose by. |
- Returns
- The transformed pose.
◆ Translation()
constexpr const Translation2d & frc::Pose2d::Translation |
( |
| ) |
const |
|
inlineconstexpr |
Returns the underlying translation.
- Returns
- Reference to the translational component of the pose.
◆ X()
constexpr units::meter_t frc::Pose2d::X |
( |
| ) |
const |
|
inlineconstexpr |
Returns the X component of the pose's translation.
- Returns
- The x component of the pose's translation.
◆ Y()
constexpr units::meter_t frc::Pose2d::Y |
( |
| ) |
const |
|
inlineconstexpr |
Returns the Y component of the pose's translation.
- Returns
- The y component of the pose's translation.
The documentation for this class was generated from the following files: