Latching doesn't work in ROS2
Simple example:
In one window:
ros2 topic pub -r 0.0001 --qos-durability=transient_local /foo std_msgs/msg/String '{data: hello}'
Then in another window:
ros2 topic echo --qos-durability=transient_local /foo
I get nothing in the 2nd window. What's wrong?
I tried all the examples in the similar questions and they don't work either.
Ubuntu 20.04, Galactic
I also have the same problem on ROS2 galactic using cyclonedds
In foxy on ubuntu 20.04, I am able to get latching working but only if the subscriber and publisher have matching settings for durability and reliability. According to the documentation, this isn't the case. For example, I should be able to have a subscriber with a best effort / volatile QoS connect to a publisher that is reliable / transient local. Unfortunately, this does not work in reality, at least with the standard rmw.
I have just switched to using Galactic as it offers some debug tools for QoS issues and uses a different middleware by default. I am still unable to get a besteffort / volatile subscriber to get data from a reliable / transient local publisher. ros2 doctor / rqt graph show no problems, and I have confirmed that the settings are what I think using ros2 topic info --verbose. Right now my workaround is to subscribe to the same topic with multiple QoS, and that works. It also seems like Galactic offers some new apis that allow me to query the QoS of the publisher and subscribe appropriately. That is great, but my understanding is that I should be able to create a volatile / besteffort subscriber that is compatible with any publisher QoS.
The answer below regarding publication rate when using a latched topic makes me curious. Isn't the whole point of having ...(more)