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

can i use a single nodehandle for multiple subscrubers in a single cpp file

asked 2016-09-26 08:10:52 -0500

rajnunes gravatar image

is it possible to use a single node handle to subscribe to multiple topics simultaneously or will this only subscribe to a single topic and then switch from one topic to another. will this cause me a loss of a particular topic data at that instant ? thnx

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-09-26 08:50:04 -0500

gvdhoorn gravatar image

updated 2016-09-26 08:52:07 -0500

Yes, you can use a single NodeHandle to subscribe (and publish) to multiple topics.

Only when the NodeHandle instance goes out of scope will your subscriptions (and any publishers) be taken down.


Edit: note that this has been asked multiple times already, as a quick search reveals: see question about the nodehandle for subscribing and publishing and roscpp node handles convention fi.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-09-26 08:10:52 -0500

Seen: 842 times

Last updated: Sep 26 '16