Announcing mqtt_client, a C++ nodelet for bi-directionally bridging messages between ROS and MQTT

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
2 Likes

Sounds awesome! I need to ask the obvious question: any plans to port for ROS2?

3 Likes

Yes, we definitely have plans to port this to ROS2. On first look however, we are not sure yet how to realize the generic subscription and publication of arbitrary ROS message types, since something like topic_tools::ShapeShifter doesn’t seem to be available for ROS2 yet.

2 Likes

You might find this useful: Generic Subscriber in ROS2 - ROS Answers: Open Source Q&A Forum

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.