Gazebo | Ignition | Community
Ask Your Question

How to include uri relatively?

asked 2017-05-15 05:01:12 -0500

medmuf gravatar image

I have built a model to be placed within my project, other than placing it in ~/.gazebo/models (then later be used like model://my_model) in my .world file, could I include like the following or similar: (p.s. the following one seems doesn't work)

  <uri>model://$(find my_package)/models/my_model.sdf</uri>
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-05-15 09:25:06 -0500

chapulina gravatar image

Your .world files are in SDF, and unfortunately SDF doesn't support the kind of substitution you're trying to do. I believe the syntax you're using is supported on ROS launch files.

Gazebo will find your model as long as its parent path is listed on the environment variable GAZEBO_MODEL_PATH. So you can place it on a directory other than ~/.gazebo/models and append that path to the environment variable.

edit flag offensive delete link more


Hooray! After setting `GAZEBO_MODEL_PATH` as my model path within `/etc/environment`, Gazebo did find customized models. Although I expect relative uri's are supported built-in. :-P

medmuf gravatar imagemedmuf ( 2017-05-15 23:52:41 -0500 )edit

Hey, can you please tell me the steps on how to do that?

cadbury gravatar imagecadbury ( 2020-06-10 02:41:09 -0500 )edit

can i use the absolute path in <uri> tag?

LR gravatar imageLR ( 2020-10-18 21:05:52 -0500 )edit

answered 2020-07-18 22:26:20 -0500

teshansj gravatar image

You can make gazebo look in the package directory for models using the package.xml. In the below example, you can put your models into <your/package/directory>/models/ and use them from the world file without copying them into the default gazebo model directory

    <gazebo_ros gazebo_model_path="${prefix}/models"/>
    <gazebo_ros gazebo_media_path="${prefix}/models"/>

Here {prefix} is evaluated to the package path

In the world file, now you can do this

edit flag offensive delete link more

Question Tools



Asked: 2017-05-15 05:01:12 -0500

Seen: 9,223 times

Last updated: Jul 18 '20