Skip to content

Disables copying of attached collision objects when updating start state - #3590

Merged
rhaschke merged 3 commits into
moveit:masterfrom
TSNoble:patch-1
Apr 29, 2024
Merged

rhaschke merged 3 commits into
moveit:masterfrom
TSNoble:patch-1

Conversation

@TSNoble

@TSNoble TSNoble commented Apr 21, 2024 •

Copy link
Copy Markdown
Contributor

Description

#3569 describes propagation of error from updating collision objects with each update of the start state during a sequence motion plan.

#3589 attempts to speed up plans by updating only joints positions when updating the start state, though this may cause the RobotState to ignore collision objects entirely if the state being updated has no knowledge of them.

This PR attempts to fix both issues by only updating the joints of a sequence motion, without copying across attached collision objects, in the hope that the start state being updated is already populated with attached collision object information.

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference (No major changes to user-facing functionality)
  • Document API changes relevant to the user in the MIGRATION.md notes (Changes implementation details / fixes error cases)
  • Create tests, which fail without this PR reference (See findings below)
  • Include a screenshot if changing a GUI (No GUI changes)
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

moveit#3569 describes propagation of error from updating collision objects with each update of the start state during a sequence motion plan.

moveit#3589 attempts to speed up plans by updating only joints positions when updating the start state, though this may cause the RobotState to ignore collision objects entirely if the state being updated has no knowledge of them.

This PR attempts to fix both issues by only updating the joints of a sequence motion, without copying across attached collision objects, in the hope that the start state being updated is already populated with attached collision object information.
@TSNoble
TSNoble requested a review from jschleicher as a code owner April 21, 2024 08:21
@welcome

welcome Bot commented Apr 21, 2024

Copy link
Copy Markdown

Thanks for helping in improving MoveIt and open source robotics!

@codecov

codecov Bot commented Apr 21, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.18%. Comparing base (c174715) to head (bb8869f).
Report is 12 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3590      +/-   ##
==========================================
+ Coverage   47.15%   47.18%   +0.04%     
==========================================
  Files         603      603              
  Lines       58999    59144     +145     
  Branches     6969     6993      +24     
==========================================
+ Hits        27814    27901      +87     
- Misses      30773    30825      +52     
- Partials      412      418       +6     

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

@TSNoble

TSNoble commented Apr 21, 2024 •

Copy link
Copy Markdown
Contributor Author

I'm unsure if this method will be loading the entire robot state (objects and all) at the start of the sequence. If not, it might face the same issue as #3589 with missing attached bodies.

If this is the case, perhaps it would make sense to add an update_attached_objects flag to setStartState which can be called once with true at the start of the sequence, then with false for each subsequent item?

@TSNoble

TSNoble commented Apr 21, 2024

Copy link
Copy Markdown
Contributor Author

If desired, I can try to write some tests which demonstrate the issue described in #3569, which should hopefully pass with this PR

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

This might be a reasonable change. I need to verify in which contexts CommandListManager::setStartState is called.

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

setStartState is only called to set the next request's start_state from the previously reached end point:
https://github.com/ros-planning/moveit/blob/0f90db67a45a0a69d871fc46ba0efba3e51a32b7/moveit_planners/pilz_industrial_motion_planner/src/command_list_manager.cpp#L235

Thus, ignoring attached collision objects is fine - they do not change throughout a sequence. The start_state should be marked as a diff, though.

@rhaschke

rhaschke commented Apr 23, 2024 •

Copy link
Copy Markdown
Contributor

I'm unsure if this method will be loading the entire robot state (objects and all) at the start of the sequence.

Yes, the initial start_state is loaded as is, i.e. clearing existing attached objects if the diff flag is set, otherwise just adding new ones.

If desired, I can try to write some tests which demonstrate the issue described in #3569

Yes, tests are always welcome to ensure behavior is not changed with future mods to the code.

@riv-tnoble

Copy link
Copy Markdown
Contributor

Thanks for taking a look. Submitted this via my personal account, so will try to make those changes & get a test reproducing the issue tonight

Co-authored-by: Robert Haschke <[email protected]>
@riv-tnoble

riv-tnoble commented Apr 26, 2024 •

Copy link
Copy Markdown
Contributor

Some findings:

I tried to reproduce the pose error issue on master. Many paths planned fine (no deviation at all), but I was able to reproduce the error consistently with some paths. @rr-mark suspects it may be occurring as a result of performing matrix inversions as part of the msg <-> object conversion process near robot singularities.

I logged the poses of every attached collision object associated with the start_state at each point inside the MotionPlanInfo constructor with one such path:

unfixed.csv

Some observations:

  • Only "ee5" and "tb_5_1" are attached to the end of the joint group we are planning for.
  • We are planning with respect to a subframe defined on "tb_5_1".
  • "tb_5_1" shows pose variation, whereas "ee5" does not, despite them both being attached to the end of the robot.
  • Only the rotational component of "tb_5_1" appears to accumulate error. The position seems fine.
  • The full path attempted contains 425 points. The planner fails to find an IK solution after point 28.

unfixed_position

unfixed_quaternion

I ran the same process over the same path using the changes proposed in this branch, which appear to fix the issue. The pose shows no deviation, and all 425 points plan successfully:

fixed.csv

fixed_position

fixed_quaternion

I'm not familiar with with the robots available to the pilz unit tests. Given the hard-to-reproduce nature of the issue, which may be somewhat dependent on knowledge of where the singularities lie, I'm not confident I can easily write an automated test for this error case (at least it'd be a big time sink).

I'm pretty confident the issue is fixed, given both that the changes imply the attached collision objects of will never be updated within a sequence motion, and the experimental evidence.

@rhaschke

Would you be happy to merge this PR without tests, given the above?

@TSNoble
TSNoble requested a review from rhaschke April 26, 2024 16:26
@rhaschke
rhaschke merged commit c43c555 into moveit:master Apr 29, 2024
@welcome

welcome Bot commented Apr 29, 2024

Copy link
Copy Markdown

Congrats on getting your first MoveIt pull request merged and improving open source robotics!

@TSNoble TSNoble mentioned this pull request Oct 24, 2024
4 of 6 tasks
github-merge-queue Bot pushed a commit to moveit/moveit2 that referenced this pull request Oct 28, 2024
* Ports moveit/moveit1#3592

* Ports moveit/moveit1#3590

* Fixes compile errors

---------

Co-authored-by: Sebastian Jahr <[email protected]>
mergify Bot pushed a commit to moveit/moveit2 that referenced this pull request Nov 21, 2024
* Ports moveit/moveit1#3592

* Ports moveit/moveit1#3590

* Fixes compile errors

---------

Co-authored-by: Sebastian Jahr <[email protected]>
(cherry picked from commit 02ebcba)

# Conflicts:
#	moveit_ros/planning_interface/move_group_interface/src/move_group_interface.cpp
sea-bass pushed a commit to moveit/moveit2 that referenced this pull request Nov 21, 2024
* Enhancement/moveit ros1 ports (#3041)

* Ports moveit/moveit1#3592

* Ports moveit/moveit1#3590

* Fixes compile errors

---------

Co-authored-by: Sebastian Jahr <[email protected]>
(cherry picked from commit 02ebcba)

# Conflicts:
#	moveit_ros/planning_interface/move_group_interface/src/move_group_interface.cpp

* Accepts all incoming changes. (#3120)

* Fixes member names (#3121)

---------

Co-authored-by: Tom Noble <[email protected]>
Co-authored-by: Mark Johnson <[email protected]>
Co-authored-by: Tom Noble <[email protected]>
Markus-Simonsen pushed a commit to Markus-Simonsen/moveit2 that referenced this pull request Aug 12, 2025
* Ports moveit/moveit1#3592

* Ports moveit/moveit1#3590

* Fixes compile errors

---------

Co-authored-by: Sebastian Jahr <[email protected]>
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.

3 participants