Skip to content

labust/mqtt_ros_bridge

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MQTT ROS Bridge

This Bridge allows to subscribe to MQTT topics and publish contents of MQTT messages to ROS. It is not yet possible to pulish to MQTT from ROS.

Installation

Clone the repository in the source folder of your catkin workspace.

git clone https://github.com/EmaroLab/mqtt_ros_bridge.git

Dependencies

In order to succesfully run the code, you should have installed paho-mqtt and ROS.

MQTT Broker

The suggested MQTT Broker is Mosquitto. In order to install Mosquitto on Ubuntu follow this guide.

Test

In order to test the code:

  1. Check the Mosquitto broker status, if the broker is already active skip step 2.
    sudo service mosquitto status
  2. Start the Mosquitto broker.
    mosquitto
  3. In a new terminal tab launch the imu_bridge.
    roslaunch mqtt_ros_bridge imu_bridge.launch
  4. In a new terminal tab check the ROS topip /inertial, nothing should appear.
    rostopic echo /inertial
  5. In a new terminal tab publish a sensors/imu message to the local Mosquitto broker.
    mosquitto_pub -h localhost -t "sensors/imu" -m "acc;9.8;-0.3;0.5;vel;0.1;0.12;-0.4"
    In the terminal open at step 4 should appear the message received by the ROS master.

How to use mqtt_ros_bridge

The imu_brdige node is an example of how to use the bridge, summing up:

  1. Import bridge.py
  2. Create a class example_brigde that inherit from the bridge class.
    class example_bridge(bridge.bridge):
  3. Implement the msg_process function to map MQTT message to ROS message.
  4. Initialize the bridge and call the loop function in a ROS while loop.

Author

Alessandro Carfì e-mail: [email protected]

Releases

No releases published

Packages

No packages published

Languages

  • Python 64.9%
  • CMake 35.1%