Gazebo | Ignition | Community
Ask Your Question
0

How to include uri relatively?

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

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)

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

2 Answers

Sort by ยป oldest newest most voted
0

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

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

Comments

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 -0600 )edit

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

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

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

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

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

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

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

Here {prefix} is evaluated to the package path

In the world file, now you can do this

<geometry>
    <mesh><uri>model://your_mesh.dae</uri></mesh>
</geometry>
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

2 followers

Stats

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

Seen: 7,432 times

Last updated: Jul 18 '20