Robotics StackExchange | Archived questions

what should be the fixed frame? if we select our base link of our robot then we get a werid output

we wrote the URDF and lauch file to visualize the robot in rviz but if we select our base link(or any link) we get weird output as below:

image description

before selecting fixed frame our model is fine as shown below:

image description

our URDF is:

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

 <link name="z_axis">
    <visual>
        <geometry>
            <box size="0.2 0.2 6.5"/>

        </geometry>
        <origin rpy="0 0 0" xyz="0.25 0 7"/>
        <material name="green">
            <color rgba="1 0 0 1"/>

        </material>
    </visual>
    <collision>
        <geometry>
                <box size="0.2 0.2 6.5"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0.25 0 7"/> 
    </collision> 
 </link>

 <link name="cross_slide">
    <visual>
        <geometry>
            <box size="0.05 1.7 1.5"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0.125 0 8"/>
        <material name="green">
            <color rgba="1 0 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="0.05 1.7 1.5"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0.125 0 8"/>
    </collision> 
 </link>

 <joint name="z_axis_to_cross_slide" type="prismatic">
    <parent link="z_axis"/>
    <child link="cross_slide"/>
    <limit effort="1000.0" lower="-0.38" upper="0" velocity="0.5"/> <!--specify exact values -->
    <origin xyz="-0.127 8 3.9"/>
    <axis xyz="0 0 1"/>
 </joint>

 <link name="beam">
    <visual>
        <geometry>
            <box size="0.2 8.5 0.6"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 0 8"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="0.2 8.5 0.6"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 0 8"/>
    </collision> 
 </link>

 <joint name="cross_slide_to_beam" type="prismatic">
    <parent link="cross_slide"/>
    <child link="beam"/>
    <limit effort="1000.0" lower="-0.38" upper="0" velocity="0.5"/> <!--specify exact values -->
    <origin xyz="-0.125 8 3.9"/>
    <axis xyz="0 0 1"/>
 </joint>

 <link name="beam_bracket_1">
    <visual>
        <geometry>
            <box size="0.25 0.5 0.7"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 3.9 8"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="0.25 0.5 0.7"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 3.9 8"/>
    </collision> 
 </link>

 <link name="beam_bracket_2">
    <visual>
        <geometry>
            <box size="0.25 0.5 0.7"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 -3.9 8"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="0.25 0.5 0.7"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 -3.9 8"/>
    </collision> 
 </link>

 <joint name="beam_to_beam_bracket_1" type="fixed">
    <parent link="beam"/>
    <child link="beam_bracket_1"/>
    <origin xyz="0.10 8 -3.9"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="beam_to_beam_bracket_2" type="fixed">
    <parent link="beam"/>
    <child link="beam_bracket_2"/>
    <origin xyz="0.10 8 3.9"/>
    <axis xyz="0 0 0"/>
 </joint>

 <link name="beam_bracket_plate_1">
    <visual>
        <geometry>
            <box size="3.75 0.7 0.05"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 3.9 7.625"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="3.75 0.7 0.05"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 3.9 7.625"/>
    </collision> 
 </link>

 <link name="beam_bracket_plate_2">
    <visual>
        <geometry>
            <box size="3.75 0.7 0.05"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 -3.9 7.625"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="3.75 0.7 0.05"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 -3.9 7.625"/>
    </collision> 
 </link>

 <joint name="beam_bracket_1_to_plate_1" type="fixed">
    <parent link="beam_bracket_1"/>
    <child link="beam_bracket_plate_1"/>
    <origin xyz="0 7.625 -3.9"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="beam_bracket_2_to_plate_2" type="fixed">
    <parent link="beam_bracket_2"/>
    <child link="beam_bracket_plate_2"/>
    <origin xyz="0 7.625 3.9"/>
    <axis xyz="0 0 0"/>
 </joint>

 <link name="column_1">
    <visual>
        <geometry>
            <cylinder length="6.85" radius="0.10"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 3.9 4.175"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="6.85" radius="0.10"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 3.9 4.175"/>
    </collision> 
 </link>

 <link name="column_2">
    <visual>
        <geometry>
            <cylinder length="6.85" radius="0.10"/>
        </geometry>
        <origin rpy="0 0 0" xyz="-1.50 3.9 4.175"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="6.85" radius="0.10"/>
        </geometry>
            <origin rpy="0 0 0" xyz="-1.50 3.9 4.175"/>
    </collision>  
 </link>

 <link name="column_3">
    <visual>
        <geometry>
            <cylinder length="6.85" radius="0.10"/>
        </geometry>
        <origin rpy="0 0 0" xyz="1.50 3.9 4.175"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="6.85" radius="0.10"/>
        </geometry>
            <origin rpy="0 0 0" xyz="1.50 3.9 4.175"/>
    </collision> 
 </link>

 <link name="column_4">
    <visual>
        <geometry>
            <cylinder length="6.85" radius="0.10"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 -3.9 4.175"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="6.85" radius="0.10"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 -3.9 4.175"/>
    </collision> 
 </link>

 <link name="column_5">
    <visual>
        <geometry>
            <cylinder length="6.85" radius="0.10"/>
        </geometry>
        <origin rpy="0 0 0" xyz="-1.5 -3.9 4.175"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="6.85" radius="0.10"/>
        </geometry>
            <origin rpy="0 0 0" xyz="-1.5 -3.9 4.175"/>
    </collision> 
 </link>

 <link name="column_6">
    <visual>
        <geometry>
            <cylinder length="6.85" radius="0.10"/>
        </geometry>
        <origin rpy="0 0 0" xyz="1.5 -3.9 4.175"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="6.85" radius="0.10"/>
        </geometry>
            <origin rpy="0 0 0" xyz="1.5 -3.9 4.175"/>
    </collision> 
 </link>

 <joint name="plate_1_to_column_1" type="fixed">
    <parent link="beam_bracket_plate_1"/>
    <child link="column_1"/>
    <origin xyz="0 8.95 0"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="plate_1_to_column_2" type="fixed">
    <parent link="beam_bracket_plate_1"/>
    <child link="column_2"/>
    <origin xyz="1.5 8.95 0"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="plate_1_to_column_3" type="fixed">
    <parent link="beam_bracket_plate_1"/>
    <child link="column_3"/>
    <origin xyz="-1.5 8.95 0"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="plate_2_to_column_4" type="fixed">
    <parent link="beam_bracket_plate_2"/>
    <child link="column_4"/>
    <origin xyz="0 8.95 7.623"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="plate_2_to_column_5" type="fixed">
    <parent link="beam_bracket_plate_2"/>
    <child link="column_5"/>
    <origin xyz="1.5 8.95 7.623"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="plate_2_to_column_6" type="fixed">
    <parent link="beam_bracket_plate_2"/>
    <child link="column_6"/>
    <origin xyz="-1.5 8.95 7.623"/>
    <axis xyz="0 0 0"/>
 </joint>

 <link name="base_1">
    <visual>
        <geometry>
            <box size="1.25 0.50 0.50"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 3.9 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="1.25 0.50 0.50"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 3.9 0.50"/>
    </collision> 
 </link>

 <link name="base_2">
    <visual>
        <geometry>
            <box size="1.25 0.50 0.50"/>
        </geometry>
        <origin rpy="0 0 0" xyz="-1.5 3.9 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="1.25 0.50 0.50"/>
        </geometry>
            <origin rpy="0 0 0" xyz="-1.5 3.9 0.50"/>
    </collision>
 </link>

 <link name="base_3">
    <visual>
        <geometry>
            <box size="1.25 0.50 0.50"/>
        </geometry>
        <origin rpy="0 0 0" xyz="1.5 3.9 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="1.25 0.50 0.50"/>
        </geometry>
            <origin rpy="0 0 0" xyz="1.5 3.9 0.50"/>
    </collision> 
 </link>

 <link name="base_4">
    <visual>
        <geometry>
            <box size="1.25 0.50 0.50"/>
        </geometry>
        <origin rpy="0 0 0" xyz="0 -3.9 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="1.25 0.50 0.50"/>
        </geometry>
            <origin rpy="0 0 0" xyz="0 -3.9 0.50"/>
    </collision> 
 </link>

 <link name="base_5">
    <visual>
        <geometry>
            <box size="1.25 0.50 0.50"/>
        </geometry>
        <origin rpy="0 0 0" xyz="-1.5 -3.9 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="1.25 0.50 0.50"/>
        </geometry>
            <origin rpy="0 0 0" xyz="-1.5 -3.9 0.50"/>
    </collision> 
 </link>

<link name="base_6">
    <visual>
        <geometry>
            <box size="1.25 0.50 0.50"/>
        </geometry>
        <origin rpy="0 0 0" xyz="1.5 -3.9 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <box size="1.25 0.50 0.50"/>
        </geometry>
            <origin rpy="0 0 0" xyz="1.5 -3.9 0.50"/>
    </collision> 
 </link>

 <joint name="column_1_to_base_1" type="fixed">
    <parent link="column_1"/>
    <child link="base_1"/>
    <origin xyz="0 1.5 0"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="column_2_to_base_2" type="fixed">
    <parent link="column_2"/>
    <child link="base_2"/>
    <origin xyz="1.5 1.5 0"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="column_3_to_base_3" type="fixed">
    <parent link="column_3"/>
    <child link="base_3"/>
    <origin xyz="-1.5 1.5 0"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="column_4_to_base_4" type="fixed">
    <parent link="column_4"/>
    <child link="base_4"/>
    <origin xyz="0 1.5 7.623"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="column_5_to_base_5" type="fixed">
    <parent link="column_5"/>
    <child link="base_5"/>
    <origin xyz="1.5 1.5 7.623"/>
    <axis xyz="0 0 0"/>
 </joint>

 <joint name="column_6_to_base_6" type="fixed">
    <parent link="column_6"/>
    <child link="base_6"/>
    <origin xyz="-1.5 1.5 7.623"/>
    <axis xyz="0 0 0"/>
 </joint>

 <link name="left_wheel_1">
    <visual>
        <geometry>
            <cylinder length="0.25" radius="0.50"/>
        </geometry>
        <origin rpy="0 1.5707 1.5707" xyz="0 4.2755 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="0.25" radius="0.50"/>
        </geometry>
            <origin rpy="0 1.5707 1.5707" xyz="0 4.2755 0.50"/>
    </collision> 
 </link>

 <link name="left_wheel_2">
    <visual>
        <geometry>
            <cylinder length="0.25" radius="0.50"/>
        </geometry> 
        <origin rpy="0 1.5707 1.5707" xyz="-1.5 4.2755 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="0.25" radius="0.50"/>
        </geometry>
            <origin rpy="0 1.5707 1.5707" xyz="1.5 4.2755 0.50"/>
    </collision> 
 </link>

 <link name="left_wheel_3">
    <visual>
        <geometry>
            <cylinder length="0.25" radius="0.50"/>
        </geometry> 
        <origin rpy="0 1.5707 1.5707" xyz="1.5 4.2755 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="0.25" radius="0.50"/>
        </geometry>
            <origin rpy="0 1.5707 1.5707" xyz="1.5 4.2755 0.50"/>
    </collision> 
 </link>

 <joint name="left_wheel_1_to_base_1" type="continuous">
    <parent link="base_1"/>
    <child link="left_wheel_1"/>
    <origin xyz="0 0.5 -4.2755"/>
    <axis xyz="0 1 0"/>
 </joint>

 <joint name="left_wheel_2_to_base_2" type="continuous">
    <parent link="base_2"/>
    <child link="left_wheel_2"/>
    <origin xyz="-1.5 0.50 -4.2755"/>
    <axis xyz="0 1 0"/>
 </joint>

 <joint name="left_wheel_3_to_base_3" type="continuous">
    <parent link="base_3"/>
    <child link="left_wheel_3"/>
    <origin xyz="1.5 0.5 -4.2755"/>
    <axis xyz="0 1 0"/>
 </joint>

 <joint name="right_wheel_1_to_base_4" type="continuous">
    <parent link="base_4"/>
    <child link="right_wheel_1"/>
    <origin xyz="0 0.50 4.2755"/>
    <axis xyz="0 1 0"/>
 </joint>

 <joint name="right_wheel_2_to_base_5" type="continuous">
    <parent link="base_5"/>
    <child link="right_wheel_2"/>
    <origin xyz="-1.5 0.50 4.2755"/>
    <axis xyz="0 1 0"/>
 </joint>

 <joint name="right_wheel_3_to_base_6" type="continuous">
    <parent link="base_6"/>
    <child link="right_wheel_3"/>
    <origin xyz="1.5 0.50 4.2755"/>
    <axis xyz="0 1 0"/>
 </joint>

 <link name="right_wheel_1">
    <visual>
        <geometry>
            <cylinder length="0.25" radius="0.50"/>
        </geometry> 
        <origin rpy="0 1.5707 1.5707" xyz="0 -4.2755 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="0.25" radius="0.50"/>
        </geometry>
            <origin rpy="0 1.5707 1.5707" xyz="0 -4.2755 0.50"/>
    </collision> 
 </link>

 <link name="right_wheel_2">
    <visual>
        <geometry>
            <cylinder length="0.25" radius="0.50"/>
        </geometry> 
        <origin rpy="0 1.5707 1.5707" xyz="-1.5 -4.2755 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="0.25" radius="0.50"/>
        </geometry>
            <origin rpy="0 1.5707 1.5707" xyz="-1.5 -4.2755 0.50"/>
    </collision> 
 </link>

 <link name="right_wheel_3">
    <visual>
        <geometry>
            <cylinder length="0.25" radius="0.50"/>
        </geometry> 
        <origin rpy="0 1.5707 1.5707" xyz="1.5 -4.2755 0.50"/>
        <material name="yellow">
            <color rgba="1 1 0 1"/>
        </material>
    </visual>
    <collision>
        <geometry>
                <cylinder length="0.25" radius="0.50"/>
        </geometry>
            <origin rpy="0 1.5707 1.5707" xyz="1.5 -4.2755 0.50"/>
    </collision> 
 </link>
</robot>

image description

our launch file is:

<launch>
    <arg name="model" />
    <!-- Parsing xacro and setting robot_description parameter -->
    <param name="robot_description" textfile="$(find chambot_description_pkg)/urdf/cham_bot.urdf" />

    <!-- Setting gui parameter to true for display joint slider -->
    <param name="use_gui" value="true"/>
    <!-- Starting Joint state publisher node which will publish the joint values -->
    <node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
    <!-- Starting robot state publish which will publish tf -->
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
    <!-- Launch visualization in rviz -->
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(find mastering_ros_robot_description_pkg)/urdf.rviz" required="true" />
</launch>

Asked by ajayguhan on 2017-03-17 01:20:00 UTC

Comments

I'm not sure, but could it be that you have all your origins relative to a shared 'world origin'? In URDF, origins are relative to the parent frame in which they are defined. Might be something to check.

Asked by gvdhoorn on 2017-03-17 05:18:06 UTC

Each link has an associated tf frame, so adding a TF view in rviz will show you if your TF frames are in the right place and the models are mis-aligned with respect to those frames, or if the models are aligned correctly and the TF frames are in the wrong places.

Asked by ahendrix on 2017-03-17 11:53:55 UTC

Answers