How to use custom textures on urdf models in gazebo?
Hello,
I am using ROS Kinetic with Gazebo 7.x and I know that I can use gazebo materials with
<gazebo reference="link">
<material>Gazebo/Orange</material>
</gazebo>
I did manage to use a custom .jpg file as a texture on my model by
editing the gazebo.materials script from usr/share/gazebo-7/media/materials/scripts
adding the .jpg file into the usr/share/gazebo-7/media/materials/textures folder.
However, since those folders are supposed to be read only and editing those does not seem right, I want to know a different way. I did read about adding the following to my package.xml, but I did not have any success with it.
<run_depend>gazebo_ros</run_depend>
<export>
<gazebo gazebo_media_path="${prefix}"/>
</export>
My package has the following structure:
- test_gazebo
- package.xml
- CMakeList.txt
- launch/
- media/
- materials/
- scripts/
- test.materials
- textures/
- test.jpg
- scripts/
- materials/
- models/
- test.urdf
- ...
Is the structure wrong for the media export to work? From what I understood ${prefix} is the path to the package and gazebo should use it to use the media folder, but it does not work for me.
Do I need to change the .urdf if I am using a different media path also? What I tried is using the in my script asigned name like
<gazebo reference="link">
<material>Custom/TextureName</material>
</gazebo>
Anyone might be able to help me out and knows what I am doing wrong?
Do you mean "editing the gazebo.materials script" or "editing the gazebo.material script"? Also is your file named "test.materials" or "test.material" ? Just checking because I have the same problem as you had and I still cannot resolve the issue. Thanks!