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

Forward / remap multiple topics to a single topic?

asked 2013-10-14 19:33:24 -0500

eacousineau gravatar image

Is there already a way to forward / aggregate multiple topics to a single topic?

I tried remapping with rostopic echo, but found that the last remapping argument takes precedence. Example in bash:

# Spin up unique publishers
rostopic pub -r 5 /test/a std_msgs/Float64 "data: 0.0" &
rostopic pub -r 5 /test/b std_msgs/Float64 "data: 20.0" &

# Echo with remapping
rostopic echo /test/c /test/c:=/test/a /test/c:=/test/b

The output shows '20.0', meaning b's data is the only one getting through.

For the time being, I wrote a script to aggregate the topics:

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-10-15 05:16:12 -0500

Will topic_tools/relay do what you want?

edit flag offensive delete link more


Seems like it only handles a single topic. I tried out `topic_tools/mux`, which handles multiple topics, but running `rostopic echo` only showed '0.0'. Will look a little more into it.

eacousineau gravatar image eacousineau  ( 2013-10-15 06:15:56 -0500 )edit

mux switches between topics, it doesn't merge them.

dornhege gravatar image dornhege  ( 2013-10-15 07:08:16 -0500 )edit

If I understand your question correctly, two instances of relay should do what you want, one that does /test/a -> /test/c and one that does /test/b -> /test/c

Dan Lazewatsky gravatar image Dan Lazewatsky  ( 2013-10-15 08:52:47 -0500 )edit

Ah, that works. Thank you!

eacousineau gravatar image eacousineau  ( 2013-10-16 05:10:13 -0500 )edit

answered 2013-10-14 23:03:05 -0500

dornhege gravatar image

My intuition says no, because that will be two distinct connections.

edit flag offensive delete link more


That makes sense.

eacousineau gravatar image eacousineau  ( 2013-10-15 06:27:00 -0500 )edit

Question Tools

1 follower


Asked: 2013-10-14 19:33:24 -0500

Seen: 3,176 times

Last updated: Oct 15 '13