Open BradySheehan opened 1 year ago
Hi @BradySheehan , I'm facing the exact same issue with the examples provided by image_transport_tutorials
, did you manage to find a solution?
I think I found the issue.
You manually need to define the parameter called image_transport
in your node. That's all, after that, starting the node with
--ros-args -p image_transport:=compressed
correctly changed the transport protocol. Note that image_transport
and not _image_transport
is required.
Before opening a PR to fix this, it this the correct way? Or should the image_transport
package responsible to create the parameter?
Hi,
I wrote in the description that I did this but did not see the messages get compressed.
I don't see in the description any mention to manually defining the parameter.
For example, this is the modified and working main of https://github.com/ros-perception/image_transport_tutorials/blob/main/src/my_subscriber.cpp
int main(int argc, char ** argv)
{
rclcpp::init(argc, argv);
rclcpp::NodeOptions options;
rclcpp::Node::SharedPtr node = rclcpp::Node::make_shared("image_listener", options);
node->declare_parameter("image_transport","raw");
cv::namedWindow("view");
cv::startWindowThread();
image_transport::ImageTransport it(node);
image_transport::Subscriber sub = it.subscribe("camera/image", 1, imageCallback);
rclcpp::spin(node);
cv::destroyWindow("view");
return 0;
}
the diff is
diff --git a/src/my_subscriber.cpp b/src/my_subscriber.cpp
index fc5fccd..c32cbc5 100644
--- a/src/my_subscriber.cpp
+++ b/src/my_subscriber.cpp
@@ -35,6 +35,7 @@ int main(int argc, char ** argv)
rclcpp::init(argc, argv);
rclcpp::NodeOptions options;
rclcpp::Node::SharedPtr node = rclcpp::Node::make_shared("image_listener", options);
+ node->declare_parameter("image_transport","raw");
cv::namedWindow("view");
cv::startWindowThread();
image_transport::ImageTransport it(node);
I was having the same issue and this solved it for me, thanks!
Compressed image topics do not appear to be working in ROS2 Humble. I have a node
panel_detector
and a Sterelabs Zed 2i sensor. I am trying to get that node to subscribe to compressed image topics from the Zed 2i.Setup: Stereolabs Zed2i Camera ROS2 Humble Installed compressed image transport plugin dependencies - https://github.com/ros-perception/image_transport_plugins/blob/rolling/image_transport_plugins/package.xml Verified that compressed topics are viewable on the system with
ros2 topic list
.Steps to Reproduce:
_image_transport:=compressed
as seen in this document https://github.com/ros-perception/image_transport_tutorials#changing-the-transport-used.Result: The node is not subscribing to the compressed topics, e.g.,
It is only subscribing to the uncompressed topics.
Expected Result: I expected
ros2 node info panel_detector
to list that it was subscribed to the compressed image topics.Debugging I confirmed that the
image_transport/compressed
is an available transport.I also tried explicitly changing the topics which were subscribed to be the actual compressed topics, but the camera image callback was never fired.