Colors not working in Rviz and Gazebo
Hi! I'm using melodic and Gazebo-9. Following a Gazebo tutorial I have 3 files: 1. my_robot.xacro (URDF model of my robot) 2. my_robot.gazebo 3. materials.xacro (where the colors are defined)
In my urdf-file I have
<?xml version="1.0"?>
<robot name="weld_robot" xmlns:xacro="https://www.ros.org/wiki/xacro" >
<xacro:include filename="$(find robot)/urdf/my_robot.gazebo" />
<xacro:include filename="$(find robot)/urdf/materials.xacro" />
...
<link name="link_1">
<visual>
<geometry>
<cylinder length="0.1" radius="1"/>
</geometry>
</visual>
<collision>
<geometry>
<cylinder length="0.1" radius="1"/>
</geometry>
</collision>
<inertial>
<mass value="1"/>
<inertia ixx="0.25" ixy="0.0" ixz="0.0"
iyy="0.25" iyz="0.0"
izz="0.5"/>
</inertial>
</link>
...
</robot>
In my my_robot.gazebo I have:
<?xml version="1.0"?>
<robot>
...
<!-- Link_1 -->
<gazebo reference="link_1">
<visual>
<material>Gazebo/Orange</material>
</visual>
...
</gazebo>
And here is my launch file for rviz, which I took from the tutorial:
<launch>
<arg name="model" default="$(find robot)/urdf/my_robot.xacro"/>
<arg name="gui" default="true" />
<arg name="rvizconfig" default="$(find robot)/rviz/urdf.rviz" />
<param name="robot_description" command="$(find xacro)/xacro.py $(arg model)"/>
<param name="use_gui" value="$(arg gui)"/>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find robot)/rviz/urdf.rviz" />
</launch>
My problem is that the colors are not displayed neither in rviz nor in Gazebo. I've tried different approaches, suggested in the forum, but the problem still exists. In Gazebo the model is completely white, and the model in rviz has the colors which I defined previously in the my_robot.urdf file (now my_robot.xacro) before I created different files for materials and my_robot.gazebo and when <material> tag was still in my_robot.urdf file.
Any help would be appreciated!