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

Trying to perform an image transport on ROS2 foxy

asked 2023-06-29 16:00:13 -0600

park12345 gravatar image

Hi, I have been trying to transport images across a network using ROS2 foxy. I have found a couple of sources that help explain talker and listeners, but I have not been able to find anything that really helps me understand how to transport images across a network. I tried using this github that seems promising, https://github.com/ros-perception/ima..., but there is no explanation on how to use the github. I am new to ROS2 and Foxy so anything will help. Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2023-06-29 23:20:09 -0600

chased11 gravatar image

Depends on your situation but If you have a camera, then you will need to write a publisher and use cv_bridge and opencv to convert the image to sensor_msgs/image message type, and use the ROS2 node to publish the image to a topic. On the other end you will also need a subscriber that does the same thing the other way around. Also, the ROS wiki is here , not sure if there is a ros2 wiki but the tutorials would be similar.

edit flag offensive delete link more
0

answered 2023-07-05 03:20:37 -0600

hank880907 gravatar image

updated 2023-07-05 03:23:56 -0600

The image transport package sounds like what you need! Image transport package allows user to define their own transport methods. Here is some common transport methods provided by image transport. The transport methods are transparent to the user. i.e. it will be discovered during runtime. A typical implementation of image transport will look like this.

image_transport::ImageTransport it_(node);
image_transport::Publisher image_pub_;
image_pub_ = it_.advertise("rgb", 10);
auto image = sensor_msgs::msg::Image::SharedPtr(new sensor_msgs::msg::Image);
image_pub_.publish(image);

By doing this, you will see some additional topics for different transport method, such as compressed, if you have install the plugins correctly. I have implemented my own type of image transport plugin that uses nvenc to encode video stream to h.264 encoding.

However, the downside of using image transport is that it will produce a lot of unused topics (an extra topic per image plugin.). There seems to be a way to disable unused topic, but it is always possible to just use sensor_msgs::msg::image to transport compressed data. Just need to make sure the encoding field in the sensor_msgs::msg::image is filled up with the correct encoding format, such as h.264.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2023-06-29 16:00:13 -0600

Seen: 1,515 times

Last updated: Jul 05 '23