Gazebo | Ignition | Community
Ask Your Question
2

Convert .urdf to .sdf or load .urdf

asked 2013-04-08 17:11:16 -0500

Zwilling gravatar image

updated 2013-04-19 04:41:23 -0500

Hi,

I am working on my bachelor-thesis and have a .urdf model I want to load. First I tried gzsdf convert *.urdf an got the error [Converter.cc:50] Unable to determine original SDF version. I would also be happy if I can load the .urdf model.

There are different solutions to this problem, but I found no one without ROS. (I use Gazebo without ROS.)

Do you know, what I can do? Thank you.

edit retag flag offensive close merge delete

Comments

can you post the urdf file?

hsu gravatar imagehsu ( 2013-04-09 16:42:37 -0500 )edit
Zwilling gravatar imageZwilling ( 2013-04-19 04:37:03 -0500 )edit

What version of Gazebo are you using?

Ben B gravatar imageBen B ( 2013-04-24 12:33:26 -0500 )edit

I use Gazebo 1.5.0

Zwilling gravatar imageZwilling ( 2013-04-30 07:19:18 -0500 )edit

I would try upgrading to the latest Gazebo -- though back up anything important. That way, the behaviour of our Gazebo installs will be more likely to coincide.

Ben B gravatar imageBen B ( 2013-05-06 18:45:37 -0500 )edit

5 Answers

Sort by ยป oldest newest most voted
2

answered 2017-10-12 13:47:00 -0500

Kukanani gravatar image

In newer versions of gazebo, the correct syntax is

gz sdf -p /my_urdf.urdf > /my_sdf.sdf
edit flag offensive delete link more
2

answered 2013-04-09 15:38:09 -0500

Ben B gravatar image

Try:

gzsdf print urdfname.urdf > newname.sdf
edit flag offensive delete link more

Comments

This results in "Warning [parser.cc:377] SDF has no <sdf> element in file[/home/zwilling/.gazebo/models/Robotino/RobotinoModel/urdf/robotino.urdf] Error: SDF parsing the xml failed"

Zwilling gravatar imageZwilling ( 2013-04-19 04:40:20 -0500 )edit

Zwilling, I get the same error using gzsdf print on your file. But, it still outputs an SDF for me. I can't use the SDF because I don't have the associated meshes, but maybe you can. Let me know if it works.

Ben B gravatar imageBen B ( 2013-04-19 13:36:47 -0500 )edit

It produces an empty SDF for me. You can find everythis associated to the model in http://svn.openrobotino.org/robotino-ros-pkg/trunk/robotino/robotino_description

Zwilling gravatar imageZwilling ( 2013-04-20 04:59:27 -0500 )edit
1

The latest command is: ``` gz sdf -p foo.urdf > foo.sdf ```

liangfok gravatar imageliangfok ( 2016-11-03 14:47:09 -0500 )edit
1

answered 2013-04-19 13:22:14 -0500

Bharadwaj Ramesh gravatar image

Hi , I use urdf mostly. But I founnd this easy method where I opened gazebo. then I insert the model and I save it as a world. this generates a sdf file that has the complete completly saves the urdf in sdf format.

I tried running a plugin on it and that worked too. But I am not sure if I should expect any later problems with this.

-Bharadwaj

edit flag offensive delete link more

Comments

How do you load an URDF file? How does the model.config look like? I get an error if I don't have a <model><sdf>...</sdf></model> in teh model.config. If I put the .urdf in the <sdf>...</sdf> I get Warning [parser.cc:377] SDF has no <sdf> element in file[/home/zwilling/.gazebo/models/RobotinoModelChangedURDF/model.urdf] Error [ModelMaker.cc:123] Unable to load file[/home/zwilling/.gazebo/models/RobotinoModelChangedURDF/model.urdf] in Gazebo

Zwilling gravatar imageZwilling ( 2013-04-20 05:16:09 -0500 )edit

I have a manifest.xml which looks like this :

Bharadwaj Ramesh gravatar imageBharadwaj Ramesh ( 2013-04-23 07:12:23 -0500 )edit
0

answered 2021-05-02 02:42:51 -0500

Now Gazebo has a beautifully written tutorial about it: http://gazebosim.org/tutorials?tut=ro...

In a nutshell: Gazebo can read URDF but you have to add some things to it:

  • [optional but useful] Use xacro to keep gazebo related stuff in separate files (for example robot.gazebo)
  • Every link should have <inertia> element

  • You can attache gazebo related information to links with the <gazebo reference="link_name"> tag (practically do this in robot.gazebo file)

edit flag offensive delete link more
0

answered 2013-04-23 07:15:44 -0500

Bharadwaj Ramesh gravatar image

@Zwilling : I have a manifest.xml which looks like this :

<model>
  <name>My Robot</name>
  <version>1.0</version>
  <sdf version='1.3'>model.sdf</sdf>

  <author>
   <name>My Name</name>
   <email>me@my.email</email>
  </author>

  <description>
    My awesome robot.
  </description>
</model>

This was written for the gazebo version-1.3. This is what I used to load the model initially on Gazebo and then saved it as a world. Hope this helps.

edit flag offensive delete link more

Comments

The problem is that I only have a model.urdf and no model.sdf.

Zwilling gravatar imageZwilling ( 2013-04-30 07:19:48 -0500 )edit

I checked other models that i had and in the manifest.xml i have said it as : <sdf>model.urdf</sdf>

Try this out. This is what I have for most of my models. I think this should work.

Bharadwaj Ramesh gravatar imageBharadwaj Ramesh ( 2013-04-30 21:04:39 -0500 )edit

I tried this and got Warning [parser.cc:377] SDF has no <sdf> element in file[/home/zwilling/.gazebo/models/RobotinoModel/urdf/robotino.urdf] Error [ModelMaker.cc:123] Unable to load file[/home/zwilling/.gazebo/models/RobotinoModel/urdf/robotino.urdf] Now I have converted the file by hand... Thank you for your help

Zwilling gravatar imageZwilling ( 2013-05-02 15:41:55 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2013-04-08 17:11:16 -0500

Seen: 24,095 times

Last updated: Apr 23 '13