Repository navigation
Conversation
|
Here is an example using it: |
095a4ee to
7a66186
Compare
|
@dirk-thomas @mlautman Ping for a review? |
mlautman
left a comment
There was a problem hiding this comment.
+1 after addressing 1 small comment
| qDebug('Registering destruction for listener of type "{}"'.format(type(listener))) | ||
| self._listener_queue.put(listener) | ||
|
|
||
| def __destroy_listener__(self, listener): |
There was a problem hiding this comment.
Why this style? why not _destroy_listener?
There was a problem hiding this comment.
Because external functions should absolutely not call this.
There was a problem hiding this comment.
Prepending a single underscore (_) has some support for protecting module variables and functions (not included with from module import *). While prepending a double underscore (__ aka “dunder”) to an instance variable or method effectively makes the variable or method private to its class (using name mangling) we discourage its use as it impacts readability and testability and isn’t really private.
The trailing double underscores could go
| self._abort = True | ||
| super().quit() | ||
|
|
||
| def register_listeners_for_destruction(self, *listeners): |
There was a problem hiding this comment.
This needs very prominent documentation. It is very reasonable for users to remove subscribers themselves if they don't know about this.
There was a problem hiding this comment.
Any suggestions? I imagine they will find rqt_gui crashing look at how other plugins do this
There was a problem hiding this comment.
I really don't know. @dirk-thomas any ideas here? The issue we are having is that the spin method isn't thread safe and we are seeing segfaults when we try to unsubscribe while the executor is running.
There was a problem hiding this comment.
Correction, spin is thread safe but destroying subscribers is not.
|
@dirk-thomas Any input on this PR and the accompanying rqt_plot PR? |
|
rqt_topic also depends on this PR |
|
I don't think I think it would be better to improve the |
|
It doesn't look like there has been any action on the related issue in rclpy I created. I can investigate the bug in rclpy and work on a PR. |
That would be great! |
|
Unfortunately, unless I had some very specific guidance, I don't think I can resolve the related Rclpy issue within our current rqt effort. It looks like it's related to this issue: |
|
Rather than wait indefinitely for the underlying bug to be fixed I think we should go ahead and merge this. Be sure to add comments explaining the spinner and noting that it can be removed once the related issues are closed |
|
We shouldn't merge this since it introduces API plugins would need to start using which they shouldn't need to once the |
6ec4173 to
e377071
Compare
|
The upstream |
Destroying subscriptions is not thread-safe. Because the executor spins the node in a separate QThread outside of the plugins UI threads, destroying listeners needs to happen after spin_once().
This adds a method for plugins to call that registers subscriptions and clients for destruction. Unfortunately this also means that the spinner object needs to be passed around.
This address issue #181