controls  3.0.0
Public Member Functions | Protected Member Functions | List of all members
EncircleTrajectory Class Reference

Arc trajectory centred on the vehicle's starting position, with an outward spiral approach. More...

#include <EncircleTrajectory.h>

Inheritance diagram for EncircleTrajectory:
TrajectoryBase

Public Member Functions

 EncircleTrajectory (const State &origin, double radius, double turn_angle, double tangent_offset, double spiral_proportion, std::shared_ptr< Trajectory6DOFLimits > vehicle_limits, const std::string &world_frame_id="world_ned")
 Constructs and plans the encircle trajectory. 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...
 
- 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...
 

Protected Member Functions

State get_model_world (double t) const override
 Evaluates the polar trajectory and converts to a world-frame Cartesian State. 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

Arc trajectory centred on the vehicle's starting position, with an outward spiral approach.

The trajectory is planned in polar coordinates \((r, \theta)\) centred at the vehicle's starting position. \(r\) grows from \(0\) to \(r_{target}\) over the first \(\text{spiral\_proportion} \times |\Delta\theta|\) of the arc, then remains constant for the remainder. At every point the vehicle's yaw is aligned with the tangent to the instantaneous circle, plus an optional fixed offset.

Cartesian position, velocity, and acceleration are derived analytically from the polar trajectory at query time using the standard polar–Cartesian identities.

Constructor & Destructor Documentation

◆ EncircleTrajectory()

EncircleTrajectory::EncircleTrajectory ( const State origin,
double  radius,
double  turn_angle,
double  tangent_offset,
double  spiral_proportion,
std::shared_ptr< Trajectory6DOFLimits vehicle_limits,
const std::string &  world_frame_id = "world_ned" 
)

Constructs and plans the encircle trajectory.

Parameters
origin[in] Starting vehicle state; the arc is centred at this position
radius[in] Target orbit radius in metres
turn_angle[in] Total arc angle in radians; positive = CCW, negative = CW
tangent_offset[in] Yaw offset from the arc tangent in radians; 0 means the vehicle faces exactly along the direction of motion
spiral_proportion[in] Fraction of the arc over which \(r\) grows from 0 to radius; 0 = move radially outward first then arc at full radius, 1 = spiral outward throughout the entire arc
vehicle_limits[in] Per-axis velocity and acceleration limits
world_frame_id[in] TF frame ID for visualisation messages

Member Function Documentation

◆ get_expected_total_time()

double EncircleTrajectory::get_expected_total_time ( ) const
overridevirtual

Returns the total planned trajectory duration.

Returns
Duration in seconds

Implements TrajectoryBase.

◆ get_model_world()

State EncircleTrajectory::get_model_world ( double  t) const
overrideprotectedvirtual

Evaluates the polar trajectory and converts to a world-frame Cartesian State.

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

Implements TrajectoryBase.

◆ get_progress()

double EncircleTrajectory::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.

◆ is_finished()

bool EncircleTrajectory::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 EncircleTrajectory::is_valid ( ) const

Returns true if trajectory planning succeeded.

Returns
True if a valid trajectory was generated

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