I would like to generate a gazebo model on the fly with a pro-grammatically created mesh. It is unclear to me how this should work. How do you specify the mesh URI for this generated mesh?
For example, lets say my program creates a plane mesh:
gazebo::common::Mesh* plane_mesh = new gazebo::common::Mesh;
gazebo::common::SubMesh* submesh = new gazebo::common::SubMesh;
submesh->AddVertex(-1,-1,0);
submesh->AddVertex(1, -1,0);
submesh->AddVertex(-1,1,0);
submesh->AddVertex(1, 1,0);
submesh->AddIndex(0);
submesh->AddIndex(1);
submesh->AddIndex(2);
submesh->AddIndex(1);
submesh->AddIndex(3);
submesh->AddIndex(2);
plane_mesh->AddSubMesh(submesh);
plane_mesh->SetName("TEST_MODEL_PLANE_MESH");
gazebo::common::MeshManager::Instance()->AddMesh(plane_mesh);
How do I refer to this mesh when I insert an SDF model? In a world plugin, what should the mesh URI for my registered plane mesh when I try to insert the model?
public: void Load(gazebo::physics::WorldPtr _world, sdf::ElementPtr _sdf)
{
_world->InsertModelString(R"( 0 1 2 0 0 0 false true TEST_MODEL_PLANE_MESH TEST_MODEL_PLANE_MESH
)");
↧