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

Having two NodeHandle, one in each class.

asked 2020-05-04 16:43:28 -0600

Kolohe113 gravatar image

I have a question regards to node handler in C++. Say I have two classes, located in different files: A.h:

class A
ros::NodeHandle n;
ros::subscriber subA;


class B
ros::NodeHandle n;

And in main.cpp, I included both A.h and B.h. Will there be any conflict here?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-05-04 18:21:38 -0600


(More characters to post)

edit flag offensive delete link more


@stevemacenski: the OP sort-of did this to himself (as the question posted is a yes/no question), but it would be nice to add a little more explanation here.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-05 02:53:36 -0600 )edit

I’d generally agree, but I’m not sure what else there is to say on this front. I’m not sure they want to hear about what the nodehandle is/does. I think this was a pretty clear question and answer :-)

stevemacenski gravatar image stevemacenski  ( 2020-05-05 11:15:08 -0600 )edit

Question Tools

1 follower


Asked: 2020-05-04 16:43:28 -0600

Seen: 508 times

Last updated: May 04 '20