Node does not subscribed multipletopics
Hi all, I have the following situation: have a constructor
unionNode() {
//publish a marker of the reconstructed object
marker_pub= n.advertise<visualization_msgs::Marker>("final_marker_visual", 1);
sub_bounding=n.subscribe<yolo_cropper::bb>("/bounding_coordinates",10,&unionNode::bbCallback,this);
yolo_Img=n.subscribe<sensor_msgs::Image>("/yolo_show",10,&unionNode::yoloCallback,this);
sub_depth = n.subscribe<sensor_msgs::Image>("/dmde/depth",10,&unionNode::depthCallback,this);
f=400;
Cx=376;
Cy=240;
std::cout<<"Constructor Builded"<<std::endl;}
where the node must subscribe itself to the three topics above described. I tried also with the Synchronizer message filter tools, but with the same problem.
When I run main:
int main(int argc, char **argv){
ros::init(argc, argv, "union");
unionNode();
ros::spin();}
I see "constructor builded" text... but if I open rqt_grap or rosnode_info I see my node Union is not subscribed to any topics... What should it be? The 3 topics are active , I v seen with rostopic echo... Thanks
I don't see a
ros::NodeHandle
anywhere in your code, but you're obviously creating one somewhere. Note that if all of yourNodeHandle
s go out of scope, roscpp will stop and all of your subscribers will stop.