Gazebo | Ignition | Community
Ask Your Question

When importing a URDF model, how are package:// URIs parsed?

asked 2013-03-08 03:36:22 -0500

Adolfo Rodríguez T gravatar image

I'm using gzfactory to load a URDF in which mesh resources are specified using package://ros_package/relative/path URIs. Testing seems to indicate that Gazebo removes the package:// identifier and treats the remaining string as a relative filesystem path. Is this what's really going on under the hood?.


edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted

answered 2013-03-15 21:13:54 -0500

hsu gravatar image

Current solution for reading URDF models in Gazebo assumes the ROS package containing the model must also have a valid Gazebo model.config file in addition to the ROS manifest.xml file. And the model must be in both GAZEBO_MODEL_PATH and ROS_PACKAGE_PATH for both ROS and Gazebo to find the model.

With that assumption, package:// is simply replaced by model:// by

edit flag offensive delete link more

answered 2015-06-17 18:25:05 -0500

l0g1x gravatar image

If you do not want to have your model in two different places like @hsu said (GAZEBO_MODEL_PATH and ROS_PACKAGE_PATH) then what you can do is edit the launch file for your model's package, and after the <launch> tag, but before you run any gazebo related stuff, insert an <env> tag which will allow you to temporarily set that environment variable, without changing across your entire system.

Here would be an example:


  <env name="GAZEBO_MODEL_PATH" value="$(find surus_sim)"/>

  <param name="robot_description" textfile="$(find surus_sim)/robots/surus_sim.sdf" />
    args="-sdf -param robot_description -model surus_sim"

and then in your SDF (and i believe this would work for URDF too) you specify the path of your mesh(s) relative to the value specified in the <env> tag.

        <scale>1 1 1</scale>
edit flag offensive delete link more


Hi, I tried the Tutorial: "Using roslaunch to start Gazebo, world files and URDF models" but though exporting the environmental path to ~/.bashrc and setting the export variables to the package.xml of test_gazebo and test_description I wasn't able to pulldown the tag in the model database in gazebo. I just followed the completely tutorial, adding the urdf model to the test_description package folder urdf. Do you have an idea? Thanks.

kathrin@gazebo gravatar imagekathrin@gazebo ( 2018-06-10 07:14:45 -0500 )edit

answered 2013-03-15 18:20:45 -0500

nkoenig gravatar image

Gazebo doesn't know about ROS paths, so the URDF to SDF parser must convert package:// to an absolute path so that Gazebo can find it.

edit flag offensive delete link more

Question Tools



Asked: 2013-03-08 03:36:22 -0500

Seen: 47,726 times

Last updated: Jun 17 '15