Skip to content

Example of creating an MQTT server with publisher in ROS Noetic and python subscriber

License

Notifications You must be signed in to change notification settings

Christdej/eq_robot_mqtt_broker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eq_robot_mqtt_broker

Example of creating an MQTT server with publisher in ROS Noetic and python subscriber

Prerequisites

You must have

  1. Docker
  2. Docker-compose

Run the example

Clone the repository and navigate to the root folder

sudo -E docker-compose up

Note that the -E option is what enables passing environment variables from the host machine to the container.

If you wish to force re-building of the docker images

sudo -E docker-compose up --build

The docker-compose should now spin up three containers.

  1. mqtt_broker
    • The MQTT server which relays messages. This is based on VerneMQ.
  2. mqtt_publisher
    • A ROS Noetic network spinning up a publisher which publishes dummy data to the broker at 1 Hz. The communication on the ROS network is relayed to the MQTT broker through an mqtt_bridge.
  3. mqtt_subscriber

The publisher will print its published message while the subscriber will echo the message.

VerneMQ status interface

The VerneMQ status interface is exposed in localhost and may be accessed at

http://localhost:8888/status

Accessing the containers

Each container may be accessed after startup through the following command

sudo docker exec -it <container_name> /bin/bash

Administering the MQTT Broker

User management

Note that the example currently has anonymous access enabled by default!

A user exists with the following credentials for the sake of the example

  • Username: test_user
  • Password: test_password

To manage the user/password file see the official VerneMQ documentation.

Broker inspection

To inspect the broker during runtime you may use docker exec to access the container and use the vmq-admin tool to inspect the broker. See the VerneMq documentation for more details.

Credits

Thanks to The EIT-hub experiments repository for heplful guide to VerneMQ.

About

Example of creating an MQTT server with publisher in ROS Noetic and python subscriber

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published