-
Notifications
You must be signed in to change notification settings - Fork 227
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
async wait/sleep implementation #1234
Comments
I like this idea. I recently ran into a similar need. My solution was |
If I am not mistaken that will block the thread you're in? How do you use that to await in a co-routine? |
Yeah it does. I wasnt using async await so... If an async/await option were available I'd probably have prefered that. Just echoing the sentiment that an API like this would be useful for people. |
Yep I understood what you meant, I was just wondering if I had missed something. |
I was also looking into this, and looks like since #1316 |
Feature request
Feature description
I have been writing some hardware "test" scripts used for checking the integration of hardware in real time (not using any test framework or assertions but simply stimulating a system with inputs and manually confirming the hardware is performing as expected). I have found writing this using async has made things much simpler and nicer:
e.g.
To which I kick off like so:
Now there is pretty much no examples of
create_task
being used like this so I have been experimenting and reading a bit of the rclpy code. After looking at the executor code in depth I couldn't find out how to use the executor to do an equivalent toawait asyncio.sleep
. I had a quick look at howasyncio
implemented theirs and I came up with this hack using aTimer
:This was the only missing piece and I was able to asynchronously "wait" and write the co-routines as expected.
My request is something like this is added to the
Executor
class, perhaps using a more elegant interface than abusing a Timer like this.#279 might be related.
The text was updated successfully, but these errors were encountered: