Brick
Loading...
Searching...
No Matches
Trajectory Class Reference

#include <trajectory.h>

Description

Represents a time-parameterized 2D motion trajectory.

Stores discrete State samples (time, velocity, acceleration, pose, curvature) along a parameterized path.

Classes

struct  State
 Represents a single discrete state sample along a trajectory. More...

Public Member Functions

 Trajectory ()=default
 Default constructor.
 Trajectory (std::vector< State > states)
 Constructs a Trajectory from a vector of State samples.
bool empty () const
units::Time total_time () const
const std::vector< State > & states () const
const std::vector< TrajectoryEvent > & events () const
void set_events (std::vector< TrajectoryEvent > events)
 Attaches a vector of time-parameterized events to the trajectory.
units::Time time_from_distance (units::Length s) const
 Interpolates the time at which a given arc distance is reached.
State sample (units::Time t) const
 Samples trajectory state at timestamp t using binary search interpolation.
Trajectory relative_to (const Pose2d &pose) const
 Expresses all poses in the trajectory relative to a reference pose.
Trajectory mirror (const Pose2d &line_pose) const
 Mirrors the trajectory across the line represented by a pose.
Trajectory rotate_center (Translation2d center=Translation2d(3_tiles, 3_tiles)) const
 Rotates the trajectory 180 degrees around a center point (Point reflection).
Trajectory reverse () const
 Returns a time-reversed version of this trajectory (traces the path from end to start).
Trajectory operator+ (const Trajectory &other) const
 Concatenates two trajectories end-to-end.
Pose2d initial_pose () const
bool operator== (const Trajectory &other) const
 Checks equality between two trajectories.

Constructor & Destructor Documentation

◆ Trajectory()

Trajectory::Trajectory ( std::vector< State > states)
inlineexplicit

Constructs a Trajectory from a vector of State samples.

Parameters
statesVector of time-parameterized states.

Member Function Documentation

◆ empty()

bool Trajectory::empty ( ) const
inline
Returns
True if the trajectory contains no state samples.

◆ events()

const std::vector< TrajectoryEvent > & Trajectory::events ( ) const
inline
Returns
Vector of events attached to this trajectory.

◆ initial_pose()

Pose2d Trajectory::initial_pose ( ) const
inline
Returns
Initial pose at t = 0s.

◆ mirror()

Trajectory Trajectory::mirror ( const Pose2d & line_pose) const
inline

Mirrors the trajectory across the line represented by a pose.

The pose translation is any point on the mirror line, and the pose rotation is the direction of the line.

Parameters
line_poseA point and direction defining the mirror line.
Returns
Mirrored Trajectory.

◆ operator+()

Trajectory Trajectory::operator+ ( const Trajectory & other) const
inline

Concatenates two trajectories end-to-end.

Parameters
otherSecondary trajectory to append.
Returns
Combined Trajectory.

◆ relative_to()

Trajectory Trajectory::relative_to ( const Pose2d & pose) const
inline

Expresses all poses in the trajectory relative to a reference pose.

Parameters
poseReference origin pose.
Returns
Relative Trajectory.

◆ reverse()

Trajectory Trajectory::reverse ( ) const
inline

Returns a time-reversed version of this trajectory (traces the path from end to start).

Returns
Reversed Trajectory.

◆ rotate_center()

Trajectory Trajectory::rotate_center ( Translation2d center = Translation2d(3_tiles, 3_tiles)) const
inline

Rotates the trajectory 180 degrees around a center point (Point reflection).

Parameters
centerThe center point (default 3 tiles from each field edge).
Returns
Rotated Trajectory.

◆ sample()

State Trajectory::sample ( units::Time t) const
inline

Samples trajectory state at timestamp t using binary search interpolation.

Parameters
tTarget timestamp.
Returns
Interpolated State struct.

◆ states()

const std::vector< State > & Trajectory::states ( ) const
inline
Returns
Reference to the internal vector of State samples.

◆ time_from_distance()

units::Time Trajectory::time_from_distance ( units::Length s) const
inline

Interpolates the time at which a given arc distance is reached.

Parameters
sArc distance along trajectory.
Returns
Interpolated time.

◆ total_time()

units::Time Trajectory::total_time ( ) const
inline
Returns
Total duration of the trajectory.

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