54 #ifndef _GAMS_BASE_CONTROLLER_H_ 55 #define _GAMS_BASE_CONTROLLER_H_ 72 #include "madara/knowledge/containers/String.h" 73 #include "madara/knowledge/containers/Vector.h" 107 virtual int monitor (
void);
114 virtual int system_analyze (
void);
120 virtual int analyze (
void);
126 virtual int plan (
void);
132 virtual int execute (
void);
153 int run (
double loop_period,
154 double max_runtime = -1,
155 double send_period = -1.0);
168 double max_runtime = -1,
169 double send_hz = -1.0)
171 double loop_rate, send_rate;
178 loop_rate = 1.0 / loop_hz;
182 send_rate = loop_rate;
185 send_rate = 1.0 / send_hz;
187 return run (loop_rate, max_runtime, send_rate);
201 void init_accent (
const std::string & algorithm,
202 const madara::knowledge::KnowledgeMap & args =
203 madara::knowledge::KnowledgeMap ());
208 void clear_accents (
void);
218 void add_platform_factory (
219 const std::vector <std::string> & aliases,
230 void add_algorithm_factory (
231 const std::vector <std::string> & aliases,
239 void init_algorithm (
const std::string & algorithm,
240 const madara::knowledge::KnowledgeMap & args = madara::knowledge::KnowledgeMap ());
255 void init_platform (
const std::string & platform,
256 const madara::knowledge::KnowledgeMap & args =
257 madara::knowledge::KnowledgeMap ());
277 void init_algorithm (jobject algorithm);
283 void init_platform (jobject platform);
291 void init_vars (
const madara::knowledge::KnowledgeRecord::Integer &
id = 0,
292 const madara::knowledge::KnowledgeRecord::Integer & processes = -1);
300 void init_vars (
const std::string & self_prefix,
301 const std::string & group_name =
"");
308 void init_vars (
const std::string & self_prefix,
348 void save_checkpoint (
void);
390 int run_once_ (
void);
395 #endif // _GAMS_BASE_CONTROLLER_H_ Base class for algorithm factories that classes derived from.
A container for swarm information.
Copyright (c) 2016 Carnegie Mellon University.
std::vector< BaseAlgorithm * > Algorithms
std::map< std::string, AlgorithmStatus > Algorithms
a map of sensor names to the sensor information
Copyright (c) 2014 Carnegie Mellon University.
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
variables::Swarm swarm_
Containers for swarm-related variables.
algorithms::BaseAlgorithm * algorithm_
Algorithm to perform.
madara::knowledge::KnowledgeBase & knowledge_
Knowledge base.
Copyright (c) 2014 Carnegie Mellon University.
std::vector< Agent > Agents
An array of agent knowledge.
Copyright (c) 2014 Carnegie Mellon University.
variables::Sensors sensors_
Containers for sensor information.
variables::Agents agents_
Containers for agent-related variables.
ControllerSettings settings_
Settings for controller management and qos.
GAMS_EXPORT void init_vars(AccentStatuses &variables, madara::knowledge::KnowledgeBase &knowledge, const std::string &prefix)
Initializes accent status containers.
Copyright (c) 2017 Carnegie Mellon University.
Contains all GAMS-related tools, classes and code.
A container for self referencing information.
std::map< std::string, PlatformStatus > Platforms
a map of sensor names to the sensor information
Base class for a group of agents.
int checkpoint_count_
keeps track of the checkpoints saved in the control loop
variables::Self self_
Containers for self-referencing variables.
The base class that algorithms in GAMS use.
int run_hz(double loop_hz=0.0, double max_runtime=-1, double send_hz=-1.0)
Runs iterations of the MAPE loop with specified hertz.
Copyright (c) 2014 Carnegie Mellon University.
variables::Algorithms algorithms_
Containers for algorithm information.
platforms::BasePlatform * platform_
Platform on which the controller is running.
The basic controller that can be used to perform actions on platforms and algorithms.
algorithms::Algorithms accents_
Accents on the primary algorithm.
Copyright (c) 2014-2018 Carnegie Mellon University.
Copyright (c) 2014 Carnegie Mellon University.
Settings used for initializing GAMS controllers.
variables::Platforms platforms_
Containers for platform information.