moveit! collision object mesh shading options

asked 2019-09-20 22:59:33 -0500

lhdu gravatar image

updated 2019-09-23 16:01:38 -0500

I am using meshes as my collision objects in moveit!, following this tutorial. The meshes are displayed in a "smooth" or "vertex" mode in rviz. The smooth shading gives meshes an unrealistic gradient: the scene from the tutorial, bunny.

"Flat" and "appearance/textured" shading are available in rviz for moveit!: In PlanningScene, Scene Robot can be displayed in terms of Visual and Collision. "Show Robot Visual" displays .dae meshes with appearances, and "Show Robot Collision"

robot's visual mesh (in *.dae) can be displayed with customized appearance, and robot's collision mesh (in *.stl) can be displayed in "flat" shading:

  • "Appearance/textured" shading: It seems that moveit! does not support appearance for collision objects. moveit! uses moveit_msgs/CollisionObject messages to store collision objects (primitives, meshes, etc), and moveit_msgs/CollisionObject uses shape_msgs/Mesh message to store meshes. shape_msgs/Mesh only stores triangles and vertices, so appearance/materials stored in a .dae file are discarded. I have converted a .stl mesh to COLLADA(.dae) format and added appearance, but moveit! parse it into a mesh with no appearance information, producing the same look as using a .stl mesh.

  • "Flat" shading: I would like to know if it is possible to display the mesh with "flat" or "face" shading: bunny with a flat shading.

Can anyone shed light on this?

edit retag flag offensive close merge delete

Comments

How did you convert stl->dae? I remember using Blender and having to modify the mesh quite a bit before it worked in RViz. Also dae is directly inspectable (you can open it with a text editor) so it's not impossible to look for the tags and check what's been done by the conversion.

aPonza gravatar image aPonza  ( 2019-09-23 05:35:10 -0500 )edit

I imported my *.stl file into blender and added material to the object (e.g. red diffuse), then I exported the object in *.dae file. I verified the modified appearance by re-opening the exported *.dae file.

lhdu gravatar image lhdu  ( 2019-09-23 15:31:16 -0500 )edit

From here it seems necessary to set the bool mesh_use_embedded_materials in the marker, however looking in moveit's repo I can't find mentions of it being set ever, so it might be ignored. You could try publishing an interactive marker to RViz to test if it would work...

I don't have a "polygon view" on my meshes like you're asking, I instead took a hi-poly mesh and decimated it only until the compromise between file size and decent looks seemed reasonable. The gradients and the lighting however seem very consistent unlike the "scene from the tutorial" you're linking.

In this old issue they're setting ambient light to black (which is also the case for my mesh). You could also look into this if it helps, although maybe it's been integrated in the past 2y.

aPonza gravatar image aPonza  ( 2019-09-24 03:02:35 -0500 )edit
1

There is a severe lack of people understanding meshes, shading and especially shaders all around. I guess the default look depends on the shaders used in rviz, maybe you can improve them? There were also some changes in the last weeks wrt color tinting markers, but nothing about collision object afaik https://github.com/ros-visualization/...

Having both a collision object/mesh and a visual counterpart in collision objects would be a nice addition to MoveIt, feel invited :) https://github.com/ros-planning/moveit

Simon Schmeisser gravatar image Simon Schmeisser  ( 2019-09-25 01:06:23 -0500 )edit