naturerobots / mesh_tools

Tools and Messages for Annotated 3D Triangle Meshes in ROS
https://wiki.ros.org/mesh_tools
BSD 3-Clause "New" or "Revised" License
229 stars 42 forks source link

How add color to vertex? #23

Open SLAMWang opened 1 year ago

SLAMWang commented 1 year ago

Hi, thanks your great work. I am using mesh_tools for visualization. According to the document: MeshGeometry (Stamped) Defines the geometric structure of a triangle mesh with 1.) an array of 3D vectors, which represents vertices in R3, 2.) an array of indices, in which three indices each define a triangle by referring 220 to the array of vertices (vertex and index buffer), and 3.) an array of vertex normal vectors. MeshVertexColors (Stamped) Colors for the vertices are represented by an array of std msgs/ColorRGBA and linked to a corresponding mesh by a string representing a UUID.

I create a MeshGeometry ros_msg and a MeshVertexColors ros_msg, and push_back the same size items in them, give them the same UUIDs, however, the rviz says that Received vertex colors, but UUIDs dont match.

amock commented 4 months ago

Hi @SLAMWang, thanks for your interest! I don't know if this comes a bit late, but with our ROS2 port, I started a side project, https://github.com/amock/mesh_msgs_examples, that aims to explain the usage of the mesh_msgs. It's far from being finished, but it already contains mesh colors. So it might help you with your problem.