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

How do you remap a topic?

asked 2011-03-01 00:36:37 -0600

Benoit Larochelle gravatar image

updated 2011-11-17 16:26:01 -0600

Mac gravatar image

How to remap a topic name?

1) From a launch file?
2) From a bag file?

For example, I have a .bag file that publishes to a topic "foo" and I would like remap it to "bar", because another node expects the topic "bar".

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
38

answered 2011-03-01 01:46:27 -0600

1) The remap tag lets you remap topics in launch files.

2) rosbag play is a node just like any other and its published topics can be remapped in the same way as any other node. For example, if I have a bag file publishing a laser scan on /base_scan, but I want it on /scan, I can do rosbag play my_bag.bag /base_scan:=/scan

edit flag offensive delete link more

Comments

1

I think it is also necessary for the previous and the new topic to publish message of the same type for remap to work.

warriorUSP gravatar image warriorUSP  ( 2018-07-06 13:32:33 -0600 )edit

Is it possible to do it on command line?

parzival gravatar image parzival  ( 2019-06-06 07:09:22 -0600 )edit
1

rosbag play my_bag.bag /base_scan:=/scan should work

rfeistenauer gravatar image rfeistenauer  ( 2019-11-15 05:06:22 -0600 )edit

In case someone runs into the issue while running ROS2, just add the --remap flag before remapping. Credit.

$ ros2 bag play my_bag2.db3 --remap /base_scan:=/scan

sgarciav gravatar image sgarciav  ( 2022-06-15 22:47:11 -0600 )edit

Question Tools

4 followers

Stats

Asked: 2011-03-01 00:36:37 -0600

Seen: 63,625 times

Last updated: Nov 17 '11