Fawkes API  Fawkes Development Version
skiller_plugin.cpp
1 
2 /***************************************************************************
3  * skiller_plugin.h - Fawkes Skill Execution Runtime Plugin
4  *
5  * Created: Mon Feb 18 10:18:50 2008
6  * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #include "skiller_plugin.h"
24 
25 #include "exec_thread.h"
26 #ifdef HAVE_NAVGRAPH
27 # include "skiller_navgraph_feature.h"
28 #endif
29 
30 using namespace fawkes;
31 
32 /** @class SkillerPlugin <plugins/skiller/skiller_plugin.h>
33  * Skill Execution Runtime Plugin.
34  * This plugin facilitates the Fawkes skill module. It allows for execution of
35  * so-called skills, basic action atoms that can be used for form complex
36  * behavior.
37  *
38  * @author Tim Niemueller
39  */
40 
41 /** Constructor.
42  * @param config Fawkes configuration
43  */
45 {
46 #ifdef HAVE_NAVGRAPH
47  bool navgraph_enable = false;
48  try {
49  navgraph_enable = config->get_bool("/skiller/features/navgraph/enable");
50  } catch (Exception &e) {
51  } // ignore, use default
52 #endif
53 
55 #ifdef HAVE_NAVGRAPH
56  if (navgraph_enable) {
57  SkillerNavGraphFeature *navgraph_feature = new SkillerNavGraphFeature();
58  exec_thread->add_skiller_feature(navgraph_feature);
59  thread_list.push_back(navgraph_feature);
60  }
61 #endif
62  thread_list.push_back(exec_thread);
63 }
64 
65 PLUGIN_DESCRIPTION("Lua-based Behavior Engine")
66 EXPORT_PLUGIN(SkillerPlugin)
fawkes::Plugin::config
Configuration * config
Fawkes configuration.
Definition: plugin.h:64
fawkes::Plugin::thread_list
ThreadList thread_list
Thread list member.
Definition: plugin.h:59
SkillerExecutionThread
Definition: exec_thread.h:58
fawkes::ThreadList::push_back
void push_back(Thread *thread)
Add thread to the end.
Definition: thread_list.cpp:779
SkillerNavGraphFeature
Definition: skiller_navgraph_feature.h:31
SkillerPlugin
Definition: skiller_plugin.h:28
fawkes::Configuration::get_bool
virtual bool get_bool(const char *path)=0
fawkes::Configuration
Definition: config.h:70
SkillerExecutionThread::add_skiller_feature
void add_skiller_feature(SkillerFeature *feature)
Add a skiller feature.
Definition: exec_thread.cpp:171
fawkes
SkillerPlugin::SkillerPlugin
SkillerPlugin(fawkes::Configuration *config)
Constructor.
Definition: skiller_plugin.cpp:44
fawkes::Plugin
Definition: plugin.h:39
fawkes::Exception
Definition: exception.h:41