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

republish image from rospy node to roscpp node

asked 2014-01-20 21:23:22 -0500

Pototo gravatar image

updated 2014-01-28 17:07:22 -0500

ngrennan gravatar image


I just want to know the right format to republish image data from a python node to a cpp node, because I keep getting an error. My python node is publishing a CompressedImage (from sensor_msgs.msg import CompressedImage) where the image data came initially as an array before adding it to a CompressedImage object, then I do republish so that my cpp node can pick it up. The image below shows my "/output/image_raw/compressed1" topic publishing the CompressedImage. The only way my republisher can subscribe is if I use "raw" as my "in_transport," (which I assume is not correct?) otherwise republish does not subscribe.

This is how I call republish from my terminal:

rosrun image_transport republish raw in:=/output/image_raw/compressed1 compressed out:=camera/image_decompressed1

I don't need to publish CompressImage from python specifically. It can be any other way/format (except "theora"), as long as it works.

Thank you for your help! I appreciate it.

edit retag flag offensive close merge delete


I do not understand why exactly you would want to republish rather than subscribing directly to the image with your rosccp node? Does your terminal command work and you wish to replace it, or does it not work at all?

Wolf gravatar image Wolf  ( 2014-02-11 20:23:04 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-09-17 20:34:53 -0500

130s gravatar image

Not sure if I understand your scenario correctly, but you want to 1) subscribe a topic 2) process the topic content 3) republish the modified topic.

Depending on what process you want to add to the topic, you may find topic_tools suitable for your need particularly transform command.

Since image_transport republish provides a way to subscribe to a topic that's being published and republish it, without adding custom processing, that might not help your case.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-01-20 21:23:22 -0500

Seen: 953 times

Last updated: Sep 17 '18