Performance of nodes that process images
My robot has:
- ROS1 Notetic Rasberry Pi 4 Raspberry
- Pi Camera V2 Running raspicam node (https://github.com/UbiquityRobotics/r...)
- My "remote" computer is running
- Ubuntu 20.04 on a cluster which is located in my lab
- They are communicating via Wifi.
- roscore is running on the robot
The raspicam node is publishing images to it's variety of topics.
I have two nodes on my remote computer, each is processing the images in a different way. One of them is looking for fiducially and one of them is doing some simple image processing with opencv.
Performance is not good. Specifically it seems like the robot itself is not moving smoothly, and there is too much of a delay before the image gets to the remote computer. I have not measured this so this is just a subjective impression.
I hypothesize that the problem is that the image data is big and causing one of a number of problems (or all).
- Transmitting it iis too much for the Pi
- The wifi is not fast enough
- Because there are several nodes on the remote computer that are subscribing to the images, the images are being sent redunantly to the remote computer
I have some ideas on how to try to fix this:
- Reduce the image size at the raspicam node
- Do some of the imate processing onboard the Pi
- Change the image to black and white
- Turn off any displays of the image on the remote computer (i.e. rviz and debugging windows)
Any insights on this scenario would be appreciated!
Pito
Quick comment: as with everything wireless: make sure to first benchmark base wireless throughput/performance (using something like
iperf
). Compare result to desired transfer rate (ie:image_raw
bw). Ifachieved_bw < desired_bw
(or very close to), things will not work (smoothly). Note thatdesired_bw
could be multiple times the bw of a singleimage_raw
subscription, as you write you have multiple subscribers.In all cases though: transmitting
image_raw
(or their rectified variants) topics over a limited bw link is not going to work. I'd suggest looking intoimage_transport
and configure a compressed transport. There are lossless plugins available, which would be important if you're looking to use the images for image processing tasks). One example would be swri-robotics/imagezero_transport. It takes some CPU, but reduces bw significantly.See also #q413068 for a recent discussion about a similar topic.