controls  3.0.0
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
PolyTrajectory Class Reference

Polynomial-optimised trajectory through a sequence of 6DOF waypoints. More...

#include <PolyTrajectory.h>

Inheritance diagram for PolyTrajectory:
TrajectoryBase

Public Member Functions

 PolyTrajectory (const State &origin, const std::vector< Pose > &targets, std::shared_ptr< Trajectory6DOFLimits > vehicle_limits, const std::string &world_frame_id="world_ned", bool needs_angle_unwrapping=true)
 Constructs and plans the trajectory from an origin state to a list of target poses. More...
 
bool is_valid () const
 Returns true if trajectory planning succeeded. More...
 
bool is_finished (double t) const override
 Returns true if the elapsed time has reached or exceeded the trajectory duration. More...
 
double get_progress (double t) const override
 Returns trajectory progress as a fractional segment index. More...
 
double get_expected_total_time () const override
 Returns the total planned trajectory duration. More...
 
int get_total_num_waypoints () const
 Returns the number of inter-waypoint segments in the trajectory. More...
 
- Public Member Functions inherited from TrajectoryBase
virtual ~TrajectoryBase ()=default
 
void start (double t)
 Records the start time of the trajectory. More...
 
State get_model (double t, const State &curr_state)
 Returns the desired body-frame state at time t. More...
 
geometry_msgs::msg::PoseArray get_visualization_msg (double t, double sample_hz=20.0) const
 Builds a PoseArray message sampling the trajectory for RViz visualisation. More...
 

Static Public Attributes

static constexpr double DEFAULT_MIN_SEGMENT_TIME = 0.01
 Minimum segment duration used when inserting constant-position segments (s) More...
 
static constexpr int DEFAULT_DERIVATIVE_TO_OPTIMIZE = mav_trajectory_generation::derivative_order::ACCELERATION
 Derivative order minimised by the polynomial optimiser (acceleration) More...
 

Protected Member Functions

State get_model_world (double t) const override
 Evaluates the planned polynomial trajectory at the given time. More...
 
- Protected Member Functions inherited from TrajectoryBase
double get_elapsed_time (double t) const
 Returns elapsed time since start(), or 0 if not yet started. More...
 

Additional Inherited Members

- Protected Attributes inherited from TrajectoryBase
std::shared_ptr< Trajectory6DOFLimitsvehicle_limits_
 Velocity and acceleration limits for trajectory planning. More...
 
std::string world_frame_id_
 TF frame ID embedded in visualisation message headers. More...
 
bool started_ = false
 True after start() has been called. More...
 
double start_time_ = 0.0
 ROS time at which start() was called. More...
 

Detailed Description

Polynomial-optimised trajectory through a sequence of 6DOF waypoints.

Uses mav_trajectory_generation to compute a minimum-acceleration polynomial trajectory respecting per-axis velocity and acceleration limits. Consecutive identical waypoints are handled by inserting constant-position segments. Yaw angles are unwrapped across waypoints by default to avoid discontinuities.

Constructor & Destructor Documentation

◆ PolyTrajectory()

PolyTrajectory::PolyTrajectory ( const State origin,
const std::vector< Pose > &  targets,
std::shared_ptr< Trajectory6DOFLimits vehicle_limits,
const std::string &  world_frame_id = "world_ned",
bool  needs_angle_unwrapping = true 
)

Constructs and plans the trajectory from an origin state to a list of target poses.

Parameters
origin[in] Starting vehicle state (pose, twist used as initial conditions)
targets[in] Ordered list of goal poses
vehicle_limits[in] Per-axis velocity and acceleration limits
world_frame_id[in] TF frame ID for visualisation messages
needs_angle_unwrapping[in] If true, yaw angles are unwrapped across waypoints

Member Function Documentation

◆ get_expected_total_time()

double PolyTrajectory::get_expected_total_time ( ) const
overridevirtual

Returns the total planned trajectory duration.

Returns
Duration in seconds

Implements TrajectoryBase.

◆ get_model_world()

State PolyTrajectory::get_model_world ( double  t) const
overrideprotectedvirtual

Evaluates the planned polynomial trajectory at the given time.

Parameters
t[in] Current ROS time in seconds
Returns
Desired State in the world frame at the given time

Implements TrajectoryBase.

◆ get_progress()

double PolyTrajectory::get_progress ( double  t) const
overridevirtual

Returns trajectory progress as a fractional segment index.

Parameters
t[in] Current ROS time in seconds
Returns
Progress where integer values indicate segment boundaries

Implements TrajectoryBase.

◆ get_total_num_waypoints()

int PolyTrajectory::get_total_num_waypoints ( ) const

Returns the number of inter-waypoint segments in the trajectory.

Returns
Number of segments (total waypoints minus 1)

◆ is_finished()

bool PolyTrajectory::is_finished ( double  t) const
overridevirtual

Returns true if the elapsed time has reached or exceeded the trajectory duration.

Parameters
t[in] Current ROS time in seconds
Returns
True when the trajectory is complete

Implements TrajectoryBase.

◆ is_valid()

bool PolyTrajectory::is_valid ( ) const

Returns true if trajectory planning succeeded.

Returns
True if a valid trajectory was generated

Member Data Documentation

◆ DEFAULT_DERIVATIVE_TO_OPTIMIZE

constexpr int PolyTrajectory::DEFAULT_DERIVATIVE_TO_OPTIMIZE = mav_trajectory_generation::derivative_order::ACCELERATION
staticconstexpr

Derivative order minimised by the polynomial optimiser (acceleration)

◆ DEFAULT_MIN_SEGMENT_TIME

constexpr double PolyTrajectory::DEFAULT_MIN_SEGMENT_TIME = 0.01
staticconstexpr

Minimum segment duration used when inserting constant-position segments (s)


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