src
nodehandles.cpp
Go to the documentation of this file.
1
#include <
nodelet/nodelet.h
>
2
#include <
pluginlib/class_list_macros.hpp
>
3
#include <string>
4
#include <
ros/ros.h
>
5
#include <std_msgs/Bool.h>
6
#include <std_msgs/Byte.h>
7
#include <std_msgs/Time.h>
8
9
namespace
test_nodelet
10
{
11
12
class
NodehandleTest
:
public
nodelet::Nodelet
13
{
14
public
:
15
NodehandleTest
(){};
16
virtual
void
onInit
()
17
{
18
ros::NodeHandle
nh = this->
getNodeHandle
();
19
ros::NodeHandle
pnh = this->
getPrivateNodeHandle
();
20
global_pub_
= nh.
advertise
<std_msgs::Time>(
"/global"
, 1000);
21
namespaced_pub_
= nh.
advertise
<std_msgs::Byte>(
"namespaced"
, 1000);
22
private_pub_
= pnh.
advertise
<std_msgs::Bool>(
"private"
, 1000);
23
}
24
private
:
25
ros::Publisher
global_pub_
,
namespaced_pub_
,
private_pub_
;
26
};
27
28
}
// namespace test_nodelet
29
30
PLUGINLIB_EXPORT_CLASS
(
test_nodelet::NodehandleTest
,
nodelet::Nodelet
);
ros::Publisher
nodelet::Nodelet::getNodeHandle
ros::NodeHandle & getNodeHandle() const
test_nodelet::NodehandleTest
Definition:
nodehandles.cpp:12
ros.h
test_nodelet
Definition:
console_tests.cpp:39
nodelet::Nodelet::getPrivateNodeHandle
ros::NodeHandle & getPrivateNodeHandle() const
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
test_nodelet::NodehandleTest::NodehandleTest
NodehandleTest()
Definition:
nodehandles.cpp:15
test_nodelet::NodehandleTest::private_pub_
ros::Publisher private_pub_
Definition:
nodehandles.cpp:25
test_nodelet::NodehandleTest::onInit
virtual void onInit()
Definition:
nodehandles.cpp:16
nodelet::Nodelet
nodelet.h
PLUGINLIB_EXPORT_CLASS
PLUGINLIB_EXPORT_CLASS(test_nodelet::NodehandleTest, nodelet::Nodelet)
class_list_macros.hpp
test_nodelet::NodehandleTest::namespaced_pub_
ros::Publisher namespaced_pub_
Definition:
nodehandles.cpp:25
test_nodelet::NodehandleTest::global_pub_
ros::Publisher global_pub_
Definition:
nodehandles.cpp:25
ros::NodeHandle
test_nodelet
Author(s): Tully Foote, Michael Carroll
autogenerated on Fri Nov 15 2024 03:38:16