Skip to content
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

Proximity engine seems to report wrong results with cylinders #8049

Closed
amcastro-tri opened this issue Feb 13, 2018 · 6 comments
Closed

Proximity engine seems to report wrong results with cylinders #8049

amcastro-tri opened this issue Feb 13, 2018 · 6 comments

Comments

@amcastro-tri
Copy link
Contributor

I created a simple test. A vertical cylinder against a half space. In principle, if you rotate the cylinder about its center 180 degrees, you should get the same result. This is not the case, the proximity engine reports very different results.
This test prints the values of the computed depths. When there is penetration, the reported depth should be "0.051". At zero degrees rotation that is exactly what you get. With 180 degrees rotation you get "0.001".
Maybe I got the frames wrong?

@amcastro-tri
Copy link
Contributor Author

You can see a video of the simulation of a cylinder falling against a half space (no friction, that is why it only moves up and down and rotates but doesn't move laterally since contact forces only act in the z-direction). The dynamic is performed by MultibodyPlant while penetration queries are handled through GeometrySystem.
You can see that while the cylinder's z-axis points "up" the simulation looks right with the cylinder bouncing off the plane at its sharp edges. However, as the cylinder starts rotating with its z axis pointing "down", it starts going through the plane. Further analysis would seem to indicate that the upper half of the cylinder would seem to be half the actual size.

@avalenzu
Copy link
Contributor

This is the function that actually computes the intersection.

@amcastro-tri
Copy link
Contributor Author

ok, this is the offending line (or one of them). It should say instead:

// this checks for cylinder axis aligned with plane normal (that's why the math is simpler!)
if(std::abs(cosa) < halfspaceIntersectTolerance<S>()) { ...
  // ^^^^^ missing abs().

Another thing I didn't like about this implementation is the very loose tolerance used in the check. halfspaceIntersectTolerance() resolves to 1e-7 for double precision.
I didn't test it, but the code in GeometricTools here seems to look cleaner.

@amcastro-tri
Copy link
Contributor Author

Fix pushed in flexible-collision-library/fcl#255

@avalenzu
Copy link
Contributor

@amcastro-tri can this be closed?

@amcastro-tri
Copy link
Contributor Author

Yes. Thanks @avalenzu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants