uwgraphics / relaxed_ik

RelaxedIK Solver
MIT License
175 stars 50 forks source link

Why would meshes have the same number of vertex and triangles? #26

Open Raziel90 opened 3 years ago

Raziel90 commented 3 years ago

In the collision_utils.py There is this condition:

       if not len(self.params['verts']) == len(self.params['tris']):
       raise TypeError(bc.FAIL + 'ERROR: number of tris must equal the number of verts in collision mesh.' + bc.ENDC)

As far as I know, unless you reuse some vertices you are going to get 3 times the amount of triangles. I doubt that all of them are going to be reused.

In case I am wrong, how can I convert a mesh to have the same numbers of vertices and triangles?

djrakita commented 3 years ago

Yes, good catch! You should be able to remove this equality check, and I'm guessing the underlying fcl model should be able to successfully initialize. If not, just let me know. Thanks!

Raziel90 commented 3 years ago

Hi djrakita, I tried as you suggested, I get a WARNING WARNING: Mesh collision object not supported in rviz visualization

To verify It was just a matter of visualization I played with the urdf_viewer_with_collision_info.py. However, I don't see the collision detected on the mesh. Will it still be detected by the sample generator? Cheers!

djrakita commented 3 years ago

Yeah, at the time this code was written a few years ago, rviz didn't have a way to easily render arbitrary meshes (it looks like there are better ways of doing this now). I would recommend either extending the relaxedIK to rviz pipeline to include mesh rendering options (specified here http://wiki.ros.org/rviz/DisplayTypes/Marker#Mesh_Resource_.28MESH_RESOURCE.3D10.29_.5B1.1.2B-.5D) or just calculate and display a bounding volume of your mesh just to verify that your object is transformed to where you want it to be.

LuciAnge commented 1 year ago

Hi guys, I update the mesh visualization for collision objects in rviz. Now, I'm able to visualize the mesh of the collision object but the urdf_viewer_with_collision_info.py doesn't show collisions between the robot and the object. How can I solve this problem? Thank you!