Ask Your Question

Remap inside a launch file vs remapping during rosbag play

asked 2020-07-25 04:30:42 -0500

praskot gravatar image

updated 2020-07-25 04:31:31 -0500

Hi All,

Goal (more of getting to know tutorial): Trying to run this particular code on an image from a rosbag.

Instead of changing the topic name inside the code (obviously this works), I tried the remap option in a launch file, which I thought is the better way. Tried the following two launch scripts,

  <node name="image_shrinker_node" pkg="image_shrinker" type="image_shrinker" output="screen">
  <remap from="/ns/camera1/image_raw" to="/camera/image_raw"/>


  <remap from="/ns/camera1/image_raw" to="/camera/image_raw"/>
  <node name="image_shrinker_node" pkg="image_shrinker" type="image_shrinker" output="screen">

Neither seems to work. The only I could get this to work is remapping it during rosbag play as, rosbag play bag_file.bag /ns/camera1/image_raw:=/camera/image_raw

Can anyone help me figure out what went wrong in the launch file?

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-07-26 18:10:10 -0500

Geoff gravatar image

In both of your launch files, you are asking the image_shrinker node to remap its topic /ns/camera1/image_raw to /camera/image_raw. This is the wrong way around. from should specify the existing name, and to the name that you want to change it to. Because image_shrinker doesn't have a topic at /ns/camera1/image_raw the remapping rule has no effect.

edit flag offensive delete link more


Thanks Geoff. That makes sense.

Also, does that mean remap works only on the publisher's end?

praskot gravatar image praskot  ( 2020-07-26 20:21:28 -0500 )edit

No, remapping works just fine on the subscriber as well.

Geoff gravatar image Geoff  ( 2020-07-26 20:31:27 -0500 )edit

I see! Thanks

This works,

  <node name="image_shrinker_node" pkg="image_shrinker" type="image_shrinker" output="screen">
  <remap from="/camera/image_raw" to="/ns/camera1/image_raw"/>
praskot gravatar image praskot  ( 2020-07-26 22:26:02 -0500 )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: 2020-07-25 04:30:42 -0500

Seen: 176 times

Last updated: Jul 26 '20