Is there an easy way to measure the distance between two meshes?

asked 2016-04-25 11:23:51 -0600

jwidauer gravatar image

Like the title says, I'm looking for an easy way to calculate the distance between two meshes.

The meshes are the collision elements of two links.

Is there an easy way to implement this or do I have to use the flexible collision library (fcl), extract the meshes from all the links and then feed that to fcl?

I can't really believe that there is no implementation of this already, but I couldn't find anything.

edit retag flag offensive close merge delete

Comments

You'll probably need to write some custom code for that. Are you looking for the shortest distance between two solids or the distance between specific points in different meshes?

chapulina gravatar imagechapulina ( 2016-04-25 11:44:37 -0600 )edit

I'm looking for the shortest distance between two solids. The problem is that you need to get the meshes for all collision elements of a link, then get all the submeshes, then get the vertices of those together with the triangles and then you are able to feed that to fcl. Unfortunately I am not sure what the submeshes represent. Are those the faces? And if you have the vertices of the submeshes could there be duplicates in the total mesh, since multiple faces can use the same vertex?

jwidauer gravatar imagejwidauer ( 2016-04-25 11:52:31 -0600 )edit

I might be mistaken, but I think submeshes are any kind of mesh, anything from a triangle to a closed solid. Meshes would be just groups of submeshes. And I think there is some internal checking to remove duplicate vertices (see this issue: https://bitbucket.org/osrf/gazebo/issues/1134).

chapulina gravatar imagechapulina ( 2016-04-25 12:10:45 -0600 )edit

Hm... Then just some other questions. Do you know of any explanations on how these meshes/submeshes are stored? Since fcl needs a std::vector<vector3> with the location of all vertices and a std::vector<vector3> with the indices of all vertices for all triangles (vector3 being a 3-dim vector of floats). Also, do the meshes change from simulation step to simulation step or is it only the transform of the meshes?

jwidauer gravatar imagejwidauer ( 2016-04-26 10:54:35 -0600 )edit