In fact, every ROS 2 launch package could be structured such that launch files can be imported via
from launch_mixins.my_amazing_package import AmazingLaunch
E.g. using include launch descriptions
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
turns into
from launch_mixins.demo_launch import TurtleSimMixin, HelloWorldMixin
class MyNewLaunch(HelloWorldMixin, TurtleSimMixin):
pass
This works for ament_python and ament_cmake, and if many people would default to launch_mixins.package_name, think this might help launch flexible projects.
Wonder how other people structure their launch files, or if this suggestion is not scalable. Happy to learn more!
I don’t really understand what mixins add in terms of functionality.
Are mixin lauch files a kind of meta launch file type that controls other launch files?
Organizing launch functionality via this mechanism makes understanding required / available functionality of a package slightly better understandable. This can be helpful when provided launch files don’t match the requirements perfectly and modifications are needed.
But I am not 100% convinced this approach makes sense.
If I understand this correctly, you’re the one promoting this system and you’re telling me that you don’t know whether this system makes sense. To be honest, that leaves me even more sceptical than before.
While ROS2 offers flexibility with multiple launch file formats YAML, XML, and Python, it can be challenging for newcomers to learn due to the lack of a single, unified standard. Each format has its own advantages and disadvantages, making it difficult to get a clear overview and choose the best approach - as determined in the correlating ROS2 Design document. Additionally, complex launch files, like the one I encountered in my working group , can be cumbersome to understand . To improve user experience, it would be beneficial to consider a more standardized approach to ROS2 launch files.
I see your point. Just wanted to share this form of organization assuming Python launch modules to help re-iterate on the mixin idea, learn how others organize their launch files etc!