-
Notifications
You must be signed in to change notification settings - Fork 287
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
[dynamics]: deep copy shapes #1612
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only shape that I do not deep copy is the
SoftMeshShape
(for now I just return anullptr
in the newcopy
function; you might want to handle this differently [e.g. output a warning or exception]).
SoftMeshShape
is a special shape that wouldn't need the deep copy functionality. This is because SoftMeshShape
should be created only by SoftBodyNode
in the constructor of SoftBodyNode
. So SoftMeshShape
is automatically created when cloning skeleton and so SoftBodyNode
as well.
For this, I would make the constructor of SoftMeshShape
private and add SoftMeshShape
as its friend class, and the clone implementation of SoftMeshShape
would just return nullptr adding an error log saying this function shouldn't be used for any case.
By the way, when cloning a skeleton, is this type of meshes re-created to point to the correct
BodyNode
?
Yes, for the reason above.
If this is OK, we can do unit tests.
Yeah, unit tests would be great!
I did all the rest (apart from unit tests: I'll do them later), but I did not understand what you mean here. Can you be more elaborate? I did the log, but not sure what you mean by making the constructor of
I'll do this next.. |
It's an optional change, but what I expected was something like:
This way |
Ah I see; I am aware of this concept, but I am not sure how this change is related to this PR though. I'd make it in a different PR, because it handles a different thing/behavior, no? Feel free to do this in case this is important for you (I just tried moving the constructor and there were many errors, so since this is not related to this PR, I'd like to not spend time for this ;)). I'll do the unit tests and then feel free to edit. By the way, should we include this behavior into the |
Please don't worry about the change for this PR. I can make this change in a separate PR.
Yeah, I was thinking about making a PR for this change. World would also need similar options. By the way, let's save those changes for the future PRs to keep this PR a good size to review. |
Good. I agree. I'll do the unit tests and leave the rest for future PRs. Thanks! |
@costashatz For clarification, is it correct that you'd add the unit tests to this PR? |
That is indeed my intention. Although I am not sure if I am going to find time for this any time soon. Is it OK if we merge this and create an issue about the tests? |
Sounds good to me |
This PR adds the possibility to deep copy shapes. In robot_dart, we clone very frequently robots and we would like to be able to make deep copies of the robot. At the current state, DART does not copy shapes. This is generally OK unless we would like to alter the shapes later (e.g. create a damage or change the ColorMode of a MeshShape). So, this PR solves the above issue by making it able to deep copy shapes. I hope that I did not forget any shape. The only shape that I do not deep copy is the
SoftMeshShape
(for now I just return anullptr
in the newcopy
function; you might want to handle this differently [e.g. output a warning or exception]). Here there is a tight relationship between theSoftBodyNode
it is attached to, so I do not touch this. By the way, when cloning a skeleton, is this type of meshes re-created to point to the correctBodyNode
?Let me know if this is OK for you or you would like to handle it differently. If this is OK, we can do unit tests.
Before creating a pull request
clang-format
Before merging a pull request
CHANGELOG.md