[Gurdy] No errors when spawning but nothing is shown in Gazebo

I am currently on URDF course unit 3. The Gurdy 3D model has been successfully shown in RVIZ but failed to spawn to Gazebo. There is no error and I can see the links and joints at the structure tree on the left-hand side of the Gazebo but nothing is shown in the simulation even though I have turned on the ‘collisions’, ‘inertias’, and ‘link frames’ in view.


gurdy.urdf

<?xml version = "1.0"?>
<robot name = "gurdy">

    <material name="red">
        <color rgba="0.8 0 0 1"/>
    </material>

    <material name="green">
        <color rgba="0 0.8 0 1"/>
    </material> 

    <material name="blue">
        <color rgba="0 0 0.8 1"/>
    </material>

    <material name="grey">
        <color rgba="0.8 0.8 0.8 1"/>
    </material>

    <!-- LINKS -->

    <link name = "base_link">
    </link>

    <link name = "head_link">
        <inertial>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <mass value = "0.01"/>
            <intertia ixx = "7.5833e-6" iyy = "7.5833e-6" izz = "1.25e-5"/>
        </inertial>

        <collision>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <cylinder radius = "0.05" length = "0.04"/>
            </geometry>
        </collision>

        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <mesh filename = "package://my_gurdy_description/models/gurdy/meshes/gurdy_head_v2.dae"/>
            </geometry>
            <material name="red"/>
        </visual>
    </link>

    <gazebo reference = "head_link">
        <kp>1000.0</kp>
        <kd>1000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Red</material>
    </gazebo>

    <link name = "upperleg_M1_link">
        <inertial>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <mass value = "0.01"/>
            <intertia ixx = "9.005208e-6" iyy = "9.005208e-6" izz = "1.8e-5"/>
        </inertial>

        <collision>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <cylinder radius = "0.06" length = "0.0025"/>
            </geometry>
        </collision>

        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <mesh filename = "package://my_gurdy_description/models/gurdy/meshes/gurdy_higherleg_v2.dae"/>
            </geometry>
            <material name="grey"/>
        </visual>
    </link>

    <gazebo reference = "upperleg_M1_link">
        <kp>1000.0</kp>
        <kd>1000.0</kd>
        <mu1>10.0</mu1>
        <mu2>10.0</mu2>
        <material>Gazebo/Green</material>
    </gazebo>

    <link name = "lowerleg_M1_link">
        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <mesh filename = "package://my_gurdy_description/models/gurdy/meshes/gurdy_lowerleg_v2.dae"/>
            </geometry>
        </visual>
    </link>

    <link name = "footM1_link">
        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <sphere radius = "0.008"/>
            </geometry>
        </visual>
    </link>

    <link name = "upperleg_M2_link">

        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <mesh filename = "package://my_gurdy_description/models/gurdy/meshes/gurdy_higherleg_v2.dae"/>
            </geometry>
            <material name="grey"/>
        </visual>
    </link>




    <link name = "lowerleg_M2_link">
        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <mesh filename = "package://my_gurdy_description/models/gurdy/meshes/gurdy_lowerleg_v2.dae"/>
            </geometry>
        </visual>
    </link>

    <link name = "footM2_link">
        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <sphere radius = "0.008"/>
            </geometry>
        </visual>
    </link>

    <link name = "upperleg_M3_link">

        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <mesh filename = "package://my_gurdy_description/models/gurdy/meshes/gurdy_higherleg_v2.dae"/>
            </geometry>
            <material name="grey"/>
        </visual>
    </link>



    <link name = "lowerleg_M3_link">
        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <mesh filename = "package://my_gurdy_description/models/gurdy/meshes/gurdy_lowerleg_v2.dae"/>
            </geometry>
        </visual>
    </link>

    <link name = "footM3_link">
        <visual>
            <origin xyz = "0 0 0" rpy = "0 0 0"/>
            <geometry>
                <sphere radius = "0.008"/>
            </geometry>
        </visual>
    </link>

    
    <!-- JOINTS -->

    <joint name = "fixed" type = "fixed">
        <parent link = "base_link"/>
        <child link = "head_link"/>
        <origin xyz = "0 0 0" rpy = "0 0 0"/>
        <limit effort = "1.0" velocity = "0.005"/>
    </joint>

    <joint name = "head_upperlegM1_joint" type = "revolute">
        <parent link = "head_link"/>
        <child link = "upperleg_M1_link"/>
        <origin xyz = "-0.02165 -0.0125 -0.008" rpy = "3.14159 0 0.0523599"/>
        <limit lower = "-0.2" upper = "0.2" effort = "1.0" velocity = "0.005"/>
        <axis xyz = "0 1 0"/>
    </joint>

    <joint name = "upperlegM1_lowerlegM1_joint" type = "revolute">
        <parent link = "upperleg_M1_link"/>
        <child link = "lowerleg_M1_link"/>
        <origin xyz = "0 0.0095 0.06" rpy = "0 -0.3 3.14159"/>
        <limit lower = "-0.2" upper = "0.2" effort = "1.0" velocity = "0.005"/>
        <axis xyz = "0 1 0"/>
    </joint>

    <joint name = "basefoot_peg_M1_joint" type = "fixed">
        <parent link = "lowerleg_M1_link"/>
        <child link = "footM1_link"/>
        <origin xyz = "0 0 0.06" rpy = "0 0 0"/>
        <limit effort = "1.0" velocity = "0.005"/>
    </joint>

    <joint name = "head_upperlegM2_joint" type = "revolute">
        <parent link = "head_link"/>
        <child link = "upperleg_M2_link"/>
        <origin xyz = "0.02165 -0.0125 -0.008" rpy = "3.14159 0 2.61799"/>
        <limit lower = "-0.2" upper = "0.2" effort = "1.0" velocity = "0.005"/>
        <axis xyz = "0 1 0"/>
    </joint>

    <joint name = "upperlegM2_lowerlegM2_joint" type = "revolute">
        <parent link = "upperleg_M2_link"/>
        <child link = "lowerleg_M2_link"/>
        <origin xyz = "0 0.0095 0.06" rpy = "0 -0.3 3.14159"/>
        <limit lower = "-0.2" upper = "0.2" effort = "1.0" velocity = "0.005"/>
        <axis xyz = "0 1 0"/>
    </joint>

    <joint name = "basefoot_peg_M2_joint" type = "fixed">
        <parent link = "lowerleg_M2_link"/>
        <child link = "footM2_link"/>
        <origin xyz = "0 0 0.06" rpy = "0 0 0"/>
        <limit effort = "1.0" velocity = "0.005"/>
    </joint>

    <joint name = "head_upperlegM3_joint" type = "revolute">
        <parent link = "head_link"/>
        <child link = "upperleg_M3_link"/>
        <origin xyz = "0 0.025 -0.008" rpy = "3.14159 0 -1.5708"/>
        <limit lower = "-0.2" upper = "0.2" effort = "1.0" velocity = "0.005"/>
        <axis xyz = "0 1 0"/>
    </joint>

    <joint name = "upperlegM3_lowerlegM3_joint" type = "revolute">
        <parent link = "upperleg_M3_link"/>
        <child link = "lowerleg_M3_link"/>
        <origin xyz = "0 0.0095 0.06" rpy = "0 -0.3 3.14159"/>
        <limit lower = "-0.2" upper = "0.2" effort = "1.0" velocity = "0.005"/>
        <axis xyz = "0 1 0"/>
    </joint>

    <joint name = "basefoot_peg_M3_joint" type = "fixed">
        <parent link = "lowerleg_M3_link"/>
        <child link = "footM3_link"/>
        <origin xyz = "0 0 0.06" rpy = "0 0 0"/>
        <limit effort = "1.0" velocity = "0.005"/>
    </joint>

</robot>

spawn_urdf.launch

<?xml version="1.0" encoding="UTF-8"?>

<launch>

    <arg name="x" default="0.0" />
    <arg name="y" default="0.0" />
    <arg name="z" default="0.0" />

    <arg name="urdf_robot_file" default="" />
    <arg name="robot_name" default="" />

    <param name="robot_description" command="cat $(arg urdf_robot_file)" />

    <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen"
    args="-urdf -x $(arg x) -y $(arg y) -z $(arg z)  -model $(arg robot_name) -param robot_description"/>
    
</launch>

spawn_gurdy.launch

<?xml version="1.0" encoding="UTF-8"?>
<launch>
    <include file="$(find my_gurdy_description)/launch/spawn_urdf.launch">
        <arg name="x" value="0.0" />
        <arg name="y" value="0.0" />
        <arg name="z" value="0.2" />
        <arg name="urdf_robot_file" value="$(find my_gurdy_description)/urdf/gurdy.urdf"/>
        <arg name="robot_name" value="gurdy" />
    </include>
</launch>

structure

Solved it!!! Here are what I found:

  1. Even though the components of inertia ixy, ixz and iyz are 0, they cannot be omitted
  2. They are some typos like ‘cyilnder’ and ‘interia’ which could not be found through launching the spawning file though it claims ‘SpawnModel: successfully spawned entity’

My suggestion is after adding the inertia and collision tags, make sure there is no error by running the following code as it can provide some hints including typos

roslaunch my_gurdy_description urdf_visualize.launch model:='$(find my_gurdy_description)/urdf/gurdy.urdf'

then proceed on spawning:

roslaunch my_gurdy_description spawn_gurdy.launch
1 Like

Hello @azurechen1203,
I am glad that you found the issue. URDF files are hard to debug because they fail silently instead of throwing errors. Note that the Gazebo physics engine to work properly, the principal moment of inertia (ixx, iyy, izz) should not be zero as this causes infinite acceleration even at the smallest force exerted.

Regards,

Roberto