0
$\begingroup$

Rosanswers logo

Can someone help me determine why Rviz is only showing one link in a urdf file that contains two?

I have a very simple model consisting of a large box representing a torso, and a smaller thinner box representing a leg.

myrobot.urdf.xacro:

<?xml version="1.0"?>
<robot name="myrobot"
    xmlns:xacro="http://www.ros.org/wiki/xacro">
    <!-- Included URDF/XACRO Files -->
    <xacro:include filename="$(find myrobot_description)/urdf/materials.urdf.xacro" />
    <!-- PROPERTY LIST -->
    <!-- Main Body-base -->
    <property name="torso_x_size" value="0.1" />
    <!-- width in cm -->
    <property name="torso_y_size" value="0.2" />
    <!-- length in cm -->
    <property name="torso_z_size" value="0.03" />
    <!-- height in cm -->
    <property name="torso_mass" value="0.920" />
    <!-- in kg -->
    <property name="upper_leg_mass" value="0.010" />
    <!-- in kg -->
    <link name="torso">
        <visual>
            <geometry>
                <box size="${torso_x_size} ${torso_y_size} ${torso_z_size}" />
            </geometry>
            <material name="red"/>
        </visual>
        <xacro:default_inertial mass="${torso_mass}"/>
    </link>
    <xacro:macro name="leg" params="name reflect_x reflect_y">
        <link name="${name}">
            <visual>
                <geometry>
                    <box size="0.003 0.04 0.005" />
                </geometry>
                <origin xyz="0 0.04 0" rpy="0 0 0"/>
                <material name="blue" />
            </visual>
            <collision>
                <geometry>
                    <box size="0.003 0.04 0.005" />
                </geometry>
                <origin xyz="0 0.04 0" rpy="0 0 0"/>
            </collision>
            <xacro:default_inertial mass="${upper_leg_mass}"/>
        </link>
        <joint name="torso_to_${name}" type="fixed">
            <parent link="torso"/>
            <child link="${name}"/>
            <origin xyz="${torso_x_size/2*reflect_x} ${torso_y_size/2*reflect_y} 0" />
        </joint>
    </xacro:macro>
    <xacro:leg name="front_right_leg" reflect_x="1" reflect_y="1" />
</robot>

When I run:

roslaunch urdf_tutorial xacrodisplay.launch model:='$(find myrobot_description)/urdf/myrobot.urdf.xacro'

all I see is the first box, rendered as a flat unshaded white blob. The second box is listed in the "RobotModel" tree in the left-hand panel, but it's not visible anywhere. How do I fix this?


Originally posted by Cerin on ROS Answers with karma: 940 on 2015-04-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This is likely related to RViz reporting no fixed frame.

You might find the RViz user guide helpful. It's a bit dated, but the sections on coordinate frames should still apply.


Originally posted by gvdhoorn with karma: 86574 on 2015-04-27

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Cerin on 2015-04-27:
Yes, I arrived at that other thread from a different direction, but the underlying issue was the same. Once I corrected it to use base_link, Rviz renders it with the correct color and shading.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.