00001 #ifndef RIDE_TRAJECTORY_HPP
00002 #define RIDE_TRAJECTORY_HPP
00003
00004 #include <vector>
00005 #include "ride/globalConst.hpp"
00006 #include "ride/mathVect.hpp"
00007
00008
00009
00010
00011 namespace jafar {
00012
00013 namespace ride {
00014
00015 struct speedRange {
00016 double vmin;
00017 double vnom;
00018 double vmax;
00019 };
00020
00021 struct timeRange {
00022 double tmin;
00023 double tnom;
00024 double tmax;
00025 };
00026
00031 enum wpType {
00032 FLYBY,
00033 FLYOVER,
00034 FLYOVER_WITH_ROUTE
00035 };
00036
00041 enum trajType {
00042 LINE,CIRCLE
00043 };
00044
00051 class Waypoint {
00052 private :
00053 int id;
00054 std::vector<double> position;
00055 speedRange speed;
00056 timeRange time;
00057 wpType type;
00058 double heading;
00059 double nmax;
00060 bool noTurn;
00061 public :
00062 Waypoint(int id_,
00063 std::vector<double> pos,
00064 speedRange speed_,
00065 timeRange time_,
00066 wpType type_,
00067 double heading_,
00068 double nmax_);
00069 ~Waypoint();
00070 int getId() const;
00071 std::vector<double> getPosition() const;
00072 Vect getPosVect2D() const;
00073 Vect getPosVect3D() const;
00074 speedRange getSpeedRange() const;
00075 timeRange getTimeRange() const;
00076 wpType getType() const;
00077 void setType(wpType type_);
00078 double getHeading() const;
00079 Vect getHeadingVect() const;
00080 void setHeading(double heading_);
00081 void setHeading(Vect dir);
00082 double getNmax() const;
00083 bool isNoTurn() const;
00084 void setNoTurn(bool noTurn_);
00085 };
00086
00091 class TrajElt {
00092 private :
00093 trajType type;
00094 Vect startPoint;
00095 Vect endPoint;
00096 Vect center;
00097 double radius;
00098 double angle;
00099 Waypoint waypoint;
00100 public :
00101 TrajElt(Vect start,
00102 Vect end,
00103 Waypoint wp);
00104 TrajElt(Vect start,
00105 Vect end,
00106 Vect center_,
00107 double radius_,
00108 double angle_,
00109 Waypoint wp);
00110 ~TrajElt();
00111 trajType getType() const;
00112 Vect getStartPoint() const;
00113 void setStartPoint(Vect pt);
00114 Vect getEndPoint() const;
00115 void setEndPoint(Vect pt);
00116 Vect getCenter() const;
00117 double getRadius() const;
00118 double getAngle() const;
00119 Waypoint getWaypoint() const;
00120 };
00121
00133 struct posTraj {
00134 Vect pos;
00135 Vect dir;
00136 Waypoint wp;
00137 double distance;
00138 bool onTraj;
00139
00140 posTraj(Vect pos_, Vect dir_, Waypoint wp_, double dist);
00141 posTraj(Waypoint wp_);
00142 Vect pos3D() const;
00143 };
00144
00145 typedef std::vector<Waypoint> wpList;
00146
00151 class Trajectory {
00152 private :
00153 std::vector<TrajElt> traj;
00154 public :
00155 Trajectory();
00156 Trajectory(wpList const& wpl);
00157 Trajectory(std::vector<TrajElt> traj_);
00158 ~Trajectory();
00159 void computeTraj(wpList wpl);
00160 posTraj getPosition(double dist) const;
00161 posTraj getPosition(int wpId) const;
00162 posTraj getPosition(double x, double y, int wpId) const;
00163 std::vector<TrajElt> getTrajectory() const;
00164 bool isEmpty() const;
00165 };
00166
00167
00168 }
00169
00170 }
00171
00172 #endif