Closed manuel-koch closed 1 year ago
Hi, thanks for reporting.
That specific assert has been a bit problematic before. I guess this is not a real issue, but just a numerical problem. Could you relax the assert by making the threshold (1e-12) larger. I would be curious for which values it works and whether the result of GJK+EPA is correct in the end.
By the way, if you have the parametric form of the two cylinders, you can also use that and compare the results.
In our use case we need colliders that are build of meshes ( even though they could be build of primitives like the parametric Cylinder you mentioned ).
I'll play with the value you suggested to relax the assertion...
In this particular case an enhanced assertion prints
check_value = abs(np.dot(search_direction, search_direction) - v_len_sq)
assert check_value < 1e-12, f"Assertion triggered by {check_value}"
AssertionError: Assertion triggered by 1.0544675763712512e-10
If I relax the asserted value to 1e-9
the sample code succeeds and prints
True 25.0
I'll try this new value to see if i get more meshes that trigger a problem and if the detected collisions look ok.
OK, please keep me updated here. I'm still not exactly sure what the best way to set this threshold is. At the moment I would just change it to 1e-9.
Relaxed check against 1e-8
did the trick for my collision data.
I tracked all non-zero check_value
that I saw during my huge test suite run:
625261 values: 1.738719250210968e-61 ... 5.3505679052358215e-09: mean=2.2413402687908774e-11 stddev=1.2231298118824676e-10
Maybe you could make this sanity-check optional or allow caller to use an argument to tweak the value ?
Maybe you could make this sanity-check optional or allow caller to use an argument to tweak the value ?
I like the idea of making it a parameter. Would you be willing to open a pull request?
Yes, I can try a PR. What would be a useful name for this new parameter/argument ? What is the geometrical think the assertion checks ( sorry for my ignorance with respect of the involved math ) ?
It is just a numerical check. v_len_sq should have been computed as np.dot(search_direction, search_direction).
I see assertion errors with rather simple geometries.
Using:
E.g. here are two cylinders, that are in collision:
which throws