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

Forward / remap multiple topics to a single topic?

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

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: topic_aggregator.py

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

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

Will topic_tools/relay do what you want?

edit flag offensive delete link more

Comments

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 -0600 )edit
1

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

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

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 -0600 )edit

Ah, that works. Thank you!

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

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

dornhege gravatar image

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

edit flag offensive delete link more

Comments

That makes sense.

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

Question Tools

1 follower

Stats

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

Seen: 3,288 times

Last updated: Oct 15 '13