classes inside nodelet (NodeHandle) [closed]

asked 2016-11-16 07:02:31 -0600

ROSfc gravatar image

Hello,

In my node I have several classes which I called from the main()

Then inside these classes constructor I simply use

nh_(ros::this_node::getName())
ros::NodeHandle nhPriv("~");

#################################

Now I convert this main() into a nodelet. The nh_ and nhPriv inside classes doesn't work because its not a node but a nodelet.

what is the best way to get nodeHandles inside these classes ?

I am dreading making these several classes into nodelets, is there a better way ?

edit retag flag offensive reopen merge delete

Closed for the following reason too localized by ROSfc
close date 2016-11-20 13:40:09.233743

Comments

Is there any reason why you cannot use getNodeHandle() and getPrivateNodeHandle()? They are described in the Nodelet tutorial.

Javier V. Gómez gravatar imageJavier V. Gómez ( 2016-11-18 12:51:15 -0600 )edit
1

yes the getNodeHandle() doesn't compile because I think it needs to be derived class from the nodelet class I am not so sure if this is the reason though. Anyway, I know decided to pass the nodehandles into the sub-classes from the nodelet. This seems to be the convention followed.

ROSfc gravatar imageROSfc ( 2016-11-20 13:39:32 -0600 )edit