We are happy to announce that mqtt_client , first released a year ago, has now been ported to and released for ROS 2 Humble, Iron, and Rolling!
The mqtt_client package provides a ROS node 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.
Main features:
- C++ node 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
- support for exchanging messages of primitive data types with other non-ROS MQTT clients
- 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 more ROS-based machines.
Feel free to check out the Quick Start from our GitHub repository or the ROS Wiki page !
mqtt_client:
ros__parameters:
broker:
host: localhost
port: 1883
bridge:
ros2mqtt:
ros_topic: /ping/ros
mqtt_topic: pingpong
mqtt2ros:
mqtt_topic: pingpong
ros_topic: /pong/ros