How to Programmatically Create SDF models/files
I want to create SDF files programmatically. The sdformat code has some examples https://bitbucket.org/osrf/sdformat
What is the best way to do this? Is there an example of programmatically generating an SDF?
Is the following the only way to do this?
// Set up a simple sdf model file
std::ostringstream stream;
stream << "<sdf version='1.3'>"
<< "<model name='test_model'>"
<< " <pose>0 1 2 0 0 0</pose>"
<< " <static>false</static>"
<< "</model>"
<< "</sdf>";
sdf::SDF sdfParsed;
sdfParsed.SetFromString(stream.str());
I was thinking something like:
sdf::SDFPtr robot(new sdf::SDF());
sdf::init(robot);
robot->root->AddElement("model");