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 #include "exec_thread.h"
25 #ifdef HAVE_NAVGRAPH
26  #include "skiller_navgraph_feature.h"
27 #endif
28 
29 using namespace fawkes;
30 
31 /** @class SkillerPlugin <plugins/skiller/skiller_plugin.h>
32  * Skill Execution Runtime Plugin.
33  * This plugin facilitates the Fawkes skill module. It allows for execution of
34  * so-called skills, basic action atoms that can be used for form complex
35  * behavior.
36  *
37  * @author Tim Niemueller
38  */
39 
40 /** Constructor.
41  * @param config Fawkes configuration
42  */
44  : Plugin(config)
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) {} // ignore, use default
51 #endif
52 
54 #ifdef HAVE_NAVGRAPH
55  if (navgraph_enable) {
56  SkillerNavGraphFeature *navgraph_feature = new SkillerNavGraphFeature();
57  exec_thread->add_skiller_feature(navgraph_feature);
58  thread_list.push_back(navgraph_feature);
59  }
60 #endif
61  thread_list.push_back(exec_thread);
62 }
63 
64 
65 PLUGIN_DESCRIPTION("Lua-based Behavior Engine")
66 EXPORT_PLUGIN(SkillerPlugin)
Plugin interface class.
Definition: plugin.h:33
Skill Execution Runtime Plugin.
Fawkes library namespace.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
Thread to access the navgraph from skiller.
Skiller Execution Thread.
Definition: exec_thread.h:58
Base class for exceptions in Fawkes.
Definition: exception.h:36
ThreadList thread_list
Thread list member.
Definition: plugin.h:53
void add_skiller_feature(SkillerFeature *feature)
Add a skiller feature.
void push_back(Thread *thread)
Add thread to the end.
Interface for configuration handling.
Definition: config.h:67
SkillerPlugin(fawkes::Configuration *config)
Constructor.