mqtt_bridge package from mqtt_bridge repomqtt_bridge |
|
Package Summary
Tags | No category tags. |
Version | 0.2.1 |
License | MIT |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/groove-x/mqtt_bridge.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2023-01-26 |
Dev Status | MAINTAINED |
CI status | Continuous Integration |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Junya Hayashi
Authors
- Junya Hayashi
mqtt_bridge
mqtt_bridge provides a functionality to bridge between ROS and MQTT in bidirectional.
mqtt_bridge is not actively maintained now. Feel free to check out mqtt_client, a high-performance C++ ROS nodelet with recent development!
Principle
mqtt_bridge
uses ROS message as its protocol. Messages from ROS are serialized by json (or messagepack) for MQTT, and messages from MQTT are deserialized for ROS topic. So MQTT messages should be ROS message compatible. (We use rosbridge_library.internal.message_conversion
for message conversion.)
This limitation can be overcome by defining custom bridge class, though.
Demo
Prerequisites
$ sudo apt install python3-pip
$ sudo apt install ros-noetic-rosbridge-library
$ sudo apt install mosquitto mosquitto-clients
Install python modules
$ pip3 install -r requirements.txt
launch node
$ roslaunch mqtt_bridge demo.launch
Publish to /ping
,
$ rostopic pub /ping std_msgs/Bool "data: true"
and see response to /pong
.
$ rostopic echo /pong
data: True
---
Publish “hello” to /echo
,
$ rostopic pub /echo std_msgs/String "data: 'hello'"
and see response to /back
.
$ rostopic echo /back
data: hello
---
You can also see MQTT messages using mosquitto_sub
$ mosquitto_sub -t '#'
Usage
parameter file (config.yaml):
mqtt:
client:
protocol: 4 # MQTTv311
connection:
host: localhost
port: 1883
keepalive: 60
bridge:
# ping pong
- factory: mqtt_bridge.bridge:RosToMqttBridge
msg_type: std_msgs.msg:Bool
topic_from: /ping
topic_to: ping
- factory: mqtt_bridge.bridge:MqttToRosBridge
msg_type: std_msgs.msg:Bool
topic_from: ping
topic_to: /pong
you can use any msg types like sensor_msgs.msg:Imu
.
launch file:
<launch>
<node name="mqtt_bridge" pkg="mqtt_bridge" type="mqtt_bridge_node.py" output="screen">
<rosparam file="/path/to/config.yaml" command="load" />
</node>
</launch>
Configuration
mqtt
Parameters under mqtt
section are used for creating paho’s mqtt.Client
and its configuration.
subsections
-
client
: used formqtt.Client
constructor -
tls
: used for tls configuration -
account
: used for username and password configuration -
message
: used for MQTT message configuration -
userdata
: used for MQTT userdata configuration -
will
: used for MQTT’s will configuration
See mqtt_bridge.mqtt_client
for detail.
mqtt private path
If mqtt/private_path
parameter is set, leading ~/
in MQTT topic path will be replaced by this value. For example, if mqtt/pivate_path
is set as “device/001”, MQTT path “~/value” will be converted to “device/001/value”.
serializer and deserializer
mqtt_bridge
uses msgpack
as a serializer by default. But you can also configure other serializers. For example, if you want to use json for serialization, add following configuration.
serializer: json:dumps
deserializer: json:loads
bridges
You can list ROS <–> MQTT tranfer specifications in following format.
bridge:
# ping pong
- factory: mqtt_bridge.bridge:RosToMqttBridge
msg_type: std_msgs.msg:Bool
topic_from: /ping
topic_to: ping
- factory: mqtt_bridge.bridge:MqttToRosBridge
msg_type: std_msgs.msg:Bool
topic_from: ping
topic_to: /pong
-
factory
: bridge class for transfering message from ROS to MQTT, and vise versa. -
msg_type
: ROS Message type transfering through the bridge. -
topic_from
: topic incoming from (ROS or MQTT) -
topic_to
: topic outgoing to (ROS or MQTT)
Also, you can create custom bridge class by inheriting mqtt_brige.bridge.Bridge
.
License
This software is released under the MIT License, see LICENSE.txt.
Changelog for package mqtt_bridge
0.2.1 (2020-12-31)
- fix build dependency (#43)
- Contributors: Junya Hayashi
0.2.0 (2020-12-31)
- migrate to Python 3 (#25)
- Contributors: Christopher Mayershofer, Junya Hayashi, Yuma Mihira
0.1.8 (2020-12-31)
- configure rostest and run it on circleci (#41)
- split requirements.txt (#38)
- add unittests (#37)
- Fix 'install_requires' warning when building with --install (#32)
- Contributors: Jacob Seibert, Junya Hayashi
0.1.7 (2020-06-21)
- Fix mqtt subscribing to private path (#27)
- Fix frequency limit (#26)
- Add bson module in requirements.txt (#10)
- Fix Bridge not to fall when ros msg cannot be created (#4)
- Contributors: 5tan, Junya Hayashi, Tomas Cernik, Yuma Mihira, kapilPython
0.1.6 (2017-11-10)
- fix if frequency is none (#2)
0.1.5 (2016-12-07)
- Update configurations
0.1.0 (2016-12-04)
- Initial Release
Wiki Tutorials
Dependant Packages
Launch files
- launch/demo.launch
-
- use_tls [default: false]
Messages
Services
Plugins
Recent questions tagged mqtt_bridge at Robotics Stack Exchange
mqtt_bridge package from mqtt_bridge repomqtt_bridge |
|
Package Summary
Tags | No category tags. |
Version | 0.2.1 |
License | MIT |
Build type | CATKIN |
Use | RECOMMENDED |
Repository Summary
Checkout URI | https://github.com/groove-x/mqtt_bridge.git |
VCS Type | git |
VCS Version | master |
Last Updated | 2023-01-26 |
Dev Status | MAINTAINED |
CI status | Continuous Integration : 0 / 0 |
Released | RELEASED |
Tags | No category tags. |
Contributing |
Help Wanted (0)
Good First Issues (0) Pull Requests to Review (0) |
Package Description
Additional Links
Maintainers
- Junya Hayashi
Authors
- Junya Hayashi
mqtt_bridge
mqtt_bridge provides a functionality to bridge between ROS and MQTT in bidirectional.
mqtt_bridge is not actively maintained now. Feel free to check out mqtt_client, a high-performance C++ ROS nodelet with recent development!
Principle
mqtt_bridge
uses ROS message as its protocol. Messages from ROS are serialized by json (or messagepack) for MQTT, and messages from MQTT are deserialized for ROS topic. So MQTT messages should be ROS message compatible. (We use rosbridge_library.internal.message_conversion
for message conversion.)
This limitation can be overcome by defining custom bridge class, though.
Demo
Prerequisites
$ sudo apt install python3-pip
$ sudo apt install ros-noetic-rosbridge-library
$ sudo apt install mosquitto mosquitto-clients
Install python modules
$ pip3 install -r requirements.txt
launch node
$ roslaunch mqtt_bridge demo.launch
Publish to /ping
,
$ rostopic pub /ping std_msgs/Bool "data: true"
and see response to /pong
.
$ rostopic echo /pong
data: True
---
Publish “hello” to /echo
,
$ rostopic pub /echo std_msgs/String "data: 'hello'"
and see response to /back
.
$ rostopic echo /back
data: hello
---
You can also see MQTT messages using mosquitto_sub
$ mosquitto_sub -t '#'
Usage
parameter file (config.yaml):
mqtt:
client:
protocol: 4 # MQTTv311
connection:
host: localhost
port: 1883
keepalive: 60
bridge:
# ping pong
- factory: mqtt_bridge.bridge:RosToMqttBridge
msg_type: std_msgs.msg:Bool
topic_from: /ping
topic_to: ping
- factory: mqtt_bridge.bridge:MqttToRosBridge
msg_type: std_msgs.msg:Bool
topic_from: ping
topic_to: /pong
you can use any msg types like sensor_msgs.msg:Imu
.
launch file:
<launch>
<node name="mqtt_bridge" pkg="mqtt_bridge" type="mqtt_bridge_node.py" output="screen">
<rosparam file="/path/to/config.yaml" command="load" />
</node>
</launch>
Configuration
mqtt
Parameters under mqtt
section are used for creating paho’s mqtt.Client
and its configuration.
subsections
-
client
: used formqtt.Client
constructor -
tls
: used for tls configuration -
account
: used for username and password configuration -
message
: used for MQTT message configuration -
userdata
: used for MQTT userdata configuration -
will
: used for MQTT’s will configuration
See mqtt_bridge.mqtt_client
for detail.
mqtt private path
If mqtt/private_path
parameter is set, leading ~/
in MQTT topic path will be replaced by this value. For example, if mqtt/pivate_path
is set as “device/001”, MQTT path “~/value” will be converted to “device/001/value”.
serializer and deserializer
mqtt_bridge
uses msgpack
as a serializer by default. But you can also configure other serializers. For example, if you want to use json for serialization, add following configuration.
serializer: json:dumps
deserializer: json:loads
bridges
You can list ROS <–> MQTT tranfer specifications in following format.
bridge:
# ping pong
- factory: mqtt_bridge.bridge:RosToMqttBridge
msg_type: std_msgs.msg:Bool
topic_from: /ping
topic_to: ping
- factory: mqtt_bridge.bridge:MqttToRosBridge
msg_type: std_msgs.msg:Bool
topic_from: ping
topic_to: /pong
-
factory
: bridge class for transfering message from ROS to MQTT, and vise versa. -
msg_type
: ROS Message type transfering through the bridge. -
topic_from
: topic incoming from (ROS or MQTT) -
topic_to
: topic outgoing to (ROS or MQTT)
Also, you can create custom bridge class by inheriting mqtt_brige.bridge.Bridge
.
License
This software is released under the MIT License, see LICENSE.txt.
Changelog for package mqtt_bridge
0.2.1 (2020-12-31)
- fix build dependency (#43)
- Contributors: Junya Hayashi
0.2.0 (2020-12-31)
- migrate to Python 3 (#25)
- Contributors: Christopher Mayershofer, Junya Hayashi, Yuma Mihira
0.1.8 (2020-12-31)
- configure rostest and run it on circleci (#41)
- split requirements.txt (#38)
- add unittests (#37)
- Fix 'install_requires' warning when building with --install (#32)
- Contributors: Jacob Seibert, Junya Hayashi
0.1.7 (2020-06-21)
- Fix mqtt subscribing to private path (#27)
- Fix frequency limit (#26)
- Add bson module in requirements.txt (#10)
- Fix Bridge not to fall when ros msg cannot be created (#4)
- Contributors: 5tan, Junya Hayashi, Tomas Cernik, Yuma Mihira, kapilPython
0.1.6 (2017-11-10)
- fix if frequency is none (#2)
0.1.5 (2016-12-07)
- Update configurations
0.1.0 (2016-12-04)
- Initial Release
Wiki Tutorials
Dependant Packages
Launch files
- launch/demo.launch
-
- use_tls [default: false]