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

Having two NodeHandle, one in each class.

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

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
{
private: 
ros::NodeHandle n;
ros::subscriber subA;
}

B.h:

class B
{
private: 
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
0

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

No.

(More characters to post)

edit flag offensive delete link more

Comments

@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 -0500 )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 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 518 times

Last updated: May 04 '20