Provides examples for calling ROS 2 services asynchronously from python. For now the repository is focused on single-threaded python nodes.
delay_server
: Offers a/delay (std_srvs/srv/Empty)
service that delays for 3 seconds before returningdeadlock
: This node calls/delay
improperly and deadlocksawait
: This node uses python asyncio to wait for the service to completefuture
: This node directly polls a future object after calling the serviceyield
: This node uses python generators to help sequence a pattern
- It is often useful to run the server and the experiment node in separate windows, to see how they interact:
ros2 run async_experiments delay_server # run the delay server ros2 run async_experiments <deadlock|await|future|yield> # run the node of your choice
- A launchfile can also be used:
ros2 launch async_experiments experiment.launch.xml experiment:=<deadlock|await|future|yield>