Part of robot model isn't showing in rviz

115 views Asked by At

Just got into gazebo ros rviz stuff. Trying to build a robot model using urdf for reinforcement learning. The robot showed up normally in vscode using ROS:Preview URDF. However when I launched it with roslaunch only partial showed up in rviz (only wheels displayed). Down below is the urdf file and launch file and a picture of the same model showed in vscode(right) and rviz(left). My rviz version is 1.14.20

forklift.urdf

<robot name="forklift">

    <link name="base_footprint">
        
    </link>
    <link name="base_link">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertial ixx="0.0" ixy="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.525 0.525 0.2155"/>
            </geometry>
            <material name="blue">
                <color rgba="0.0 0.0 1.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.525 0.525 0.2155"/>
            </geometry>
        </collision>
    </link>
    <joint name="base_joint" type="fixed">
        <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
        <parent link="base_footprint"/>
        <child link="base_link"/>
    </joint>

<!--    ***   wheels   ***   -->    
    <!--   back right wheel   -->
    <link name="wheel_link_br">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
            <material name="black">
                <color rgba="0.0 0.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
        </collision>
    </link>

    <joint name="wheel_joint_br" type="continuous">
        <origin xyz="-0.150000 -0.272513 -0.100250" rpy="1.57 0.0 0.0"/>
        <parent link="base_link"/>
        <child link="wheel_link_br"/>
        <axis xyz="1.0 0.0 0.0"/>
    </joint>

    <!--   back left wheel   -->
    <link name="wheel_link_bl">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
            <material name="black">
                <color rgba="0.0 0.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
        </collision>
    </link>

    <joint name="wheel_joint_bl" type="continuous">
        <origin xyz="-0.150000 0.272513 -0.100250" rpy="1.57 0.0 0.0"/>
        <parent link="base_link"/>
        <child link="wheel_link_bl"/>
        <axis xyz="1.0 0.0 0.0"/>
    </joint>

    <!--   front right wheel   -->
    <link name="wheel_link_fr">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
            <material name="black">
                <color rgba="0.0 0.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
        </collision>
    </link>

    <joint name="wheel_joint_fr" type="continuous">
        <origin xyz="0.150000 -0.272513 -0.100250" rpy="1.57 0.0 0.0"/>
        <parent link="base_link"/>
        <child link="wheel_link_fr"/>
        <axis xyz="1.0 0.0 0.0"/>
    </joint>

    <!--   front left wheel   -->
    <link name="wheel_link_fl">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
            <material name="black">
                <color rgba="0.0 0.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <cylinder radius="0.06" length="0.02"/>
            </geometry>
        </collision>
    </link>

    <joint name="wheel_joint_fl" type="continuous">
        <origin xyz="0.150000 0.272513 -0.100250" rpy="1.57 0.0 0.0"/>
        <parent link="base_link"/>
        <child link="wheel_link_fl"/>
        <axis xyz="1.0 0.0 0.0"/>
    </joint>

<!--   ***   fork   ***   -->
    <!--   right fork base   -->
    <link name="forkbase_link_r">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertial ixx="0.0" ixy="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.01 0.05 0.1"/>
            </geometry>
            <material name="green">
                <color rgba="0.0 1.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.01 0.05 0.1"/>
            </geometry>
        </collision>
    </link>

    <joint name="forkbase_link_r" type="fixed">
        <origin xyz="0.2675 -0.055 -0.10025" rpy="0.0 0.0 0.0"/>
        <parent link="base_link"/>
        <child link="forkbase_link_r"/>
    </joint>

        <!--   left fork base   -->
    <link name="forkbase_link_l">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertial ixx="0.0" ixy="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.01 0.05 0.1"/>
            </geometry>
            <material name="green">
                <color rgba="0.0 1.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.01 0.05 0.1"/>
            </geometry>
        </collision>
    </link>

    <joint name="forkbase_link_l" type="fixed">
        <origin xyz="0.2675 0.055 -0.10025" rpy="0.0 0.0 0.0"/>
        <parent link="base_link"/>
        <child link="forkbase_link_l"/>
    </joint>

        <!--   right fork   -->
    <link name="fork_link_r">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertial ixx="0.0" ixy="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.25 0.05 0.01"/>
            </geometry>
            <material name="green">
                <color rgba="0.0 1.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.25 0.05 0.01"/>
            </geometry>
        </collision>
    </link>

    <joint name="fork_link_r" type="fixed">
        <origin xyz="0.13 0 -0.045" rpy="0.0 0.0 0.0"/>
        <parent link="forkbase_link_r"/>
        <child link="fork_link_r"/>
    </joint>

            <!--   left fork   -->
    <link name="fork_link_l">
        <inertial>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <mass value="0.0"/>
            <inertial ixx="0.0" ixy="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
        </inertial>
        <visual name="">
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.25 0.05 0.01"/>
            </geometry>
            <material name="green">
                <color rgba="0.0 1.0 0.0 1.0"/>
                <texture filename=""/>
            </material>
        </visual>
        <collision>
            <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
            <geometry>
                <box size="0.25 0.05 0.01"/>
            </geometry>
        </collision>
    </link>

    <joint name="fork_link_l" type="fixed">
        <origin xyz="0.13 0 -0.045" rpy="0.0 0.0 0.0"/>
        <parent link="forkbase_link_l"/>
        <child link="fork_link_l"/>
    </joint>

</robot>

rviz.launch

<?xml version="1.0"?>
<launch>
    <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find forklift)/urdf/forklift.urdf'"/>
    <arg name="rviz_config_file" default="$(find forklift)/config/robot.rviz"/>
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher"/>
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rviz_config_file)"/>       
</launch>

right: vscode Ros:Preview URDF  left: rviz

edit: This is what it showed in the terminal when I roslaunch rviz.launch, it do opened the rviz but only displayed the wheels and axis like the picture above showed

roslaunch forklift rviz.launch
... logging to /home/rvl224/.ros/log/9acf8f50-73c5-11ee-8e9d-450e3298adb9/roslaunch-eervl224-3145248.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: in-order processing became default in ROS Melodic. You can drop the option.
started roslaunch server http://eervl224:41535/

SUMMARY
========

PARAMETERS
 * /robot_description: <?xml version="1....
 * /rosdistro: noetic
 * /rosversion: 1.16.0

NODES
  /
    joint_state_publisher_gui (joint_state_publisher_gui/joint_state_publisher_gui)
    robot_state_publisher (robot_state_publisher/robot_state_publisher)
    rviz (rviz/rviz)

ROS_MASTER_URI=http://localhost:11311

process[robot_state_publisher-1]: started with pid [3145282]
process[joint_state_publisher_gui-2]: started with pid [3145283]
process[rviz-3]: started with pid [3145284]
[ERROR] [1698896444.508930639]: Inertial element must have inertia element
[ERROR] [1698896444.509853268]: Could not parse inertial element for Link [base_link]
[ERROR] [1698896444.510027240]: Inertial element must have inertia element
[ERROR] [1698896444.510039679]: Could not parse inertial element for Link [forkbase_link_r]
[ERROR] [1698896444.510060477]: Inertial element must have inertia element
[ERROR] [1698896444.510071123]: Could not parse inertial element for Link [forkbase_link_l]
[ERROR] [1698896444.510093003]: Inertial element must have inertia element
[ERROR] [1698896444.510104116]: Could not parse inertial element for Link [fork_link_r]
[ERROR] [1698896444.510124657]: Inertial element must have inertia element
[ERROR] [1698896444.510135783]: Could not parse inertial element for Link [fork_link_l]
[ERROR] [1698896445.598512878]: Inertial element must have inertia element
[ERROR] [1698896445.598550758]: Could not parse inertial element for Link [base_link]
[ERROR] [1698896445.598783315]: Inertial element must have inertia element
[ERROR] [1698896445.598800076]: Could not parse inertial element for Link [forkbase_link_r]
[ERROR] [1698896445.598832292]: Inertial element must have inertia element
[ERROR] [1698896445.598845063]: Could not parse inertial element for Link [forkbase_link_l]
[ERROR] [1698896445.598877314]: Inertial element must have inertia element
[ERROR] [1698896445.598891633]: Could not parse inertial element for Link [fork_link_r]
[ERROR] [1698896445.598923755]: Inertial element must have inertia element
[ERROR] [1698896445.598936445]: Could not parse inertial element for Link [fork_link_l]
1

There are 1 answers

0
brian2lee On BEST ANSWER

found what's wrong, in inertial element I misspell inertia as inertial and miss some ixz attribute, for example

<inertial>
    <origin xyz="0.0 0.0 0.0" rpy="0.0 0.0 0.0"/>
    <mass value="0.0"/>
    <!-- original: <inertial ixx="0.0" ixy="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>-->
    <inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0"/>
</inertial>