0
$\begingroup$

Rosanswers logo

I'm trying to visualize my robot in Rviz and I'm getting several errors:

  • Global Status: Fixed Frame: No tf data. Actual error: Fixed Frame [odom] does not exist
  • Robot Model: base_link: No transform from [base_link] to [odom]
  • Imu: Transform [sender=unknown_publisher] For frame [base_link]: Fixed Frame [odom] does not exist

Why am I getting these errors?

My robot is a simple cylinder with the URDF:

<?xml version="1.0" encoding="UTF-8"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="robot">
    <xacro:property name="torso_radius" value="0.075" />
    <xacro:property name="torso_height" value="0.16" />
    <link name="base_link">
        <visual>
            <geometry>
                <cylinder length="${torso_height}" radius="${torso_radius}" />
            </geometry>
            <origin xyz="0 0 ${torso_height/2}" rpy="0 0 0" />
        </visual>
    </link>
</robot>

It outputs odometry messages like:

header: 
  seq: 10
  stamp: 
    secs: 1496543906
    nsecs: 963784933
  frame_id: /odom
child_frame_id: /base_link
pose: 
  pose: 
    position: 
      x: 0.082
      y: 0.001
      z: 0.0
    orientation: 
      x: 0.0
      y: 0.0
      z: 0.0234978370806
      w: 0.999723887707
  covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
twist: 
  twist: 
    linear: 
      x: 0.002
      y: 0.0
      z: 0.0
    angular: 
      x: 0.0
      y: 0.0
      z: -0.009
  covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

and IMU messages like:

header: 
  seq: 165
  stamp: 
    secs: 1496543986
    nsecs: 493674993
  frame_id: base_link
orientation: 
  x: 0.0
  y: 0.0
  z: 0.0
  w: 1.0
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: 0.0
  y: 0.0
  z: 0.0
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration: 
  x: -0.5
  y: -0.24
  z: 9.77
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

I'm launching Rviz with the launch file:

<launch>
    <arg name="model" default="$(find myrobot_description)/urdf/robot.urdf.xacro"/>
    <param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />
    <node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
    <arg name="gui" default="true" />
    <arg name="rvizconfig" default="$(find myrobot_description)/rviz/urdf.rviz" />
    <param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />
    <param name="use_gui" value="$(arg gui)"/>    
    <node name="rviz" pkg="rviz" type="rviz" args="-d $(arg rvizconfig)" required="true" />
</launch>

What am I missing?


Originally posted by Cerin on ROS Answers with karma: 940 on 2017-06-03

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Although you are publishing a message describing the robot's position in the odom frame, there probably isn't a TF transform being published. How are you publishing the odom message? Most packages that publish odometry messages will also give the option to publish the TF transform as well, which will fix your error.

I see you have the robot_state_publisher node running, which will publish transforms for you, but only using joints on the joint_states topic. This will work for everything above base_link, but won't work for base_link->odom.


Originally posted by ufr3c_tjc with karma: 885 on 2017-06-04

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Cerin on 2017-06-05:
You're right, I wasn't publishing any TF data. I actually have a node to do this, but it only publishes TF data when the robot's actively moving. As soon as I activated the motors and the motor encoders started publishing odometry info, then the Rviz errors went away.

$\endgroup$

Your Answer

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