00001 #ifndef RIDE_ALLOC_JAMMER_HPP
00002 #define RIDE_ALLOC_JAMMER_HPP
00003
00004 #include <list>
00005 #include <vector>
00006 #include "ride/trajectory.hpp"
00007 #include "ride/threat.hpp"
00008 #include "ride/interval.hpp"
00009
00010
00011
00012
00013 namespace jafar {
00014
00015 namespace ride {
00016
00021 class Alloc {
00022 private :
00023
00024 std::vector<Threat> threats;
00025 public :
00026 Alloc();
00027 Alloc(std::vector<Threat> threats_);
00028 Alloc(std::vector<Threat>::iterator const& itb,
00029 std::vector<Threat>::iterator const& ite);
00030 ~Alloc();
00031 bool operator == (Alloc const& a) const;
00032 std::vector<Threat> getThreats() const;
00033 std::vector<int> getThreatsId() const;
00034 bool isInAlloc(int id) const;
00035 Vect getDirection2D(Vect const& pos) const;
00036 Vect getDirection3D(Vect const& pos) const;
00037 double getAperture(Vect const& pos) const;
00038 double getCost(Vect const& pos) const;
00039 bool isValid(posTraj const& pos,
00040 std::list<Threat> const& ewList,
00041 std::list<Threat> const& visited,
00042 double apertureMax) const;
00043 };
00044
00045 typedef std::list<Alloc> localAlloc;
00046
00051 struct rangeAlloc {
00052 double start,end;
00053 localAlloc alloc;
00054 };
00055
00060 class GlobalAlloc {
00061 private :
00062 std::list<rangeAlloc> globalAlloc;
00063 public :
00064 GlobalAlloc();
00065 ~GlobalAlloc();
00066 void addLocalAlloc(localAlloc local, double start, double end);
00067 std::list<rangeAlloc> getGlobalAlloc() const;
00068 localAlloc getLocalAlloc(double dist) const;
00069 std::list<rangeAlloc> getNextLocalAlloc(double dist, double anticip) const;
00070 };
00071
00076 GlobalAlloc computeAlloc(
00077 Formation const& form,
00078 Trajectory const& traj,
00079 GlobalThreat & threats);
00080
00085 std::pair<std::list<Slot>,std::list<Alloc> > getJamEWSlotList(
00086 posTraj const& pos,
00087 Formation const& form,
00088 GlobalAlloc const& alloc,
00089 Interval const& inter,
00090 GlobalThreat & threats);
00091
00096 struct unprotectedSlot {
00097 int uavId;
00098 int threatId;
00099 };
00100
00105 std::list<unprotectedSlot> setDefensiveJamming(
00106 posTraj const& pos,
00107 Formation & form,
00108 std::list<Threat> const& threats,
00109 Interval const& inter);
00110
00111 }
00112
00113 }
00114
00115
00116 #endif