controls  3.0.0
EncircleTrajectory.h
Go to the documentation of this file.
1 #ifndef ENCIRCLE_TRAJECTORY_H
2 #define ENCIRCLE_TRAJECTORY_H
3 
4 #include <mav_trajectory_generation/motion_defines.h>
5 #include <mav_trajectory_generation/trajectory.h>
7 
8 #include <optional>
9 #include <string>
10 #include <vector>
11 
25 public:
40  EncircleTrajectory(const State& origin, double radius, double turn_angle, double tangent_offset,
41  double spiral_proportion, std::shared_ptr<Trajectory6DOFLimits> vehicle_limits,
42  const std::string& world_frame_id = "world_ned");
43 
49  bool is_valid() const;
50 
58  bool is_finished(double t) const override;
59 
67  double get_progress(double t) const override;
68 
74  double get_expected_total_time() const override;
75 
76 protected:
84  State get_model_world(double t) const override;
85 
86 private:
87  State origin_;
88  double radius_ = 0.0;
89  double turn_angle_ = 0.0;
90  double tangent_offset_ = 0.0;
91  double spiral_proportion_ = 1.0;
92  mav_trajectory_generation::Trajectory trajectory_;
93  bool valid_ = false;
94 
95  static constexpr double MIN_SEGMENT_TIME = 0.01;
96  static constexpr int DERIVATIVE_TO_OPTIMIZE = mav_trajectory_generation::derivative_order::ACCELERATION;
97 
102  static constexpr double ALPHA = 0.5;
103 
111  double calculate_progress(double t) const;
112 
118  std::optional<mav_trajectory_generation::Trajectory> plan_trajectory();
119 };
120 
121 #endif // ENCIRCLE_TRAJECTORY_H
Arc trajectory centred on the vehicle's starting position, with an outward spiral approach.
Definition: EncircleTrajectory.h:24
State get_model_world(double t) const override
Evaluates the polar trajectory and converts to a world-frame Cartesian State.
Definition: EncircleTrajectory.cpp:56
bool is_valid() const
Returns true if trajectory planning succeeded.
Definition: EncircleTrajectory.cpp:34
double get_progress(double t) const override
Returns trajectory progress as a fractional segment index.
Definition: EncircleTrajectory.cpp:45
double get_expected_total_time() const override
Returns the total planned trajectory duration.
Definition: EncircleTrajectory.cpp:52
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.
Definition: EncircleTrajectory.cpp:15
bool is_finished(double t) const override
Returns true if the elapsed time has reached or exceeded the trajectory duration.
Definition: EncircleTrajectory.cpp:38
Abstract base class for all trajectory representations.
Definition: TrajectoryBase.h:18
Full kinematic state of the vehicle.
Definition: Types.h:63