Skip to content

Fix duplicate action_ns and default keys in simple controller - #3732

Open
yonteels wants to merge 2 commits into
moveit:masterfrom
yonteels:fix-action-ns-duplication
Open

yonteels wants to merge 2 commits into
moveit:masterfrom
yonteels:fix-action-ns-duplication

Conversation

@yonteels

Copy link
Copy Markdown

This PR fixes a bug in outputSimpleControllersYAML() where duplicate YAML keys (action_ns and default) were being generated for the same controller entry when processing controller_configs_ #3434 .

When generating the simple controllers YAML, controllers could be written multiple times, resulting in duplicated fields

In order to fix this I Added a std::setstd::string to track which controllers have already been written.
Thereby skipping duplicate controller entries using the if case:
if (!written_checker.insert(controller.name_).second)
continue;

@yonteels
yonteels requested a review from rhaschke as a code owner April 30, 2026 04:09
@codecov

codecov Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.08%. Comparing base (26716fa) to head (b0fa96a).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...t_setup_assistant/src/tools/moveit_config_data.cpp 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3732      +/-   ##
==========================================
- Coverage   62.09%   62.08%   -0.00%     
==========================================
  Files         385      385              
  Lines       32743    32746       +3     
==========================================
  Hits        20327    20327              
- Misses      12416    12419       +3     

☔ 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.

@rhaschke rhaschke 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.

While the fix will solve the described issue, I don't yet see why the issue occurs in first place. Shouldn't this code snippet in addController() avoid duplicate controller names in first place:
https://github.com/moveit/moveit/blob/26716fabb765bcbebeac8ff059da33bc255ca461/moveit_setup_assistant/src/tools/moveit_config_data.cpp#L1957-L1961

Also, why are duplicate controller names an issue at all? The YAML looks like this:

controller_list:
  - name: ...
    type: ...
    joints: [...]
  - name: ...
    type: ...
    joints: [...]

This is a list of maps.

I think it would be more important to have such a fix for outputROSControllersYAML(), which generates a YAML of the following structure:

<name 1>:
  type: ...
  joints: [...]
<name 2>:
  type: ...
  joints: [...]

So, please, describe your original issue in more detail. How to reproduce it?

Comment on lines +963 to +964
if (!written_checker.insert(controller.name_).second)
continue;

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.

This should be moved to line 971, because only there we really attempt to write the config.

@yonteels yonteels Apr 30, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, you're right

  • if (!written_checker.insert(controller.name_).second)
  •  continue;
    

Should be moved inside the if (type == "FollowJointTrajectory" || type == "GripperCommand") statement marking it when we actually need to output it.

The addController() suppose to check and prevent duplicate controller name however since controller could be loaded in from existing files, or added through other path it could bypass the check. Therefore the configs could still contain duplicates name leading to ambiguous configuration when generating since it expect each of the controller name to be unique.

@rhaschke

rhaschke commented Apr 30, 2026 •

Copy link
Copy Markdown
Contributor

I just noticed that you linked the issue moveit/moveit2#3434. However this refers to MoveIt2! With which MoveIt version do you actually have issues?
If it is MoveIt2, this PR moveit/moveit2#3478 might help.

@rhaschke

rhaschke commented May 1, 2026

Copy link
Copy Markdown
Contributor

@yonteels, please comment on #3732 (review) and #3732 (comment).

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