Is there an easy way to measure the distance between two meshes?
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.
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?
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?
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).
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?
Take a look at the API: http://osrf-distributions.s3.amazonaws.com/gazebo/api/dev/classgazebo_1_1common_1_1SubMesh.html