humanoid-path-planner/hpp-fcl

What is the correct way to get the distance between and the corresponding closest points?

BolunDai0216 opened this issue · 3 comments

Hi,

I just started to look into this library, and I noticed that when computing the distance between two objects

import hppfcl
import numpy as np

box = hppfcl.Box(np.array([1.0, 1.0, 1.0]))
capsule = hppfcl.Capsule(1.0, 2.0)

M_box = hppfcl.Transform3f(np.eye(3), np.array([0, 0, 0]))
M_capsule = hppfcl.Transform3f(np.eye(3), np.array([10, 0, 0]))

req = hppfcl.DistanceRequest()
res = hppfcl.DistanceResult()

dis = hppfcl.distance(capsule, M_capsule, box, M_box, req, res)

It does not give any other information, like the corresponding closest points. Is possible to help me understand how I can obtain that information?

Thanks in advance!

Did you look at the res quantity? This is very similar to FCL here.

Thanks for the response!

So we can get the closest points using

capsule_point = res.getNearestPoint1()
box_point = res.getNearestPoint2()

This seems to give the points in world frame coordinates, is there a way to directly get the points in body frame coordinates?

Another question I have is, when I want to compute the distance between the same objects just with different Transform3fs, is there an update function for that?

This seems to give the points in world frame coordinates, is there a way to directly get the points in body frame coordinates?

Just apply the inverse transformation on the points.

Another question I have is, when I want to compute the distance between the same objects just with different Transform3fs, is there an update function for that?

Do a new call. You won't gain so much, except in specific scenarios.
What do you expect with the update?

And please do not forget to cite this repository in your code and publications.