Robotics StackExchange | Archived questions

Gazebo9, no methods is working to change urdf colors

Hi, I tried everything to change color of links in Gazebo9-ROS Melodic. Nothing works, I already followed official guides as well as every other question in the forum. Can you explain me what's wrong with my methods?

METHOD 1: In "materials.xacro" :

<?xml version="1.0"?>
<robot>
  <material name="myblue">
    <color rgba="0.0 0.0 0.8 1.0"/>
  </material>
</robot>

In mybot.xacro: Hi, I tried everything to change color of links in Gazebo9-ROS Melodic. Nothing works, I already followed official guides as well as every other question in the forum. Can you explain me what's wrong with my methods?

METHOD 1: In "materials.xacro" :

<?xml version="1.0"?>
<robot>
  <material name="myblue">
    <color rgba="0.0 0.0 0.8 1.0"/>
  </material>
</robot>

In mybot.xacro:

> <?xml version="1.0"?>   <link
> name="chassis_front1">
>     <inertial>
>           <!--   various things -->
>     </inertial>
>     <collision name='collision_front1'>
>           <!--   various things -->
>     </collision>
>     <visual name='chassis_visual_front1'>
>       <origin xyz="${x_or} ${y_or} 0" rpy=" 0 0 0"/>
>       <geometry>
>           <!--   various things -->
>       </geometry>
>     </visual>
>       <color name="myblue" />    </link>

I also tried to put inside tag 'visual', but nothing happenend

METHOD 2:
in a file named "mybot.gazebo":

<gazebo reference="chassis_front1"> 
      <material>Gazebo/Red</material>     
</gazebo>

But, also this time, component color did not change. What's wrong with it?

Asked by Tobi92 on 2019-09-19 03:30:41 UTC

Comments

did you ever find the solution to this? I'm having the same problem

Asked by Emanuele on 2020-11-10 04:38:16 UTC

Answers

You can try

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

Asked by kumpakri on 2019-09-19 05:17:21 UTC

Comments

Thank you, unfortunately nothing changes... I tried to put this string in mybot.xacro (and within visual and within link and external to link with a reference) and I tried to add it in mybot.gazebo too.. Nothing

Asked by Tobi92 on 2019-09-19 08:51:45 UTC

Try deleting the "name" from your visual tags, this worked for me.

NO:

<visual name='chassis_visual_front1'>

YES:

<visual>

See a full working example here.

Asked by Oscar Lima on 2021-03-23 13:43:21 UTC

Comments