Trajectory Interface

TODO

  1namespace autopilot {
  2
  3/**
  4 * @brief The Trajectory class is an abstract class that defines the interface
  5 * to create a trajectory section that can be followed by a trajectory or path following controller
  6*/
  7class StaticTrajectory {
  8
  9public:
 10
 11    using SharedPtr = std::shared_ptr<StaticTrajectory>;
 12    using UniquePtr = std::unique_ptr<StaticTrajectory>;
 13    using WeakPtr = std::weak_ptr<StaticTrajectory>;
 14
 15    /**
 16     * @brief This function returns the desired position of the vehicle at a given time
 17     * provided the parameter gamma which paramaterizes the trajectory
 18     * @param gamma The parameter that paramaterizes the trajectory
 19     * @return The desired position of the vehicle at a given time (Eigen::Vector3d)
 20     */ 
 21    virtual Eigen::Vector3d pd(const double gamma) const = 0;
 22
 23    /**
 24     * @brief This function returns the desired velocity of the vehicle at a given time
 25     * provided the parameter gamma which paramaterizes the trajectory
 26     * @param gamma The parameter that paramaterizes the trajectory
 27     * @return The desired velocity of the vehicle at a given time (Eigen::Vector3d)
 28     */
 29    virtual Eigen::Vector3d d_pd(const double gamma) const { return Eigen::Vector3d::Zero(); }
 30
 31    /**
 32     * @brief This function returns the desired acceleration of the vehicle at a given time
 33     * provided the parameter gamma which paramaterizes the trajectory
 34     * @param gamma The parameter that paramaterizes the trajectory
 35     * @return The desired acceleration of the vehicle at a given time (Eigen::Vector3d)
 36     */
 37    virtual Eigen::Vector3d d2_pd(const double gamma) const { return Eigen::Vector3d::Zero(); }
 38
 39    /**
 40     * @brief This function returns the desired jerk of the vehicle at a given time
 41     * provided the parameter gamma which paramaterizes the trajectory
 42     * @param gamma The parameter that paramaterizes the trajectory
 43     * @return The desired jerk of the vehicle at a given time (Eigen::Vector3d)
 44     */
 45    virtual Eigen::Vector3d d3_pd(const double gamma) const { return Eigen::Vector3d::Zero(); }
 46
 47    /**
 48     * @brief This function returns the desired snap of the vehicle at a given time
 49     * provided the parameter gamma which paramaterizes the trajectory
 50     * @param gamma The parameter that paramaterizes the trajectory
 51     * @return The desired snap of the vehicle at a given time (Eigen::Vector3d)
 52     */
 53    virtual Eigen::Vector3d d4_pd(const double gamma) const { return Eigen::Vector3d::Zero(); }
 54
 55    /**
 56     * @brief This function returns the desired yaw angle (in radians) of the vehicle at a given time
 57     * provided the parameter gamma which paramaterizes the trajectory
 58     * @param gamma The parameter that paramaterizes the trajectory
 59     * @return The desired yaw angle of the vehicle at a given time (radians)
 60     */
 61    virtual double yaw(const double gamma) const { return 0.0; }
 62
 63    /**
 64     * @brief This function returns the desired yaw rate (in radians/s) of the vehicle at a given time
 65     * provided the parameter gamma which paramaterizes the trajectory
 66     * @param gamma The parameter that paramaterizes the trajectory
 67     * @return The desired yaw rate of the vehicle at a given time (radians/s)
 68     */
 69    virtual double d_yaw(const double gamma) const { return 0.0; }
 70
 71    /**
 72     * @brief This function returns the vehicle speed in m/s at any given position in the trajectory
 73     * @param gamma The parameter that paramaterizes the trajectory
 74     * @return The desired speed of the vehicle at a given time (double)
 75     */
 76    virtual double vehicle_speed(double gamma) const = 0;
 77
 78    /**
 79     * @brief This function returns the desired vehicle speed in the trajectory frame
 80     * (Note that this is not expressed in m/s as the trajectory can be normalized between 0-1)
 81     * @param gamma The parameter that paramaterizes the trajectory
 82     * @return The desired speed of the vehicle at a given time (double)
 83     */
 84    virtual double vd(const double gamma) const = 0;
 85
 86    /**
 87     * @brief This function returns the desired vehicle acceleration in the trajectory frame
 88     * (Note that this is not expressed in m/s^2 as the trajectory can be normalized between 0-1)
 89     * @param gamma The parameter that paramaterizes the trajectory
 90     * @return The desired acceleration of the vehicle at a given time (double)
 91     */
 92    virtual double d_vd(const double gamma) const { return 0.0; };
 93
 94    /**
 95     * @brief This function returns the desired vehicle jerk in the trajectory frame
 96     * (Note that this is not expressed in m/s^3 as the trajectory can be normalized between 0-1)
 97     * @param gamma The parameter that paramaterizes the trajectory
 98     * @return The desired jerk of the vehicle at a given time (double)
 99     */
100    virtual double d2_vd(const double gamma) const { return 0.0; };
101
102    /**
103     * @brief Getter for the minimum value of the variable that parameterizes the trajectory
104     */
105    inline double min_gamma() const { return min_gamma_; }
106
107    /**
108     * @brief Getter for the maximum value of the variable that parameterizes the trajectory
109     */
110    inline double max_gamma() const { return max_gamma_; }
111
112protected:
113
114    /**
115     * @brief Construct a new Trajectory object
116     */
117    StaticTrajectory(double min_gamma=0.0, double max_gamma=1.0) : 
118        min_gamma_(min_gamma), max_gamma_(max_gamma) {}
119
120    /**
121     * @brief The minimum and maximum value of the variable that parameterizes the trajectory
122     */
123    double min_gamma_;
124    double max_gamma_;
125
126};
127
128} // namespace autopilot