Repository navigation
no nearest_points attribute for python bindings #623
|
Hi, i couldn't find It would be useful for testing things in python, Is it possible to implement or there are some issues with it? (i have no experience for writing python bindings for cpp libraries). |
Replies: 2 comments
|
Hi @almazgaliev, col_res = hppfcl.CollisionResult()
[...] # do some collision checks
if col_res.isCollision():
contact = col_res.getContact(0) # get the first `Contact` object
cp1, cp2 = contact.getNearestPoint1(), contact.getNearestPoint2()If you are using the latest release which corresponds to the col_res = hppfcl.CollisionResult()
[...] # do some collision checks
if col_res.isCollision():
contact = col_res.getContact(0) # get the first `Contact` object
cp = contact.pos
normal = contact.normal
d = contact.penetration_depth
cp1, cp2 = cp - d * normal, cp + d * normalA few notes:
|
|
thanks! |
Hi @almazgaliev,
A
CollisionResultstores a vector ofContact(in case there is indeed a collision).I don't know which branch of hpp-fcl you are using, but on the devel one (which will soon be released, @jorisv is working on it), you can retrieve the nearest points. On the master branch, you can use the normal and the contact point to find the associated "nearest" points.
On the
develbranch, you can go over eachContactand usegetNearestPoint1/2methods:If…