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

Suspend a publisher [closed]

asked 2017-03-15 05:48:59 -0500

jony gravatar image

Hi! In my system there are 2 nodes that publish on a topic concurrently. This situation leads an unstable state for my system, so I would suspend publication (only for that topic) from one of the two nodes. I wouldn't work on the code of two nodes. There is a way to pause the subscribtion of a publisher to a topic? Thanks

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by jony
close date 2017-03-16 09:09:35.419542

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-03-15 10:37:50 -0500

lucasw gravatar image

With a topic_tools mux you can feed both inputs into a node and select which gets published out with a service call:

http://wiki.ros.org/topic_tools/mux

So instead of

node1 -> topicA 
node2 -> topicA
topicA -> node3

it would be

node1 -> topicB -> mux
node2 -> topicC -> mux
mux -> topicA  (which is a copy of either B or C depending on mux selection)
topicA -> node3
edit flag offensive delete link more

Comments

thank you for the answer, but following your suggestion I should work on the code of node1 and node2 to divert respectively node1 to topic B and node2 to topicC. Right? In this case your solution isn't good for me.

jony gravatar image jony  ( 2017-03-15 11:06:09 -0500 )edit

You don't have to alter the code to change where publications go, remapping can change that at runtime: http://wiki.ros.org/Remapping%20Argum... or http://wiki.ros.org/roslaunch/XML/remap

lucasw gravatar image lucasw  ( 2017-03-15 13:20:14 -0500 )edit

Great! It works. Thank you so much ;)

jony gravatar image jony  ( 2017-03-16 08:54:10 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-03-15 05:48:59 -0500

Seen: 577 times

Last updated: Mar 15 '17