Howdy folks,
I am trying to get to the bottom of how exactly a mesh is loaded in Gazebo.
I am working on a Gazebo Plugin that generates trees procedurally such that I can create a forest where each tree's geometry/shape is unique (more or less).
I have figured out how to convert a procedurally generated tree to a Mesh, and then add this Mesh to MeshManager:
gazebo::common::Mesh * treeMesh = procTreeFunction();
treeMesh->SetName("Tree_1234");
gazebo::common::MeshManager::Instance()->AddMesh(treeMesh);
But what I am currently struggling with what to do next in order to see this tree in my Gazebo world, and what follows is questionable and is what I need some help with.
So next I am creating an SDF model string:
modelStr << ""
""
"" << pose << " "
""
""
"0.01 "
"0.01 "
" "
"" << _mass << " "
""
"" << Ixx << " "
"" << Iyy << " "
"" << Izz << " "
"" << 0.0 << " "
"" << 0.0 << " "
"" << 0.0 << " "
" "
" "
""
""
""
"" Tree_1234 " "
" "
" "
" "
""
""
""
"" Tree_1234 " "
" "
" "
""
"" << _materialAmbient[0] << " " << _materialAmbient[1] << " " << _materialAmbient[2] << " " << _materialAmbient[3] <<" "
"" << _materialDiffuse[0] << " " << _materialDiffuse[1] << " " << _materialDiffuse[2] << " " << _materialDiffuse[3] <<" "
"" << _materialSpecular[0] << " " << _materialSpecular[1] << " " << _materialSpecular[2] << " " << _materialSpecular[3] <<" "
"" << _materialEmissive[0] << " " << _materialEmissive[1] << " " << _materialEmissive[2] << " " << _materialEmissive[3] <<" "
" "
" "
""
" "
" ";
And then I add the model to my world
sdf::SDF sdfDescription.SetFromString(modelStr.str());
_parent->InsertModelSDF(sdfDescription);
However, instead of seeing a tree, I am seeing a cube (that appears to be a unit cube of 1 m^3). The cuboid is rendered in the correct material settings and at the right location. It's just not a tree :)
Does anyone have an idea what I might be doing wrong?
Thanks in advance!!
Galto
↧