Skip to content
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

[Launch] Allow ros launch targets to include each other idiomatically #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

beekarthik
Copy link
Contributor

Description

This PR introduces a custom Bazel rule (ros_launch_rule) and macro (ros_launch_macro) that automate the process of generating and executing ROS launch scripts, while handling the necessary runtime dependencies for ROS nodes, launch files, and parameter files.

Key Changes

Custom Provider

A custom provider used to propagate information about ROS nodes, launch files, and parameter files through the build graph.

  • Fields:
    • nodes: A depset of node binaries or scripts to be launched.
    • launch_files: A depset of launch files defining the startup behavior of the ROS system.
    • param_files: A depset of YAML files that configure the ROS nodes.

Custom ros_launch_rule Rule

Generates a Python launch script by expanding a template.
1, Collects transitive dependencies such as node binaries, launch files, and parameter files from the current target and its dependencies.
2. Exposes these resources via the RosLaunchInfo provider, enabling downstream rules to access them.
3. Uses Bazel’s runfiles mechanism to ensure that the generated script and all required files are available at runtime.
RosLaunchInfo Provider:

Modified ros_launch Macro

  • Simplifies the creation of a ROS launch target by wrapping ros_launch_rule and automatically generating a py_binary target that executes the generated script.
  • Handles setting up runtime dependencies (data) and ensures all required files are included when the script is executed.

Potential Points of Contention

One potential point of contention I can already see is that the actual py_binary target is now named <target_name>_launch - happy to swap the name of the rule and py_binary if that makes for a cleaner PR (no interface breakage)

How was this Tested

Everything builds and ran examples

@mvukov
Copy link
Owner

mvukov commented Sep 26, 2024

Thanks for the contribution. What's the use-case here? Can you add an example or even better a test for this new feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants