groove-x / mqtt_bridge

mqtt_bridge provides a functionality to bridge between ROS and MQTT in bidirectional
MIT License
160 stars 146 forks source link

several changes #21

Closed dayjaby closed 4 years ago

dayjaby commented 5 years ago

We've been relying on mqtt_bridge for an interface with one of our customers. In this pull request are all the modifications to mqtt_bridge that we made in the process:

  1. allow retained messages (with retain: True)
  2. allow setting the qos (e.g. with qos: 1)
  3. new bridge type: RosProtoToMqttBridge. This compresses the data from the ros message with protobuf. It is necessary to specify the proto_type, in the same format like msg_type, e.g. my_proto_msgs.State_pb2:State
  4. allow topic wildcards for + and #. E.g. with topic=sensors/+/value, wildcards=[sensorId] you get a sensorId=temperature001 if you receive the topic sensors/temperature001/value
  5. allow to send mqtt disconnect on shutdown by setting the parameter mqtt.disconnect_on_shutdown to True
  6. handle std_msgs/String and std_msgs/Empty more efficiently
  7. allow the mqtt client_id to be set according to the mac address of an interface by setting the parameter mqtt.client.client_id_from_mac to the correct interface

I know that's a lot of changes. Let me know if you don't like any of those and I will create a pull request without them.

dayjaby commented 5 years ago

One issue that I am working on right now is to resubscribe all the topics when the client disconnected and reconnects again.