Robotics StackExchange | Archived questions

How can I visualize TF of the urdf model on rviz

i have created an urdf model and want to visualize it on rviz but i cannot see the TF

myrobot.launch

<launch>
    <param name="mybot_descriptions" textfile="$(find mybot_descriptions)/ src / urdf/ myrobot.urdf"/>
    <node name="rviz" pkg="rviz" type="rviz" required="true"/>
</launch>

myrobot.urdf

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

    <link name="base_footprint"/>

    <joint name="base_footprint_joint" type="fixed">
        <parent link="base_footprint"/>
        <child link="base_link"/>
        <origin xyz="0 0 0.010" rpy="0 0 0"/>
    </joint>

    <link name="base_link">
        <visual>
            <origin xyz="-0.064 0 0.0" rpy="0 0 0"/>
            <geometry>
                <mesh filename="package://mybot_descriptions/src/meshes/bases/CARRIER_ASM.STL"
                      scale="0.001 0.001 0.001"/>
            </geometry>
            <material name="light_black"/>
        </visual>
        <collision>
            <origin xyz="-0.064 0 0.047" rpy="0 0 0"/>
            <geometry>
                <box size="0.266 0.266 0.094"/>
            </geometry>
        </collision>

        <inertial>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <mass value="1.3729096e+00"/>
            <inertia ixx="8.7002718e-03" ixy="-4.7576583e-05" ixz="1.1160499e-04"
                     iyy="8.6195418e-03" iyz="-3.5422299e-06"
                     izz="1.4612727e-02"/>
        </inertial>
    </link>

    <!--joint bwtween base_link and back left wheel-->

    <joint name="back_left_whell_joint" type="continuous">
        <parent link="base_link"/>
        <child link="back_left_wheel_link"/>
        <origin xyz="0.0 0.144 0.023" rpy="-1.57 0 0"/>
        <axis xyz="0 0 1"/>
    </joint>


    <link name="back_left_wheel_link">
        <visual>
            <origin xyz="0 0 0" rpy="-1.57 0 0"/>
            <geometry>
                <mesh filename="package://mybot_descriptions/src/meshes/wheels/Big_Wheel.stl"
                      scale="0.001 0.001 0.001"/>
            </geometry>
            <material name="dark"/>
        </visual>
    </link>

    <!---joint bwtween base_link and back right wheel--->

    <joint name="back_right_wheel_joint" type="continuous">
        <parent link="base_link"/>
        <child link="back_right_wheel_link"/>
    </joint>
    <link name="back_right_wheel_link">
        <visual>
            <origin xyz="0 0 0" rpy="-1.57 0 0"/>
            <geometry>
                <mesh filename="package://mybot_descriptions/src/meshes/wheels/Big_Wheel.stl"
                      scale="0.001 0.001 0.001"/>
            </geometry>
            <material name="dark"/>
        </visual>

        <collision>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <cylinder length="0.018" radius="0.033"/>
            </geometry>
        </collision>

        <inertial>
            <origin xyz="0 0 0"/>
            <mass value="2.8498940e-02"/>
            <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
                     iyy="1.1192413e-05" iyz="-1.4400107e-11"
                     izz="2.0712558e-05"/>
        </inertial>
    </link>


    <!---joint bwtween base_link and front right wheel--->

    <joint name="front_left_wheel_joint" type="continuous">
        <parent link="base_link"/>
        <child link="front_left_wheel_link"/>
    </joint>
    <link name="front_left_wheel_link">
        <visual>
            <origin xyz="0 0 0" rpy="1.57 0 0"/>
            <geometry>
                <mesh filename="package://mybot_descriptions/src/meshes/wheels/Big_Wheel.stl"
                      scale="0.001 0.001 0.001"/>
            </geometry>
            <material name="dark"/>
        </visual>
    </link>

    <joint name="front_right_wheel_joint" type="continuous">
        <parent link="base_link"/>
        <child link="front_right_wheel_link"/>
    </joint>
    <link name="front_right_wheel_link">
        <visual>
            <origin xyz="0 0 0" rpy="1.57 0 0"/>
            <geometry>
                <mesh filename="package://mybot_descriptions/src/meshes/wheels/Big_Wheel.stl"
                      scale="0.001 0.001 0.001"/>
            </geometry>
            <material name="dark"/>
        </visual>

        <collision>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <cylinder length="0.018" radius="0.033"/>
            </geometry>
        </collision>

        <inertial>
            <origin xyz="0 0 0"/>
            <mass value="2.8498940e-02"/>
            <inertia ixx="1.1175580e-05" ixy="-4.2369783e-11" ixz="-5.9381719e-09"
                     iyy="1.1192413e-05" iyz="-1.4400107e-11"
                     izz="2.0712558e-05"/>
        </inertial>
    </link>


    <joint name="camera_joint" type="fixed">
        <parent link="base_link"/>
        <child link="camera_link"/>
        <origin xyz="0.1814 0 0.1414"/>
    </joint>
    <link name="camera_link">
    </link>


    <!---joint bwtween base_link and imu_link--->

    <joint name="imu_joint" type="fixed">
        <parent link="base_link"/>
        <child link="imu_link"/>
        <origin xyz="0.0 0 0.068" rpy="0 0 0"/>
    </joint>

    <link name="imu_link"/>

    <!---joint bwtween base_link and lidar_link--->
    <joint name="lidar_joint" type="fixed">
        <parent link="base_link"/>
        <child link="lidar_link"/>
        <origin xyz="0.1814 0 0.1414"/>
    </joint>
    <link name="lidar_link">
        <visual>
            <origin xyz="0 0 0" rpy="0 0 0"/>
            <geometry>
                <mesh filename="package://tmybot_descriptions/src/meshes/wheels/lds.stl" scale="0.001 0.001 0.001"/>
            </geometry>
            <material name="dark"/>
        </visual>

        <collision>
            <origin xyz="0.015 0 -0.0065" rpy="0 0 0"/>
            <geometry>
                <cylinder length="0.0315" radius="0.055"/>
            </geometry>
        </collision>

        <inertial>
            <mass value="0.114"/>
            <origin xyz="0 0 0"/>
            <inertia ixx="0.001" ixy="0.0" ixz="0.0"
                     iyy="0.001" iyz="0.0"
                     izz="0.001"/>
        </inertial>
    </link>

</robot>

Asked by dhaour9x on 2019-12-03 08:17:14 UTC

Comments

Answers

That's because you're not publishing any TF. If you want just static TF publishing from the model, have a look at the tutorial on robot_state_publisher here. For the joints use joint_state_publisher described here.

Asked by l4ncelot on 2019-12-03 08:53:51 UTC

Comments

That didn't work. if i set all joint types to fixed, i can see TF on rviz, and if i add the robot model to rviz then rviz crashes.

Asked by dhaour9x on 2019-12-04 08:19:14 UTC

@dhaour9x, that's weird... have you tried to display the model in Gazebo?

Asked by l4ncelot on 2019-12-04 08:58:52 UTC

no, only on rviz and it always shows this ERROR

[ERROR] [1575469128.227399807]: Could not load model 'package://mybot_descriptions/src/meshes/bases/base.dae' for link 'base_link': OGRE EXCEPTION(7:InternalErrorException): Vertex Buffer: Out of memory in GLHardwareVertexBuffer::lock at /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/OgreGLHardwareVertexBuffer.cpp (line 124) ================================================================================REQUIRED process [rviz-3] has died! process has died [pid 10195, exit code -11, cmd /opt/ros/kinetic/lib/rviz/rviz -d /home/fsd/turtlebot_ws/src/mybot_descriptions/src/urdf.rviz __name:=rviz __log:=/home/fsd/.ros/log/56502750-15ef-11ea-9ce9-000c29ac3d84/rviz-3.log]. log file: /home/fsd/.ros/log/56502750-15ef-11ea-9ce9-000c29ac3d84/rviz-3*.log Initiating shutdown!

Asked by dhaour9x on 2019-12-04 09:19:29 UTC

@dhaour9x try to display the model in Gazebo. Maybe you have some error in the model which needs to be fixed.

Asked by l4ncelot on 2019-12-04 11:49:00 UTC

But this is unrelated to the original problem you had imo.

Asked by l4ncelot on 2019-12-04 11:51:57 UTC

@dhaour9x All tfs generated by the robot_state_publisher of type fixed are static and hence published only once at the start of the execution since the KDL does not have to compute anything. Thus, they are not published at the rate passed to the node.

I am not 100% sure but you can either use one additional joint not fixed or listen to tf_static.

Asked by Weasfas on 2019-12-11 12:01:04 UTC