-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ros2 topic echo] does not echo a published message by [ros2 topic pub] if joining late, even with --qos-durability=transient_local #523
Comments
problem confirmed with source build ros2/ros2@0444bff |
If you manually specify the reliability, does it work for you? |
if I change the following, it works fine.
|
This is because qos profile on publication(in this case ros2 topic pub) is set as system_default, and depth is 0. changing qos profile, it can work as following,
I do not think this is bug but just a setting. |
@fujitatomoya Good work finding that! The out-of-the-box experience here is kind of bad, so I'm thinking we should change the default. What do you think about changing the publisher to use system_default, but with a depth of 1, instead? |
definitely this is important,
i think that may be better, i may come up with PR. btw, is that supposed to mean we want to change rmw default? or only on ros2cli pub? I believe the latter one, since rmw has effect for all of the components including application. |
the question is why do we not have option to set history and depth as well? this is kind of constrain for user. |
Yeah, let's just keep it confined to ros2cli pub for now.
Those would also be nice to have, though they wouldn't help the out-of-the-box experience. I think the reason we don't have them is that these don't typically cause too many problems for the CLI tools, so we haven't implemented them yet. |
yeah, maybe it is likely to set profile but nothing else. it is always trading-off flexibility or complication... |
could you check #528 if you got time? if we prefer it to adjust the depth(not exposing it), i can do that too. but it is likely that user requests the flexibility something like this, so that is the current implementation. btw, |
I think we should do both. That is, I can take a look at #528, but I'd prefer if we also changed the depth on |
sounds reasonable, will be back with fix in today.
actually this is |
Thank you! This works for me now. I did actually try to change the
As a new user, this is more intuitive to me. It's also a great way to test/demonstrate the |
Heh, yes, good point. Sorry, this was a thinko :). |
I think this issue still affects older versions of ROS2, which are still supported though, like |
I think that is reasonable enough. @bergercookie would you mind opening a backport PR? |
I'm trying this combination of commands on Galactic, but it's not working for me. First I run:
I wait until I see
Is this expected to work? |
In general, yes. In Rolling, this works exactly as expected, in that no command-line arguments are required and It's possible that Galactic doesn't have all of the changes necessary to make it work out-of-the-box; I don't remember at this time when exactly we put those in. That said, I can make this work fine in Galactic if I do the following:
|
**Public API Changes** Subscriber QoS is automatically chosen based on available publishers to achieve compatible QoS settings in more cases. **Description** When looking into https://github.com/foxglove/studio/issues/1987 I discovered that rosbridge was not receiving "latched" `/tf_static` messages. This led us to learn that subscribers need specific qos profile settings for certain publishers (ros2/ros2cli#523 (comment)). This PR attempts to use a qos profile that would accept any published message. Closes #654 Closes #582 Fixes #551 Co-authored-by: Jacob Bandes-Storch <jacob@foxglove.dev>
Bug report
Required Info:
Steps to reproduce issue
If I start a publisher with the ros2cli tool at 0.1Hz, with the option
--qos-durability=transient_local
, and then wait 10 seconds for it to publish a message, and then I start a topic echoer with the same qos settings, I would expect to see the last message published by the publisher, even though the echoer wasn't around when the message was published. However, this doesn't happen.i.e: First:
ros2 topic pub -r 0.1 --qos-durability=transient_local hello std_msgs/msg/String
Then after 10 seconds in a new terminal:
ros2 topic echo --qos-durability=transient_local hello std_msgs/msg/String
Expected behavior
As soon as the ros2 topic echo node starts, it should print the message that was published by the publisher before this node was started.
Actual behavior
It ignores this first message, and only prints a new message after another 10 seconds when the publisher publishes a new message
Implementation considerations
I created my own echo node with the transient_local durability option to see if this would work. This behaves with the expected behavior I mentioned above.
This is probably an awful implementation, and it does not accept other qos options, but it proves that even when late joining, an echo node can get the last message of a publisher.
This can be run with
python3 ros2-topic-echo-transient-local.py hello std_msgs/msg/String
Looking at the code: https://github.com/ros2/ros2cli/blob/master/ros2topic/ros2topic/verb/echo.py
It seems that the only key difference is that the qos profile is created with:
And in my example it is:
So perhaps the
qos_profile_from_short_keys
generates a QoS profile with depth 0? That's the only thing I can think of that would cause this.Comments
This utility would be really useful to me because it allows me to query the state of my system. For example, I have a bunch of nodes representing robots, that publish the state of the robots when they change. I want to quickly query the state of one of the robots so I use
ros2 topic echo
to print the messages on that topic. At the moment I will only be able to see the state of my robots if the state changes after I have runros2 topic echo
. If thetransient_local
policy worked I would be able to get the state even if it hasn't changed during the time the echo node has been running (as long as it is published once, for example when the publisher first starts up).The text was updated successfully, but these errors were encountered: