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 
31 namespace fawkes {
32 class Blackboard;
33 class Configuration;
34 class SkillerInterface;
35 
36 namespace gpp {
37 
39 {
40 public:
41  InvalidArgumentException(const char *format, ...);
42 };
43 
45 {
46 public:
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_changed(Interface *) throw() override;
56 
57 protected:
58  const char *name() const;
61 
62 private:
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 */
fawkes::gpp::SkillerActionExecutor::name
const char * name() const
Get the name of the executor; mainly used for logging.
Definition: skiller_action_executor.cpp:176
fawkes::gpp::InvalidArgumentException
An exception that is thrown if the given arguments do not match the skill's arguments.
Definition: skiller_action_executor.h:39
fawkes::gpp::InvalidArgumentException::InvalidArgumentException
InvalidArgumentException(const char *format,...)
Constructor.
Definition: skiller_action_executor.cpp:41
fawkes::BlackBoardInterfaceListener
BlackBoard interface listener.
Definition: interface_listener.h:42
fawkes::BlackBoard
The BlackBoard abstract class.
Definition: blackboard.h:46
fawkes::gpp::SkillerActionExecutor::blackboard_
BlackBoard * blackboard_
The blackboard to use to access the skiller.
Definition: skiller_action_executor.h:59
fawkes::Configuration
Interface for configuration handling.
Definition: config.h:65
fawkes::gpp::SkillerActionExecutor::can_execute_activity
bool can_execute_activity(std::shared_ptr< gologpp::Activity > activity) const override
Check if we can execute the given activity.
Definition: skiller_action_executor.cpp:133
fawkes::Logger
Interface for logging.
Definition: logger.h:42
fawkes::gpp::SkillerActionExecutor::~SkillerActionExecutor
virtual ~SkillerActionExecutor() override
Destructor.
Definition: skiller_action_executor.cpp:116
fawkes
Fawkes library namespace.
fawkes::Interface
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
fawkes::gpp::SkillerActionExecutor::start
void start(std::shared_ptr< gologpp::Activity > activity) override
Start the given activity.
Definition: skiller_action_executor.cpp:143
fawkes::gpp::SkillerActionExecutor::stop
void stop(std::shared_ptr< gologpp::Grounding< gologpp::Action >> activity) override
Stop the activity if it is currently running.
Definition: skiller_action_executor.cpp:164
fawkes::SkillerInterface
SkillerInterface Fawkes BlackBoard Interface.
Definition: SkillerInterface.h:34
fawkes::ActionSkillMapping
Class to maintain and perform mapping from actions to skills.
Definition: map_skill.h:28
fawkes::gpp::SkillerActionExecutor::bb_interface_data_changed
virtual void bb_interface_data_changed(Interface *) override
Update the status of the activity according to the Skiller status.
Definition: skiller_action_executor.cpp:217
fawkes::gpp::SkillerActionExecutor::SkillerActionExecutor
SkillerActionExecutor(Logger *logger, BlackBoard *blackboard, Configuration *config, const std::string &cfg_prefix)
Constructor.
Definition: skiller_action_executor.cpp:71
fawkes::gpp::ActionExecutor
Abstract class to execute a Golog++ activity.
Definition: action_executor.h:35
fawkes::gpp::SkillerActionExecutor
An ActionExecutor that executes an activity using the Skiller.
Definition: skiller_action_executor.h:45
fawkes::gpp::SkillerActionExecutor::blackboard_owner_
bool blackboard_owner_
True if this executor is owning its blackboard.
Definition: skiller_action_executor.h:60
fawkes::Exception
Base class for exceptions in Fawkes.
Definition: exception.h:36