-
Notifications
You must be signed in to change notification settings - Fork 417
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
contact normal changes randomly between two opposite directions #422
Comments
@ClementRolinat have you seen issue #368? It sounds like this may be affecting you. If it oscillates with each query (even if nothing is moving), that sounds like it's a victim of the implicit BVH changes. |
I am not sure to understand the issue. But as far as I understood, my issue could be a direct consequence of this, if the normal direction returned by FCL depend directly on the order of the two colliding objets... Anyway, I confirm that the direction oscillate approximately at the update rate of the simulator (so at each query to FCL) |
Exactly right. The broadphase mutates itself (even if nothing moves), so that the ordering of the two objects to the narrowphase algorithm alternates: (A, B), (B, A), (A, B), etc. The narrowphase algorithm could be consistent (and probably is) in how it reports the normals, but it lacks the greater context of knowing which is A and which is B. This burned us as well (it's horrible for physics if you need to know where and how to apply a contact force). We resolved it outside of FCL by associating our own ids so that we could guarantee the interpretation of the normal. Fixing the BVH to be stable in its |
There is something I still don't understand. This info is retrieved by DART as well (at least, the contact object on DART side also have two variables to store colliding objects for this contact). But here, the returned objects doesn't switch place... |
A fine point. I'm not familiar with the DART code. I went looking and my limited scanning didn't detect anything obvious. In translating from fcl results to dart results, they are storing pointers to the fcl collision objects, so there should be sufficient data to handle the order flipping. But I didn't happen across the resolution the stored contact results (via Finally, going back to your original stated issue. Does the In the Dart code, I did find where the So, what quantity is your sensor actually measuring? |
my sensor report for a given object every collision in which it is involved. Each collision consist of several contacts. For each contacts, the position, penetration depth, normal, force, torque and colliding objects are reported. On these reported values, the normal and force are oscillating, whereas the two colliding objects stay in the same order. However, the physics behavior is correct. So, as you said, it is just an annoyance, but for my application it is really bad because I need to make some computation involving contact normal... EDIT: |
I would assume then, that the pointers to the two objects likewise "oscillate" (swap back and forth). So, you'll probably have to do the same thing as dart -- devise some canonical ordering for the given pair and reconcile it. One thing you might do if you feel confident there's no destruction/construction of objects. Compare the pointers of the reported objects. If o1 < o2, leave the normal, otherwise flip it. That should normalize your directions. |
oh, thanks for the pointer trick, I will definitely try this out ! I will let you know if it works. |
Did it work? Or did it open up a wormhole into the dungeon dimensions and release all of the demons of C++ on you? |
I didn't try it yet (but I expect some C++ black magic will occur of course). edit: |
I saw the same code you pointed out. I agree the If my guess is right, doing the ordering in
|
Ok, for the fix implementation details, I will see with DART maintainers, hopefully they will know better where and what to do. |
I'm going to close it in favor of the more general issue #368. If this proves to be something more than that issue, we can re-open it. |
hello,
I am using DART as physics engine for Gazebo 9, and DART is using FCL as collision detector.
(this issue is also referenced on DART here: issue 1425
I found this bug when attaching a contact sensor to a model.
When I display the gazebo topic associated with this sensor, I can see that the normals of the contacts are not constant, even if the model is lying on the ground and is at rest (only gravity force is applied on it). More precisely, the directions of the normals oscillate between approximately (0, 0, 1), and (-0, -0, -1).
The bug is very easy to reproduce in Gazebo (with DART physics engine enabled), you just need to attach a contact sensor to a model, and display the associated gazebo topic.
The FCL version used is the one available on apt repository, libfcl0.5
The text was updated successfully, but these errors were encountered: