GAMS  1.2.2
ZoneCoverage.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ALGORITHMS_ZONE_COVERAGE_H_
55 #define _GAMS_ALGORITHMS_ZONE_COVERAGE_H_
56 
57 #include <vector>
58 #include <string>
59 
60 #include "gams/variables/Sensor.h"
63 #include "gams/variables/Self.h"
65 #include "gams/pose/Position.h"
67 #include "madara/knowledge/containers/Integer.h"
68 #include "madara/knowledge/containers/Barrier.h"
70 
71 namespace gams
72 {
73  namespace algorithms
74  {
86  {
87  public:
88 
103  ZoneCoverage (
104  const std::string &protectors,
105  const std::string &assets,
106  const std::string &enemies,
107  const std::string &formation,
108  double buffer, double distance,
109  madara::knowledge::KnowledgeBase * knowledge = 0,
110  platforms::BasePlatform * platform = 0,
111  variables::Sensors * sensors = 0,
112  variables::Self * self = 0);
113 
117  ~ZoneCoverage ();
118 
123  void operator= (const ZoneCoverage & rhs);
124 
129  virtual int analyze (void);
130 
135  virtual int execute (void);
136 
141  virtual int plan (void);
142 
143  protected:
146 
147  std::string frame_;
148 
152 
156 
157  std::string formation_;
158 
159  double buffer_;
160 
161  double distance_;
162 
163  int index_;
164 
165  typedef pose::Position (ZoneCoverage::*formation_func) () const;
166 
167  formation_func form_func_;
168 
169  pose::Position line_formation () const;
170  pose::Position arc_formation () const;
171  pose::Position onion_formation () const;
172 
173  static formation_func get_form_func (const std::string &form_name);
174 
175  typedef std::vector<madara::knowledge::containers::NativeDoubleArray> MadaraArrayVec;
176 
177  MadaraArrayVec asset_loc_cont_;
178  MadaraArrayVec enemy_loc_cont_;
179 
180  std::vector<pose::Position> asset_locs_;
181  std::vector<pose::Position> enemy_locs_;
183 
184  private:
185  void update_arrays (const gams::groups::AgentVector &names,
186  MadaraArrayVec &arrays) const;
187  void update_locs (const MadaraArrayVec &arrays,
188  std::vector<pose::Position> &locs) const;
189  };
190 
195  {
196  public:
197 
215  virtual BaseAlgorithm * create (
216  const madara::knowledge::KnowledgeMap & args,
217  madara::knowledge::KnowledgeBase * knowledge,
218  platforms::BasePlatform * platform,
219  variables::Sensors * sensors,
220  variables::Self * self,
221  variables::Agents * agents);
222  };
223  }
224 }
225 
226 #endif // _GAMS_ALGORITHMS_FORMATION_SYNC_H_
Base class for algorithm factories that classes derived from.
gams::groups::AgentVector enemies_members_
Definition: ZoneCoverage.h:155
std::vector< madara::knowledge::containers::NativeDoubleArray > MadaraArrayVec
Definition: ZoneCoverage.h:175
std::vector< std::string > AgentVector
A vector of agent names.
Definition: GroupBase.h:71
An algorithm for covering an area in formation with a synchronous model of computation.
Definition: ZoneCoverage.h:85
Copyright (c) 2014 Carnegie Mellon University.
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
The base platform for all platforms to use.
Definition: BasePlatform.h:190
Copyright (c) 2014 Carnegie Mellon University.
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Copyright (c) 2014 Carnegie Mellon University.
gams::groups::GroupBase * assets_
Definition: ZoneCoverage.h:150
gams::groups::AgentVector protectors_members_
Definition: ZoneCoverage.h:153
Contains all GAMS-related tools, classes and code.
gams::groups::AgentVector assets_members_
Definition: ZoneCoverage.h:154
A container for self referencing information.
Definition: Self.h:69
Base class for a group of agents.
Definition: GroupBase.h:90
std::vector< pose::Position > asset_locs_
Definition: ZoneCoverage.h:180
#define GAMS_EXPORT
Definition: GamsExport.h:20
gams::groups::GroupBase * protectors_
Definition: ZoneCoverage.h:149
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:94
Copyright (c) 2014 Carnegie Mellon University.
A repository for group factories.
A factory class for creating Formation Coverage algorithms.
Definition: ZoneCoverage.h:194
Copyright (c) 2016 Carnegie Mellon University.
std::vector< pose::Position > enemy_locs_
Definition: ZoneCoverage.h:181
gams::groups::GroupBase * enemies_
Definition: ZoneCoverage.h:151
Copyright (c) 2014 Carnegie Mellon University.
groups::GroupFactoryRepository group_factory_
factory for interacting with user-defined groups
Definition: ZoneCoverage.h:145