gazebo-forks / dart

Dynamic Animation and Robotics Toolkit
http://dartsim.github.io/
BSD 2-Clause "Simplified" License
6 stars 5 forks source link

Fix issue with removing skeletons without shapes #4

Closed azeey closed 4 years ago

azeey commented 4 years ago

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.


Before creating a pull request

Before merging a pull request

azeey commented 4 years ago

@mxgrey Do you mind reviewing this? For context, the issue addressed by this PR causes collision detection to fail after skeletons are loaded and unloaded several times. The problem occurs only when there is a memory address collision in the mSkeletonSources container. Here's a print out of mSkeletonSources after running several load/unload cycles via the levels feature of ign-gazebo: https://gist.github.com/azeey/8fe5a55d19758923ef7c1b5df90869d3

And here's the collision detection failing (failure after the 4th cycle): Peek 2020-01-27 19-22

iche033 commented 4 years ago

nice I'm no longer able to get the robot to fall through the tile using this branch