Skip to content
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

Add tips about service client and rate #4132

Open
wants to merge 14 commits into
base: rolling
Choose a base branch
from
Open

Conversation

mjforan
Copy link
Contributor

@mjforan mjforan commented Jan 24, 2024

No description provided.

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO I would like to keep those documents for the transition guidance and tutorials as simple as that. instead, i would add those note in https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Executors.html.

@mjforan
Copy link
Contributor Author

mjforan commented Jan 26, 2024

IMO I would like to keep those documents for the transition guidance and tutorials as simple as that. instead, i would add those note in https://docs.ros.org/en/rolling/Concepts/Intermediate/About-Executors.html.

I would not say these are intermediate concepts. As a matter of fact, the rate.sleep() design pattern is used in the first rospy tutorial.

What do you think about my shortened wording? It's easily digestible for complete beginners while serving as an important tip for developers coming from ROS 1.

@mjforan
Copy link
Contributor Author

mjforan commented Feb 20, 2024

bump

mjforan and others added 2 commits February 29, 2024 14:34
…ages.rst

Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Signed-off-by: Matthew Foran <matthewjforan@gmail.com>
…-Service-And-Client.rst

Co-authored-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
Signed-off-by: Matthew Foran <matthewjforan@gmail.com>
@mjforan
Copy link
Contributor Author

mjforan commented Mar 23, 2024

@fujitatomoya @clalancette bump

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

i will leave this @clalancette

@mjforan
Copy link
Contributor Author

mjforan commented Apr 15, 2024

It has come to my attention that publishers can have a similar issue with deadlock. Doesn't that make the basic python tutorial incorrect, since it uses the publish method in a timer callback with a single-threaded executor?

@clalancette
Copy link
Contributor

It has come to my attention that publishers can have a similar issue with deadlock. Doesn't that make the basic python tutorial incorrect, since it uses the publish method in a timer callback with a single-threaded executor?

That should not be the case, as far as we know. Publishers do not use the executor, and thus are not subject to the same deadlock. Can you give more details about the deadlock you are seeing?

@mjforan
Copy link
Contributor Author

mjforan commented Apr 15, 2024

Interesting - I will do some more investigating and submit a separate bug report for my issue.

Anyways, this PR should be ready for @clalancette approval.

@mjforan
Copy link
Contributor Author

mjforan commented Apr 29, 2024

@clalancette can you please take a look at this PR?

@mjforan mjforan requested a review from clalancette May 15, 2024 16:24
mjforan and others added 2 commits May 16, 2024 08:46
…ages.rst

Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Matthew Foran <matthewjforan@gmail.com>
…-Service-And-Client.rst

Co-authored-by: Chris Lalancette <clalancette@gmail.com>
Signed-off-by: Matthew Foran <matthewjforan@gmail.com>
Comment on lines 260 to 265
.. warning::

Synchronous calls such as ``rclpy.spin_until_future_complete`` can cause deadlock.
For more details see the :doc:`sync deadlock article <../Sync-Vs-Async>`.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still wrong; the path here needs to be updated (sorry, I made a mistake in my earlier suggestion).

But the closer we get to putting this in, the less I like it here. As a beginner user with this tutorial, what am I supposed to do about this warning? The tutorial just told me to use it, and then it is warning me against it. It doesn't make much sense to me.

Now that I think about this more, I think that if we want to do something here, we need to change the tutorial somehow so that it doesn't use this call, or at least uses it in a safe context.

What I'm going to suggest is that we just remove this line from this PR, so we can get the changes to the Migrating-Python-Packages in. Then we can consider what to do here separately.

Suggested change
.. warning::
Synchronous calls such as ``rclpy.spin_until_future_complete`` can cause deadlock.
For more details see the :doc:`sync deadlock article <../Sync-Vs-Async>`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tutorial just told me to use it, and then it is warning me against it.

Sure, but then if they use it in the wrong way it will break with no debug output. That's what the warning should mean, "be careful how you use this". I still think my earlier explicit wording was better; we can shorten it to just say "Do not use this in a ROS callback" with a link to the other article for further reading.

I don't want to remove this entirely because then there will be no mention of the issue in any of the tutorials. This one-line warning will not be too confusing for beginners.

Obviously the final call is yours to make, so if this is too much go ahead and just merge the other file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants