Skip to content

Give the controller spawners a parameter file (backport #3851) - #3869

Merged
130s merged 1 commit into
jazzyfrom
mergify/bp/jazzy/pr-3851
Nov 26, 2026
Merged

130s merged 1 commit into
jazzyfrom
mergify/bp/jazzy/pr-3851

Conversation

@mergify

@mergify mergify Bot commented Sep 25, 2026

Copy link
Copy Markdown

Description

The controller spawners do not receive a parameter file. The controller_manager node reads ros2_controllers.yaml, but the controller nodes do not read it. Each controller therefore starts with no parameters, and initialization fails:

Exception thrown during init stage with message: Invalid value set during initialization
for parameter 'joints': Length of parameter 'joints' is '0' but must be greater than '0'
[ERROR] [controller_manager]: Could not initialize the controller named 'panda_arm_controller'

The user can plan a motion in RViz, but the user cannot run the motion. The Execute button has no action server to call.

The spawner program has a --param-file option that loads the file into the controller node before configuration. This pull request gives that option to every spawner that MoveIt starts.

Changes

1. moveit_configs_utils.launches.generate_spawn_controllers_launch()

Passes --param-file with the ros2_controllers.yaml of the configuration package. generate_demo_launch() already uses that path convention for the ros2_control_node. The option is omitted when the file does not exist, so a configuration package without one keeps its present behavior.

The function also takes an optional controller_manager_timeout for callers that start the controller manager in the same launch file.

The callers of this function are generated, not committed: MoveIt Setup Assistant offers a "Spawn Controllers Launch" bundle (moveit_setup_app_plugins/src/launches.cpp:66), and templates/launch/generic.launch.py.template writes a launch file whose body is return generate_spawn_controllers_launch(moveit_config). Every generated configuration package therefore calls it.

2. Four moveit_servo demo launch files now call that function

demo_joint_jog, demo_pose, demo_ros_api and demo_twist spawn exactly the controllers the function creates, from the same configuration package, so the call is equivalent. They keep their 300 second wait through the new argument.

3. Eight further launch files receive --param-file directly

The function would change the behavior of these, so they keep their own spawners:

File Reason
prbt_moveit_config/launch/demo.launch.py, hybrid_planning/test/launch/test_basic_integration.test.py spawn panda_joint_group_position_controller, not the controller in moveit_controllers.yaml
planning_interface/test/launch/move_group_launch_test_common.py, tests/launch/move_group_api.test.py also spawn panda_hand_controller
planning_scene_monitor.test.py, servo_{cpp,ros}_integration.test.py, servo_utils.test.py stage each spawner with a TimerAction or an event handler

That is 18 spawners across 12 files. Every file already holds the correct path in ros2_controllers_path.

Testing

Ubuntu 26.04 (Resolute), ROS 2 Lyrical binary packages, MoveIt 2.15.0 from the build farm.

ros2 launch moveit_servo demo_ros_api.launch.py before the change: Failed loading controller panda_arm_controller, no active controller.

After:

panda_arm_controller     joint_trajectory_controller/JointTrajectoryController  active
joint_state_broadcaster  joint_state_broadcaster/JointStateBroadcaster          active

The same correction on moveit_resources (moveit/moveit_resources#221) brings all three Panda controllers to active and makes /panda_arm_controller/follow_joint_trajectory and /panda_hand_controller/gripper_cmd available, so trajectory execution works again.

I also confirmed that each changed launch description still builds, and that ros2_controllers_path is in scope at all 18 spawners.

Note on the tests

The CI log of the first run shows a controller failing to initialize while the test still passes:

[controller_manager]: Could not initialize the controller named 'panda_arm_controller'
6/6 Test #6: test_best_seen_execution_time_policy_with_move_group ....... Passed

The _with_move_group tests therefore run today without an active controller. This pull request starts the controllers; a test that fails afterwards was failing silently before.

Related

moveit_resources has the same defect in its hand-written demo launch files: moveit/moveit_resources#221.

Checklist

  • Code is auto formatted using black (pre-commit passes).
  • Extend the tutorials / documentation — not needed.
  • Document API changes relevant to the user in MIGRATION.md — the new argument is optional and the default keeps present behavior.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Controller spawners now load parameters from the configured controller file when available.
    • Controller startup behavior is more consistent across demos and integration tests.
    • Joint-state, arm, and hand controllers now use consistent spawning and configuration behavior across supported launch scenarios.
    • Controller launches support an extended manager startup timeout where needed.
    • The PRBT demo now starts the controller defined by its configured controller mapping.

This is an automatic backport of pull request #3851 done by [Mergify](https://mergify.com).

@mergify mergify Bot added the conflicts label Sep 25, 2026
@mergify

mergify Bot commented Sep 25, 2026

Copy link
Copy Markdown
Author

Cherry-pick of 4bdbde2 has failed:

On branch mergify/bp/jazzy/pr-3851
Your branch is up to date with 'origin/jazzy'.

You are currently cherry-picking commit 4bdbde2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   moveit_configs_utils/moveit_configs_utils/launches.py
	modified:   moveit_planners/test_configs/prbt_moveit_config/launch/demo.launch.py
	modified:   moveit_ros/hybrid_planning/test/launch/test_basic_integration.test.py
	modified:   moveit_ros/moveit_servo/launch/demo_joint_jog.launch.py
	modified:   moveit_ros/moveit_servo/launch/demo_pose.launch.py
	modified:   moveit_ros/moveit_servo/launch/demo_ros_api.launch.py
	modified:   moveit_ros/moveit_servo/launch/demo_twist.launch.py
	modified:   moveit_ros/moveit_servo/tests/launch/servo_cpp_integration.test.py
	modified:   moveit_ros/moveit_servo/tests/launch/servo_ros_integration.test.py
	modified:   moveit_ros/moveit_servo/tests/launch/servo_utils.test.py
	modified:   moveit_ros/planning/planning_scene_monitor/test/launch/planning_scene_monitor.test.py
	modified:   moveit_ros/planning_interface/test/launch/move_group_launch_test_common.py
	modified:   moveit_ros/tests/launch/move_group_api.test.py
	modified:   moveit_ros/trajectory_cache/test/test_trajectory_cache.py

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   moveit_ros/trajectory_cache/test/fixtures/gtest_with_move_group.py

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a2700a6d-681f-45e3-8350-93fefa80b43c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@130s 130s left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I triggered a backport assuming the original PR #3851 is a bugfix and applicable to jazzy. Wait for review from other reviewers.

@130s
130s requested a review from nbbrooks September 25, 2026 15:10
@mergify

mergify Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Author

This pull request is merged.

@130s 130s mentioned this pull request Sep 28, 2026
* moveit_configs_utils: give the controller spawners a parameter file

generate_spawn_controllers_launch starts each spawner with only the
controller name. The controller_manager node reads
ros2_controllers.yaml, but the controller nodes do not read it. Each
controller therefore starts with no parameters and fails to initialize.
The user can plan a motion, but the user cannot run it.

The spawner program has a --param-file option. The option loads the file
into the controller node before configuration. This commit gives the
option to each spawner.

generate_demo_launch already uses the same path convention for the
ros2_control_node. This commit reuses that convention. The code omits
the option if the file does not exist, so a config package without
ros2_controllers.yaml keeps the old behavior.

Co-Authored-By: Claude Opus 5 <[email protected]>

* Give a parameter file to the controller spawners in this repository

The utility function now has callers, but 12 launch files in this
repository create their spawners directly. They have the same defect, so
this commit corrects them too.

Four moveit_servo demo launch files spawn the same controllers that
generate_spawn_controllers_launch() creates, and they use the same
configuration package. They now call the utility function instead. The
utility function takes an optional controller_manager_timeout, because
these demos start the controller manager themselves and must wait longer
than the default.

The other eight launch files cannot use the utility function without a
change of behavior:

* prbt_moveit_config and the hybrid planning test spawn
  panda_joint_group_position_controller, which is not the controller in
  moveit_controllers.yaml.
* The move_group tests also spawn panda_hand_controller.
* The remaining tests stage each spawner with a TimerAction or an event
  handler, which the utility function does not reproduce.

Each of those files gets --param-file directly. Every file already holds
the correct path in ros2_controllers_path.

Co-Authored-By: Claude Opus 5 <[email protected]>

* prbt_moveit_config: spawn the controller that the configuration defines

demo.launch.py spawns panda_joint_group_position_controller. The
variable that holds the node is named prbt_arm_controller_spawner, and
prbt_ros_controllers.yaml defines prbt_arm_controller, not the panda
one. prbt_controllers.yaml also maps MoveIt to prbt_arm_controller.

The requested controller therefore has no type and cannot load. This
commit spawns prbt_arm_controller.

This defect is older than this branch. It became visible once the
spawner received the parameter file.

Co-Authored-By: Claude Opus 5 <[email protected]>

* trajectory_cache: give the spawners a parameter file

The two trajectory_cache fixtures start their spawners with
ExecuteProcess and a shell command, not with a Node action. The earlier
commits looked only for the Node form, so these two files kept the
defect.

Both files already hold the correct path in ros2_controllers_path.

Co-Authored-By: Claude Opus 5 <[email protected]>

* trajectory_cache: pass the spawner command as an argument list

The previous commit put the parameter file path into a shell command
string. A path that holds a space or a shell metacharacter would split
before --param-file received it.

These two fixtures were the only launch files in the repository that ran
a shell. Every other launch file gives an argument list to a Node
action. This commit gives ExecuteProcess an argument list as well, so no
shell reads the path and no quoting is necessary.

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
(cherry picked from commit 4bdbde2)
@130s
130s force-pushed the mergify/bp/jazzy/pr-3851 branch from 78a9e4a to fcbea81 Compare November 25, 2026 23:33
@codecov

codecov Bot commented Nov 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.38%. Comparing base (3e89c14) to head (fcbea81).
⚠️ Report is 1 commits behind head on jazzy.

Additional details and impacted files
@@            Coverage Diff             @@
##            jazzy    #3869      +/-   ##
==========================================
+ Coverage   46.35%   46.38%   +0.04%     
==========================================
  Files         718      718              
  Lines       59255    59267      +12     
  Branches     7611     7612       +1     
==========================================
+ Hits        27459    27484      +25     
+ Misses      31630    31618      -12     
+ Partials      166      165       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@130s 130s removed the conflicts label Nov 26, 2026
@130s
130s merged commit daf89d3 into jazzy Nov 26, 2026
9 of 10 checks passed
@130s
130s deleted the mergify/bp/jazzy/pr-3851 branch November 26, 2026 15:40
@github-project-automation github-project-automation Bot moved this to ✅ Done in MoveIt Nov 26, 2026
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