Home | Tutorials | Wiki | Issues
Ask Your Question

Warning and fail to read an sdf element: Converting a deprecated SDF source[data-string].

asked 2016-06-01 09:54:22 -0500

mdingwer gravatar image

updated 2016-07-23 04:51:28 -0500

Hi, I have a problem with some sdf files under gazebo, when I load a plugin. Currently I try to develop my worlds under ros-jade and gazebo7 (and under ros-kinetic). But when I call the worlds per roslaunch files I become the following warning messages.

Warning [parser. cc: 437] Converting a deprecated SDF source [data-string].

There is also no difference whether I access to the sdf in the plugins or not. If I also try to access to an element of the sdf, the plugin crashed each time, because i can't read the string from the sdf files (the variable will be empty). I hope you can help me.

The Source Code: https://mdingwer@bitbucket.org/mdingwer/test_gazebo.git

edit retag flag offensive close merge delete


you should post the SDF that's causing the problem

Peter Mitrano gravatar imagePeter Mitrano ( 2016-06-01 19:02:47 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-06-03 20:31:29 -0500

So, I didn't bother to figure out why the warning is there, but I figured out why your code doesn't work. Apparently, gazebo puts whatever your put inside <plugin> inside some <sdf> tags. I find this out by printing _sdf->ToString(" ");.

It showed this:

<plugin name='FieldGroundPlugin' filename='libFieldGroundPlugin.so'>

You probably didn't expect the sdf tags to wrap it all.

change line 34 to say something like this->sdf = _sdf->GetElement("sdf"); instead of this->sdf = _sdf. Then it should behave the way you expect.

I think we should either document this better, or fix it so it doesn't add "sdf" tags. I'm not sure which is the better option.

edit flag offensive delete link more


i try it but it doesn't work. The plugin can't read the parameter of this plugin. To find the error, i change the plugin to a ModelPlugin. This ModelPlugin works fine and gives out the path (example) in the terminal. If i change it back to an Visualplugin, the plugin doesn't work because it dosn't can read the parameter. So i think that this is a bug in gazebo. Here is also the link to the VisualPlugin: https://drive.google.com/open?id=0Bxeju8GDXusWOW9GOGwxc1lCdmc

mdingwer gravatar imagemdingwer ( 2016-06-04 08:42:05 -0500 )edit

I tried it on the code you posted in your answer below, and yes it does work. If you are using github, can you link to that? Google drive is not a good way to shared code.

Peter Mitrano gravatar imagePeter Mitrano ( 2016-06-04 16:56:05 -0500 )edit

I crate one: git@bitbucket.org:mdingwer/test_gazebo.git

mdingwer gravatar imagemdingwer ( 2016-06-05 05:42:35 -0500 )edit

I made a PR to demonstrate what I mean. please accept this as the correct answer so others can see it.

Peter Mitrano gravatar imagePeter Mitrano ( 2016-06-08 21:58:17 -0500 )edit

For people reading this in the future: `<plugin><sdf>` problem was fixed on Gazebo 7, see this for more context: https://bitbucket.org/osrf/sdformat/issues/168/sdformat-pushes-visual-plugin-comments

chapulina gravatar imagechapulina ( 2017-09-29 16:26:12 -0500 )edit

answered 2016-06-02 13:57:45 -0500

mdingwer gravatar image

updated 2016-07-22 13:23:28 -0500

I have test it today but it doesn't work (I used gazebo 5.3 the last months)

Each time i get a warning and the variable path is empty. But the variable path should contain "example".

Here is a repo with the source code:


edit flag offensive delete link more


Your problem could be associated with the C-style comment within the SDF file. I'm referring to "//Create the ground visual in the plugin".

nkoenig gravatar imagenkoenig ( 2016-06-02 16:09:10 -0500 )edit

No, that was only a short comment I make in the post. But is it right that the visual plugin has non elements. Because in the PDF specification the visual has only a plugin and non elements. All other plugin have elements like name, filename And user parameters. The visual plugin is the only plugin where I have this problems. In my sensor plugins, were I do the same thing, everything works (there I have only problems that the laser scanner look through the object)

mdingwer gravatar imagemdingwer ( 2016-06-03 00:20:52 -0500 )edit

I have test it today but it doesn't work (I used gazebo 5.3 the last months) Each time i get a warning and the variable path is empty. But the variable path should contain "example". Here is a repo with the source code: https://mdingwer@bitbucket.org/mdingwer/test_gazebo.git

mdingwer gravatar imagemdingwer ( 2016-07-22 13:24:43 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-06-01 09:54:22 -0500

Seen: 731 times

Last updated: Jul 23 '16