ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Hi, I am just posting so that other users could see. I managed to add a color on Gazebo based on this tutorial: http://gazebosim.org/tutorials/?tut=ros_urdf I used this in my xacro file :

   <gazebo reference="link1">
    <material>Gazebo/Orange</material>
   </gazebo>

This uses already built-in gazebo colors from gazebo.materials which you can find this link: https://github.com/osrf/gazebo/blob/master/media/materials/scripts/gazebo.material

I wanted to add a red sphere but there was no pure red color in the built-in ones. The present colors had either dark or light gradients. To solve this I added a custom color to the gazebo.materials I found it on my computer on this path:(I am runing Ubuntu 20.04) /usr/share/gazebo-11/media/materials/scripts/gazebo.material

To insert pure red, i added this code:

material Gazebo/RED
      {
        technique
        {
          pass
          {
            texture_unit
            {
              colour_op_ex source1 src_manual src_current 1 0 0
            }
          } 
        }
      }

Then you have to save as sudo. I used visual studio to do that. It is possible that with other code editor it does't allow you save.

You can find more details on adding a color in here: https://wiki.ogre3d.org/Materials#Solid_colour