How to use getNodeHandle ?
I have a node which uses private node handle to advertise topics. I wanted to subscribe to a topic from another node. So I wanted to create another node handle instance. I tried to use getNodeHandle() but got the below error. Am I missing some include files? I have included nodelet/nodelet.h
error: ‘getNodeHandle’ was not declared in this scope ros::NodeHandle& nh = getNodeHandle();
How did you declare it in your class? Try to post the more of the code if possible.
To use
getNodeHandle
you would have to actually use anodelet
(thus derive your class from the class nodelet, define an onInit() method etc...) which doesn't seem to be what you want.