0
$\begingroup$

Rosanswers logo

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


Originally posted by eacousineau on ROS Answers with karma: 174 on 2013-10-14

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Will topic_tools/relay do what you want?


Originally posted by Dan Lazewatsky with karma: 9115 on 2013-10-15

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by eacousineau on 2013-10-15:
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.

Comment by dornhege on 2013-10-15:
mux switches between topics, it doesn't merge them.

Comment by Dan Lazewatsky on 2013-10-15:
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

Comment by eacousineau on 2013-10-16:
Ah, that works. Thank you!

$\endgroup$
0
$\begingroup$

Rosanswers logo

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


Originally posted by dornhege with karma: 31395 on 2013-10-14

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by eacousineau on 2013-10-15:
That makes sense.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.