Understanding uorb aspects (reading queued topics)

Hi all,

I’m trying to understand how to work with queued topics (that is advertised with orb_advertise_queue or orb_advertise_multi_queue) - how can I copy out several messages from queue?

For example, let say gps driver publishes to topic gps_dump data of NMEA messages from 20Hz gps receiver. gps_dump.msg data array is limited by 79 bytes, so messages are published in topic with higher then 20Hz rate. The size of queue of gps_dump topic is 8.

Now my module subscribes on gps_dump topic and limit polling rate to 20Hz. On every update I would like to read out all messages that are currently in the queue, something like this:

if (fds[0].revents & POLLIN) {
	struct gps_dump_s report;
	uint8_t buf[79*4];			//up to 4 reports
	ammountR = 0;
	bool updated = true;

	//accumulate several reports in one message
	do {
		orb_copy(ORB_ID(gps_dump), gps_dump_sub_fd, &report);
		memcpy(buf+ammountR, (uint8_t*)report.data, (uint8_t)report.len);
		ammountR += (uint8_t)report.len;
		orb_check(gps_dump_sub_fd, &updated);
	} while ((updated) && (ammountR < 79*3));
	...

but every time I read out only one 79 bytes long message. This leads to lost messages (according to uorb top -a)

Of course, I can uprate polling rate of my module and it works, but I didn’t understand why orb topics can be queued at all then? I think that I missed something.

Thanks in advance for help!