src
nodes
param_example.cpp
Go to the documentation of this file.
1
#include <string>
2
#include <
ros/ros.h
>
3
#include <
swri_roscpp/parameters.h
>
4
5
int
main
(
int
argc,
char
**argv)
6
{
7
ros::init
(argc, argv,
"param_test"
);
8
ros::NodeHandle
pnh(
"~"
);
9
10
int
int_var;
11
swri::getParam
(pnh,
"used_int_var_1"
, int_var);
12
swri::param
(pnh,
"used_int_var_2"
, int_var, 2);
13
swri::param
(pnh,
"unset_int_var"
, int_var, 2);
14
15
std::string str_var;
16
swri::getParam
(pnh,
"used_str_var_1"
, str_var);
17
swri::param
(pnh,
"used_str_var_2"
, str_var,
"foo"
);
18
swri::param
(pnh,
"unset_str_var"
, str_var,
"foo"
);
19
20
double
dbl_var;
21
swri::getParam
(pnh,
"used_dbl_var_1"
, dbl_var);
22
swri::param
(pnh,
"used_dbl_var_2"
, dbl_var, 2.0);
23
swri::param
(pnh,
"unset_dbl_var"
, dbl_var, 2.0);
24
25
bool
bool_var;
26
swri::getParam
(pnh,
"used_bool_var_1"
, bool_var);
27
swri::param
(pnh,
"used_bool_var_2"
, bool_var,
true
);
28
swri::param
(pnh,
"unset_bool_var"
, bool_var,
true
);
29
30
swri::warnUnusedParams
(pnh);
31
32
return
0;
33
}
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
ros.h
swri::warnUnusedParams
static void warnUnusedParams(ros::NodeHandle const &n)
Definition:
parameters.h:267
main
int main(int argc, char **argv)
Definition:
param_example.cpp:5
parameters.h
swri::getParam
bool getParam(swri::NodeHandle &nh, const std::string name, T &value, const std::string description)
Definition:
node_handle.h:1200
swri::param
void param(swri::NodeHandle &nh, const std::string name, std::string &value, const std::string def, const std::string description)
Definition:
node_handle.h:1159
ros::NodeHandle
swri_roscpp
Author(s): P. J. Reed
autogenerated on Fri Aug 2 2024 08:39:15