ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Isn't the problem here that you're trying to use image_transport::Subscriber
to subscribe to a topic which isn't actually carrying Image
s, but darknet_ros_msgs::ImageWithBoundingBoxes
? That's also what the error message seems to tell you:
error: invalid initialization of reference of type ‘darknet_ros_msgs::ImageWithBoundingBoxes&’ from expression of type ‘boost::shared_ptr<const sensor_msgs::Image>
2 | No.2 Revision |
Isn't the problem here that you're trying to use image_transport::Subscriber
to subscribe to a topic which isn't actually carrying Image
s, but darknet_ros_msgs::ImageWithBoundingBoxes
? ?
That's also what the error message seems to tell you:you. Paraphrasing, it would read:
error: invalid initialization of reference of type ‘darknet_ros_msgs::ImageWithBoundingBoxes&’ from expression of type ‘boost::shared_ptr<const sensor_msgs::Image>
You'll probably have to switch to a regular ros::Subscriber
instead of using image_transport
's.
3 | No.3 Revision |
Isn't the problem here that you're trying to use image_transport::Subscriber
to subscribe to a topic which isn't actually carrying Image
s, but darknet_ros_msgs::ImageWithBoundingBoxes
?
That's also what the error message seems to tell you. Paraphrasing, it would read:
error: invalid initialization of reference of type ‘darknet_ros_msgs::ImageWithBoundingBoxes&’ from expression of type ‘boost::shared_ptr<const sensor_msgs::Image>
You'll probably have to switch to a regular ros::Subscriber
instead of using image_transport
's.
Edit:
Oh, right yes... But how could I rewrite it? So that I still can use the image_transport functionality?
I'm not sure. Possibly not using a custom message, but using something like message_filters to combine related messages based on their timestamps (so only publish a list of boundingboxes (one from vision_msgs preferably) with the same timestamp as the sensor_msgs/Image
that the detection was run on, then later recombine the two using message_filters
).
I'm not an image_transport
expert though, so there could be a different option.
There is a tutorial on writing your own transport plugin (this one), but I don't believe that is something that would fit your use-case.
Edit 2:
Edit: Thank you! Now it works. But what I am still not sure about: Is it now slower? Because i don't use the image transport functionality?
Using image_transport
doesn't make anything magically faster. The "only" thing image_transport
does is making it easier to use different compression algorithms (called "transports" in image_transport
lingo) without having to deal with their details in image producers and consumers. Simple configure a specific transport to be used, and without recompiling or changing anything in your publishers or subscribers it will be used. Transparently.
In the case of compression, this actually has the potential to make things slower (as compression adds overhead).
So with switching to a regular Subscriber
, you lose all of that. But you had already lost that, as you were using a regular Publisher
as well.
4 | No.4 Revision |
Isn't the problem here that you're trying to use image_transport::Subscriber
to subscribe to a topic which isn't actually carrying Image
s, but darknet_ros_msgs::ImageWithBoundingBoxes
?
That's also what the error message seems to tell you. Paraphrasing, it would read:
error: invalid initialization of reference of type ‘darknet_ros_msgs::ImageWithBoundingBoxes&’ from expression of type ‘boost::shared_ptr<const sensor_msgs::Image>
You'll probably have to switch to a regular ros::Subscriber
instead of using image_transport
's.
Edit:
Oh, right yes... But how could I rewrite it? So that I still can use the image_transport functionality?
I'm not sure. Possibly not using a custom message, but using something like message_filters to combine related messages based on their timestamps (so only publish a list of boundingboxes (one from vision_msgs preferably) with the same timestamp as the sensor_msgs/Image
that the detection was run on, then later recombine the two using message_filters
).
I'm not an image_transport
expert though, so there could be a different option.
There is a tutorial on writing your own transport plugin (this one), but I don't believe that is something that would fit your use-case.
Edit 2:
Edit: Thank you! Now it works. But what I am still not sure about: Is it now slower? Because i don't use the image transport functionality?
Using image_transport
doesn't make anything magically faster. The "only" thing image_transport
does is making it easier to use different compression algorithms (called "transports" in image_transport
lingo) without having to deal with their details in image producers and consumers. Simple Simply configure a specific transport to be used, and without recompiling or changing anything in your publishers or subscribers it will be used. Transparently.
In the case of compression, this actually has the potential to make things slower (as compression adds overhead).
So with switching to a regular Subscriber
, you lose all of that. But you had already lost that, as you were using a regular Publisher
as well.
5 | No.5 Revision |
Isn't the problem here that you're trying to use image_transport::Subscriber
to subscribe to a topic which isn't actually carrying Image
s, but darknet_ros_msgs::ImageWithBoundingBoxes
?
That's also what the error message seems to tell you. Paraphrasing, it would read:
error: invalid initialization of reference of type ‘darknet_ros_msgs::ImageWithBoundingBoxes&’ from expression of type ‘boost::shared_ptr<const sensor_msgs::Image>
You'll probably have to switch to a regular ros::Subscriber
instead of using image_transport
's.
Edit:
Oh, right yes... But how could I rewrite it? So that I still can use the image_transport functionality?
I'm not sure. Possibly not using a custom message, but using something like message_filters to combine related messages based on their timestamps (so only publish a list of boundingboxes (one from vision_msgs preferably) with the same timestamp as the sensor_msgs/Image
that the detection was run on, then later recombine the two using message_filters
).
I'm not an image_transport
expert though, so there could be a different option.
There is a tutorial on writing your own transport plugin (this one), but I don't believe that is something that would fit your use-case.
Edit 2:
Edit: Thank you! Now it works. But what I am still not sure about: Is it now slower? Because i don't use the image transport functionality?
Using image_transport
doesn't make anything magically faster. The "only" thing image_transport
does is making it easier to use different compression algorithms (called "transports" in image_transport
lingo) without having to deal with their details in image producers and consumers. Simply configure a specific transport to be used, and without recompiling or changing anything in your publishers or subscribers it will be used. Transparently.
In the case of compression, this actually has the potential to make things slower (as compression adds overhead).overhead), but that obviously depends on a number of other factors (size of images vs bandwidth, latency, etc).
So with switching to a regular Subscriber
, you lose all of that. But you had already lost that, as you were using a regular Publisher
as well.