Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to Programmatically Create SDF models/files

I want to create SDF files programmatically. The sdformat code has some examples

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;

I was thinking something like:

sdf::SDFPtr robot(new sdf::SDF());