68 #include "madara/transport/SharedMemoryPush.h"
70 #include "madara/knowledge/containers/String.h"
71 #include "madara/knowledge/containers/Vector.h"
72 #include "madara/knowledge/Hive.h"
101 madara::knowledge::Hive & hive,
102 size_t init_id = 0,
size_t num_controllers = 1,
119 const std::vector <std::string> & aliases,
131 const std::vector <std::string> & aliases,
149 const madara::transport::QoSTransportSettings & source_settings);
162 const madara::knowledge::EvalSettings & settings =
163 madara::knowledge::EvalSettings::DELAY);
171 void evaluate(
size_t controller_index,
const std::string & logic,
172 const madara::knowledge::EvalSettings & settings =
173 madara::knowledge::EvalSettings::DELAY);
181 const std::string & algorithm,
182 const madara::knowledge::KnowledgeMap & args = madara::knowledge::KnowledgeMap());
191 const std::string & algorithm,
192 const madara::knowledge::KnowledgeMap & args = madara::knowledge::KnowledgeMap());
200 const std::string & algorithm,
201 const madara::knowledge::KnowledgeMap & args = madara::knowledge::KnowledgeMap());
210 const std::string & algorithm,
211 const madara::knowledge::KnowledgeMap & args = madara::knowledge::KnowledgeMap());
229 const std::string & platform,
230 const madara::knowledge::KnowledgeMap & args =
231 madara::knowledge::KnowledgeMap());
240 const std::string & platform,
241 const madara::knowledge::KnowledgeMap & args =
242 madara::knowledge::KnowledgeMap());
260 void init_algorithm(
size_t controller_index, jobject algorithm);
267 void init_platform(
size_t controller_index, jobject platform);
275 void init_vars(
const madara::knowledge::KnowledgeRecord::Integer &
id = 0,
276 const madara::knowledge::KnowledgeRecord::Integer & processes = -1);
331 madara::knowledge::KnowledgeBase
get_kb(
size_t controller_index);
346 void resize(
size_t init_id,
size_t num_controllers,
347 bool init_non_self_vars =
false);
367 inline void set_hive(madara::knowledge::Hive& hive)
383 int run(
double loop_period,
384 double max_runtime = -1,
385 double send_period = -1.0);
398 double max_runtime = -1,
399 double send_hz = -1.0)
401 double loop_rate, send_rate;
408 loop_rate = 1.0 / loop_hz;
412 send_rate = loop_rate;
415 send_rate = 1.0 / send_hz;
417 return run(loop_rate, max_runtime, send_rate);
Copyright(c) 2014-2018 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 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.
Settings used for initializing GAMS controllers.
A controller that has the capability of managing multiple controllers.
algorithms::BaseAlgorithm * get_algorithm(size_t controller_index=0)
Gets the current algorithm at the controller index.
void init_vars(size_t controller_index, algorithms::BaseAlgorithm &algorithm)
Initializes containers and knowledge base in an algorithm.
madara::knowledge::Hive * hive_
Pointer to a hive mind managed by parent.
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.
void init_algorithm(const std::string &algorithm, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Initializes all managed controllers with an algorithm.
void clear_accents(size_t controller_index=0)
Clears all accent algorithms.
int run(double loop_period, double max_runtime=-1, double send_period=-1.0)
Runs iterations of the MAPE loop with specified periods.
void add_transports(const madara::transport::QoSTransportSettings &source_settings)
Add transports to the knowledge bases that are being used by each controller.
void add_platform_factory(const std::vector< std::string > &aliases, platforms::PlatformFactory *factory)
Adds an aliased platform factory.
void refresh_vars(bool init_non_self_vars=false)
Calls init_vars for each controller.
int run_once(void)
Runs a single iteration of the MAPE loop Always sends updates after the iteration.
void init_algorithm(size_t controller_index, const std::string &algorithm, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Initializes a specific controller with an algorithm.
int run(void)
Runs iterations of the MAPE loop with configured settings.
void init_algorithm(size_t controller_index, algorithms::BaseAlgorithm *algorithm)
Initializes the controller with a user-provided algorithm.
virtual ~HiveController()
Destructor.
void set_hive(madara::knowledge::Hive &hive)
Sets the hive to control a portion of.
void init_accent(size_t controller_index, const std::string &algorithm, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Adds an accent algorithm.
platforms::BasePlatform * get_platform(size_t controller_index=0)
Gets the current platform at the controller index.
void init_vars(const madara::knowledge::KnowledgeRecord::Integer &id=0, const madara::knowledge::KnowledgeRecord::Integer &processes=-1)
Initializes global variable containers.
ControllerSettings settings_
Settings for controller management and qos.
std::vector< BaseController * > controllers_
Controllers that need to be instrumented.
size_t offset_
the starting id within offsets and transports
void init_platform(size_t controller_index, platforms::BasePlatform *platform)
Initializes the controller with a user-provided platform.
void evaluate(const std::string &logic, const madara::knowledge::EvalSettings &settings=madara::knowledge::EvalSettings::DELAY)
Evaluates a karl logic across all controllers and knowledge bases.
void add_algorithm_factory(const std::vector< std::string > &aliases, algorithms::AlgorithmFactory *factory)
Adds an aliased algorithm factory.
void init_vars(size_t controller_index, platforms::BasePlatform &platform)
Initializes containers and knowledge base in a platform This is usually the first thing a developer s...
void clear_knowledge(void)
Clears all controller knowledge bases.
size_t get_num_controllers(void)
Returns the number of controllers being managed.
void init_platform(size_t controller_index, const std::string &platform, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Initializes the platform.
void evaluate(size_t controller_index, const std::string &logic, const madara::knowledge::EvalSettings &settings=madara::knowledge::EvalSettings::DELAY)
Evaluates a karl logic across all controllers and knowledge bases.
HiveController()
Default constructor.
void init_platform(const std::string &platform, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Initializes all managed controllers with the platform.
madara::knowledge::KnowledgeBase get_kb(size_t controller_index)
Returns the kb that is being used by the internal controller.
HiveController(madara::knowledge::Hive &hive, size_t init_id=0, size_t num_controllers=1, const ControllerSettings &settings=ControllerSettings())
Constructor.
void init_accent(const std::string &algorithm, const madara::knowledge::KnowledgeMap &args=madara::knowledge::KnowledgeMap())
Initializes all managed controllers with an accent algorithm.
void resize(size_t init_id, size_t num_controllers, bool init_non_self_vars=false)
Resizes the number of controllers and knowledge bases.
Contains all GAMS-related tools, classes and code.