Skip to content

Restore saved Xacro arguments when loading a MoveIt config - #4008

Open
sylvesterkaczmarek wants to merge 1 commit into
moveit:mainfrom
sylvesterkaczmarek:fix/setup-assistant-restore-xacro-args
Open

sylvesterkaczmarek wants to merge 1 commit into
moveit:mainfrom
sylvesterkaczmarek:fix/setup-assistant-restore-xacro-args

Conversation

@sylvesterkaczmarek

@sylvesterkaczmarek sylvesterkaczmarek commented Nov 29, 2026 •

Copy link
Copy Markdown

Description

Fixes #3605. Restore the Xacro argument vector when loading a URDF from a package, and clear stale saved arguments when the next configuration has none.

Checklist

  • Code auto-formatted with clang-format
  • Tutorial/documentation changes (not needed)
  • API migration (no API change)
  • Added regression test for loading saved arguments and reloading without them
  • Screenshot (not a GUI change)
  • Review another open PR

Validation: Xacro fixture expands to the expected link with and without arguments; changed-file pre-commit hooks pass. The ROS 2 C++ build and GTest could not be executed locally because ROS 2 and colcon are unavailable. CI validation is required.

Summary by CodeRabbit

  • Bug Fixes
    • Previously saved Xacro arguments are now applied when loading a URDF configuration, so custom settings such as link names are retained. When no saved arguments are available, the Xacro file’s defaults are used.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

URDF configuration loading now uses saved xacro arguments when reloading a package. A new Google Test checks that a supplied argument sets the link name and that the xacro default is used when arguments are absent.

Changes: URDF xacro argument reload

Layer / File(s) Summary
Load saved arguments and verify results
moveit_setup_assistant/moveit_setup_framework/src/urdf_config.cpp, moveit_setup_assistant/moveit_setup_framework/CMakeLists.txt, moveit_setup_assistant/moveit_setup_framework/package.xml, moveit_setup_assistant/moveit_setup_framework/test/test_urdf_config.cpp
loadPrevious passes saved xacro arguments to loadFromPackage, which initializes the argument vector before loading. The new test checks the custom link name and the xacro default when arguments are absent. CMake registers the test, and the manifest adds its test dependencies.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: dlu

Merge Risk: Minimal · up to 44997

Reloading a MoveIt configuration now restores its saved xacro arguments and clears stale ones when none are saved. A regression test covers both cases. No merge-blocking risk was found; CI should confirm the build and test.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Restore saved Xacro arguments when loading a MoveIt config" matches the main change. The urdf_config.cpp change passes saved xacro_args through loadPrevious and loadFromPackage so they appl…
Linked Issues check Passed [#3605] The reported defect is that saved Xacro arguments (bimanual:=true) were recognized but not applied when editing an existing package. At the merge base, URDFConfig::loadFromPackage set `xac…
Out of Scope Changes check Passed All changed files relate to the objective. src/urdf_config.cpp contains the fix. test/test_urdf_config.cpp is the regression test. CMakeLists.txt registers that test when BUILD_TESTING is enab…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "Restore saved Xacro arguments when loading a MoveIt config" matches the main change. The urdf_config.cpp change passes saved xacro_args through loadPrevious and loadFromPackage so they apply on load. The new test checks that saved link_name:=custom_link is used and that the default applies when no arguments are saved. The PR objectives describe the same fix for issue #3605.

Full details: Linked Issues check

Explanation

[#3605] The reported defect is that saved Xacro arguments (bimanual:=true) were recognized but not applied when editing an existing package. At the merge base, URDFConfig::loadFromPackage set xacro_args_ but did not update xacro_args_vec_. load() passes xacro_args_vec_ to rdf_loader::RDFLoader::loadXmlFileToString, so the saved arguments were dropped. At head, loadFromPackage sets xacro_args_vec_ = { xacro_args_ };, so load() receives the saved arguments. This matches the existing loadFromPath(string) pattern. loadPrevious now reads xacro_args into a local string, so an absent xacro_args key yields an empty value. This clears stale arguments from a prior configuration. The PR adds a regression test (test/test_urdf_config.cpp) that covers loading with link_name:=custom_link and loading without arguments. Limits: the ROS 2 build and GTest were not run in this review. Multi-argument strings are passed as one vector element, as in the existing loadFromPath(string) path. This behavior was not verified for multi-argument inputs. The issue's single-argument case is covered.

Full details: Out of Scope Changes check

Explanation

All changed files relate to the objective. src/urdf_config.cpp contains the fix. test/test_urdf_config.cpp is the regression test. CMakeLists.txt registers that test when BUILD_TESTING is enabled. package.xml adds the test dependencies ament_cmake_gtest and xacro, which the test requires. No unrelated functional change was identified in the summary or the reviewed urdf_config.cpp diff. No public declarations changed.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5399d29 and 44997f0.

Files selected for processing: 4

  • moveit_setup_assistant/moveit_setup_framework/CMakeLists.txt
  • moveit_setup_assistant/moveit_setup_framework/package.xml
  • moveit_setup_assistant/moveit_setup_framework/src/urdf_config.cpp
  • moveit_setup_assistant/moveit_setup_framework/test/test_urdf_config.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@mergify

mergify Bot commented Nov 29, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

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.

MoveIt Setup Assistant ignores xacro arguments when editing package

1 participant