Home | Tutorials | Wiki | Issues
Ask Your Question
1

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?.

TIA

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
2

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 parser_urdf.cc.

edit flag offensive delete link more
3

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. http://wiki.ros.org/roslaunch/XML/env

Here would be an example:

<launch>

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

  <param name="robot_description" textfile="$(find surus_sim)/robots/surus_sim.sdf" />
  <node
    name="spawn_model"
    pkg="gazebo_ros"
    type="spawn_model"
    args="-sdf -param robot_description -model surus_sim"
    output="screen">
  </node>
</launch>

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.

   <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://meshes/base_link.STL</uri>
      </mesh>
    </geometry>
edit flag offensive delete link more

Comments

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
0

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
Login/Signup to Answer

Question Tools

2 followers

Stats

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

Seen: 5,815 times

Last updated: Jun 17 '15