GAMS  1.2.2
BaseAlgorithm.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ALGORITHMS_BASE_ALGORITHM_H_
55 #define _GAMS_ALGORITHMS_BASE_ALGORITHM_H_
56 
57 #include "gams/variables/Sensor.h"
60 #include "gams/variables/Self.h"
61 #include "gams/pose/Region.h"
62 #include "madara/knowledge/KnowledgeBase.h"
63 
65 
66 #include <vector>
67 
68 namespace gams
69 {
70  namespace controllers
71  {
72  class BaseController;
73  class Multicontroller;
74  }
75 
76  namespace algorithms
77  {
82  {
83  UNKNOWN = 0x00000000,
84  OK = 0x00000001,
85  WAITING = 0x00000002,
86  DEADLOCKED = 0x00000004,
87  FAILED = 0x00000008,
88  FINISHED = 0x00000010
89  };
90 
95  {
96  public:
97  // allow Base controller to initialize our variables
100 
109  BaseAlgorithm (
110  madara::knowledge::KnowledgeBase * knowledge = 0,
111  platforms::BasePlatform * platform = 0,
112  variables::Sensors * sensors = 0,
113  variables::Self * self = 0,
114  variables::Agents * agents = 0);
115 
119  virtual ~BaseAlgorithm ();
120 
125  void operator= (const BaseAlgorithm & rhs);
126 
131  virtual int analyze (void) = 0;
132 
137  virtual int execute (void) = 0;
138 
143  virtual int plan (void) = 0;
144 
149  virtual void set_agents (variables::Agents * agents);
150 
155  virtual void set_platform (platforms::BasePlatform * platform);
156 
161  virtual void set_self (variables::Self * self);
162 
167  virtual void set_sensors (variables::Sensors * sensors);
168 
172  variables::Agents * get_agents (void);
173 
177  madara::knowledge::KnowledgeBase * get_knowledge_base (void);
178 
182  platforms::BasePlatform * get_platform (void);
183 
187  variables::Self * get_self (void);
188 
192  variables::Sensors * get_sensors (void);
193 
197  variables::AlgorithmStatus * get_algorithm_status (void);
198 
199  protected:
202 
204  unsigned int executions_;
205 
207  madara::knowledge::KnowledgeBase * knowledge_;
208 
211 
214 
217 
220  };
221 
222  // deprecated typdef. Please use BaseAlgorithm instead.
224 
225  typedef std::vector <BaseAlgorithm *> Algorithms;
226  }
227 }
228 
229 #endif // _GAMS_VARIABLES_SWARM_H_
A container for algorithm status information.
variables::AlgorithmStatus status_
provides access to status information for this platform
std::vector< BaseAlgorithm * > Algorithms
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.
platforms::BasePlatform * platform_
provides access to the platform
AlgorithmAnalyzeStatus
Possible algorithm statuses, as returnable by analyze ()
Definition: BaseAlgorithm.h:81
Contains all GAMS-related tools, classes and code.
A container for self referencing information.
Definition: Self.h:69
BaseAlgorithm Base
#define GAMS_EXPORT
Definition: GamsExport.h:20
madara::knowledge::KnowledgeBase * knowledge_
provides access to the knowledge base
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:94
variables::Self * self_
the algorithm&#39;s concept of self
The basic controller that can be used to perform actions on platforms and algorithms.
A controller that has the capability of starting many different threads.
variables::Agents * agents_
the list of agents potentially participating in the algorithm
Copyright (c) 2014 Carnegie Mellon University.
variables::Sensors * sensors_
provides access to sensor information
unsigned int executions_
number of executions