Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clone and restore for invalid non colliding cache #1455

Open
wants to merge 7 commits into
base: production
Choose a base branch
from

Conversation

snozawa
Copy link
Collaborator

@snozawa snozawa commented Oct 24, 2024

summary

Issue

  • When Clone or kinbodysaver's restoring is called while _isListNonCollidingLinksValid is false, Grabbed's internal savers are inconsistent.
  • For example,
    1. The original Grabbed has savers at the configuration A.
    2. Later, set the configuration to B.
    3. Then, call Clone or KinBodyStateSaver::Restore(pbody).
    4. In such case, the new Grabbed instance is created for the cloned/restored body. But, the newly created Grabbed has savers at the configuration B. Since the original saver is at the configuration A, the derived listNonCollidingLinks are different between the original one and the new one.

Resolution

  • Principle
    • The intention of the past PR is to introduce the lazy computation.
    • Thus, in principle, the computation results with lazy computation should be exactly same as the results without lazy computation.
  • Fix in this PR
    • Add the special constructor for Grabbed to copy the saver's states from other Grabbed.
  • To do so, add the special constructor for KinBodyStateSaver and RobotStateSaver, to copy the states from other savers.
  • The usual user should use the existing constructor. The newly added one is introduced for very specific use case.
  • The new constructor does not support all Saver options. It only supports the copy-able states without deep copy. If the state is pointer, the copying of it might not be always expected.

Discussion

  • To directly copy the saver's states, we assume that the robot's kinematics are same between two kin bodies.
  • Just in case, add the checking for it: 76e9662
  • Instead of this PR's resolution, we might be able to restore the original kinbody, copy such states from the original kinbody to the cloned kinbody, and then, instantiate the Grabbed. But, it looks still tricky and the computation time for it is not small. So, in this PR, i'm trying to simply copy the KinBodyStateSaver's state itself.

…ng context.

- Issue
  - #1455
  - When _listNonCollidingIsValid = false and cloning of grabbed is conducted, the new saver state is different from the original saver state.
  - This leads the inconsistent results between the new Grabbed and the original Grabbed.
- Resolution
  - Directly copy the saver state from the original one.
@snozawa snozawa force-pushed the fixCloneAndRestoreForInvalidNonColCache branch from c387aeb to 4e43a76 Compare December 27, 2024 01:54
@snozawa snozawa force-pushed the fixCloneAndRestoreForInvalidNonColCache branch from 4e43a76 to 94c9b9e Compare December 27, 2024 02:59
@snozawa snozawa changed the title WIP: Fix clone and restore for invalid non colliding cache Fix clone and restore for invalid non colliding cache Jan 6, 2025
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.

1 participant