[Documentation] [TitleIndex] [WordIndex

Topic Tools

rosh has wrappers for the topic_tools nodes that allow you to add nodes that throttle and otherwise manipulate topic data.


The simplest version of using a mux is to simply assign one topic to another:

topics.chatter_muxed = topics.chatter

This creates a mux that will change based on future assignments.

If you wish to have more explicit control over a mux, you can call mux().

mux(input_topics, output_topic)

mux_obj(input_topic), mux_obj.switch(input_topic)

mux_obj.kill(), kill(mux_obj)


In [1]: m = mux([topics.chatter, topics.chatter2], topics.chatter_mux)
In [2]: topics.chatter_mux[1]
Out[2]: data: hello world 1285199173.47
In [3]: m.topic_input[1]
Out[3]: data: hello world 1285199176.47
In [4]: m.topic_input._name
Out[4]: '/chatter'
In [5]: m(topics.new_topic)
Out[5]: prev_topic: /chatter
In [6]: m.topic_input._name
Out[6]: '/new_topic'
In [7]: kill(m)


relay(input_topic, output_topic, unreliable=False)

udprelay(input_topic, output_topic)

relay_obj.kill(), kill(relay_obj)



Throttles are useful for limiting the rate at which high bandwidth topics are published. This is useful for either limiting bandwidth across a network link (e.g. wireless) or for limiting the rate at which data is fed to an algorithm.

throttle(input_topic, output_topic, msgs_per_sec)

throttlebw(input_topic, output_topic, bytes_per_sec, window=1)

throttle_obj.kill(), kill(throttle_obj)


In [1]: t = throttle(topics.chatter, topics.chatter_1hz, 1)
In [2]: topics.chatter_1hz[1]
Out[2]: data: hello world 1285200089.85
In [3]: kill(t)

2019-11-16 13:16