Ask Your Question

Rviz - Unknown reason for transform failure - but only when using config file

asked 2021-08-07 07:52:06 -0500

Cion gravatar image

updated 2021-08-10 08:08:14 -0500

Hey, I have a weird error here which I can not figure out why it is happening. I am using the same launch file in two runs. In the first run I am setting up Rviz manually and add a Laserscan with the /scan topic, adding a TF and changing the fixed frame from /map to /odom and everything works perfectly fine. I then proceeded to store this Rviz configuration to not have to manually add the stuff mentioned before and added the config file to my launch file. Running the launch file now results in Rviz telling me the mentioned error in the title when looking at the Laserscan. The Laserscan receives 4 messages, then the error pops up for 1-2 seconds. This circle repeats infinitely. Does someone know why that is happening?


  <param name="/use_sim_time" value="false"/>

  <node pkg="tf" type="static_transform_publisher" name="base_to_laser" args="0.0 0.0 0.0 0.0 0.0 0.0 base_link laser_link 40" />

  <!-- Running next line the first time and the line after the second time -->
  <node pkg="rviz" type="rviz" name="rviz" /> 
  <!--node pkg="rviz" type="rviz" name="rviz" args="-d $(find test)/rviz_config/standard_cfg.rviz" /> -->

  <!-- RPLidar starting and setup    -->
  <node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
    <param name="serial_port"         type="string" value="/dev/ttyUSB0"/>
    <param name="serial_baudrate"     type="int"    value="115200"/><!--A1/A2 -->
    <!--param name="serial_baudrate"     type="int"    value="256000"--><!--A3 -->
    <param name="frame_id"            type="string" value="laser_link"/>
    <param name="inverted"            type="bool"   value="false"/>
    <param name="angle_compensate"    type="bool"   value="true"/>

  <node pkg="laser_scan_matcher" type="laser_scan_matcher_node" 
    name="laser_scan_matcher_node" output="screen">
    <param name="fixed_frame" value = "odom"/>
    <param name="use_alpha_beta" value="true"/>
    <param name="max_iterations" value="10"/>



The first time I run this launch file I use this line and add everything manually and everything works:

<node pkg="rviz" type="rviz" name="rviz" />

I then save the configuration I just made, close rviz and launch my file with this line instead of the one before:

<node pkg="rviz" type="rviz" name="rviz" args="-d $(find test)/rviz_config/standard_cfg.rviz" />

Everything loads up but the LaserScan tells me in 1-2sec intervals: Unknown reason for transform failure and then scans properly again. And that is happening in an infinite loop. I hope this helps you to understand my problem better.

edit retag flag offensive close merge delete


Is rviz running on a different host than the lidar? If multiple hosts, is time-of-day clock synchronized on all of them?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-08-10 08:42:41 -0500 )edit

I am not sure whether I understand you correctly because I am not too familiar with multiple hosts yet but everything is running on one PC from on terminal.

Cion gravatar image Cion  ( 2021-08-10 08:49:47 -0500 )edit

Is this simulated in gazebo, or are you using real hardware?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-08-10 10:10:20 -0500 )edit

I am using real hardware. RPLidar A2.

Cion gravatar image Cion  ( 2021-08-10 10:26:43 -0500 )edit

I'm beginning to think this issue has nothing to do with rviz config file. According to the wiki, both ~use_imu and ~use_odom default to true. Are you providing the information described on that page?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-08-10 11:42:51 -0500 )edit

Hey there and sorry that its been a while. I indeed had them set to true but setting them to false doesn't change the error from appearing. And to be honest I also don't understand why it should. I am still running the same launch file both times, so both times they have been set to true. The only difference is that when adding everything manually to rviz it works properly but loading this stored configuration the next time when launching leads to the error.

Cion gravatar image Cion  ( 2021-08-12 01:18:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-08-08 09:37:56 -0500

Mike Scheutzow gravatar image

You have not actually "added the config file" to your launch file. What that line currently does is simply run the rviz application. The launch file should also specify the full path name to the rviz config file that you saved.

When rviz is started by this launch file, is the fixed_frame and other rviz config what you expect? Does it start working if you use File|OpenConfig from the rviz menus?

edit flag offensive delete link more


When rviz is started by my config file everything is according to the manual setup but still the same error. Meanwhile when opening my stored config via file/open config it works like a charm. Any idea why?

Cion gravatar image Cion  ( 2021-08-10 02:54:34 -0500 )edit

rviz is not loading your personal config file because you have not provided the args= field when rviz is started. That field should specify -d followed by the full path to your .rviz file.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-08-10 07:29:19 -0500 )edit

That's exactly what I did. In the launch file above I commented that I run the exact same file twice, only changing the one line below the comment. When I run just rviz and add everything manually there is no error at all. Then I proceeded to save that configuration and open it with the same launch file, but this time uncommenting this line: and commenting the line above this one. The result is rviz loading up with the configuration I saved before and everything works fine but every 1-2 seconds there is a transform failure with the LaserScan which tells me Unknown reason for transform failure.

Cion gravatar image Cion  ( 2021-08-10 08:03:44 -0500 )edit

I have edited my question, I hope this makes it easier to understand. Ty for your coming help!

Cion gravatar image Cion  ( 2021-08-10 08:08:58 -0500 )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


Asked: 2021-08-07 07:52:06 -0500

Seen: 32 times

Last updated: Aug 10 '21