ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You could use a shared memory buffer if you really want to have a shared global state. Or, you could publish the number of messages published on a separate topic. Anyone interested could subscribe to that topic. In the callback, you would copy the number from the message into a local variable, and this should (most of the time) correspond to the actual number of sent messages, from which you can calculate the number in the queue.