ros2 / launch

Tools for launching multiple processes and for writing tests involving multiple processes.
Apache License 2.0
124 stars 139 forks source link

Feature Request: Option to use a cached launch description #721

Open john-maidbot opened 1 year ago

john-maidbot commented 1 year ago

Feature request

Feature description

Please correct me if this line of thought is misguided (or if such a feature already exists), but my understanding of the launch process is when a user calls ros2 launch, that executes a (potentially large) number of substitutions based on the provided launch description(s) to convert the launch description into a list of processes (and their resolved arguments) that need to be started/executed.

I am working with a ROS2 project with a decently large ROS2 launch setup, and what I believe I am seeing is a considerable amount of time being spent in this pre-launch phase (i.e. after i run launch, there is a big delay before the processes actually start). However, in a realistic scenario where the launch description the pre-launch phase is creating does not need to change between calls to ros2 launch (e.g. a robot that will be turned on and off many times), I think there would be a considerable time savings in caching the previous launch description and providing users with the option to use that rather than going through the pre-launch phase again.

Implementation considerations

Has this been considered in the past? Was there a reason it was not implemented?

A big question is how exactly can the launch description be cached for future use. Maybe some near-final by-product of the prelaunch phase can can be stored as a binary file (e.g. pickled). And users could pass a --cached argument to request that the file be used?

I am also not yet deeply familiar with the pipeline the launch description goes through before node processes actually get started. So it is unclear to me at what point this caching should/could occur.

Any feedback is greatly appreciated.

Thanks for taking the time to read through this! :smiley: