Fawkes API  Fawkes Development Version
navgraph_plugin.cpp
1 
2 /***************************************************************************
3  * navgraph_plugin.cpp - Graph-based global path planning
4  *
5  * Created: Tue Sep 18 15:55:38 2012
6  * Copyright 2012 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 <core/plugin.h>
24 
25 #include "navgraph_thread.h"
26 #ifdef HAVE_VISUALIZATION
27 # include "visualization_thread.h"
28 #endif
29 #ifdef HAVE_FAWKES_MSGS
30 # include "rospub_thread.h"
31 #endif
32 
33 using namespace fawkes;
34 
35 /** Graph-based global path planning.
36  * @author Tim Niemueller
37  */
39 {
40  public:
41  /** Constructor.
42  * @param config Fawkes configuration
43  */
45  : Plugin(config)
46  {
47 #ifdef HAVE_VISUALIZATION
48  bool use_vis = false;
49  try {
50  use_vis = config->get_bool("/navgraph/visualization/enable");
51  } catch (Exception &e) {} // ignored, use default
52  if (use_vis) {
54  thread_list.push_back(new NavGraphThread(vt));
55  thread_list.push_back(vt);
56  } else {
57  thread_list.push_back(new NavGraphThread());
58  }
59 #else
60  thread_list.push_back(new NavGraphThread());
61 #endif
62 #ifdef HAVE_FAWKES_MSGS
63  bool use_rospub = false;
64  try {
65  use_rospub = config->get_bool("/navgraph/ros-publishing/enable");
66  } catch (Exception &e) {} // ignored, use default
67  if (use_rospub) {
68  thread_list.push_back(new NavGraphROSPubThread());
69  }
70 #endif
71  }
72 };
73 
74 PLUGIN_DESCRIPTION("Graph-based local path planning")
75 EXPORT_PLUGIN(NavGraphPlugin)
Publish navgaraph to ROS.
Definition: rospub_thread.h:36
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.
Send Marker messages to rviz to show navgraph info.
Thread to perform graph-based path planning.
Graph-based global path planning.
Base class for exceptions in Fawkes.
Definition: exception.h:36
NavGraphPlugin(Configuration *config)
Constructor.
Interface for configuration handling.
Definition: config.h:67