Closed fabioperez closed 10 years ago
You need to subscribe to the base image topic and not a specific image_transport topic.
I quote from ROS wiki: "The actual ROS topic subscribed to depends on which transport is used." and "typically you should not directly reference the transport-specific topic used by a particular plugin."
In order to select a specific transport, you have to add hints :
image_transport::TransportHints hints("name_of_the_plugin", ros::TransportHints());
sub1 = n.subscribe("image", 1000, &Main::imageReceivedCB, this, hints);
I've tried what you suggested, but I'm getting this error:
main.hpp:85:70: error: no matching function for call to ‘ros::NodeHandle::subscribe(const char [6], int, void (Main::*)(const ImageConstPtr&), Main* const, image_transport::TransportHints&)’
The GUI node is subscribing to the correct compressed camera topic (it's showing the images), but the tracker node is subscribing to the topic without the /compressed
. Maybe it's because /ros_tld_tracker_node
receives the _image_transport:=compressed
argument but the main_node
cannot see it.
I made a mistake, it's it.subscribe(...);
not n.subscribe(...);
.
It's specified in the ROS documentation that the base_topic have to be used and the transport need to be set by the image_transport parameter or the hints. Indeed, it could be an issue with the nodehandles. You can try to instantiate the image_transport object with the private nodehandle used to get all the parameters in the constructor.
It's now working. I wasn't adding <remap from="image/compressed" to="$(arg image_topic)/compressed"/>
to ros_tld_tracker.launch
. However, this remap workaround is not elegant at all.
I added the hints but they were not necessary for the program to work. The full modified code is in my fork.
I'm trying to use a compressed image transport with ros_opentld. I changed the project to work with image_transport, which can handle compressed images.
I've made the following modifications to the project:
main.hpp
:#include <image_transport/image_transport.h>
sub1 = n.subscribe("image", 1000, &Main::imageReceivedCB, this);
toros::Subscriber sub1
toimage_transport::Subscriber sub1;
.base_frame.hpp
:ros::Subscriber sub1;
toimage_transport::Subscriber sub1;
base_frame.cpp
:#include <image_transport/image_transport.h>
changedsub1 = n.subscribe("image", 1000, &BaseFrame::image_receivedCB, this);
toIn both launch files I added:
<remap from="image/compressed" to="$(arg image_topic)/compressed"/>
.I also changed the default image topic to my camera. Then I run the tracker (tracker/gui in two terminal tabs):
I can see the image from the camera within the GUI window, update with F5, select a box, press ENTER, but the tracking is not working.
When enter is pressed, the following message is echoed:
[ INFO] [1387170673.023733280]: Bounding Box received
.I've also tried
auto_face_detection:=true
, but it's not working either.