Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The joints cannot rotate in Rviz

I use .xacro file as the model of the robot, and show it in Rviz.

Part of the .xacro file is as follows.

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

<link name="Base">
    <inertial>
        <origin xyz="0.010476 0.000747 0.035226" rpy="0 0 0"/>
        <mass value="1.886"/>
        <inertia ixx="0.001196219" ixy="-0.000029358" ixz="0.000014859" 
                 iyy="0.001147997" iyz="0.000016274"  izz="0.001425617"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Base.STL"/>
        </geometry>
        <origin xyz = "0 0 0 " rpy = "0 0 0"/>
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<link name="Link1">
    <inertial>
        <origin xyz="-0.002175 0 0.029097" rpy="0 0 0"/>
        <mass value="0.2141"/>
        <inertia ixx="0.000496945" ixy="-0.000000082" ixz="-0.000002744" 
                 iyy="0.000150389" iyz="-0.000000002" izz="0.000522487"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link1.STL"/>
        </geometry>
        <origin xyz = "0 0 -0.0723" rpy = "0 0 0" />
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint1" type="revolute">
    <axis xyz="0 0 1"/>
    <limit effort = "1000.0" lower = "-3" upper = "3" velocity = "0" />
    <parent link="Base"/>
    <child link="Link1"/>
    <origin xyz= "0 0 0.0723" rpy = " 0 0 0" />
</joint>


<link name="Link2">
    <inertial>
        <origin xyz="-0.001071 0.001101 0.053193" rpy="0 0 0"/>
        <mass value="0.026"/>
        <inertia ixx="0.000061744" ixy="-0.000000025" ixz="-0.000000763" 
                 iyy="0.000062096" iyz="-0.000001053" izz="0.000002942"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link2.STL"/>
        </geometry>
        <origin xyz = "-0.0132 0 -0.1056" rpy = "0 0 0" />
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint2" type="revolute">
    <axis xyz="0 1 0"/>
    <limit effort = "1000.0" lower = "-3" upper = "3" velocity = "0" />
    <parent link="Link1"/>
    <child link="Link2"/>
    <origin xyz= "0.0132 0 0.0333" rpy = " 0 0 0" />
</joint>


<link name="Link3">
    <inertial>
        <origin xyz="0.101948 -0.00022 0.011917" rpy="0 0 0"/>
        <mass value="0.023"/>
        <inertia ixx="0.000001982" ixy="0.000000483" ixz="-0.000005373" 
                 iyy="0.000081264" iyz="0.000000008" izz="0.000080538"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link3.STL"/>
        </geometry>
        <origin xyz="-0.0132 0 -0.24767"/>
        <material name="">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint3" type="revolute">
    <axis xyz="0 1 0"/>
    <parent link="Link2" />
    <child link="Link3" />
    <limit effort="1000" lower="-1.45" upper="1.45" velocity="0"/>
    <origin xyz="0 0 0.14207 " rpy="0 0 0"/>
</joint>

<link name="Link4">
    <inertial>
        <origin xyz="-0.00235 0.013618 0.015458" rpy="0 0 0"/>
        <mass value="0.003"/>
        <inertia ixx="0.000000316" ixy="0.000000001"  ixz="0.000000177" 
                 iyy="0.000001679" iyz="-0.000000007" izz="0.000001378"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link4.STL"/>
        </geometry>
        <origin xyz = "-0.0132 0 -0.24767" rpy = "0 0 0" />
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint4" type="revolute">
    <axis xyz="0 1 0"/>
    <limit effort = "1000.0" lower = "-3" upper = "3" velocity = "0" />
    <parent link="Link2"/>
    <child link="Link4"/>
    <origin xyz= "0 0 0.14207" rpy = " 0 0 0" />
</joint>

</robot>

The launch file is as follows.

<launch>
    <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find robot)/urdf/robot.xacro'"/>

    <!-- Combine joint values-->
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>

    <!-- Show in Rviz -->
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find robot)/launch/config.rviz"/>

    <!-- Send joint values -->
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
        <param name="use_gui" value="True"/>
    </node>
</launch>

When I change the joint_state_publisher pedal, the robot just stays static. How can I make them rotate? Thanks!

The joints cannot rotate in Rviz

I use .xacro file as the model of the robot, and show it in Rviz.

Part of the .xacro file is as follows.

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

<link name="Base">
    <inertial>
        <origin xyz="0.010476 0.000747 0.035226" rpy="0 0 0"/>
        <mass value="1.886"/>
        <inertia ixx="0.001196219" ixy="-0.000029358" ixz="0.000014859" 
                 iyy="0.001147997" iyz="0.000016274"  izz="0.001425617"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Base.STL"/>
        </geometry>
        <origin xyz = "0 0 0 " rpy = "0 0 0"/>
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<link name="Link1">
    <inertial>
        <origin xyz="-0.002175 0 0.029097" rpy="0 0 0"/>
        <mass value="0.2141"/>
        <inertia ixx="0.000496945" ixy="-0.000000082" ixz="-0.000002744" 
                 iyy="0.000150389" iyz="-0.000000002" izz="0.000522487"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link1.STL"/>
        </geometry>
        <origin xyz = "0 0 -0.0723" rpy = "0 0 0" />
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint1" type="revolute">
    <axis xyz="0 0 1"/>
    <limit effort = "1000.0" lower = "-3" upper = "3" velocity = "0" />
    <parent link="Base"/>
    <child link="Link1"/>
    <origin xyz= "0 0 0.0723" rpy = " 0 0 0" />
</joint>


<link name="Link2">
    <inertial>
        <origin xyz="-0.001071 0.001101 0.053193" rpy="0 0 0"/>
        <mass value="0.026"/>
        <inertia ixx="0.000061744" ixy="-0.000000025" ixz="-0.000000763" 
                 iyy="0.000062096" iyz="-0.000001053" izz="0.000002942"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link2.STL"/>
        </geometry>
        <origin xyz = "-0.0132 0 -0.1056" rpy = "0 0 0" />
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint2" type="revolute">
    <axis xyz="0 1 0"/>
    <limit effort = "1000.0" lower = "-3" upper = "3" velocity = "0" />
    <parent link="Link1"/>
    <child link="Link2"/>
    <origin xyz= "0.0132 0 0.0333" rpy = " 0 0 0" />
</joint>


<link name="Link3">
    <inertial>
        <origin xyz="0.101948 -0.00022 0.011917" rpy="0 0 0"/>
        <mass value="0.023"/>
        <inertia ixx="0.000001982" ixy="0.000000483" ixz="-0.000005373" 
                 iyy="0.000081264" iyz="0.000000008" izz="0.000080538"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link3.STL"/>
        </geometry>
        <origin xyz="-0.0132 0 -0.24767"/>
        <material name="">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint3" type="revolute">
    <axis xyz="0 1 0"/>
    <parent link="Link2" />
    <child link="Link3" />
    <limit effort="1000" lower="-1.45" upper="1.45" velocity="0"/>
    <origin xyz="0 0 0.14207 " rpy="0 0 0"/>
</joint>

<link name="Link4">
    <inertial>
        <origin xyz="-0.00235 0.013618 0.015458" rpy="0 0 0"/>
        <mass value="0.003"/>
        <inertia ixx="0.000000316" ixy="0.000000001"  ixz="0.000000177" 
                 iyy="0.000001679" iyz="-0.000000007" izz="0.000001378"/>
    </inertial>
    <visual>
        <geometry>
            <mesh filename="package://robot/urdf/links/Link4.STL"/>
        </geometry>
        <origin xyz = "-0.0132 0 -0.24767" rpy = "0 0 0" />
        <material name = "">
            <color rgba = "0.3 0.3 0.3 1" />
        </material>
    </visual>
</link>

<joint name="Joint4" type="revolute">
    <axis xyz="0 1 0"/>
    <limit effort = "1000.0" lower = "-3" upper = "3" velocity = "0" />
    <parent link="Link2"/>
    <child link="Link4"/>
    <origin xyz= "0 0 0.14207" rpy = " 0 0 0" />
</joint>

</robot>

The launch file is as follows.

<launch>
    <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find robot)/urdf/robot.xacro'"/>

    <!-- Combine joint values-->
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher"/>

    <!-- Show in Rviz -->
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find robot)/launch/config.rviz"/>

    <!-- Send joint values -->
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
        <param name="use_gui" value="True"/>
    </node>
</launch>

When I change the joint_state_publisher pedal, the robot just stays static. How can I make them rotate? Thanks!