Skip to content

Commit 084162a

Browse files
authored
Merge pull request #23 from ika-rwth-aachen/docker-ros
Integrate docker-ros
2 parents 2d633e1 + cd7f4df commit 084162a

File tree

6 files changed

+93
-14
lines changed

6 files changed

+93
-14
lines changed

.github/workflows/docker-ros.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: docker-ros
2+
3+
on: push
4+
5+
jobs:
6+
7+
ros:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: ika-rwth-aachen/docker-ros@v1.0.0
11+
with:
12+
image-tag: ros
13+
base-image: rwthika/ros:latest
14+
command: roslaunch mqtt_client standalone.launch
15+
platform: amd64,arm64
16+
target: run
17+
18+
ros2:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: ika-rwth-aachen/docker-ros@v1.0.0
22+
with:
23+
image-tag: ros2
24+
base-image: rwthika/ros2:latest
25+
command: ros2 launch mqtt_client standalone.launch.ros2.xml
26+
platform: amd64,arm64
27+
target: run
28+
enable-push-as-latest: 'true'
29+

.github/workflows/build.yml renamed to .github/workflows/industrial_ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: industrial_ci
22

33
on: push
44

@@ -17,7 +17,7 @@ jobs:
1717
- testing
1818
- main
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121
- uses: ros-industrial/industrial_ci@master
2222
with:
2323
config: ${{ toJSON(matrix) }}

.gitlab-ci.ros.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include:
2+
- remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.0.0/.gitlab-ci/docker-ros.yml
3+
4+
variables:
5+
IMAGE_TAG: ros
6+
BASE_IMAGE: rwthika/ros:latest
7+
COMMAND: roslaunch mqtt_client standalone.launch
8+
PLATFORM: amd64,arm64
9+
TARGET: dev,run
10+
ENABLE_INDUSTRIAL_CI: 'true'

.gitlab-ci.ros2.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include:
2+
- remote: https://raw.githubusercontent.com/ika-rwth-aachen/docker-ros/v1.0.0/.gitlab-ci/docker-ros.yml
3+
4+
variables:
5+
IMAGE_TAG: ros2
6+
BASE_IMAGE: rwthika/ros:latest
7+
COMMAND: ros2 launch mqtt_client standalone.launch.ros2.xml
8+
PLATFORM: amd64,arm64
9+
TARGET: dev,run
10+
ENABLE_INDUSTRIAL_CI: 'true'
11+
ENABLE_PUSH_AS_LATEST: 'true'

.gitlab-ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ros:
2+
trigger:
3+
include: .gitlab-ci.ros.yml
4+
strategy: depend
5+
6+
ros2:
7+
trigger:
8+
include: .gitlab-ci.ros2.yml
9+
strategy: depend

README.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
<p align="center">
44
<img src="https://img.shields.io/github/v/release/ika-rwth-aachen/mqtt_client"/></a>
55
<img src="https://img.shields.io/github/license/ika-rwth-aachen/mqtt_client"/></a>
6-
<a href="https://github.com/ika-rwth-aachen/mqtt_client/actions/workflows/build.yml"><img src="https://github.com/ika-rwth-aachen/mqtt_client/actions/workflows/build.yml/badge.svg"/></a>
6+
<a href="https://github.com/ika-rwth-aachen/mqtt_client/actions/workflows/industrial_ci.yml"><img src="https://github.com/ika-rwth-aachen/mqtt_client/actions/workflows/industrial_ci.yml/badge.svg"/></a>
7+
<a href="https://github.com/ika-rwth-aachen/mqtt_client/actions/workflows/docker-ros.yml"><img src="https://github.com/ika-rwth-aachen/mqtt_client/actions/workflows/docker-ros.yml/badge.svg"/></a>
78
<img src="https://img.shields.io/badge/ROS-noetic-blueviolet"/>
89
<img src="https://img.shields.io/badge/ROS 2-humble|iron|rolling-blueviolet"/>
910
<a href="https://github.com/ika-rwth-aachen/mqtt_client"><img src="https://img.shields.io/github/stars/ika-rwth-aachen/mqtt_client?style=social"/></a>
@@ -12,6 +13,7 @@
1213
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.
1314

1415
- [Installation](#installation)
16+
- [docker-ros](#docker-ros)
1517
- [Usage](#usage)
1618
- [Quick Start](#quick-start)
1719
- [Launch](#launch)
@@ -37,7 +39,7 @@ If you would like to install *mqtt_client* from source, simply clone this reposi
3739
# mqtt_client$
3840
rosdep install -r --ignore-src --from-paths .
3941

40-
# ROS 1
42+
# ROS
4143
# workspace$
4244
catkin build -DCMAKE_BUILD_TYPE=Release mqtt_client
4345

@@ -46,6 +48,19 @@ catkin build -DCMAKE_BUILD_TYPE=Release mqtt_client
4648
colcon build --packages-up-to mqtt_client --cmake-args -DCMAKE_BUILD_TYPE=Release
4749
```
4850

51+
### docker-ros
52+
53+
*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+
4964
## Usage
5065

5166
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:
97112
After building your ROS workspace, launch the *mqtt_client* nodelet with the pre-configured demo parameters using *roslaunch*, which should yield the following output.
98113
99114
```bash
100-
# ROS 1
115+
# ROS
101116
roslaunch mqtt_client standalone.launch
102117

103118
# ROS 2
@@ -126,7 +141,7 @@ In order to test the communication among *mqtt_clients*, publish any ROS message
126141
```bash
127142
# 1st terminal: publish ROS message to /ping
128143

129-
# ROS 1
144+
# ROS
130145
rostopic pub -r 1 /ping/ros std_msgs/String "Hello MQTT"
131146

132147
# ROS 2
@@ -136,7 +151,7 @@ ros2 topic pub /ping/ros std_msgs/msg/String "{data: \"Hello MQTT\"}"
136151
```bash
137152
# 2nd terminal: listen for ROS messages on /pong
138153

139-
# ROS 1
154+
# ROS
140155
rostopic echo /pong/ros
141156

142157
# ROS 2
@@ -164,7 +179,7 @@ ros2 topic pub /ping/primitive std_msgs/msg/Int32 "{data: 42}"
164179
```bash
165180
# 4th terminal: listen for primitive ROS messages on /pong/primitive
166181

167-
# ROS 1
182+
# ROS
168183
rostopic echo /pong/primitive
169184

170185
# ROS2
@@ -183,7 +198,7 @@ If everything works as expected, the second terminal should print a message at 1
183198
You can start the *mqtt_client* nodelet in a standalone nodelet manager with:
184199

185200
```bash
186-
# ROS 1
201+
# ROS
187202
roslaunch mqtt_client standalone.launch
188203

189204
# ROS 2
@@ -193,7 +208,7 @@ ros2 launch mqtt_client standalone.launch.ros2.xml
193208
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`.
194209

195210
```bash
196-
# ROS 1
211+
# ROS
197212
roslaunch mqtt_client standalone.launch params_file:="</PATH/TO/PARAMS.YAML>"
198213

199214
# ROS 2
@@ -270,6 +285,7 @@ bridge:
270285
latched: # [false] whether to latch ROS message
271286
```
272287

288+
273289
## Primitive Messages
274290

275291
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
278294

279295
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)).
280296

297+
281298
## Latency Computation
282299

283300
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
287304
These latencies can be printed easily with *rostopic echo*
288305

289306
```bash
290-
# ROS 1
307+
# ROS
291308
rostopic echo --clear /<mqtt_client_name>/latencies/<mqtt2ros/ros_topic>/data
292309
293310
# ROS 2
@@ -297,18 +314,19 @@ ros2 topic echo /<mqtt_client_name>/latencies/<mqtt2ros/ros_topic>/data
297314
or plotted with [rqt_plot](http://wiki.ros.org/rqt_plot):
298315

299316
```bash
300-
# ROS 1
317+
# ROS
301318
rosrun rqt_plot rqt_plot /<mqtt_client_name>/latencies/<mqtt2ros/ros_topic>/data
302319
303320
# ROS 2
304321
ros2 run rqt_plot rqt_plot /<mqtt_client_name>/latencies/<mqtt2ros/ros_topic>/data
305322
```
306323

324+
307325
## Package Summary
308326

309327
This short package summary documents the package in line with the [ROS Wiki Style Guide](http://wiki.ros.org/StyleGuide).
310328

311-
### ROS 1
329+
### ROS
312330

313331
#### Nodelets
314332

@@ -366,9 +384,10 @@ Enables connected ROS-based devices or robots to exchange ROS messages via an MQ
366384

367385
See [Configuration](#configuration).
368386

387+
369388
## How It Works
370389

371-
### ROS 1
390+
### ROS
372391

373392
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.
374393

@@ -409,6 +428,7 @@ To summarize, the dataflow is as follows:
409428
- if the message contained a timestamp, the latency is computed and published on ROS topic `~/latencies/<mqtt2ros_ros_topic>`
410429
- the serialized ROS message is published using the *ShapeShifter* on ROS topic `<mqtt2ros_ros_topic>`
411430

431+
412432
## Acknowledgements
413433

414434
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

Comments
 (0)