Robotics StackExchange | Archived questions

Having two NodeHandle, one in each class.

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?

Asked by Kolohe113 on 2020-05-04 16:43:28 UTC

Comments

Answers

No.

(More characters to post)

Asked by stevemacenski on 2020-05-04 18:21:38 UTC

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.

Asked by gvdhoorn on 2020-05-05 02:53:36 UTC

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 :-)

Asked by stevemacenski on 2020-05-05 11:15:08 UTC