Ask Your Question
0

How can I visualize TF of the urdf model on rviz

asked 2019-12-03 07:17:14 -0600

dhaour9x gravatar image

updated 2019-12-04 08:03:38 -0600

l4ncelot gravatar image

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 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-12-03 07:53:51 -0600

l4ncelot gravatar image

updated 2019-12-03 08:22:32 -0600

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.

edit flag offensive delete link more

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.

dhaour9x gravatar imagedhaour9x ( 2019-12-04 07:19:14 -0600 )edit

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

l4ncelot gravatar imagel4ncelot ( 2019-12-04 07:58:52 -0600 )edit

no, only on rviz and it always shows this ERROR

================================================================================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!

dhaour9x gravatar imagedhaour9x ( 2019-12-04 08:19:29 -0600 )edit

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

l4ncelot gravatar imagel4ncelot ( 2019-12-04 10:49:00 -0600 )edit

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

l4ncelot gravatar imagel4ncelot ( 2019-12-04 10:51:57 -0600 )edit

@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.

Weasfas gravatar imageWeasfas ( 2019-12-11 11:01:04 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-12-03 07:17:14 -0600

Seen: 30 times

Last updated: Dec 04