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

How to use tf_remap??

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

beginner gravatar image

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

Hello,

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:

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

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

Comments

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 -0500 )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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
5

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

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}]
  </rosparam>
</node>

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

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

Comments

and no qutation marks..

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

Can tf_remap be used without using bag files?

dj95 gravatar image dj95  ( 2020-05-07 15:39:00 -0500 )edit

@dj95 Yes it can

Remi_Tortue gravatar image Remi_Tortue  ( 2023-07-12 03:13:57 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 11,678 times

Last updated: Mar 22 '16