controls  3.0.0
TrajectoryBase.h
Go to the documentation of this file.
1 #ifndef TRAJECTORY_BASE_H
2 #define TRAJECTORY_BASE_H
3 
5 #include <utils/Transforms.h>
6 
7 #include <memory>
8 
19 public:
20  virtual ~TrajectoryBase() = default;
21 
27  void start(double t);
28 
40  State get_model(double t, const State& curr_state);
41 
49  virtual bool is_finished(double t) const = 0;
50 
59  virtual double get_progress(double t) const = 0;
60 
66  virtual double get_expected_total_time() const = 0;
67 
76  geometry_msgs::msg::PoseArray get_visualization_msg(double t, double sample_hz = 20.0) const;
77 
78 protected:
80  std::shared_ptr<Trajectory6DOFLimits> vehicle_limits_;
81 
83  std::string world_frame_id_;
84 
86  bool started_ = false;
87 
89  double start_time_ = 0.0;
90 
98  double get_elapsed_time(double t) const;
99 
107  virtual State get_model_world(double t) const = 0;
108 
109 private:
118  static State convert_model_to_body_frame(const State& model_world, const State& curr_state);
119 };
120 
121 #endif // TRAJECTORY_BASE_H
Abstract base class for all trajectory representations.
Definition: TrajectoryBase.h:18
double start_time_
ROS time at which start() was called.
Definition: TrajectoryBase.h:89
State get_model(double t, const State &curr_state)
Returns the desired body-frame state at time t.
Definition: TrajectoryBase.cpp:13
bool started_
True after start() has been called.
Definition: TrajectoryBase.h:86
virtual bool is_finished(double t) const =0
Returns true if the trajectory has completed at time t.
virtual ~TrajectoryBase()=default
std::shared_ptr< Trajectory6DOFLimits > vehicle_limits_
Velocity and acceleration limits for trajectory planning.
Definition: TrajectoryBase.h:80
void start(double t)
Records the start time of the trajectory.
Definition: TrajectoryBase.cpp:8
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.
Definition: TrajectoryBase.cpp:54
std::string world_frame_id_
TF frame ID embedded in visualisation message headers.
Definition: TrajectoryBase.h:83
virtual State get_model_world(double t) const =0
Evaluates the desired world-frame state at the given ROS time.
double get_elapsed_time(double t) const
Returns elapsed time since start(), or 0 if not yet started.
Definition: TrajectoryBase.cpp:84
virtual double get_expected_total_time() const =0
Returns the total expected duration of the trajectory.
virtual double get_progress(double t) const =0
Returns fractional trajectory progress at time t.
Full kinematic state of the vehicle.
Definition: Types.h:63