-
Notifications
You must be signed in to change notification settings - Fork 285
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 issue with removing skeletons without shapes #1625
Fix issue with removing skeletons without shapes #1625
Conversation
When `subscribeTo` is called with a skeleton in `addSkeleton`, the skeleton is added to `mSkeletonSources`. However, inside `removeSkeleton`, `unsubscribeFrom` is not called. Instead, `removeShapeFrameOf` is called. This is fine for most cases, but if it fails to remove the skeleton from `mSkeletonSources` if the skeleton does not have any shapes within it. This causes `mSkeletonSources` to grow indefinitely. A hazardous side effect of this is that when an attempt is made to add a new skeleton via `subscribeTo`, the address of the skeleton might be the same as one of the stale entries in `mSkeletonSources`. Consequently, the new skeleton's shapes don't get added to the collision detection engine and very surprising results follow. Signed-off-by: Addisu Z. Taddese <[email protected]>
boxShape); | ||
|
||
// Needed to update subscribtions | ||
world->step(1); |
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.
world->step(1); | |
world->step(); |
I guess you use 1
as the parameter to take a single simulation step, presuming from the gazebo API, but the parameter of World::step()
is boolean to set whether reset the commands (e.g., joint forces). You can safely omit the parameter in that case since the function takes single step anyway.
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.
Yup, you guessed right 😄. Removed the parameter in bc78a37.
Signed-off-by: Addisu Z. Taddese <[email protected]>
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.
LGTM! Let me create a new PR for updating the changelog for this PR
Upstream reviewed and merged the following patches that are important for the robotics community: * Fix grouping of contact constraints dartsim/dart#1624 * Fix issue with removing skeletons without shapes dartsim/dart#1625 Add them in d/patches since upstream does not provide patch releases
Description copied from gazebo-forks#4
When
subscribeTo
is called with a skeleton inaddSkeleton
, the skeleton is added tomSkeletonSources
. However, insideremoveSkeleton
,unsubscribeFrom
is not called. Instead,removeShapeFrameOf
is called. This is fine for most cases, but it fails to remove the skeleton frommSkeletonSources
if the skeleton does not have any shapes within it. This causesmSkeletonSources
to grow indefinitely. A hazardous side effect of this is that when an attempt is made to add a new skeleton viasubscribeTo
, the address of the skeleton might be the same as one of the stale entries inmSkeletonSources
. Consequently, the new skeleton's shapes don't get added to the collision detection engine and very surprising results follow.Here's a print out of
mSkeletonSources
after running several load/unload cycles via the levels feature of ign-gazebo where skeletons are removed and added repeatedly: https://gist.github.com/azeey/8fe5a55d19758923ef7c1b5df90869d3And here's the collision detection failing (failure after the 4th cycle):
Before creating a pull request
clang-format
Before merging a pull request
CHANGELOG.md