From 360622ae711845d4c66322626dfad57847335a1b Mon Sep 17 00:00:00 2001 From: Jan Gutsche Date: Mon, 2 Oct 2023 20:08:05 +0200 Subject: [PATCH 1/6] Readme: add overview of components Signed-off-by: Jan Gutsche --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 47f5421..f496bdc 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,14 @@ The tools in this package are provided as composable ROS 2 component nodes, so t ## Components +- [Relay](#relay): Subscribes to a topic and republishes to another. +- [RelayField](#relayfield): Republishes data in a different message type. +- [Transform](#transform): Manipulates a topic or a field and outputs data on another topic. +- [Throttle](#throttle): Republishes data with bandwidth or rate limit. +- [Drop](#drop): Republishes by dropping X out of every Y incoming messages. +- [Mux](#mux): Multiplexes incoming topics to an output. +- [Delay](#delay): Delays and republishes incoming data. + ### Relay Relay is ROS 2 node that subscribes to a topic and republishes all incoming data to another topic. It can work with any message type. From b8fd1d8bced84d165ffab2b99080f8da0a6abdfc Mon Sep 17 00:00:00 2001 From: Jan Gutsche Date: Mon, 2 Oct 2023 20:08:05 +0200 Subject: [PATCH 2/6] Readme: Update wiki.ros.org URL to https Signed-off-by: Jan Gutsche --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f496bdc..b63f079 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # topic_tools -This package is the ROS 2 port of http://wiki.ros.org/topic_tools +This package is the ROS 2 port of https://wiki.ros.org/topic_tools Tools for directing, throttling, selecting, and otherwise manipulating ROS 2 topics at a meta-level. These tools do not generally perform serialization on the streams being manipulated, instead acting on generic binary data using `rclcpp`'s `GenericPublisher` and `GenericSubscription`. @@ -230,4 +230,4 @@ ros2 run topic_tools delay base_scan 0.5 - `lazy` (bool, default=False) - If True, only subscribe to `input_topic` if there is at least one subscriber on the `output_topic` - `delay` (double) - - delay in seconds \ No newline at end of file + - delay in seconds From f65b061fc1aca4dcbe3faaea22c48b87676b84c5 Mon Sep 17 00:00:00 2001 From: Jan Gutsche Date: Mon, 2 Oct 2023 20:08:05 +0200 Subject: [PATCH 3/6] Readme: specify shell language for commands Signed-off-by: Jan Gutsche --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index b63f079..bb22c5e 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Relay is ROS 2 node that subscribes to a topic and republishes all incoming data #### Usage -``` +```shell ros2 run topic_tools relay [outtopic] ``` @@ -32,7 +32,7 @@ Subscribe to `intopic` and republish to either E.g. rename `base_scan` to `my_base_scan`: -``` +```shell ros2 run topic_tools relay base_scan my_base_scan ``` @@ -51,7 +51,7 @@ RelayField is a ROS 2 node that allows to republish data in a different message #### Usage -``` +```shell ros2 run topic_tools relay_field [] ``` @@ -59,7 +59,7 @@ Subscribe to `input topic` and republish one or many of its fields onto another E.g. publish the contents of the `data` field in a `std_msgs/msg/String` onto the `frame_id` field of a `std_msgs/msg/Header`: -``` +```shell ros2 run topic_tools relay_field /chatter /header std_msgs/Header "{stamp: {sec: 0, nanosec: 0}, frame_id: m.data}" ``` @@ -69,7 +69,7 @@ Transform is a ROS 2 node that allows to take a topic or one of it fields and ou #### Usage -``` +```shell ros2 run topic_tools transform [] [--import ] [--field ] ``` @@ -78,7 +78,7 @@ Subscribe to `input topic` and convert topic content or its field into E.g. transform `imu` orientation to `norm`: -``` +```shell ros2 run topic_tools transform /imu --field orientation /norm std_msgs/Float64 'std_msgs.msg.Float64(data=numpy.sqrt(numpy.sum(numpy.array([m.x, m.y, m.z, m.w]))))' --import std_msgs numpy ``` @@ -90,7 +90,7 @@ Throttle is ROS 2 node that subscribes to a topic and republishes incoming data #### throttle message (rate) -``` +```shell ros2 run topic_tools throttle messages [outtopic] ``` @@ -101,13 +101,13 @@ Throttle messages on `intopic` to a particular rate. E.g. throttle bandwidth-hogging laser scans (base_scan) to 1Hz: -``` +```shell ros2 run topic_tools throttle messages base_scan 1.0 ``` #### throttle bytes (bandwidth) -``` +```shell ros2 run topic_tools throttle bytes [outtopic] ``` @@ -118,7 +118,7 @@ Throttle messages on `intopic` to a particular rate. E.g. throttle bandwidth-hogging laser scans (base_scan) to 1KBps: -``` +```shell ros2 run topic_tools throttle bytes base_scan 1024 1.0 ``` @@ -140,7 +140,7 @@ It's mainly useful for limiting bandwidth usage, e.g., over a wireless link. It #### Usage -``` +```shell ros2 run topic_tools drop [outtopic] ``` @@ -151,7 +151,7 @@ Subscribe to and drop every out of messages. E.g. drop every other message published to base_scan: -``` +```shell ros2 run topic_tools drop base_scan 1 2 ``` @@ -174,7 +174,7 @@ and to add and delete input topics. At startup, the first input topic on the com #### Usage -``` +```shell ros2 run topic_tools mux [intopic2...] ``` @@ -184,7 +184,7 @@ Subscribe to ...N and publish currently selected topic to outopic. mux E.g. mux two command streams (auto_cmdvel and joystick_cmdvel) into one (sel_cmdvel): -``` +```shell ros2 run topic_tools mux sel_cmdvel auto_cmdvel joystick_cmdvel ``` @@ -206,7 +206,7 @@ It's useful to simulate computational results with high latency. #### Usage -``` +```shell ros2 run topic_tools delay [outtopic] ``` @@ -217,7 +217,7 @@ Subscribe to and republish on delayed by . E.g. delay messages published to base_scan by 500ms: -``` +```shell ros2 run topic_tools delay base_scan 0.5 ``` From 0c62cbdf371b363fd868366f8ce787f40e3a4c21 Mon Sep 17 00:00:00 2001 From: Jan Gutsche Date: Mon, 2 Oct 2023 20:08:05 +0200 Subject: [PATCH 4/6] Readme: Consistent punctuation Signed-off-by: Jan Gutsche --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bb22c5e..0245d41 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ ros2 run topic_tools relay base_scan my_base_scan ### RelayField -RelayField is a ROS 2 node that allows to republish data in a different message type +RelayField is a ROS 2 node that allows to republish data in a different message type. #### Usage @@ -65,7 +65,7 @@ ros2 run topic_tools relay_field /chatter /header std_msgs/Header "{stamp: {sec: ### Transform -Transform is a ROS 2 node that allows to take a topic or one of it fields and output it on another topic +Transform is a ROS 2 node that allows to take a topic or one of it fields and output it on another topic. #### Usage From 89fd195bb4812a8de57d47c5bfa5dfb5291a783d Mon Sep 17 00:00:00 2001 From: Jan Gutsche Date: Mon, 2 Oct 2023 20:08:05 +0200 Subject: [PATCH 5/6] Readme: Update parameter description Signed-off-by: Jan Gutsche --- README.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 0245d41..1049e21 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ ros2 run topic_tools throttle messages [outtopic] Throttle messages on `intopic` to a particular rate. - `intopic`: Incoming topic to subscribe to -- `msgs_per_sec`: maximum messages per second to let through. +- `msgs_per_sec`: Maximum messages per second to let through. - `outtopic`: Outgoing topic to publish on (default: intopic_throttle) E.g. throttle bandwidth-hogging laser scans (base_scan) to 1Hz: @@ -113,7 +113,8 @@ ros2 run topic_tools throttle bytes [outtopic Throttle messages on `intopic` to a particular rate. - `intopic`: Incoming topic to subscribe to -- `msgs_per_sec`: maximum messages per second to let through. +- `bytes_per_sec`: Maximum bytes of messages per second to let through. +- `window`: Time window in seconds to consider - `outtopic`: Outgoing topic to publish on (default: intopic_throttle) E.g. throttle bandwidth-hogging laser scans (base_scan) to 1KBps: @@ -132,6 +133,14 @@ ros2 run topic_tools throttle bytes base_scan 1024 1.0 - If True, only subscribe to `input_topic` if there is at least one subscriber on the `output_topic` - `use_wall_clock` (bool, default=False) - If True, then perform all rate measurements against wall clock time, regardless of whether simulation / log time is in effect. +- `throttle_type` (string, either `messages` or `bytes`) + - Method how to throttle +- `msgs_per_sec` (double) + - Maximum messages per second to let through. +- `bytes_per_sec` (integer) + - Maximum bytes of messages per second to let through. +- `window` (double) + - Time window in seconds to consider ### Drop @@ -163,8 +172,8 @@ ros2 run topic_tools drop base_scan 1 2 - the same as if provided as a command line argument - `lazy` (bool, default=False) - If True, only subscribe to `input_topic` if there is at least one subscriber on the `output_topic` -- `X`, `Y` (int) - - drop X out of every Y incoming messages +- `X` (int), `Y` (int) + - Drop X out of every Y incoming messages ### Mux @@ -227,7 +236,7 @@ ros2 run topic_tools delay base_scan 0.5 - the same as if provided as a command line argument - `output_topic` (string, default=`_delay`) - the same as if provided as a command line argument -- `lazy` (bool, default=False) - - If True, only subscribe to `input_topic` if there is at least one subscriber on the `output_topic` -- `delay` (double) +- `delay` (double, default=0.0) - delay in seconds +- `use_wall_clock` (bool, default=False) + - If True, then perform all rate measurements against wall clock time, regardless of whether simulation / log time is in effect. From 507030d0e4ec121e514874a0059d28420c9d5f76 Mon Sep 17 00:00:00 2001 From: Jan Gutsche Date: Mon, 2 Oct 2023 20:08:05 +0200 Subject: [PATCH 6/6] Readme: Clearify mux initial_topic param Signed-off-by: Jan Gutsche --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1049e21..15321c8 100644 --- a/README.md +++ b/README.md @@ -205,8 +205,8 @@ ros2 run topic_tools mux sel_cmdvel auto_cmdvel joystick_cmdvel - the same as if provided as a command line argument - `lazy` (bool, default=False) - If True, only subscribe to `input_topic` if there is at least one subscriber on the `output_topic` -- `initial_topic` (str) - - Input topic to select on startup. If __none, start with no input topic. If unset, default to first topic in arguments +- `initial_topic` (str, default="") + - Input topic to select on startup. If `__none`, start with no input topic. If unset, default to first topic in arguments ### Delay