Gazebo | Ignition | Community
Ask Your Question
0

relative path to material file

asked 2014-02-01 08:23:26 -0600

Andrea gravatar image

Hello everybody, I am trying to add some custom materials. To do this I used the <uri> tag in the following way

    <material>
      <script>
        <uri>file:///home/mago/Development/hydro/src/ugv_description/Media/materials.material</uri>
        <name>materials/Black</name>
      </script>
    </material>

However, the project is shared via some repositories and I want the other users to run the simulations without having to change the path to the script. The materials are defined in a ROS package that is shared as well, and I would like to reference it in the SDF file. Is there any way of doing this? Thank you, Andrea

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2014-02-01 12:12:11 -0600

Carlos Agüero gravatar image

updated 2014-02-01 12:12:35 -0600

Yo could use a relative path and the GAZEBO_RESOURCE_PATH environment variable. For example, in your case:

<material>
  <script>
    <uri>file://Media/materials.material</uri>
    <name>materials/Black</name>
  </script>
</material>

export GAZEBO_RESOURCE_PATH=$GAZEBO_RESOURCE_PATH:/home/mago/Development/hydro/src/ugv_description/

It's very common to use a bash script that sets GAZEBO_RESOURCE_PATH according to the directory where your resource files are located. Using this method you just need to remember source this script.

edit flag offensive delete link more

Comments

Thank you very much! I will write the script!

Andrea gravatar imageAndrea ( 2014-02-05 09:56:10 -0600 )edit

Question Tools

Stats

Asked: 2014-02-01 08:23:26 -0600

Seen: 5,333 times

Last updated: Feb 01 '14