Gazebo | Ignition | Community
Ask Your Question
0

SDF files with Gazebo plugin for ROS?

asked 2012-11-06 11:21:21 -0500

ammar gravatar image

updated 2012-11-06 13:27:43 -0500

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/simulatorgazebo/gazeboworlds/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...robot/mobilebase

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 simulatorgazebo 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 GAZEBORESOURCE_PATH

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

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2012-11-06 12:31:45 -0500

nkoenig gravatar image

Hello,

You can programmatically spawn an SDF model a couple ways:

  1. Via a World or Model plugin:
  2. Via a msgs::Factory message on the "~/factory" topic.
  3. Use the gzfactory command line tool.
edit flag offensive delete link more

Comments

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'

mcevoy.andy gravatar imagemcevoy.andy ( 2012-11-06 12:49:55 -0500 )edit

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

ammar gravatar imageammar ( 2012-11-06 13:35:24 -0500 )edit

This is only for gazebo 1.2 and greater.

nkoenig gravatar imagenkoenig ( 2012-11-07 13:47:33 -0500 )edit

Is there a gazebo 1.2 plugin for ROS?

ammar gravatar imageammar ( 2012-11-08 19:41:42 -0500 )edit

It is being worked on as we speak.

nkoenig gravatar imagenkoenig ( 2012-11-09 14:06:36 -0500 )edit

These links all take me to the Gazebosim home page.

Ben B gravatar imageBen B ( 2013-01-14 14:18:31 -0500 )edit

Unfortunately the links in this answer have gone stale.

SL Remy gravatar imageSL Remy ( 2016-02-15 17:57:37 -0500 )edit
0

answered 2013-01-11 18:37:43 -0500

hsu gravatar image

latest ros-fuerte-simulator-gazebo and ros-groovy-simulator-gazebo should be able to spawn sdf directly, please verify, thanks.

edit flag offensive delete link more

Comments

It's not working for me anyways. I've created the sdf and manifest files from the first part (up to step 2 of "Build the model's structure") of this tutorial: http://gazebosim.org/wiki/Tutorials/1.3/buildrobot/mobilebase .

Ben B gravatar imageBen B ( 2013-01-14 14:08:55 -0500 )edit

Tried to file-> open both the model and manifest files and I get: Warning [parser.cc:348] Gazebo SDF has no gazebo element Error [parser.cc:263] parse as old deprecated model file failed. Error [Server.cc:396] Unable to read sdf file[~/ .... ]

Ben B gravatar imageBen B ( 2013-01-14 14:45:02 -0500 )edit

Hi there, I seem to have the same problem as Ben B. I use ros fuerte and gazebo 1.4 (compiled from source) on Ubuntu 12.04. After following this very tutorial: http://gazebosim.org/wiki/Tutorials/1.4/rosenabledmodelplugin I get Unable to load file [~/gazeboros_plugin/models/robot/model.sdf] err.

dejanpan gravatar imagedejanpan ( 2013-02-04 09:25:45 -0500 )edit

There 2 more warning and error lines: Warning [parser.cc:377] SDF has no <sdf> element in file[urdf file] Error [parser.cc:291] parse as old deprecated model file failed.

dejanpan gravatar imagedejanpan ( 2013-02-04 09:26:56 -0500 )edit

I think this is not the preferred method for loading SDFs. It's a bug none the less. Anyway, the preferred method is to put your models in the appropriate directory then you can load the from within Gazebo. Check out: http://answers.gazebosim.org/question/854/error-loading-sdf-in-gazebo-131/

Ben B gravatar imageBen B ( 2013-02-04 13:34:13 -0500 )edit

Thx Ben B. I was actually sloppy and forgot one < in my sdf file. It now works like a charm. I do not think of drag and dropping of models as a preferable way of loading the models, especially if I am working with really complex worlds.

dejanpan gravatar imagedejanpan ( 2013-02-04 14:00:17 -0500 )edit

Make sure you run export GAZEBO_MODEL_PATH=~/gazebo_ros_plugin/models:${GAZEBO_MODEL_PATH} in the terminal that you run gazebo in.

nkoenig gravatar imagenkoenig ( 2013-02-04 19:38:52 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2012-11-06 11:21:21 -0500

Seen: 4,778 times

Last updated: Jan 11 '13