Skip to content

WIP: Fix clone and restore for invalid non colliding cache#1455

Open
snozawa wants to merge 8 commits intoproductionfrom
fixCloneAndRestoreForInvalidNonColCache
Open

WIP: Fix clone and restore for invalid non colliding cache#1455
snozawa wants to merge 8 commits intoproductionfrom
fixCloneAndRestoreForInvalidNonColCache

Conversation

@snozawa
Copy link
Copy Markdown
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
@rdiankov
Copy link
Copy Markdown
Owner

@snozawa Is this pull request still active?

@snozawa
Copy link
Copy Markdown
Collaborator Author

snozawa commented May 3, 2025

@snozawa Is this pull request still active?

thanks for checking!

yes, this is still active.
initially, this PR was ready but i'll need to resolve conflict and double check if this PR is still working.
I set WIP for a while.

@snozawa snozawa changed the title Fix clone and restore for invalid non colliding cache WIP: Fix clone and restore for invalid non colliding cache May 3, 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.

2 participants