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:

  1. Validates Workspace: It checks for the existence of an install/ directory to ensure the workspace has been built with a command like genesys build.
  2. 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 effectively source 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:

  1. Full Target (<package>:<launch_file>): This is the most explicit format.

    genesys launch my_package:main.launch.py
    
  2. 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 by genesys 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

  1. Discovery: It searches every package inside your src/ directory for a file named exactly default.launch.py. The genesys make command automatically creates this file for you when you add a node.
  2. Dynamic Generation: It dynamically generates a temporary master launch file. This file contains a launch.actions.IncludeLaunchDescription action for every default.launch.py it discovered.
  3. Execution: It runs ros2 launch on this temporary, in-memory master file, which in turn launches all the individual default.launch.py files.

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.