-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Streamline Python launchfiles to promote best practices #5413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streamline Python launchfiles to promote best practices #5413
Conversation
I think the launchfile content is done, but I still need to go update the |
This pull request has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/ros-2-pmc-meeting-minutes-for-april-29-2025/43451/1 |
Signed-off-by: Emerson Knapp <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
b60d2a1
to
f321e84
Compare
Updated the RST to match the new line numbers and contents, this is ready for merge IMO |
source/Tutorials/Intermediate/Launch/launch/turtlesim_world_3_launch.py
Outdated
Show resolved
Hide resolved
source/Tutorials/Intermediate/Launch/launch/turtlesim_rviz_launch.py
Outdated
Show resolved
Hide resolved
source/Tutorials/Intermediate/Launch/launch/turtlesim_world_2_launch.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Emerson Knapp <[email protected]>
Will you try to backport this? |
I will indeed try to backport it. I don't think it should be difficult. It would be nice to have included it in the Kilted tutorials testing but that's probably an unwelcome wrench in those works. |
Signed-off-by: Emerson Knapp <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
Signed-off-by: Emerson Knapp <[email protected]>
…ices (#5413) (#5627) Signed-off-by: Emerson Knapp <[email protected]>
Closes robograph-project/planning#9
The changes included in this PR are meant to produce shorter, clearer, and more flexible Python launchfiles. By showing these examples to users, we encourage them to also follow best practices for a better experience and more correct results.
Changes
PythonLaunchDescriptionSource
(and xml, yaml versions) in favor of encoding less explicit knowledge into user facing APIThis makes the code shorter and therefore easier to read, and makes it easier to change out launchfile frontends.
return LaunchDescription([...
as possibleThis matches the XML/YAML style, and removes room for programming errors in launchfiles. I have seen plenty of cases where declared variables are then used out of order, or accidentally missed entirely. When simply declaring everything into the Action list, you can't make those mistakes.
os.path.join
withPathJoinSubstitution
This allows for extension to uses with other Substitutions, such as
LaunchConfiguration
etc. The more flexible and correct way to write launchfiles.get_package_share_directory
withFindPackageShare
This allows the package name to be a substitution, such as from a launch arg. That's a use case I have seen. Plus the pattern allows parsing launchfiles in a context where the package prefix may not yet be known, like in build and tooling scenarios.
TextSubstitution
It's not needed, and therefore is more confusion!