Skip to content

Title: "robot_spawn.launch.py fails with generate:=false in Jazzy (regression)" #91

@Botman-Mike

Description

@Botman-Mike

Bug Report: robot_spawn.launch.py fails with generate:=false in Jazzy

Issue

The robot does not spawn in Gazebo when using generate:=false parameter in ROS 2 Jazzy, breaking a workflow that worked correctly in Humble.

Environment

  • ROS Distribution: Jazzy
  • Package: clearpath_gz (clearpath_simulator)
  • Branch: jazzy
  • File: clearpath_gz/launch/robot_spawn.launch.py
  • Line: 208

Expected Behavior

When running:

ros2 launch clearpath_gz simulation.launch.py generate:=false

The robot should spawn in Gazebo without regenerating URDF/SRDF/config files (same behavior as Humble).

Actual Behavior

The robot does not spawn. Only gazebo and parameter_bridge processes start. The spawn action is never added to the launch actions list.

Root Cause

Line 208 in robot_spawn.launch.py:

if not bool(generate.perform(context)):
    actions.append(group_action_spawn_robot)

The Problem: When generate:=false is passed, generate.perform(context) returns the string 'false'. In Python, bool('false') evaluates to True because any non-empty string is truthy. Therefore:

  • bool('false')True
  • not bool('false')False
  • The spawn action is never appended

Comparison with Humble (Working Code)

The Humble version correctly uses launch conditions:

do_not_generate = GroupAction(actions=[group_action_spawn_robot],
                              condition=UnlessCondition(LaunchConfiguration('generate')))

UnlessCondition properly handles string-based launch configuration values ('true'/'false').

Fix

Replace lines 208-209:

# BROKEN
if not bool(generate.perform(context)):
    actions.append(group_action_spawn_robot)

With:

# FIX 1: Use proper condition (like Humble)
do_not_generate = GroupAction(actions=[group_action_spawn_robot],
                              condition=UnlessCondition(LaunchConfiguration('generate')))
actions.append(do_not_generate)

# OR FIX 2: Properly check string value
generate_str = generate.perform(context).lower()
if generate_str in ['false', '0', 'no', 'off']:
    actions.append(group_action_spawn_robot)

Impact

This breaks the workflow for users who manually edit robot configuration files in ~/clearpath/ and don't want them overwritten by the generator. The generate:=false parameter is essential for development and customization.

Reproduction Steps

  1. Set up a Clearpath robot configuration in ~/clearpath/
  2. Run: ros2 launch clearpath_gz simulation.launch.py generate:=false
  3. Observe that only Gazebo world loads, no robot spawns
  4. Check ros2 node list - only /clock_bridge exists (no robot nodes)

Verified Locations

Suggested Priority

High - This is a regression from Humble that breaks documented functionality and workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions