In this section we will learn how to add colors to the robot in Gazebo.

Step 1: Create New File mobile_base_gazebo.xacro

image.png

Step 2: Include the File in my_robot.urdf.xacro

<?xml version="1.0"?>
<robot name="my_robot" xmlns:xacro="<http://www.ros.org/wiki/xacro>">

    <xacro:include filename="common_properties.xacro" />
    <xacro:include filename="mobile_base.xacro" />
    <xacro:include filename="mobile_base_gazebo.xacro" />

</robot>

Step 3: Modify mobile_base_gazebo.xacro to Add Colors

<?xml version="1.0"?>
<robot xmlns:xacro="<http://www.ros.org/wiki/xacro>">

    <gazebo reference="base_link">
        <material>Gazebo/Blue</material>
    </gazebo>

    <gazebo reference="right_wheel_link">
        <material>Gazebo/Grey</material>
    </gazebo>

    <gazebo reference="left_wheel_link">
        <material>Gazebo/Grey</material>
    </gazebo>

    <gazebo reference="caster_wheel_link">
        <material>Gazebo/Grey</material>
    </gazebo>
</robot>