-
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
Fix "dir" in GJKDistance function #290
Fix "dir" in GJKDistance function #290
Conversation
Is this ready for review, @hongkai-dai ? |
Yes it is ready for review. The error on Mac CI is likely due to libccd being compiled with single precision |
@sherm1 Want to split feature/platform review? Review status: 0 of 7 files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
+@SeanCurtis-TRI for feature review I really like the directory structure in the First pass done. Reviewed 7 of 7 files at r1. include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1330 at r1 (raw file):
BTW META: Based on the work you did, could you provide a function-level documentation for this function (and the others you touched to a sufficient degree to feel confident in your ability to document it)? You had to gain that understanding, it would be nice if future generations could benefit from that. test/test_fcl_sphere_sphere.cpp, line 51 at r1 (raw file):
BTW "Compute the (optionally signed) distance..." test/test_fcl_sphere_sphere.cpp, line 85 at r1 (raw file):
BTW Neither of these booleans appear to be anything other than true in this test. (Applies across this entire file). test/test_fcl_sphere_sphere.cpp, line 103 at r1 (raw file):
BTW It might be worth creating arrays of relative positions. Right now, one at the origin and one displaced along a single axis may be less exhausting than we'd really want. test/test_fcl_sphere_sphere.cpp, line 105 at r1 (raw file):
FYI If you expressed these in terms of your parameters it would be less brittle. Then you could position the spheres in non-axis-aligned positions and still get the right answers. test/test_fcl_sphere_sphere.cpp, line 106 at r1 (raw file):
BTW Also, given notation Ultimately, what I really want is a clear statement that the answers are in the sphere's local frames. test/test_fcl_sphere_sphere.cpp, line 107 at r1 (raw file):
BTW A lot of the other tests in fcl separate the solvers into different unit tests. Without good reason, I'd propose we do the same. test/test_fcl_sphere_sphere.cpp, line 121 at r1 (raw file):
BTW It should be more clear that the tests you've created are only testing signed distance. test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 67 at r1 (raw file):
BTW These two lines constitute a memory leak; there should be an accompanying invocation of: test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 89 at r1 (raw file):
You might also consider doing a:
test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 100 at r1 (raw file):
BTW The value of swapping the order of the spheres in this test isn't worth as much as in test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 107 at r1 (raw file):
BTW As I commented on the other tests, I'd like to see an array of scenarios rather than just this one. test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 114 at r1 (raw file):
BTW you can use In fact, you could hard-code that tolerance inside the test rather than passing it in here. Comments from Reviewable |
Review status: all files reviewed at latest revision, 13 unresolved discussions, some commit checks failed. include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1330 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Good call. test/test_fcl_sphere_sphere.cpp, line 51 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 85 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
That is true. By setting both these booleans to true, I test the function test/test_fcl_sphere_sphere.cpp, line 103 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Good call. I added more tests. But the precision for the new tests are not as good as 1E-14. They are now about 1E-3. test/test_fcl_sphere_sphere.cpp, line 106 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 107 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 121 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done, I added the test with test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 67 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Good catch! test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 89 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Thanks test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 100 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Without the bug fix on test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 107 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 114 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
I pass it in here as I thought the tolerance would depend on the type of Comments from Reviewable |
Reviewed 4 of 7 files at r1, 3 of 3 files at r2. include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1160 at r2 (raw file):
FYI you could use backticks for variables rather than include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1171 at r2 (raw file):
BTW consider moving these declarations down to just prior to their use and in the loop scope where possible. I had trouble figuring out what was used where by scanning the code. I believe include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1350 at r2 (raw file):
BTW so great to see all this duplicate code deleted! Thanks! test/test_fcl_sphere_sphere.cpp, line 35 at r2 (raw file):
FYI could add a space before closing comment. test/test_fcl_sphere_sphere.cpp, line 60 at r2 (raw file):
BTW consider a brief explanation of this notation and a link to Drake's documentation for it: http://drake.mit.edu/doxygen_cxx/group__multibody__spatial__pose.html Likely FCL programmers are not familiar with it yet. test/test_fcl_sphere_sphere.cpp, line 180 at r2 (raw file):
BTW Yikes! Is that really the best we can hope for with libccd? Comments from Reviewable |
Second pass Reviewed 1 of 3 files at r2. include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1157 at r2 (raw file):
I know it's asking a lot, but if this were elevated to a Drake-quality piece of documentation, we'd all benefit. Something along the lines of:
(With appropriate Unknowns: What happens if the simplex is not initialized? Or it's lying? include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1339 at r2 (raw file):
BTW I'd modify this to reflect the comment on the other function. The difference between the two is that this does the warm starting of the libccd GJK implementation. test/test_fcl_sphere_sphere.cpp, line 49 at r2 (raw file):
FYI I just realized: if you had spheres A and B and radius_A and radius_B, that makes p_FB and p_FA fit better. test/test_fcl_sphere_sphere.cpp, line 116 at r2 (raw file):
BTW missing space before test/test_fcl_sphere_sphere.cpp, line 117 at r2 (raw file):
FYI slightly more efficient to negate the radius. But yours reads better. :) test/test_fcl_sphere_sphere.cpp, line 123 at r2 (raw file):
BTW These three comments are slightly redundant. The first one includes the next two. So, I'd suggest one of two options:
test/test_fcl_sphere_sphere.cpp, line 143 at r2 (raw file):
BTW This is a dangerous test -- this should be a test/test_fcl_sphere_sphere.cpp, line 180 at r2 (raw file): Previously, sherm1 (Michael Sherman) wrote…
BTW Not all of the tests fail at this precision -- I'd like a note/todo indicating why this value is so high and which combination of spheres is ending so badly. test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 100 at r1 (raw file): Previously, hongkai-dai (Hongkai Dai) wrote…
Refined f2f Comments from Reviewable |
Review status: 4 of 7 files reviewed at latest revision, 14 unresolved discussions. include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1157 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Thanks a lot for writing this clear documentation! include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1160 at r2 (raw file): Previously, sherm1 (Michael Sherman) wrote…
Done. include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1171 at r2 (raw file): Previously, sherm1 (Michael Sherman) wrote…
Done. I think include/fcl/narrowphase/detail/convexity_based_algorithm/gjk_libccd-inl.h, line 1339 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 105 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
I think now with test/test_fcl_sphere_sphere.cpp, line 35 at r2 (raw file): Previously, sherm1 (Michael Sherman) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 49 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
I am hesitant to do that, since the letter test/test_fcl_sphere_sphere.cpp, line 60 at r2 (raw file): Previously, sherm1 (Michael Sherman) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 116 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 123 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 143 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Good point! test/test_fcl_sphere_sphere.cpp, line 180 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. All pairs of combination are bad. test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 100 at r1 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Comments from Reviewable |
Reviewed 3 of 3 files at r3. test/test_fcl_sphere_sphere.cpp, line 156 at r2 (raw file):
BTW some odd characters at beginning of line here? Comments from Reviewable |
It's worth noting that this PR seems to have fixed the persistent mac CI failure we've had. That's outstanding! Now I just have to fix the box-box test so that it passes in the mac release. Reviewed 2 of 3 files at r3. test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 47 at r3 (raw file):
BTW measured and expressed in frame F? Certainly, according to Drake's monogram notation test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 126 at r3 (raw file):
BTW This is a repeat of the other test's issue -- if someone changes the spheres such that they collide, no tests will be executed for that pair and the test will meaninglessly pass. Comments from Reviewable |
Reviewed 1 of 3 files at r3. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. test/test_fcl_sphere_sphere.cpp, line 117 at r2 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. test/test_fcl_sphere_sphere.cpp, line 156 at r2 (raw file): Previously, sherm1 (Michael Sherman) wrote…
Hmm I do not see them, maybe a reviewable glitch? test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 47 at r3 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Good catch. test/narrowphase/detail/convexity_based_algorithm/test_gjk_libccd-inl.cpp, line 126 at r3 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Good catch Comments from Reviewable |
Reviewed 2 of 2 files at r4. Comments from Reviewable |
Reviewed 2 of 2 files at r4. Comments from Reviewable |
The variable
dir
is overloaded inGJKDistance
function, that it means both the point within the simplex that is closest to the origin, and the directional vector along which to compute the support mapping. One issue caused by this overload, is that when callingextractClosestPoint
, we should pass in the closest point, but instead passed in the directional vector. In this PR I introduce a separate variableclosest_p
to represent the closest point.This change is