Fawkes API
Fawkes Development Version
amcl_plugin.cpp
1
2
/***************************************************************************
3
* amcl_plugin.cpp - Adaptive Monte Carlo Localization plugin
4
*
5
* Created: Wed May 16 16:02:15 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 "amcl_thread.h"
24
25
#include <core/plugin.h>
26
#ifdef HAVE_ROS
27
# include "amcl_utils.h"
28
# include "ros_thread.h"
29
#endif
30
31
using namespace
fawkes
;
32
33
/** Adaptive Monte Carlo Localization plugin.
34
* @author Tim Niemueller
35
*/
36
class
AmclPlugin
:
public
fawkes::Plugin
37
{
38
public
:
39
/** Constructor.
40
* @param config Fawkes configuration
41
*/
42
explicit
AmclPlugin
(
Configuration
*config) :
Plugin
(config)
43
{
44
#ifdef HAVE_ROS
45
AmclROSThread
*rt = NULL;
46
bool
ros_enabled =
true
;
47
try
{
48
ros_enabled = config->
get_bool
(AMCL_CFG_PREFIX
"ros/enable"
);
49
}
catch
(
Exception
&e) {
50
}
// ignore, use default
51
if
(ros_enabled) {
52
rt =
new
AmclROSThread
();
53
thread_list.push_back(rt);
54
}
55
thread_list.push_back(
new
AmclThread
(rt));
56
#else
57
thread_list.push_back(
new
AmclThread
());
58
#endif
59
}
60
};
61
62
PLUGIN_DESCRIPTION(
"Adaptive Monte Carlo Localization"
)
63
EXPORT_PLUGIN(
AmclPlugin
)
AmclThread
Definition:
amcl_thread.h:68
fawkes::Configuration::get_bool
virtual bool get_bool(const char *path)=0
AmclPlugin::AmclPlugin
AmclPlugin(Configuration *config)
Constructor.
Definition:
amcl_plugin.cpp:42
AmclROSThread
Definition:
ros_thread.h:48
fawkes::Configuration
Definition:
config.h:70
fawkes
AmclPlugin
Adaptive Monte Carlo Localization plugin.
Definition:
amcl_plugin.cpp:36
fawkes::Plugin
Definition:
plugin.h:39
fawkes::Exception
Definition:
exception.h:41
src
plugins
amcl
amcl_plugin.cpp
Generated by
1.8.17