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

Why the collision result remain the same, no matter how I change the box scale and position when I run the example.py file #25

Open
MarkusZh opened this issue Mar 3, 2021 · 1 comment

Comments

@MarkusZh
Copy link

MarkusZh commented Mar 3, 2021

Why is the collision result always True? And why is the distance between the two objects always -1.0. Actually I have changed the sizes and postions of the test objects for multiple times, sometimes, it is obviouly that the two objects will no collide with each other(for example, I set the two objects very far from each other), but the result remain the unchanged of being Collided. No error was raised.
And my python-fcl version is python-fcl-win32-nr.
What is wrong with my scripts? or Is there any dependency which I need to install?
Thanks a lot for help.
image

@ebianchi
Copy link

I noticed the same issue, for both the collision checking and distance checking examples. The issue goes away if you re-define the res result object before calling fcl.collide or fcl.distance, e.g.:

req = fcl.CollisionRequest(enable_contact=True)
res = fcl.CollisionResult()
n_contacts = fcl.collide(
    fcl.CollisionObject(box, fcl.Transform()),
    fcl.CollisionObject(cone, fcl.Transform()),
    req,
    res,
)
print_collision_result("Box", "Cone", res)

res = fcl.CollisionResult()   # Add this line to reset the result.
n_contacts = fcl.collide(
    fcl.CollisionObject(box, fcl.Transform()),
    fcl.CollisionObject(cyl, fcl.Transform(np.array([6.0, 0.0, 0.0]))),
    req,
    res,
)
print_collision_result("Box", "Cylinder", res)

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

No branches or pull requests

2 participants