0
$\begingroup$

Rosanswers logo

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!!


Originally posted by beginner on ROS Answers with karma: 83 on 2015-08-26

Post score: 4


Original comments

Comment by spmaniato on 2016-02-04:
Did you end up figuring this out? I would love to know the answer. Thanks!

Comment by OzzieTheHead on 2021-08-20:
I know this is not what you are asking but, for this use case I would just find&replace

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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'}

Originally posted by Stephen Vidas with karma: 131 on 2016-03-22

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by engyasin on 2018-09-03:
and no qutation marks..

Comment by dj95 on 2020-05-07:
Can tf_remap be used without using bag files?

Comment by Remi_Tortue on 2023-07-12:
@dj95 Yes it can

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.