Fawkes API  Fawkes Development Version
navgraph_generator_plugin.cpp
1 
2 /***************************************************************************
3  * navgraph_generator_plugin.cpp - Graph-based global path planning
4  *
5  * Created: Mon Feb 09 17:34:21 2015
6  * Copyright 2015 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #include <core/plugin.h>
23 
24 #include "navgraph_generator_thread.h"
25 #ifdef HAVE_VISUALIZATION
26 # include "visualization_thread.h"
27 #endif
28 
29 using namespace fawkes;
30 
31 /** Plugin to generate navgraphs based on given parameters.
32  * @author Tim Niemueller
33  */
35 {
36  public:
37  /** Constructor.
38  * @param config Fawkes configuration
39  */
41  : Plugin(config)
42  {
43 #ifdef HAVE_VISUALIZATION
44  bool use_vis = false;
45  try {
46  use_vis = config->get_bool("/navgraph-generator/visualization/enable");
47  } catch (Exception &e) {} // ignored, use default
48  if (use_vis) {
50  thread_list.push_back(new NavGraphGeneratorThread(vt));
51  thread_list.push_back(vt);
52  } else {
53  thread_list.push_back(new NavGraphGeneratorThread());
54  }
55 #else
56  thread_list.push_back(new NavGraphGeneratorThread());
57 #endif
58  }
59 };
60 
61 PLUGIN_DESCRIPTION("Plugin to instruct and perform navgraph generation")
62 EXPORT_PLUGIN(NavGraphGeneratorPlugin)
Thread to perform graph-based path planning.
Plugin interface class.
Definition: plugin.h:33
Fawkes library namespace.
virtual bool get_bool(const char *path)=0
Get value from configuration which is of type bool.
NavGraphGeneratorPlugin(Configuration *config)
Constructor.
Base class for exceptions in Fawkes.
Definition: exception.h:36
Plugin to generate navgraphs based on given parameters.
Send Marker messages to rviz to show navgraph-generator info.
Interface for configuration handling.
Definition: config.h:67