Unit 7 robot arm Xacro joint error

Hi

attached my robot arm xacro. Currently just has base, waist and shoulder joints.
after launching the publisher and rviz I can only see base and waist in white. There should be shoulder joint in grey and the rest in orange.

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="my_robot_arm_joint">
    <xacro:property name="robot_stand_width" value="0.5"/>
    <xacro:property name="robot_stand_lenght" value="0.5"/>
    <xacro:property name="robot_stand_height" value="0.2"/>
    <xacro:property name="waist_height" value="0.1" />
    <xacro:property name="waist_radius" value="0.2" />
    <xacro:property name="arm_joint_width" value="0.2" />
    <xacro:property name="arm_joint_radius" value="0.03" />

    <material name="orange">
        <color rgba="1.0 0.423529411765 0.0392156862745 1.0"/>
    </material>
    <material name="grey">
        <color rgba="0.2 0.2 0.2 1.0"/>
    </material>

    <!-- arm part macro -->
    <xacro:macro name="arm_part" params="arm_part_name parent_name">
        <link name="${arm_part_name}">    
            <visual>
                <origin rpy="0 0 0" xyz="0 0 0"/>
                <geometry>
                <cylinder length="${arm_joint_width}" radius="${arm_joint_radius}"/>
                </geometry>
                <material name="grey" />
            </visual>

            <collision>
                <origin rpy="0 0 0" xyz="0 0 0"/>
                <geometry>
                <cylinder length="${arm_joint_width}" radius="${arm_joint_radius}"/>
                </geometry>
            </collision>

            <inertial>
                <origin rpy="0 0 0" xyz="0 0 0"/>
                <mass value="0.05"/>
                <inertia ixx="1.531666666666667e-05" ixy="0" ixz="0" iyy="1.531666666666667e-05" iyz="0" izz="3.0625000000000006e-05"/>
            </inertial>
        </link>
        <joint name="${arm_part_name}-joint" type="continuous">
            <parent link="${parent_name}" />
            <child link="${arm_part_name}" />
            <origin xyz="0 0 0.1" rpy="0 -1.5708 0" />
        </joint>
    </xacro:macro>
    <!-- init end   -->

    <link name="world" />
    <joint name="world_to_root" type="fixed">
        <parent link="world" />
        <child link="robot_stand" />
        <origin xyz="0 0 0.1" rpy="0 0 0" />    
    </joint> 
 
    <link name="robot_stand">
        <visual>
            <geometry>
                <box size="${robot_stand_width} ${robot_stand_lenght} ${robot_stand_height}"/>
            </geometry>
            <material name="orange"/>
        </visual>
        <collision>
            <geometry>
                <box size="${robot_stand_width} ${robot_stand_lenght} ${robot_stand_height}"/>
            </geometry>
        </collision>

        <inertial>
            <mass value="1.0"/>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <inertia ixx="0.0008333333333333335" ixy="0" ixz="0" iyy="0.0008333333333333335" iyz="0" izz="0.0008333333333333335"/>
        </inertial>
    </link>

    <!-- waist -->
    <link name="robot_waist">    
        <visual>
            <origin rpy="0 0 0" xyz="0 0 ${robot_stand_height}"/>
            <geometry>
            <cylinder length="${waist_height}" radius="${waist_radius}"/>
            </geometry>
            <material name="orange"/>
        </visual>

        <collision>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <geometry>
            <cylinder length="${waist_height}" radius="${waist_radius}"/>
            </geometry>
        </collision>

        <inertial>
            <origin rpy="0 0 0" xyz="0 0 0"/>
            <mass value="0.05"/>
            <inertia ixx="1.531666666666667e-05" ixy="0" ixz="0" iyy="1.531666666666667e-05" iyz="0" izz="3.0625000000000006e-05"/>
        </inertial>
    </link>

    <joint name="stand_to_waist" type="continuous">
        <parent link="robot_stand" />
        <child link="robot_waist" />
        <origin xyz="0 0 0" rpy="0 0 0" />    
    </joint> 

    <!-- arm joints   -->
    <xacro:arm_part arm_part_name="shoulder" parent_name="robot_waist" />

</robot>

Any hint why the shoulder is missing and parts are white ?

Regards,
Volker

Hi Volker,
I think that the only problem you have there is in the Rviz configuration, but your URDF looks correct. This means, you have a visualization problem, not an URDF problem.

The problem in Rviz is that you have set the Fixed frame to /map, but you should set it to the base link of your robot (in your case, it should be /world.

Let me know if it works

Hi @rtellez ,

thanks a lot. That did work for the robot_stand part. Still there are two errors shown.

robot_waist
No transform from [robot_waist] to [world]
shoulder
No transform from [shoulder] to [world]

Is there also a setting for the transform of these parts ?

Regards

Hello @vkuehn,

I think you may be missing the robot_state_publisher node. Could you please run this command and see if you see that node is in the list?

ros2 node list

This will show you the names of all running nodes.

Cheers,

Roberto

Hello @rzegers

shows

/my_robot_state_publisher_node
/rviz_node

and rviz looks like that.

so only partialy the color ist updated

Cheers,
Volker

Hello @vkuehn,

ok, so robot_state_publisher is there, and I assume that you have configured the topic correctly in Rviz. My next suggestion is to add a joint_state_publisher node.

In a ROS2 python launch file you can add it by creating a Node object like this and then include this object in the list of arguments that you pass in to the LaunchDescription function:

   joint_state_publisher_node = Node(
        package='joint_state_publisher',
        executable='joint_state_publisher',
        name='joint_state_publisher'
    )

....

   return LaunchDescription([
        ....
        ....
        joint_state_publisher_node,
        robot_state_publisher_node,
        ......
        ......
    ])

Compile your workspace, start everything again and see if that works.

Cheers,

Roberto

Hello @rzegers ,

yeah that did the trick for the colors. Thanks for that.

If you don’t mind “one last thing”. According to the xacro the shoulder part should be attached to the waist not the base. The visualization looks differently
orange
if you kindly can comment on that ?

Cheers,
Volker

Hello @vkuehn,

The image appears to show that the shoulder is connected to the base, but it is not necessarily the case. To confirm the correct linkages, you can refer to the tf tree by running rqt_tf_tree. This will display the hierarchy of links, and if the waist is the parent to the shoulder, then the parent-children linkages are correct. If in Rviz the shoulder appears below the waist, it could be due to an offset in the joint or an incorrect sign direction. Adjust the link and origin values, save the file, and reopen the robot model in Rviz to see the impact of the changes. Through a process of trial and error, you can determine which changes affect each link and in which direction.

This is how you run rqt_tf_tree:

ros2 run rqt_tf_tree rqt_tf_tree

Hope this helps,

Roberto

Hello @rzegers ,

thanks for the command
the arm hierachy looks ok
arm_hirachy

to make this not an endless question and answer thing, is there a solution I could look at ?
I guess it will be the origin setting at the end.

Cheers,
Volker

Hello @vkuehn,

yes, those parent-children linkages look correct. So the fact that Rviz is showing you that image is because of how you have defined the different origins, rotations and offsets.
At the moment there is no project solution available. Please post here at the forum any doubts if you get stuck again.

Cheers,

Roberto

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

Hi,

We now have solutions for this project: SOLUTIONS FOR PROJECT

2 Likes