22#include "gologpp_fawkes_backend.h"
24#include "message_action_executor.h"
25#include "print_action_executor.h"
26#include "remote_skiller_executor.h"
27#include "skiller_action_executor.h"
28#include "sleep_action_executor.h"
30#include <config/config.h>
31#include <golog++/model/activity.h>
32#include <golog++/model/transition.h>
37using namespace gologpp;
52 std::string cfg_prefix,
60 for (
const string &robot :
62 const std::string agent_prefix = cfg_prefix +
"/agents/" + robot;
63 const std::string &hostname =
65 const unsigned short int &port =
67 action_dispatcher_.
register_executor(std::make_shared<RemoteSkillerActionExecutor>(
68 logger,
"robot", robot, hostname, port, config, cfg_prefix));
72 std::make_shared<SkillerActionExecutor>(logger, blackboard, config, cfg_prefix));
75 std::make_shared<BBMessageActionExecutor>(logger, blackboard, config, cfg_prefix));
76 action_dispatcher_.
register_executor(std::make_shared<SleepActionExecutor>(logger));
77 action_dispatcher_.
register_executor(std::make_shared<PrintActionExecutor>(logger));
80GologppFawkesBackend::~GologppFawkesBackend()
98gologpp::Clock::time_point
101 return gologpp::Clock::time_point{
102 gologpp::Clock::duration{
clock->
now().
in_sec() / gologpp::Clock::duration::period::den}};
109GologppFawkesBackend::execute_activity(shared_ptr<Activity> a)
Thread aspect provide a new aspect.
The BlackBoard abstract class.
Clock * clock
By means of this member access to the clock is given.
Time now() const
Get the current time.
Interface for configuration handling.
virtual std::string get_string_or_default(const char *path, const std::string &default_val)
Get value from configuration which is of type string, or the given default if the path does not exist...
virtual unsigned int get_uint_or_default(const char *path, const unsigned int &default_val)
Get value from configuration which is of type unsigned int, or the given default if the path does not...
virtual bool get_bool_or_default(const char *path, const bool &default_val)
Get value from configuration which is of type bool, or the given default if the path does not exist.
virtual std::vector< std::string > get_strings_or_defaults(const char *path, const std::vector< std::string > &default_val)
Get list of values from configuration which is of type string, or the given default if the path does ...
double in_sec() const
Convet time to seconds.
std::shared_ptr< ActionExecutor > get_executor(std::shared_ptr< gologpp::Activity >)
Determine the executor for a given activity.
void register_executor(std::shared_ptr< ActionExecutor > executor)
Register a new executor.
virtual gologpp::Clock::time_point time() const noexcept override
Get the current time from Fawkes.
virtual void preempt_activity(std::shared_ptr< gologpp::Activity > a) override
Preempt the currently running activity.
GologppFawkesBackend(Configuration *config, std::string cfg_prefix, Logger *logger, BlackBoard *blackboard)
Constructor.
Fawkes library namespace.