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

Publisher and Subscriber using same node!

asked 2016-03-22 16:05:32 -0500

SarSam gravatar image

updated 2016-03-23 05:34:28 -0500

Can anybody provide me an example for using publisher and subscriber with the same node? I want to publish a topic from node 1 and then subscribe to that topic from node 2 and then publish the subscribed data from node 2 to another topic!

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2016-03-22 16:38:27 -0500

ahendrix gravatar image

This is a pretty frequently asked question, with lots of answers. The first four results that I get on Google all have reasonable answers with examples and discussions of the pros and cons of the various approaches:

edit flag offensive delete link more

answered 2018-03-15 18:52:21 -0500

KenLafond gravatar image

The above links didn't help me hardly at all, and I kept tripping across this thread while searching on this topic. Sorry for the very late post, but the below link really helped me out, and I wish I hadn't had to dig so much for it:

Hope it helps someone else out too!

edit flag offensive delete link more

answered 2019-08-09 08:01:04 -0500

lochlomond gravatar image

I kind of like this one: Hope this may help

edit flag offensive delete link more


Please trust this guy. His youtube link helped me!

WangTCU gravatar image WangTCU  ( 2020-10-03 17:03:22 -0500 )edit

answered 2022-07-29 02:15:58 -0500

I have wrote a demo using c++, it can be reach in my github, Thank you!

The link is below:

This demo enable subscriber and publisher work together in same node.

github: link text

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-03-22 15:54:13 -0500

Seen: 28,750 times

Last updated: Aug 09 '19