Skip to content

Issues generating paths for a subset of mesh faces #149

@riv-tnoble

Description

@riv-tnoble

Hi,

I'm currently trying to use noether to generate paths over a subset of faces on a mesh. The faces are chosen through a tool I've developed in rviz, which then extracts those faces from the Mesh (represented as a vtkPolyData object) and converts them into a shape_msgs/Mesh message. this mesh selection is eventually passed to noether's plane slicer and edge path planners. This is the code I'm using to generate the message.

shape_msgs::Mesh Mesh::toShapeMsgsMesh(std::vector<int> faces)
{
    std::vector<int> processed_points;
    shape_msgs::Mesh mesh;
    for (int i : faces)
    {
        shape_msgs::MeshTriangle triangle;
        vtkIdList* face = vtkIdList::New();
        mesh_->GetCellPoints(i, face);
        for (int j = 0; j < 3; j++)
        {
            int vertex_id = face->GetId(j);
            if (std::find(processed_points.begin(), processed_points.end(), vertex_id) != processed_points.end())
                continue;
            double* point = mesh_->GetPoint(vertex_id);
            geometry_msgs::Point vertex;
            vertex.x = point[0];
            vertex.y = point[1];
            vertex.z = point[2];
            mesh.vertices.push_back(vertex);
            processed_points.push_back(vertex_id);
        }
        triangle.vertex_indices = {face->GetId(0), face->GetId(1), face->GetId(2)};
        mesh.triangles.push_back(triangle);
    }
    return mesh;
}

mesh_ is the vtkPolyData object containing all faces, and faces is the vector of selected face indexes.

When I attempt to generate a plane slice path over a selection, the message is passed to noether which then crashes. I don't think it's an issue with the message building or noether calling code as, when I select every face on the mesh, the planning works fine. It's just when using a subset of faces that it breaks.

Any help would be much appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions