GAMS  1.2.2
FormationFlying.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ALGORITHMS_FORMATION_FLYING_H_
55 #define _GAMS_ALGORITHMS_FORMATION_FLYING_H_
56 
57 #include "gams/variables/Sensor.h"
60 #include "gams/variables/Self.h"
62 #include "gams/pose/Position.h"
65 
66 namespace gams
67 {
68  namespace algorithms
69  {
74  {
75  public:
89  const std::string & head_id,
90  const std::vector<double> & offset,
91  const std::vector<double> & destination,
92  const std::string & group_name,
93  const std::string & modifier,
94  madara::knowledge::KnowledgeBase * knowledge = 0,
95  platforms::BasePlatform * platform = 0,
96  variables::Sensors * sensors = 0,
97  variables::Self * self = 0);
98 
102  ~FormationFlying ();
103 
108  void operator= (const FormationFlying & rhs);
109 
114  virtual int analyze (void);
115 
120  virtual int execute (void);
121 
126  virtual int plan (void);
127 
131  bool is_head () const;
132 
137  bool is_ready () const;
138 
139  protected:
144  pose::Position get_destination() const;
145 
147  struct Compiled
148  {
149  madara::knowledge::CompiledExpression ref;
150  std::string agent;
151  };
152  std::vector<Compiled> compiled_formation_;
153 
155  madara::knowledge::containers::Integer formation_ready_;
156 
158  bool head_;
159 
161  int head_id_;
162 
164  madara::knowledge::containers::NativeDoubleArray head_location_;
165 
167  madara::knowledge::containers::NativeDoubleArray head_destination_;
168 
171 
173  madara::knowledge::containers::Integer in_formation_;
174 
176  enum
177  {
179  ROTATE
180  } modifier_;
181 
184 
187 
189  unsigned int num_agents_;
190 
192  double phi_;
193 
195  double phi_dir_;
196 
198  double rho_;
199 
202 
204  double z_;
205  };
206 
211  {
212  public:
213 
233  virtual BaseAlgorithm * create (
234  const madara::knowledge::KnowledgeMap & args,
235  madara::knowledge::KnowledgeBase * knowledge,
236  platforms::BasePlatform * platform,
237  variables::Sensors * sensors,
238  variables::Self * self,
239  variables::Agents * agents);
240  };
241  }
242 }
243 
244 #endif // _GAMS_ALGORITHMS_FORMATION_FLYING_H_
Base class for algorithm factories that classes derived from.
madara::knowledge::CompiledExpression ref
std::vector< Compiled > compiled_formation_
pose::Position next_position_
next position
Copyright (c) 2014 Carnegie Mellon University.
double rho_
planar distance formation offsets
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
An algorithm for moving in formation.
The base platform for all platforms to use.
Definition: BasePlatform.h:190
bool need_to_move_
do we need to move?
Copyright (c) 2014 Carnegie Mellon University.
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
unsigned int num_agents_
number of agents in formation; only head_id_ needs to know this
double phi_
angular formation offsets
Copyright (c) 2014 Carnegie Mellon University.
variables::SensorNames sensor_names_
list of sensor names
madara::knowledge::containers::NativeDoubleArray head_destination_
head destination
madara::knowledge::containers::NativeDoubleArray head_location_
head location
madara::knowledge::containers::Integer in_formation_
am i in formation?
Contains all GAMS-related tools, classes and code.
A container for self referencing information.
Definition: Self.h:69
#define GAMS_EXPORT
Definition: GamsExport.h:20
double z_
altitude formation offsets
madara::knowledge::containers::Integer formation_ready_
are we in formation?
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:94
Copyright (c) 2014 Carnegie Mellon University.
std::vector< std::string > SensorNames
a list of sensor names
Definition: Sensor.h:241
double phi_dir_
directional angular formation offsets
pose::Position destination_
destination as Position
Copyright (c) 2016 Carnegie Mellon University.
Copyright (c) 2014 Carnegie Mellon University.
A factory class for creating Formation Flying algorithms.