Gazebo Answers logo

Hello All, I recently learned that URDF is being deprecated, being substituted by SDF. I have in the past used spawn_models node to introduce new models in my Gazebo environment. How do I spawn SDF models? I tried using the 'Open' option in the Gazebo world GUI but it gives me the following error:

Error [parser.cc:566] XML Element[static], child of element[model] not defined in SDF. Ignoring.[model] Error [parser.cc:557] Error reading element Error [parser.cc:340] Unable to parse sdf element[gazebo] Error [parser.cc:263] parse as old deprecated model file failed. Error [Server.cc:396] Unable to read sdf file[/opt/ros/fuerte/stacks/simulator_gazebo/gazebo_worlds/objects/first_robotv3.sdf]

The SDF file I am trying to load is exactly from the tutorials found here: http://gazebosim.org/wiki/Tutorials/1.2/build_robot/mobile_base

This should work with ROS as well right?

Please help. Thanks, Ammar

EDIT: So after trying a few different configurations I observed that ROS has a gazebo node and a gazebo-1.0.2 node. Which one of these two supports SDF better? The default launch files I found in the simulator_gazebo stack were launching the "gazebo" node. When I try to launch the "gazebo-1.02" node I get the following error: Error [SystemPaths.cc:262] cannot load file [sdf/gazebo.sdf]in GAZEBO_RESOURCE_PATH

I am really confused with which is a stable Gazebo version I should use. Thanks

Originally posted by ammar on Gazebo Answers with karma: 11 on 2012-11-06

Post score: 0


1 Answer 1


Gazebo Answers logo


You can programmatically spawn an SDF model a couple ways:

  1. Via a World or Model plugin:
  1. Via a msgs::Factory message on the "~/factory" topic.
  2. Use the gzfactory command line tool.

Originally posted by nkoenig with karma: 7676 on 2012-11-06

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by mcevoy.andy on 2012-11-06:
is this only for v1.2? I get errors when trying to insert by the last two methods in point 1. I followed the tutorial for v1.0. error = class gazebo::physics::World’ has no member named ‘InsertModelSDF’ and same thing for 'InsertModelString'

Comment by ammar on 2012-11-06:
I get errors in the last method as well: Error [SystemPaths.cc:262] cannot load file [sdf/gazebo.sdf]in GAZEBO_RESOURCE_PATH[/opt/ros/fuerte/stacks/simulator_gazebo/gazebo:] ERROR: SDF parsing the xml failed

Comment by nkoenig on 2012-11-07:
This is only for gazebo 1.2 and greater.

Comment by ammar on 2012-11-08:
Is there a gazebo 1.2 plugin for ROS?

Comment by nkoenig on 2012-11-09:
It is being worked on as we speak.

Comment by Ben B on 2013-01-14:
These links all take me to the Gazebosim home page.

Comment by SL Remy on 2016-02-15:
Unfortunately the links in this answer have gone stale.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.