Image_transport for Python node
In http://wiki.ros.org/image_transport#r..., it is said that "image_transport does not yet support Python, though it is on the Roadmap. If you need to interface a Python node with some compressed image transport, try interposing a republish node."
Can someone help me with the republish node solution? Perhaps some example code? I have no idea how this implementation would look like.
I think the intention of this comment is that you should write a C++ node that uses an
image_transport
subscriber to subscribe to the compressed image data, and then publish the data in an uncompressed format for your Python node to subscribe to. This C++ node would be the "republish node". The tutorials for image_transport should give a pretty good idea of how to write that node.@jarvisschultz I am a bit confused. How would the Python node subscribe to this data? The first sentence of the image_transport documentation says "image_transport should always be used to subscribe to and publish images." Python doesn't have image_transport so how would I subscribe to that republished uncompressed image format that you are referring to?
Also, I have another question. In section 4 of this guide, http://wiki.ros.org/cv_bridge/Tutoria... they use Python to subscribe to images topic. What is going on?
image_transport/republish already supports this.
Should be no need to write something custom.
Still a bit of a kludge though.
@Heelbruise: please don't post additional/follow-up questions in comments. It's your question already, so edit your original question text and append it.
But do please note that ROS Answers (ie: Askbot) is not a forum. The ideal ratio of questions-to-answers is 1:1.
Good point @gvdhoorn! I completely forgot about the republish capability.
@gvdhoorn OK I will ask on a separate post :)
@jarvisschultz any answer to my confusion?
Do I understand this correctly?: Python can sub to image/compressed but not /image so: 1. Republish /image to image/compressed in c++ but without actually compressing 2. subscribe to /compressed image in python node?
Both the comment you originally asked about and the
image_transport/republish
that @gvdhoorn mentioned are working around the limitation that Python can't natively useimage_transport
to subscribe to the compressed/streaming transports. The goal of the "republisher" is to take in a compressed stream topic and output asensor_msgs/Image
topic for Python to subscribe to. You shouldn't have to write an C++ code, just a launch file that starts a republisher with the correct stream types and topic remappings.