You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The *mqtt_client* package provides a ROS nodelet or ROS 2 node that enables connected ROS-based devices or robots to exchange ROS messages via an MQTT broker using the [MQTT](http://mqtt.org) protocol. This works generically for arbitrary ROS message types. The *mqtt_client* can also exchange primitive messages with MQTT clients running on devices not based on ROS.
13
14
14
15
-[Installation](#installation)
16
+
-[docker-ros](#docker-ros)
15
17
-[Usage](#usage)
16
18
-[Quick Start](#quick-start)
17
19
-[Launch](#launch)
@@ -37,7 +39,7 @@ If you would like to install *mqtt_client* from source, simply clone this reposi
*mqtt_client* is also available as a Docker image, containerized through [*docker-ros*](https://github.com/ika-rwth-aachen/docker-ros).
54
+
55
+
```bash
56
+
# ROS
57
+
docker run --rm ghcr.io/ika-rwth-aachen/mqtt_client:ros
58
+
59
+
# ROS 2
60
+
docker run --rm ghcr.io/ika-rwth-aachen/mqtt_client:ros2
61
+
```
62
+
63
+
49
64
## Usage
50
65
51
66
The *mqtt_client* can be easily integrated into an existing ROS-based system. Below, you first find a quick start guide to test the *mqtt_client* on a single machine. Then, more details are presented on how to launch and configure it in more complex applications.
@@ -97,7 +112,7 @@ bridge:
97
112
After building your ROS workspace, launch the *mqtt_client* nodelet with the pre-configured demo parameters using *roslaunch*, which should yield the following output.
98
113
99
114
```bash
100
-
# ROS 1
115
+
# ROS
101
116
roslaunch mqtt_client standalone.launch
102
117
103
118
# ROS 2
@@ -126,7 +141,7 @@ In order to test the communication among *mqtt_clients*, publish any ROS message
This will automatically load the provided demo [`params.yaml`](mqtt_client/config/params.yaml) / [`params.ros2.yaml`](mqtt_client/config/params.ros2.yaml). If you wish to load your custom configuration file, simply pass `params_file`.
As seen in the [Quick Start](#quick-start), the *mqtt_client* can not only exchange arbitrary ROS messages with other *mqtt_clients*, but it can also exchange primitive message data with other non-*mqtt_client* MQTT clients. This allows ROS-based devices to exchange primitive messages with devices not based on ROS. The `primitive` parameter can be set for both ROS-to-MQTT (`bridge/ros2mqtt`) and for MQTT-to-ROS (`bridge/mqtt2ros`) transmissions.
@@ -278,6 +294,7 @@ If a ROS-to-MQTT transmission is configured as `primitive` and the ROS message t
278
294
279
295
If an MQTT-to-ROS transmission is configured as `primitive`, the MQTT message is interpreted and published as a primitive data type, if possible. The message is probed in the following order: `bool`([`std_msgs/Bool`](http://docs.ros.org/en/api/std_msgs/html/msg/Bool.html)), `int` ([`std_msgs/Int32`](http://docs.ros.org/en/api/std_msgs/html/msg/Int32.html)), `float` ([`std_msgs/Float32`](http://docs.ros.org/en/api/std_msgs/html/msg/Float32.html)), `string` ([`std_msgs/String`](http://docs.ros.org/en/api/std_msgs/html/msg/String.html)).
280
296
297
+
281
298
## Latency Computation
282
299
283
300
The *mqtt_client* provides built-in functionality to measure the latency of transferring a ROS message via an MQTT broker back to ROS. Note that this functionality is only available for non-primitive messages (see [Primitive Messages](#primitive-messages)). To this end, the sending client injects the current timestamp into the MQTT message. The receiving client can then compute the latency between message reception time and the injected timestamp. **Naturally, this is only accurate to the level of synchronization between clocks on sending and receiving machine.**
@@ -287,7 +304,7 @@ In order to inject the current timestamp into outgoing MQTT messages, the parame
287
304
These latencies can be printed easily with *rostopic echo*
ros2 run rqt_plot rqt_plot /<mqtt_client_name>/latencies/<mqtt2ros/ros_topic>/data
305
322
```
306
323
324
+
307
325
## Package Summary
308
326
309
327
This short package summary documents the package in line with the [ROS Wiki Style Guide](http://wiki.ros.org/StyleGuide).
310
328
311
-
### ROS 1
329
+
### ROS
312
330
313
331
#### Nodelets
314
332
@@ -366,9 +384,10 @@ Enables connected ROS-based devices or robots to exchange ROS messages via an MQ
366
384
367
385
See [Configuration](#configuration).
368
386
387
+
369
388
## How It Works
370
389
371
-
### ROS 1
390
+
### ROS
372
391
373
392
The *mqtt_client* is able to bridge ROS messages of arbitrary message type to an MQTT broker. To this end, it needs to employ generic ROS subscribers and publishers, which only take shape at runtime.
374
393
@@ -409,6 +428,7 @@ To summarize, the dataflow is as follows:
409
428
- if the message contained a timestamp, the latency is computed and published on ROS topic `~/latencies/<mqtt2ros_ros_topic>`
410
429
- the serialized ROS message is published using the *ShapeShifter* on ROS topic `<mqtt2ros_ros_topic>`
411
430
431
+
412
432
## Acknowledgements
413
433
414
434
This research is accomplished within the projects [6GEM](https://6gem.de/) (FKZ 16KISK036K) and [UNICAR*agil*](https://www.unicaragil.de/) (FKZ 16EMO0284K). We acknowledge the financial support for the projects by the Federal Ministry of Education and Research of Germany (BMBF).
0 commit comments