ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A solution using existing things could be to read the .ply into a pcl::PolygonMesh (see this or this) and then convert it like it's done here.

Another solution, since the message already exists, would be to copy the triangles into the shape_msgs::Mesh. Iirc a better idea, which I've used before, is assimp, not sure if it can load .ply meshes, but if it can, the package geometric_shapes comes to the rescue with its geometric_shapes::createMeshFromResource.

A solution using existing things could be to read the .ply into a pcl::PolygonMesh (see this or this) and then convert it like it's done here.

Another solution, since the message already exists, would be to copy the triangles into the shape_msgs::Mesh. Iirc a better idea, which I've used before, is assimp, not sure if it can load .ply meshes, but if it can, the package geometric_shapes comes to the rescue with its geometric_shapes::createMeshFromResource.

Edit: ply seems supported as per this, it might be worth a try.

A solution using existing things could be to read the .ply into a pcl::PolygonMesh (see this or this) and then convert it like it's done here.

Another solution, since the message already exists, would be to copy the triangles into the shape_msgs::Mesh. Iirc a better idea, which I've used before, is assimp, not sure if it can load .ply meshes, but if it can, the package geometric_shapes comes to the rescue with its geometric_shapes::createMeshFromResource. Edit2: I was missing a piece in the explanation: shapes::constructMsgFromShape converts the Mesh* to a variant of shape_msgs::Mesh. The code would be almost the same as in q245995.

Edit: Edit1: ply seems supported as per this, it might be worth a try.

A solution using existing things could be to read the .ply into a pcl::PolygonMesh (see this or this) and then convert it like it's done here.

Another solution, since the message already exists, would be to copy the triangles into the shape_msgs::Mesh. Iirc a better idea, which I've used before, is assimp, not sure if it can load .ply meshes, but if it can, the package geometric_shapes comes to the rescue with its geometric_shapes::createMeshFromResource. Edit2: I was missing a piece in the explanation: shapes::constructMsgFromShape converts the Mesh* to a variant of shape_msgs::Mesh. shape_msgs::Mesh. The code would be almost the same as in q245995.

Edit1: ply seems supported as per this, it might be worth a try.

A solution using existing things could be to read the .ply into a pcl::PolygonMesh (see this or this) and then convert it like it's done here.

Another solution, since the message already exists, would be to copy the triangles into the shape_msgs::Mesh. Iirc a better idea, which I've used before, is assimp, not sure if it can load .ply meshes, but if it can, the package geometric_shapes comes to the rescue with its geometric_shapes::createMeshFromResource. Edit2: I was missing a piece in the explanation: shapes::constructMsgFromShape shapes::constructMsgFromShape converts the Mesh* Mesh* to a variant of shape_msgs::Mesh. The code would be almost the same as in q245995.

Edit1: ply seems supported as per this, it might be worth a try.