Ask Your Question

make tf from rosbag data raw

asked 2014-09-12 10:20:04 -0500

pmarinplaza gravatar image


I am trying to make tf tree from rosbag file and raw topics like /imu/data and /scan without tf topic. At the time when record the bagfile, we don't know the tf jet and now we want to make the tf appropriate tree.

We are doing tf static transform with static_transform_publisher nodes by launch file:

    <node pkg="tf" type="static_transform_publisher" name="base_link_imu" args="0.5 0 0.1 0 1.57 0 /base_link /imu 10"/>
<node pkg="tf" type="static_transform_publisher" name="base_footprint" args="0 0 0.2 0 0 0 /base_footprint /base_link 10"/>
<node pkg="tf" type="static_transform_publisher" name="base_link_laser" args="0.5 0 0 0 0 0 /base_link /laser 10"/>

In imu msg topic, the header is the follow:

  seq: 49958
    secs: 1410520339
    nsecs: 565862711
  frame_id: imu

Frame_id : imu.

The same for the laser data:

  seq: 1831
    secs: 1410520215
    nsecs: 426117012
  frame_id: laser
angle_min: -0.872664630413
angle_max: 0.872664630413
angle_increment: 0.00436332309619
time_increment: 3.70370362361e-05
scan_time: 0.0533333346248
range_min: 0.0
range_max: 81.0

Notice that both frame publisher are "imu" and "laser". Now we run the launch file generating the tree but when we want to see in rviz, appear the next msg: In imu frame:

Transform [sender=unknown_publisher]
Message removed because it is too old (frame=[imu], stamp=[1410520316.775747058])

In laser frame.

Transform [sender=unknown_publisher]
Message removed because it is too old (frame=[laser], stamp=[1410520194.940736519])

The problem is the msg has other timestamp as the tf_publisher.

What is the best strategy to make new tf with old timestamp to use the raw data from the rosbag file? The aim is watch the robot pose and the map/odometry just with the rosbag sensors. I read hector_mapping can do the thing but need tf in order to make correct odometry.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2014-09-12 10:35:51 -0500

kmhallen gravatar image

Set the parameter /use_sim_time to true, and use the --clock option in 'rosbag play'

This tells all nodes to use timestamps published from the bag.

edit flag offensive delete link more


Works great. Thank you very much.

pmarinplaza gravatar image pmarinplaza  ( 2014-09-12 11:02:30 -0500 )edit

Still same error coming up in Rviz. Is there something else. How to make Rviz understand that is the timestamp it needs to look?

Harsh2308 gravatar image Harsh2308  ( 2017-08-29 03:28:22 -0500 )edit

Yeah thanks! It worked . Setting /use_sim_time before running any node

Harsh2308 gravatar image Harsh2308  ( 2017-08-29 23:49:08 -0500 )edit

answered 2017-08-29 07:53:13 -0500

kmhallen gravatar image

Make sure to set the /use_sime_time parameter to true before running Rviz. Nodes only check that parameter at startup. Also, Rviz will display 'Wall Time' and 'ROS Time' in the lower left.

edit flag offensive delete link more

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: 2014-09-12 10:20:04 -0500

Seen: 3,587 times

Last updated: Sep 12 '14