CLI Command: genesys launch
The genesys launch command is a powerful wrapper for ros2 launch that adds convenience features for launching nodes and entire systems within a Genesys workspace.
How It Works
Before running any launch command, genesys launch performs two key actions:
- Validates Workspace: It checks for the existence of an
install/directory to ensure the workspace has been built with a command likegenesys build. - Sources Environment: It automatically sources the
install/setup.bash(or equivalent) file in a sub-shell. This means you don't have to manually source the workspace in your current terminal session before launching something. The command that gets run is effectivelysource install/setup.bash && ros2 launch ....
Usage: Launching a Specific Target
This is the most common way to launch a single launch file.
genesys launch <target> [launch_arguments]
Target Formats
The <target> argument can be specified in two ways:
-
Full Target (
<package>:<launch_file>): This is the most explicit format.genesys launch my_package:main.launch.py -
Shorthand (
<package>): If you only provide a package name, it defaults to launching a file named<package>_launch.py. This convention works perfectly with the launch files generated bygenesys make node.# This command... genesys launch my_package # ...is a shortcut for: genesys launch my_package:my_package_launch.py
Passing Launch Arguments
Any arguments placed after the target are passed directly to ros2 launch.
Example:
genesys launch my_package log_level:=debug use_sim_time:=true
Usage: Launching an Entire System
The --all flag is a key feature for bringing up a complete, multi-package system with a single command.
genesys launch --all
How --all Works
- Discovery: It searches every package inside your
src/directory for a file named exactlydefault.launch.py. Thegenesys makecommand automatically creates this file for you when you add a node. - Dynamic Generation: It dynamically generates a temporary master launch file. This file contains a
launch.actions.IncludeLaunchDescriptionaction for everydefault.launch.pyit discovered. - Execution: It runs
ros2 launchon this temporary, in-memory master file, which in turn launches all the individualdefault.launch.pyfiles.
This mechanism allows each package to define its own default entry point, and genesys launch --all acts as the conductor to bring up the entire orchestra at once.