ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Playback of rosbag with tf2-static transforms

asked 2017-02-21 11:12:29 -0500

Tobias Neumann gravatar image

updated 2017-02-21 11:14:47 -0500

Hello ROS users,

I've got a robot setup where (most) of the static transforms are defined by an URDF (which results in tf2-static tfs). During a testrun we recoded plenty of bag-files which where splitted after 1 min.

The static transforms are only contained in the 1. bagfile.

(1. Question) Is there a way to record splitted bagfiles with static-tfs, that the static-tfs are contained in each bag-file?

Furthermore (2. question), if the bagfile containing the static-tfs is played, they are only received by rviz (and probably other nodes as well) if rviz was started prior the playback of the bag-file, which seems for me like a bug. Is there a solution to fix that (e.g. have rviz receiving the static-tfs even when its started lets say 2sec after the rosbag playback started)?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-02-21 13:24:06 -0500

tfoote gravatar image

updated 2017-02-22 11:09:00 -0500

For splitting bags, you'll likely want to use the rosbag API to push the static transform message into the separate bags.

A few other resources: which links to and some proposed solutions here:

With respect to the startup order there are a few issues relating to latched values: and I'm not sure if any apply to your case without more details.

edit flag offensive delete link more


And unfortunately rosbag doesn't support

does not support what? :)

gvdhoorn gravatar image gvdhoorn  ( 2017-02-22 01:05:45 -0500 )edit

Thanks for the answer, it seems like a common problem ;)

For the 2. case, the relevant output from rosbag info:

/tf_static          2 msgs    : tf2_msgs/TFMessage              (2 connections)
Tobias Neumann gravatar image Tobias Neumann  ( 2017-02-22 10:49:29 -0500 )edit

So if I understand your linked topics correctly, does apply and only the 2. msg is received by RVIZ (or other nodes) (the 1. is probably the URDF and the 2. is one tf2 static-tf-publisher)

Tobias Neumann gravatar image Tobias Neumann  ( 2017-02-22 10:51:27 -0500 )edit

@gvdhoorn sorry fragment from earlier draft.

tfoote gravatar image tfoote  ( 2017-02-22 11:09:28 -0500 )edit

@ToXeR if you have two static transform publishers that can be a problem with rosbag as it will only latch one on playback.

tfoote gravatar image tfoote  ( 2017-02-22 11:10:40 -0500 )edit

answered 2022-01-17 07:44:30 -0500

ticotico gravatar image

Good news for your first question:

In Noetic, this PR has been merged and thus you can do the following:

rosbag record -a --repeat-latched --duration 5 --split

Note, some issues with the --repeat-latched option will hopefully be resolved by this PR.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-02-21 11:12:29 -0500

Seen: 1,546 times

Last updated: Jan 17 '22