ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, that is perfectly fine.

Yes, that reusing your NodeHandle instance is perfectly fine.fine in general.

In your specific example though, you are creating a NodeHandle referencing the private namespace ("~") of the node, then start creating publishers and subscribers through it that publish and subscribe to topics that appear to be in the global namespace. I'm not sure, but that either won't work, or the node will try to find /topic_name in its private namespace, and fail.