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

Mistmach between GJKSolver::shapeIntersect and GJKSolver::shapeDistance #250

Open
jcarpent opened this issue Nov 7, 2021 · 5 comments
Open
Assignees
Labels

Comments

@jcarpent
Copy link
Contributor

jcarpent commented Nov 7, 2021

From the current code version, it appears that the methods GJKSolver::shapeIntersect:

https://github.com/humanoid-path-planner/hpp-fcl/blob/ea9afdc2ee5771826a12a769a108368cd0c57212/include/hpp/fcl/narrowphase/narrowphase.h#L57-L61

and GJKSolver::shapeDistance:
https://github.com/humanoid-path-planner/hpp-fcl/blob/ea9afdc2ee5771826a12a769a108368cd0c57212/include/hpp/fcl/narrowphase/narrowphase.h#L212-L216

returns opposite outputs when there are collisions.
Is it expected?

@jcarpent jcarpent changed the title Mistmach between Mistmach between GJKSolver::shapeIntersect and GJKSolver::shapeDistance Nov 7, 2021
@jcarpent
Copy link
Contributor Author

jcarpent commented Nov 7, 2021

@jmirabel @florent-lamiraux Maybe you have some hints on this issue?

@jmirabel
Copy link
Contributor

jmirabel commented Nov 8, 2021

Can you be more precise on what is opposite ? I cannot guess it from the code.

@jcarpent
Copy link
Contributor Author

jcarpent commented Nov 8, 2021

What I meant is that shapeIntersect returns True if there is a collision while shapeDistance will return False and vice-versa.

@jmirabel
Copy link
Contributor

jmirabel commented Nov 8, 2021

gjk.shapeIntersect() == true naturally means there is a collision. This one should not be changed.

gjk.shapeDistance(distance) == true conventionally means distance > some_security_threshold. Personally, I find it natural that it returns true in this case (personal taste) and I don't see any objectively good reason to change this convention. (The behavior being different from shapeIntersect is clearly not strong enough for me).

If you want the same interface, you can add a method like shapeCollisionFree or shapePenetration (I don't advise the latter).

@jcarpent
Copy link
Contributor Author

Looks clear to me. I will add shapeCollisionFree in the near Future.

@jcarpent jcarpent self-assigned this Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants