We would like to introduce our recently released package mqtt_client!
The mqtt_client package provides a ROS nodelet that enables connected ROS-based devices or robots to exchange ROS messages via an MQTT broker using the MQTT protocol. This works generically for arbitrary ROS message types.
A similar Python package mqtt_bridge already exists, but our mqtt_client brings better performance, easier and more extensive configurability, and an integrated latency measurement function.
Main features:
- C++ nodelet for high performance and memory efficiency
- support for arbitrary ROS message types through the use of generic publishers and subscribers
- support for many MQTT features like QoS levels, authentication, and encryption
- extensive configuration options on both the ROS and MQTT side
- built-in functionality for measuring the latency of transferring a ROS message via an MQTT broker back to ROS
Below you can find a minimal configuration for sending any message on ROS topic /ping
to MQTT topic /pingpong
and back to ROS topic /pong
on a single machine. A real use case would naturally involve one or more ROS-based machines.
Feel free to check out the Quick Start from our GitHub repository or the ROS Wiki page!
broker:
host: localhost
port: 1883
bridge:
ros2mqtt:
- ros_topic: /ping
mqtt_topic: pingpong
mqtt2ros:
- mqtt_topic: pingpong
ros_topic: /pong