Bandwidth issues for image transmission in ROS2 humble containe over internet

I have bandwidth issues while enabling ROS2 communication in a Docker container over the internet.

I’m using a sidecar ROS2 humble container build alongside my project container with fastDDS built. String-type topics work fine, but I’m facing problems with image topics. Devices on different networks can find the image topics but cannot display or receive them. The logs indicate packet loss, likely due to insufficient VPN bandwidth.

How can I increase the VPN bandwidth to handle more data?

Hi!
We do not limit the bandwidth in any way - the most notable external limiting factors would be the network capacity and CPU. Keep in mind that the network capacity that matters may be on a direct (P2P) route, or via the Internet (so to/from our Base Servers and to/from the other device). Also - Husarnet is using UDP, which in case of most ISPs is prioritized because of gaming community, but some obscure ones artificially limit bandwidth on those. Secondly Husarnet is using a pretty CPU-heavy cryptography to operate safely and securely. From time to time we’re going through the code with profilers/benchmarks and optimize the parts we can, but it’s a tedious process with a little return. If you want to optimize it on your side - currently the rule of thumb would be to operate on hosts with a good single-core performance (rather than multi-core). This may change in the future, but making networking operations multi-core in a sensible way is not a simple task and will require a lot of testing before we release it.


Sorry for not having a better answer, I hope that it helps either way
Paweł

1 Like

I had once observed the same issue.
Any chance you are using the Theora compression? What does your publisher code look like?

Also, if you are using the default or raw image topic, the VPN is unable to support that for sure. You may want to try some compressed topic.

Hi, Thank you for the info. I haven’t use any compression yet, and my publisher code is very simple, just using OpenCV to get camera frames and publish the raw image like "
msg = self.bridge.cv2_to_imgmsg(frame, “bgr8”)
self.publisher_.publish(msg)
"
May I ask why the VPN is unable to support raw image topic in your opinion? And do you have any suggestions about which compressed method works in this setup? Thank you very much for the help!

You may find the discussion on this community post helpful.

The discussion will lead you to this github readme which has some additional instructions that you may find useful.

From what I am seeing, it seems that the VPN can support raw images but that is dependent on their size. Assume you are sending an HD image at 30fps, that can be called equivalent to 1080x720x3x30 = 70 MB/s or ~0.5Gbps. Assuming the VPN can support this, your ethernet/wifi adapter must be able to handle such large data rates too. This is why compression is required.

Depending on your requirements and compute availability, you may try anything from as simple as JPEG compression to theora compression or H264. I would recommend checking out this repository for a relatively simple and quick way to get compression native to ROS2 running.

1 Like