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

Revision history [back]

You have (at least) three publish calls in the callback callback:

marker_publisher.publish(faces) marker_publisher.publish(faces_caption) marker_publisher.publish(est_pose)

This means, for every message you get, you publish (at least) three. This would lead to "bursts" of three messages on the box_visual topic. Then silence for roughly 1/40 s, and another three messages. As the frequency obtained by rostopic hz (which I assume you got the numbers from) is more an "average" frequency, i.e. number_of_messages/time, this could, depending on some timing issues, lead to the "unstable" frequency of around 120 Hz.

If you want to have approximately the same frequency of the outgoing topic, you should just publish one. If you need to publish multiple markers, consider using a MarkerArray.

You have (at least) three publish calls in the callback callback:

marker_publisher.publish(faces) marker_publisher.publish(faces_caption) marker_publisher.publish(est_pose)

This means, for every message you get, you publish (at least) three. This would lead to "bursts" of three messages on the box_visual topic. Then silence for roughly 1/40 s, and another three messages. As the frequency obtained by rostopic hz (which I assume you got the numbers from) is more an "average" frequency, i.e. number_of_messages/time, this could, depending on some timing issues, lead to the "unstable" frequency of around 120 Hz.

To explicitly state this: Your callback is firing with the expected 40Hz and not running faster then the received message, you publish multiple times to the same topic from within the callback.

If you want to have approximately the same frequency of the outgoing topic, you should just publish one. If you need to publish multiple markers, consider using a MarkerArray.