Ask Your Question

How to use tf_remap??

asked 2015-08-26 10:25:09 -0600

beginner gravatar image

updated 2015-09-01 08:03:17 -0600


I have a rosbag in which a /tf topic is recorded.

I need to remap all tf frames in that bag which refer to the frame named '/world' to refer to a new frame named '/vision'. I tried the following but it is unfortunately not working:

rosrun tf tf_remap _mappings:='[{old: /world, new: /vision}]'

Am I missing something?

EDIT: I have also tried to do it from a launch file:

  <node pkg="tf" type="tf_remap" name="tf_remapper" output="screen">
    <rosparam param="mappings">
      - {old: "/world",
         new: "/vision"}

but it's not working :(

Could it be that I am missing some argument when calling rosbag play?

EDIT 2: After searching, I found people saying that, in addition to running the tf_remap node, rosbag should be run as follows:

rosbag play x.bag /tf:=/tf_old

I tried it, and still it's not working :(

The tf_frames are still referring to /world rather than /vision.

Any help would be highly appreciated!!

edit retag flag offensive close merge delete


Did you end up figuring this out? I would love to know the answer. Thanks!

spmaniato gravatar image spmaniato  ( 2016-02-04 09:27:35 -0600 )edit

I know this is not what you are asking but, for this use case I would just find&replace

OzzieTheHead gravatar image OzzieTheHead  ( 2021-08-20 14:47:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-22 20:14:23 -0600

I think I had the same problem and I found the following syntax to work from my launch file:

<node pkg="tf" type="tf_remap" name="tf_remapper" output="screen">
  <rosparam param="mappings">
    [{old: depth_camera, new: /camera_rgb_optical_frame},{old: thermal_camera, new: /camera_optris_frame}]

<node pkg="rosbag" type="play" name="player" args="--clock $(arg bag_dir)/$(arg file)">
  <remap from="tf" to="tf_old" />

Bear in mind I was remapping two frames, so you probably won't need the comma. Also, my original frames didn't have a forward slash in front of them which is why I left it out.

You should then see a message printed to the console with something like the following:

Applying the following mappings to incoming tf frame ids {'depth_camera': '/camera_rgb_optical_frame', 'thermal_camera': '/camera_optris_frame'}
edit flag offensive delete link more


and no qutation marks..

engyasin gravatar image engyasin  ( 2018-09-03 09:02:08 -0600 )edit

Can tf_remap be used without using bag files?

dj95 gravatar image dj95  ( 2020-05-07 15:39:00 -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



Asked: 2015-08-26 10:25:09 -0600

Seen: 9,370 times

Last updated: Mar 22 '16