Skip to content

m-elwin/async_experiments

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ROS 2 Asynchronous Service Client

Overview

Provides examples for calling ROS 2 services asynchronously from python. For now the repository is focused on single-threaded python nodes.

Nodes

  • delay_server: Offers a /delay (std_srvs/srv/Empty) service that delays for 3 seconds before returning
  • deadlock: This node calls /delay improperly and deadlocks
  • await: This node uses python asyncio to wait for the service to complete
  • future: This node directly polls a future object after calling the service

Usage

  • 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> # run the node of your choice
        
  • A launchfile can also be used: ros2 launch async_experiments experiment.launch.xml experiment:=<deadlock|await|future>

Other

  1. async_experiments/hand_async.py outlines an experiment that can be done to test a hand-rolled async implementation example.
    • The code expects a named pipe called /tmp/fifo to exist: make it with mkfifo /tmp/fifo
    • Run the example with python3 -m async_experiments.hand_async
    • Events can be sent by echo "A" > /tmp/fifo (for example). See async_experiments/hand_async.py for a detailed walkthrough.

Code Walkthrough

See https://nu-msr.github.io/ros_notes/ros2/spin.html#walkthrough

About

Asynchronous service client experiments for ros2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages