Ask Your Question
0

Gazebo loading custom texture

asked 2020-08-13 19:49:03 -0500

definitive gravatar image

How to load custom texture through launch file? I created new directories space in path ~/models.

Dir tree:

-models
--media
---materials
----scripts
-----gazebo.material
----textures
-----texture_01.jpg

World file:

  <material>
    <script>
      <uri>file://media/materials/scripts/gazebo.material</uri>
      <name>Gazebo/Texture_01</name>
    </script>
  </material>

Launch file:

  <include file="$(find test_package)/launch/empty_world.launch">
    <arg name="verbose" value="true"/>
    <arg name="world_name" value="$(find test_package)/worlds/test.world"/>
  </include>

Where and how to pass environments variable in my without changing empty_world.launch?

<env name="GAZEBO_MODEL_PATH" value="$(find test_package)/models"/>
<env name="GAZEBO_RESOURCE_PATH" value="$(find test_package)/media/materials"/>

Putting them in my launch file doesn't work. Typing export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/models/ and export GAZEBO_RESOURCE_PATH=$GAZEBO_RESOURCE_PATH:~/models/media/materials/ also doesn't work. My objects stays white without any texture.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-08-14 08:37:51 -0500

definitive gravatar image

updated 2020-08-14 08:40:52 -0500

In world file instead of:

  <material>
    <script>
      <uri>file://media/materials/scripts/gazebo.material</uri>
      <name>Gazebo/Texture_01</name>
    </script>
  </material>

Should be:

  <material>
    <script>
      <uri>model://media/materials/scripts/</uri>
      <uri>model://media/materials/textures/</uri>
      <name>Gazebo/Texture_01</name>
    </script>
  </material>

Now it works with env path inside launch file:

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

Setting GAZEBO_RESOURCE_PATH is not necessary.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-08-13 19:49:03 -0500

Seen: 329 times

Last updated: Aug 14 '20