ika-rwth-aachen / mqtt_client

ROS / ROS 2 C++ Node for bi-directionally bridging messages between ROS and MQTT
MIT License
184 stars 41 forks source link

mqtt_client doesn't react correctly to a changed ROS message type #15

Open lreiher opened 1 year ago

lreiher commented 1 year ago

Steps to reproduce

JiaqiangZhang commented 1 year ago

Hi, @lreiher, has this issue been fixed on ros2? When I want to change the message type, this error shows:

# `mqtt_client` on host1
[mqtt_client-1] [ERROR] [168314**08.779**20] [mqtt_client]: Failed to create generic subscriber: could not create subscription: failed to create topic [rt/test_topicmain] because it's already in use in this context with a different message type, at /home/host1/workspace/tracing_ws/src/ros2/rmw_cyclonedds/rmw_cyclonedds_cpp/src/rmw_node.cpp:1613, at /home/host1/workspace/tracing_ws/src/ros2/rcl/rcl/src/rcl/subscription.c:105

# `mqtt_client` on host2
[mqtt_client-1] [ERROR] [16**08.7794***20] [mqtt_client]: Failed to create generic publisher: could not create publisher: failed to create topic [rt/test_topicmain] because it's already in use in this context with a different message type, at /home/host2/workspace/tracing_ws/src/ros2/rmw_cyclonedds/rmw_cyclonedds_cpp/src/rmw_node.cpp:1828, at /home/host2/workspace/tracing_ws/src/ros2/rcl/rcl/src/rcl/publisher.c:116

These two errors didn't appear at the same.

lreiher commented 1 year ago

No, the ros2 version is even less designed for a change of the message type. To be honest, I don't see that big of a use case in changing the message type anyway. If your message type changes, you might just as well restart the mqtt_client. What's your motivation for changing the message type during operation?

JiaqiangZhang commented 1 year ago

No practical motivation. I'm testing the performance of different rmw. It would be easier to be able to change the message type. Anyway, I finished my test by restarting the broker and mqtt_client.