Api/Method to know ros2 subscriber queue is empty or not

asked 2022-08-23 06:47:58 -0500

TinyTurtle gravatar image

Hi, I am using ROS2 foxy on Ubuntu 20.04.

I have a node Node A which publishes Msg A on topic Topic_A. I have another node Node B which subscribes to the topic Topic_A published by Node A.

I would like to write on the data subscribed by Node B to a file. This file is written in the end, which means only after Node A has completely published all the data. The data subscribed by Node B is stored in a vector and written to file once Node A has finished publishing.

Now, I can add a variable/flag to the Msg A telling when it is finished or I can also add a new publisher to tell when Node A had finished publishing. But these two options are ruled out(due to architectural reasons).

I would like to know if there is already a ROS2 API/Method to check/know if ros2 subscriber queue has finished processing all the received callbacks.

edit retag flag offensive close merge delete