Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

URDF: different colors in gazebo for one link with multiple visual meshes

Hi, I have a URDF with a few links. One of the links with multiple visual meshes. The meshes dont have the right origin at the moment, but thats not the point.

Is it possible to give each visual mesh a different color in gazebo or is gazebo only possible to reference one color to the link_name and not to a specific visual tag?

Gazebo reference:

  <gazebo reference="assembly_table">
<material>Gazebo/White</material>
 </gazebo>

Example link:

<link name= "assembly_table">
<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/table_top.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/item_table.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/UTS100cc.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/ims300pp.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual> 
</link>

I would be very happy if someone has more information about this concern.

Thankyou

URDF: different colors in gazebo for one link with multiple visual meshes

Hi, I have a URDF with a few links. One of the links with multiple visual meshes. The meshes dont have the right origin at the moment, but thats not the point.

Is it possible to give each visual mesh a different color in gazebo or is gazebo only possible to reference one color to the link_name and not to a specific visual tag?

Gazebo reference:

  <gazebo reference="assembly_table">
<material>Gazebo/White</material>
 </gazebo>

Example link:

<link name= "assembly_table">
<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/table_top.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/item_table.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/UTS100cc.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/ims300pp.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual> 
</link>

Update:

I would advise that you do the following and examine the sdf description

gz sdf -p <robot>.urdf

rosrun xacro xacro -o model.urdf model.xacro

and

gz sdf -p model.urdf

So this is what I get (without the collision part):

<link name='assembly_table'>
  <visual name='assembly_table_visual'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/table_top.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <visual name='assembly_table_visual_1'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/item_table.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <visual name='assembly_table_visual_2'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/UTS100cc.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <visual name='assembly_table_visual_3'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/ims300pp.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <gravity>0</gravity>
  <velocity_decay/>
</link>

Am I reading this right, that there is no reference to the visual tag in urdf. The sdf uses the uri material path for each visual element, refering to each visual tag assembly_table_visual_1 to assembly_table_visual_3.

I would be very happy if someone has more information about this concern.

Thankyou

URDF: different colors in gazebo for one link with multiple visual meshes

Hi, I have a URDF with a few links. One of the links with multiple visual meshes. The meshes dont have the right origin at the moment, but thats not the point.

Is it possible to give each visual mesh a different color in gazebo or is gazebo only possible to reference one color to the link_name and not to a specific visual tag?

Gazebo reference:

  <gazebo reference="assembly_table">
<material>Gazebo/White</material>
 </gazebo>

Example link:

<link name= "assembly_table">
<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/table_top.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/item_table.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/UTS100cc.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual>

<visual>
  <geometry>
    <mesh filename="package://path/to/mesh/ims300pp.dae"/>
  </geometry>
  <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
</visual> 
</link>

Update:

I would advise that you do the following and examine the sdf description

gz sdf -p <robot>.urdf

rosrun xacro xacro -o model.urdf model.xacro

and

gz sdf -p model.urdf

So this is what I get (without the collision part):

<link name='assembly_table'>
  <visual name='assembly_table_visual'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/table_top.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <visual name='assembly_table_visual_1'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/item_table.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <visual name='assembly_table_visual_2'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/UTS100cc.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <visual name='assembly_table_visual_3'>
    <pose frame=''>0 0 0 0 -0 0</pose>
    <geometry>
      <mesh>
        <scale>1 1 1</scale>
        <uri>model://path/to/mesh/ims300pp.dae</uri>
      </mesh>
    </geometry>
    <material>
      <script>
        <name>alu3</name>
        <uri>file://media/materials/scripts/gazebo.material</uri>
      </script>
    </material>
  </visual>
  <gravity>0</gravity>
  <velocity_decay/>
</link>

Am I reading this right, that there is no reference to the visual tag in urdf. The sdf uses the uri material path for each visual element, refering to each visual tag assembly_table_visual_1 to assembly_table_visual_3.

Just found this:

<visual> (optional)

The visual properties of the link. This element specifies the shape of the object (box, cylinder, etc.) for visualization purposes. Note: multiple instances of <visual> tags can exist for the same link. The union of the geometry they define forms the visual representation of the link.

name (optional)
    Specifies a name for a part of a link's geometry. This is useful to be able to refer to specific bits of the geometry of a link.

from http://wiki.ros.org/urdf/XML/link

I would be very happy if someone has more information about this concern.

Thankyou