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

Very low image publish rate from raspicam_node over WiFi

asked 2018-04-21 17:34:34 -0600

rayvburn gravatar image

Hi. I'm facing a problem of very slow forwarding of sensor_msgs::ImageCompressed data between 2 devices in my local network. Sorry if answer to this question is not very ROS related, but I have no idea where the problem is.

It's the slave machine which publishes images (Raspberry Pi 3 with Ubuntu 16.04 and ROS Kinetic using Raspberry Pi Camera v1.3) and the master (my laptop with Ubuntu 16.04 and ROS Kinetic) which subscribes a /raspicam_node/image/compressed topic. Image data will be used in ORB-SLAM2 algorithm which will be executed on master machine.

The problem is that master machine receives new data with very low rates 0.5-3 Hz. I would be content with at least 10 Hz rate. Those are example listings from terminal:

rostopic hz:

average rate: 0.794
    min: 0.425s max: 3.632s std dev: 0.76286s window: 19
average rate: 0.813
    min: 0.425s max: 3.632s std dev: 0.75262s window: 20
average rate: 0.830
    min: 0.425s max: 3.632s std dev: 0.74203s window: 21

rostopic hz:

average rate: 2.487
    min: 0.133s max: 1.813s std dev: 0.22539s window: 198
average rate: 2.477
    min: 0.133s max: 1.813s std dev: 0.22597s window: 199
average rate: 2.457
    min: 0.133s max: 1.813s std dev: 0.22981s window: 200
average rate: 2.453
    min: 0.133s max: 1.813s std dev: 0.22879s window: 202
average rate: 2.450
    min: 0.133s max: 1.813s std dev: 0.22720s window: 205

rostopic bw:

average: 81.79KB/s
    mean: 105.07KB min: 102.39KB max: 107.66KB window: 16
average: 77.99KB/s
    mean: 105.07KB min: 102.39KB max: 107.66KB window: 16
average: 83.88KB/s
    mean: 105.12KB min: 102.39KB max: 107.66KB window: 18
average: 84.87KB/s
    mean: 105.23KB min: 102.39KB max: 107.66KB window: 19

I checked what will happen if I run raspicam_node separately on Raspberry Pi (made RPi master and ran raspicam_node on it) and "rostopic hz" returned 70 Hz (with desired 90 fps) or 30 Hz (with desired 30 fps - set in yaml file). I don't think that it is possible that transmitting such amount of data (640x480 pixels image) would choke bandwidth - rostopic bw shows about 85KB/s which is nothing comparing to RPi possibilities (100Mb/s if I remember correctly).

I'm using UbiquityRobotics' raspicam_node ( https://github.com/UbiquityRobotics/r... ) which uses typical publish message engine. I was trying to change it for image_transport but catkin build threw some errors and I forgot it. I followed all build instructions except network setup, which I've done before.

I also have to admit that if I run rqt_image_view the image shown in gui seems to be delayed few seconds (but I don't think that matters in this situation). I didn't calibrate camera so far too (just wrote some random numbers into .yaml file ... (more)

edit retag flag offensive close merge delete

Comments

Compression always takes up resources that would be otherwise used for other things. With everything running, can you check htop (or top)? If using a from-sources install, did you compile with optimisations enabled?

Any difference when not using a compressed topic?

gvdhoorn gravatar image gvdhoorn  ( 2018-04-22 04:03:38 -0600 )edit

I checked top and noticed that raspicam_node takes no more than 15% of CPU. I installed from source but didn't compile with any optimisations. Should I?

To tell if there's any difference between raw and compressed I'll have to look into code, because there is no option to switch. I'll check it.

rayvburn gravatar image rayvburn  ( 2018-04-22 05:58:49 -0600 )edit

One easy test might be to try over a wired instead of wireless network. It's possible you're just running into bandwidth limitations due to one of your wireless devices. I ran this exact test with the Pi cam and Ubiquity's package last week. For us, when wired, our rate was ~5x as fast as wireless

jarvisschultz gravatar image jarvisschultz  ( 2018-04-22 11:41:52 -0600 )edit

Of course, we wanted wireless, and we were able to use the quality private param to reduce BW requirements, and achieve our desired sub rat; image quality was still ok

jarvisschultz gravatar image jarvisschultz  ( 2018-04-22 11:43:01 -0600 )edit

I tested https://github.com/dganbold/raspicam_node package which provides direct possibility to publish raw images. It takes less than 3% of CPU usage but from a master point of view I get images at the rate of about 0.5 Hz (with wired connection and desired rate of 5Hz).

rayvburn gravatar image rayvburn  ( 2018-04-22 13:19:04 -0600 )edit

From a slave (RPi) point of view the /raspicam_node/image_raw topic is published at frequency of 5 Hz (rostopic hz) which is what I set in a launch file. It seems like it's something wrong with a master's buffer? In this moment I don't have any node that subscribes the topic (if that matters).

rayvburn gravatar image rayvburn  ( 2018-04-22 13:22:48 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-04-26 11:48:31 -0600

rayvburn gravatar image

@jarvisschultz You were right. The quality parameter plays a big role in frequency that master receives images from slave. Image quality doesn't change so much even if I set this parameter quite low. With quality set to <10 I managed to get >15 FPS (which is not that great but fully usable with SLAM algorithm).

If somebody will have similar situation to mine just paste this into your .launch file:

<param name="/raspicam_node/quality"  value="9"/>
edit flag offensive delete link more

Comments

Glad to hear you made some progress!

jarvisschultz gravatar image jarvisschultz  ( 2018-04-27 09:13:59 -0600 )edit
0

answered 2018-12-25 03:12:22 -0600

hallo guys merry christmas btw :P im in a project i have a raspi 3b+ and camera module v2 i create a catkin workstation in my raspi same as you i create a pkg but ii dont know how to get those pkg to my laptop with ethernet cable connected from raspi to my laptop (ubuntu mate in raspi and ubuntu 16.04on my laptop ) can you help me ? thanks btw for reading my bad english :P

edit flag offensive delete link more

Comments

1

Merry Christmas to you as well, but please don't post follow-up/related questions as answers on other questions.

Please post your own question.

gvdhoorn gravatar image gvdhoorn  ( 2018-12-26 07:22:33 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-21 17:34:34 -0600

Seen: 1,758 times

Last updated: Apr 26 '18