GAMS  1.4.0
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 
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:
145 
147  struct Compiled
148  {
149 #ifndef _MADARA_NO_KARL_
150  madara::knowledge::CompiledExpression ref;
151 #endif
152  std::string agent;
153  };
154  std::vector<Compiled> compiled_formation_;
155 
157  madara::knowledge::containers::Integer formation_ready_;
158 
160  bool head_;
161 
163  int head_id_;
164 
166  madara::knowledge::containers::NativeDoubleArray head_location_;
167 
169  madara::knowledge::containers::NativeDoubleArray head_destination_;
170 
173 
175  madara::knowledge::containers::Integer in_formation_;
176 
178  enum
179  {
181  ROTATE
182  } modifier_;
183 
186 
189 
191  unsigned int num_agents_;
192 
194  double phi_;
195 
197  double phi_dir_;
198 
200  double rho_;
201 
204 
206  double z_;
207  };
208 
213  {
214  public:
215 
236  const madara::knowledge::KnowledgeMap & args,
237  madara::knowledge::KnowledgeBase * knowledge,
238  platforms::BasePlatform * platform,
239  variables::Sensors * sensors,
240  variables::Self * self,
241  variables::Agents * agents);
242  };
243  }
244 }
245 
246 #endif // _GAMS_ALGORITHMS_FORMATION_FLYING_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 Flying algorithms.
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 Flying Algorithm.
An algorithm for moving in formation.
madara::knowledge::containers::Integer in_formation_
am i in formation?
virtual int execute(void)
Plans the next execution of the algorithm.
variables::SensorNames sensor_names_
list of sensor names
madara::knowledge::containers::NativeDoubleArray head_destination_
head destination
FormationFlying(const std::string &head_id, const std::vector< double > &offset, const std::vector< double > &destination, const std::string &group_name, const std::string &modifier, madara::knowledge::KnowledgeBase *knowledge=0, platforms::BasePlatform *platform=0, variables::Sensors *sensors=0, variables::Self *self=0)
Constructor.
madara::knowledge::containers::NativeDoubleArray head_location_
head location
std::vector< Compiled > compiled_formation_
double z_
altitude formation offsets
void operator=(const FormationFlying &rhs)
Assignment operator.
virtual int analyze(void)
Analyzes environment, platform, or other information.
bool is_ready() const
Get ready value.
bool is_head() const
Return true if this agent is head.
pose::Position next_position_
next position
unsigned int num_agents_
number of agents in formation; only head_id_ needs to know this
pose::Position destination_
destination as Position
bool need_to_move_
do we need to move?
madara::knowledge::containers::Integer formation_ready_
are we in formation?
double phi_
angular formation offsets
double phi_dir_
directional angular formation offsets
double rho_
planar distance formation offsets
pose::Position get_destination() const
Get head's destination.
virtual int plan(void)
Plans the next execution of the algorithm.
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 > SensorNames
a list of sensor names
Definition: Sensor.h:241
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.
madara::knowledge::CompiledExpression ref