ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Latching doesn't work in ROS2

asked 2021-07-15 20:44:56 -0500

dheeranet gravatar image

updated 2021-07-15 20:45:42 -0500

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

edit retag flag offensive close merge delete

Comments

I also have the same problem on ROS2 galactic using cyclonedds

canderson gravatar image canderson  ( 2021-07-20 21:00:05 -0500 )edit

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.

pionex gravatar image pionex  ( 2021-10-06 22:25:10 -0500 )edit

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)

pionex gravatar image pionex  ( 2021-10-07 16:20:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-07-15 23:16:51 -0500

prince gravatar image

Please set appropriate rate of publication. Currently it is 0.0001 which is too low. Set it to 1. It works.

ros2 topic pub -r 1 --qos-durability=transient_local /foo std_msgs/msg/String '{data: hello}'
edit flag offensive delete link more

Comments

2

The word latching has a very specific meaning in ros1. Unless they changed this for ros2, then your answer misses the point.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-07-17 07:25:31 -0500 )edit
1

Right, the idea is that one message should be enough, the second subscriber should see the last message it missed when it subscribes. This kind of latching mechanism is documented in ROS2 as "transient_local" QoS but it's not working as expected.

dheeranet gravatar image dheeranet  ( 2021-07-17 11:42:11 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-07-15 20:44:56 -0500

Seen: 874 times

Last updated: Jul 15 '21