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

Revision history [back]

click to hide/show revision 1
initial version

First, for your tests there is a simple tool: rostopic hz will tell you the data-rate a topic is published at.

For your actual problem: Yes, there is an elegant way to limit the topic to, e.g. 2 msg/s = 0.5Hz. You can use the throttle tool in topic_tools that will republish a given topic at a specific rate. You then subscribe the ..._throttle topic at a lower rate.

For the case of pointclouds here is an example launch file that uses a nodelet to throttle the topic. I'm not sure if there is a nodelet throttle yet.

Regarding threading: Yes, as long as you don't spin your callback is not called anymore and the queue will fill up. On the other hand you can put the spinning in another thread and not miss messages. It's just a matter of what behavior you want. The article about Callbacks and Spinning contains more detail about this.

First, for your tests there is a simple tool: rostopic hz will tell you the data-rate a topic is published at.

For your actual problem: Yes, there is an elegant way to limit the topic to, e.g. 2 msg/s = 0.5Hz. You can use the throttle tool in topic_tools that will republish a given topic at a specific rate. You then subscribe the ..._throttle topic at a lower rate.

For the case of pointclouds here a nodelet will be more efficient. Here is an example launch file that uses a nodelet to throttle the topic. I'm not sure if there is a nodelet throttle yet.

Regarding threading: Yes, as long as you don't spin your callback is not called anymore and the queue will fill up. On the other hand you can put the spinning in another thread and not miss messages. It's just a matter of what behavior you want. The article about Callbacks and Spinning contains more detail about this.