pygazebo icon indicating copy to clipboard operation
pygazebo copied to clipboard

PyGazebo can now wait until Gazebo starts

Open Skylion007 opened this issue 10 years ago • 4 comments
trafficstars

Added a feature to allow PyGazebo to wait until Gazebo starts up. This is useful if you want to say launch Gazebo and then wait for the network service to become available before proceeding with your PyGazebo code.

Skylion007 avatar Jul 15 '15 16:07 Skylion007

This code will block an event loop, seems like this should be implemented with trollius and set a future instead.

virtuald avatar Jul 15 '15 17:07 virtuald

I am little confused on how to do that. Do I just return a future true or false and put this in a coroutine?

Skylion007 avatar Jul 15 '15 17:07 Skylion007

Almost. You would return a future object, yes. And then you would do some socket operations using the async API (not using socket directly), and when the connection finally succeeds then you would set the future value to something.

virtuald avatar Jul 15 '15 19:07 virtuald

virtuald is correct, you'd want to use trollius/asyncio primitives to accomplish waiting. Here that would mean returning a future object which was invoked when the connection was made.

jpieper avatar Aug 01 '15 11:08 jpieper