Gazebo | Ignition | Community
Ask Your Question

Cannot add material when inserting from a plugin via InsertModelSDF().

asked 2013-02-05 09:27:37 -0600

AndreiHaidu gravatar image


When I insert a model in the environment from a plugin with InsertModelSDF() and I try to give it a material, I get an error.

The code is something like this:

    std::stringstream xml;

    xml << "\t\t\t<visual name='sphere_visual_" << i << "'>\n";
    xml << "\t\t\t\t<geometry>\n";
    xml << "\t\t\t\t\t<sphere>\n";
    xml << "\t\t\t\t\t\t<radius>" << radius << "</radius>\n";
    xml << "\t\t\t\t\t</sphere>\n";
    xml << "\t\t\t\t</geometry>\n";
    //xml << "\t\t\t\t<material/>\n";
    //xml << "\t\t\t\t\t<script>\n";
    //xml << "\t\t\t\t\t\t<uri>file://media/materials/scripts/gazebo.material</uri>\n";
    //xml << "\t\t\t\t\t\t<name>Gazebo/Red</name>\n";
    //xml << "\t\t\t\t\t</script>\n";
    //xml << "\t\t\t\t</material>\n";
    xml << "\t\t\t</visual>\n";

    sdf::SDF sphereSDF;


If I uncomment the <material> tag I get an error and the whole model is not loaded.

Error [] Unable to find a model, light, or actor in:
<sdf version='1.3'/>

Bug, or am I doing something wrong?

Thanks, Andrei

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-05 11:12:31 -0600

nkoenig gravatar image

I think your SDF is incorrect. Look at the start of your material XML element. It has an forward slash that shouldn't be there:


should be

edit flag offensive delete link more


You are right, sorry for not noticing it.

AndreiHaidu gravatar imageAndreiHaidu ( 2013-02-05 16:21:19 -0600 )edit

Question Tools


Asked: 2013-02-05 09:27:37 -0600

Seen: 399 times

Last updated: Feb 05 '13