Gazebo | Ignition | Community
Ask Your Question
0

Gazebo9, no methods is working to change urdf colors

asked 2019-09-19 03:30:41 -0500

Tobi92 gravatar image

updated 2019-09-19 05:02:48 -0500

kumpakri gravatar image

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 <color name="myblue"/> 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?

edit retag flag offensive close merge delete

Comments

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

Emanuele gravatar imageEmanuele ( 2020-11-10 03:38:16 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-03-23 13:43:21 -0500

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.

edit flag offensive delete link more
0

answered 2019-09-19 05:17:21 -0500

kumpakri gravatar image

You can try

 <material>
       <script>
           <uri>file://media/materials/scripts/gazebo.material</uri>
           <name>Gazebo/Red</name>
        </script>
 </material>
edit flag offensive delete link more

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

Tobi92 gravatar imageTobi92 ( 2019-09-19 08:51:45 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-09-19 03:30:41 -0500

Seen: 854 times

Last updated: Mar 23 '21