GAMS  1.4.0
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 
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 
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 
172 
173  static formation_func get_form_func(const std::string &form_name);
174 
175  typedef std::vector<madara::knowledge::containers::NativeDoubleArray> MadaraArrayVec;
176 
179 
180  std::vector<pose::Position> asset_locs_;
181  std::vector<pose::Position> enemy_locs_;
183 
184  private:
186  MadaraArrayVec &arrays) const;
187  void update_locs(const MadaraArrayVec &arrays,
188  std::vector<pose::Position> &locs) const;
189  };
190 
195  {
196  public:
197 
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_
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
#define GAMS_EXPORT
Definition: GamsExport.h:20
Copyright(c) 2016 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Base class for algorithm factories that classes derived from.
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:95
A factory class for creating Formation Coverage algorithms.
Definition: ZoneCoverage.h:195
virtual BaseAlgorithm * create(const madara::knowledge::KnowledgeMap &args, madara::knowledge::KnowledgeBase *knowledge, platforms::BasePlatform *platform, variables::Sensors *sensors, variables::Self *self, variables::Agents *agents)
Creates a Formation Coverage Algorithm.
An algorithm for covering an area in formation with a synchronous model of computation.
Definition: ZoneCoverage.h:86
void operator=(const ZoneCoverage &rhs)
Assignment operator.
gams::groups::GroupBase * protectors_
Definition: ZoneCoverage.h:149
gams::groups::GroupBase * assets_
Definition: ZoneCoverage.h:150
gams::groups::AgentVector enemies_members_
Definition: ZoneCoverage.h:155
pose::Position onion_formation() const
virtual int plan(void)
Plans the next execution of the algorithm.
ZoneCoverage(const std::string &protectors, const std::string &assets, const std::string &enemies, const std::string &formation, double buffer, double distance, madara::knowledge::KnowledgeBase *knowledge=0, platforms::BasePlatform *platform=0, variables::Sensors *sensors=0, variables::Self *self=0)
Constructor.
static formation_func get_form_func(const std::string &form_name)
gams::groups::GroupBase * enemies_
Definition: ZoneCoverage.h:151
gams::groups::AgentVector assets_members_
Definition: ZoneCoverage.h:154
pose::Position line_formation() const
std::vector< pose::Position > asset_locs_
Definition: ZoneCoverage.h:180
std::vector< pose::Position > enemy_locs_
Definition: ZoneCoverage.h:181
void update_locs(const MadaraArrayVec &arrays, std::vector< pose::Position > &locs) const
std::vector< madara::knowledge::containers::NativeDoubleArray > MadaraArrayVec
Definition: ZoneCoverage.h:175
gams::groups::AgentVector protectors_members_
Definition: ZoneCoverage.h:153
groups::GroupFactoryRepository group_factory_
factory for interacting with user-defined groups
Definition: ZoneCoverage.h:145
virtual int analyze(void)
Analyzes environment, platform, or other information.
virtual int execute(void)
Plans the next execution of the algorithm.
pose::Position arc_formation() const
void update_arrays(const gams::groups::AgentVector &names, MadaraArrayVec &arrays) const
Base class for a group of agents.
Definition: GroupBase.h:91
A repository for group factories.
The base platform for all platforms to use.
Definition: BasePlatform.h:113
A container for self referencing information.
Definition: Self.h:70
std::vector< std::string > AgentVector
A vector of agent names.
Definition: GroupBase.h:71
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Contains all GAMS-related tools, classes and code.
Copyright (c) 2015-2018 Carnegie Mellon University.