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

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 http://wiki.ros.org/image_pipeline/Tutorials/Simple%20image%20processor 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,
launch_file1:

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

launch_file2:

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

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
1

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

Comments

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,

<launch>
  <node name="image_shrinker_node" pkg="image_shrinker" type="image_shrinker" output="screen">
  <remap from="/camera/image_raw" to="/ns/camera1/image_raw"/>
  </node>
</launch>
praskot gravatar image praskot  ( 2020-07-26 22:26:02 -0500 )edit

Question Tools

2 followers

Stats

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

Seen: 401 times

Last updated: Jul 26 '20