cmu-rss-lab / roswire

A library for static and dynamic analysis of ROS applications via Docker 🔌
http://christimperley.co.uk/roswire
Apache License 2.0
8 stars 0 forks source link

Add ROSLaunchController for controlling ROS launch processes #354

Closed ChrisTimperley closed 4 years ago

ChrisTimperley commented 4 years ago

Calling the launch method of ROSLaunchManager would no longer return None and instead return a ROSLaunchController instance, allowing the user to interact with the underlying roslaunch process. Note that this change is fully backwards compatible as users can simply choose to ignore the return value as they do now.

At a minimum, the ROSLaunchController could expose the following methods:

By adding __enter__ and __exit__, users can use the with keyword in conjuction with the ROSLaunchController instance to automatically close the launch process at the end of a context:

launch = roscore.roslaunch(...)
with launch:
    # do stuff
# launch is dead!

with roscore.roslaunch(...) as launch:
    # do stuff

# launch is dead!

There is also the possibility that the ROSLaunchController could expose the logs for its associated roslaunch process. This feature would be useful for debugging roslaunch processes that do not behave as expected.