Fawkes API Fawkes Development Version
skiller_action_executor.h
1/***************************************************************************
2 * skiller_action_executor.h - Execute skills for Golog++ activities
3 *
4 * Created: Thu 03 Oct 2019 08:51:27 CEST 08:51
5 * Copyright 2019 Till Hofmann <hofmann@kbsg.rwth-aachen.de>
6 ****************************************************************************/
7
8/* This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Library General Public License for more details.
17 *
18 * Read the full text in the LICENSE.GPL file in the doc directory.
19 */
20
21#ifndef FAWKES_GOLOGPP_SKILLER_ACTION_EXECUTOR_H
22#define FAWKES_GOLOGPP_SKILLER_ACTION_EXECUTOR_H
23
24#include "action_executor.h"
25
26#include <blackboard/interface_listener.h>
27#include <utils/misc/map_skill.h>
28
29#include <string>
30
31namespace fawkes {
32class Blackboard;
33class Configuration;
34class SkillerInterface;
35
36namespace gpp {
37
39{
40public:
41 InvalidArgumentException(const char *format, ...);
42};
43
45{
46public:
48 BlackBoard * blackboard,
49 Configuration * config,
50 const std::string &cfg_prefix);
51 virtual ~SkillerActionExecutor() override;
52 void start(std::shared_ptr<gologpp::Activity> activity) override;
53 void stop(std::shared_ptr<gologpp::Grounding<gologpp::Action>> activity) override;
54 bool can_execute_activity(std::shared_ptr<gologpp::Activity> activity) const override;
55 virtual void bb_interface_data_refreshed(Interface *) noexcept override;
56
57protected:
58 const char *name() const;
61
62private:
63 void initialize_action_skill_mapping();
64 std::string map_activity_to_skill(std::shared_ptr<gologpp::Activity> activity);
65 ActionSkillMapping action_skill_mapping_;
66 SkillerInterface * skiller_if_;
67 Configuration * config_;
68 const std::string cfg_prefix_;
69};
70
71} // namespace gpp
72} // namespace fawkes
73
74#endif /* !FAWKES_GOLOGPP_SKILLER_ACTION_EXECUTOR_H */
Class to maintain and perform mapping from actions to skills.
Definition: map_skill.h:28
BlackBoard interface listener.
The BlackBoard abstract class.
Definition: blackboard.h:46
Interface for configuration handling.
Definition: config.h:68
Base class for exceptions in Fawkes.
Definition: exception.h:36
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
Interface for logging.
Definition: logger.h:42
SkillerInterface Fawkes BlackBoard Interface.
Abstract class to execute a Golog++ activity.
An exception that is thrown if the given arguments do not match the skill's arguments.
InvalidArgumentException(const char *format,...)
Constructor.
An ActionExecutor that executes an activity using the Skiller.
const char * name() const
Get the name of the executor; mainly used for logging.
void stop(std::shared_ptr< gologpp::Grounding< gologpp::Action > > activity) override
Stop the activity if it is currently running.
SkillerActionExecutor(Logger *logger, BlackBoard *blackboard, Configuration *config, const std::string &cfg_prefix)
Constructor.
void start(std::shared_ptr< gologpp::Activity > activity) override
Start the given activity.
virtual void bb_interface_data_refreshed(Interface *) noexcept override
Update the status of the activity according to the Skiller status.
bool blackboard_owner_
True if this executor is owning its blackboard.
virtual ~SkillerActionExecutor() override
Destructor.
BlackBoard * blackboard_
The blackboard to use to access the skiller.
bool can_execute_activity(std::shared_ptr< gologpp::Activity > activity) const override
Check if we can execute the given activity.
Fawkes library namespace.