00001 #ifndef RIDE_FORMATION_HPP
00002 #define RIDE_FORMATION_HPP
00003
00004 #include <vector>
00005 #include <list>
00006 #include "ride/globalConst.hpp"
00007 #include "ride/mathVect.hpp"
00008
00009
00010
00011
00012 namespace jafar {
00013
00014 namespace ride {
00015
00022 class Slot {
00023 private :
00024 std::vector<double> position;
00025 public :
00026 Slot(double pos_x = 0., double pos_y = 0., double pos_z = 0.);
00027 Slot(Vect pos);
00028 void setPosition(double pos_x, double pos_y, double pos_z);
00029 void setPosition(Vect pos);
00030 std::vector<double> getPosition() const;
00031 Vect getPosVect2D() const;
00032 Vect getPosVect3D() const;
00033 };
00034
00039 enum UAVType {
00040 FIGHTER,BOMBER,JAMMER,RECO
00041 };
00042
00047 struct tagSlot {
00048 Slot slot;
00049 std::list<UAVType> typeTag;
00050 std::list<int> idTag;
00051
00054 bool isValid(int id, UAVType type) const;
00055 };
00056
00061 class State {
00062 private :
00063 int id;
00064 std::vector<double> position;
00065 std::vector<double> speed;
00066 double heading;
00067 double distance;
00068 double time;
00069 UAVType type;
00070 std::vector<int> jamEWid;
00071 std::vector<int> jamTFid;
00072 double reward;
00073 bool freeFlight;
00074 Slot slot;
00075 public :
00076 State();
00077 State(int id, UAVType type_);
00078 ~State();
00079 int getId() const;
00080 UAVType getType() const;
00081 void setState(std::vector<double> pos, std::vector<double> speed_);
00082 void setState(double x, double y, double z, double vx, double vy, double vz);
00083 std::vector<double> getPosition() const;
00084 Vect getPosVect2D() const;
00085 Vect getPosVect3D() const;
00086 std::vector<double> getSpeed() const;
00087 Vect getSpeedVect2D() const;
00088 Vect getSpeedVect3D() const;
00089 void setHeading(double heading_);
00090 double getHeading() const;
00091 void setDistance(double distance_);
00092 double getDistance() const;
00093 void setTime(double time_);
00094 double getTime() const;
00095 void setJamEWid(std::vector<int> threatId);
00096 bool isJamEWActif() const;
00097 std::vector<int> getJamEWid() const;
00098 void clearJamEWid();
00099 void setJamTFid(int id, int sector);
00100 void setJamTFid(std::vector<int> threatId);
00101 int getJamTFid(int sector) const;
00102 std::vector<int> getJamTFid() const;
00103 void clearJamTFid();
00104 void setReward(double reward_);
00105 double getReward() const;
00106 void setFreeFlight(bool flight);
00107 bool isFreeFlight() const;
00108 void setSlot(Slot slot_);
00109 Slot getSlot() const;
00110 };
00111
00116 class FormationCommand {
00117 private :
00118 int id;
00119 Slot slot;
00120 std::vector<int> jamEWid;
00121 std::vector<int> jamTFid;
00122 public :
00123 FormationCommand(int id_,
00124 Slot slot_,
00125 std::vector<int> jamEWid_,
00126 std::vector<int> jamTFid_);
00127 ~FormationCommand();
00128 int getId() const;
00129 std::vector<double> getSlotPosition() const;
00130 Slot getSlot() const;
00131 std::vector<int> getJamEWid() const;
00132 std::vector<int> getJamTFid() const;
00133 };
00134
00139 class Formation {
00140 private :
00141 int id;
00142 std::list<State> formation;
00143 double distance;
00144 double time;
00145 double Dmin;
00146 double Dmax;
00147 double corridor;
00148 int size,nbJammer;
00149 public :
00150 Formation(int id_);
00151 Formation(int id_, std::list<State> form);
00152 ~Formation();
00153 bool addUAV(State uav);
00154 bool removeUAV(int uavId);
00155 State getUAV(int uavId) const;
00156 std::list<State> getFormation() const;
00157 std::list<State> getEstimatedFormation() const;
00158 void setFormation(std::list<State> form);
00159 void setFormation(State state);
00160 void setDistance(double dist);
00161 double getDistance() const;
00162 double getDistanceAuto() const;
00163 void setTime(double time_);
00164 double getTime() const;
00165 Vect getPosition() const;
00166 Vect getEstimatedPosition() const;
00167 void setDmin(double Dmin_);
00168 void setDmax(double Dmax_);
00169 void setCorridor(double corridor_);
00170 double getDmin() const;
00171 double getDmax() const;
00172 double getCorridor() const;
00173 int getSize() const;
00174 int getNbJammer() const;
00175 bool isOnSlot(bool useEstimate) const;
00176 std::list<FormationCommand> getFormationCommand() const;
00177 void setFormationCommand(FormationCommand cmd);
00178 void setFormationCommand(std::list<FormationCommand> cmdList);
00179 };
00180
00181 }
00182
00183 }
00184
00185 #endif
00186