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

Bug fix in SurfaceNormalOutlierFilter #457

Merged
merged 6 commits into from
Aug 3, 2021
Merged

Bug fix in SurfaceNormalOutlierFilter #457

merged 6 commits into from
Aug 3, 2021

Conversation

cjamin
Copy link
Contributor

@cjamin cjamin commented Mar 25, 2021

This call to anyabs should not be here.

Here is an example: if maxAngle = 0.2, an angle of 3.1 radians should obviously be reject. But with the current code, eps = cos (0.2) ~= 0.98, and abs(cos(3.1) ~= 0.999, so it is accepted. With this fix, cos(3.1 ~= -0.999, it is rejected.

Example: if `maxAngle = 0.2`, an angle of 3.1 radians should obviously be reject. But with the current code, `eps = cos (0.2)` ~= 0.98, and `abs(cos(3.1)` ~= 0.999, so it is accepted. With this fix, `cos(3.1` ~= -0.999, it is rejected.
@ethzasl-jenkins
Copy link

Can one of the admins verify this patch?

@pomerlef
Copy link
Collaborator

ok to test

@pomerlef
Copy link
Collaborator

pomerlef commented Jul 6, 2021

@simonpierredeschenes could you have a look?

@simonpierredeschenes
Copy link
Collaborator

I don't think this is the wanted behavior, the call to anyabs is there to allow normals of opposite directions, thus from parallel surfaces. If we remove it, users will need to call the OrientNormalsDataPointsFilter filter to orient all normals in the same direction. This filter acts almost randomly for points far from the robot, so they would likely be discarded by the outlier filter.

@cjamin
Copy link
Contributor Author

cjamin commented Jul 7, 2021

Then the name and this documentation are misleading: "Maximum authorised angle between the 2 surface normals (in radian) - min: 0.0 - max: 3.1416". If it was meant to work like you say, the max would be PI/2, not PI.

I use this filter to prevent matching points that are on two different faces of a wall, so this is really useful.

A solution could be to add a parameter to choose between both behaviors.

@simonpierredeschenes
Copy link
Collaborator

@cjamin I discussed with my colleagues and it appears I was mistaken, the filter is meant to avoid matching different faces of a wall, as you said. The fix you did solves the issue. Could you please add a small sentence to the documentation that says that the filter must be used in combination with the OrientNormalsDataPointsFilter to get the expected behavior, to avoid some confusion for the users? Then the PR would be ready to merge. Thanks!

@cjamin
Copy link
Contributor Author

cjamin commented Jul 8, 2021

All right, thanks.

The "official" documentation only mention this filter in this page, without any explanation. This documentation (this link I gave earlier) seems unofficial. So, if I'm not mistaken, I can't change it here in the repository.

@simonpierredeschenes
Copy link
Collaborator

simonpierredeschenes commented Jul 8, 2021

Oh, I meant in the outlier filter description (here). This code is used to auto-generate this documentation. This documentation also comes from us, we will link it in the tutorials in the future.

@pomerlef
Copy link
Collaborator

The utest are not passing:

Error Message
/home/jenkins/workspace/pointmatcher/label/ubuntu-xenial/utest/utest.cpp:158
Expected: (rel_err) < (0.03), actual: 0.0650631 vs 0.03
This error was caused by the test file:
   ../examples/data/icp_data/force4DOFForPointToPlaneMinimizer.yaml

@cjamin
Copy link
Contributor Author

cjamin commented Jul 27, 2021

I updated the documentation.

Regarding the test, I can only guess that the test used to pass for bad reasons...
FYI, I've been testing this patch for a few month on a project now, and it works like a charm.

@pomerlef
Copy link
Collaborator

pomerlef commented Aug 3, 2021

I've updated the test results on your branch. I'll merge as soon as the CI is letting me. Thanks for the patch!

@pomerlef pomerlef merged commit d478ef2 into norlab-ulaval:master Aug 3, 2021
@cjamin
Copy link
Contributor Author

cjamin commented Aug 4, 2021

Thanks for integration!

@cjamin cjamin deleted the patch-1 branch August 4, 2021 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants