-
Hi everyone! In code below I'm trying to test collision between two equal boxes on same position (without transformation) and penetration depth is zero. shared_ptr<fcl::Box> shape1 = make_shared<fcl::Box>(1,1,1);
shared_ptr<fcl::Box> shape2 = make_shared<fcl::Box>(1,1,1);
auto* obj1 = new fcl::CollisionObject(shape1);
auto* obj2 = new fcl::CollisionObject(shape2);
fcl::CollisionRequest col_req;
fcl::CollisionResult col_res;
// Collision call
fcl::collide(obj1, obj2, col_req, col_res);
cout << "Collision? " << col_res.isCollision() << "\n";
if (col_res.isCollision()) {
fcl::Contact contact = col_res.getContact(0);
cout << "Penetration depth: " << contact.penetration_depth << "\n";
cout << "Witness point on shape1: " << contact.pos << "\n";
cout << "Normal: " << contact.normal << "\n";
} Output: Collision? 1 What I'm doing wrong? Although I tested the same case with old FCL library and I'm getting non-zero value. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @maxwave11, |
Beta Was this translation helpful? Give feedback.
Hi @maxwave11,
We are working on the next major release of hpp-fcl. If I try your code with the latest commit of the
devel
branch, I get a penetration depth of-1.0
like expected.Also, quick note:
contact.pos
is not the witness point on shape1.We have
contact.pos = (p1 + p2) / 2
wherep1 = contact.nearest_points[0]
andp2 = contact.nearest_points[1]
, hencep1
andp2
are the witness points on the shapes.