Hey all! Suppose some node is publishing to some topic with a rate of 5 hz, and I want to build a subscriber for that topic (and to print the msg for example) but to print the msg in a lower rate for example 2 hz. How can I do it? thanks a lot!

asked 03 Sep '18, 08:22

MoranNechushtan's gravatar image

accept rate: 100%

Hello @MoranNechushtan,

You can define a loop rate for your subscriber, independently of your callback method. In this case, you can set a global variable in the callback method and print it in the main loop its value. Although, you may not have all the values printed, since the publisher works in a higher frequency.

Let me know if I clarify how to do it!


permanent link

answered 08 Sep '18, 13:52

marcoarruda's gravatar image

marcoarruda ♦♦
accept rate: 18%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 03 Sep '18, 08:22

question was seen: 319 times

last updated: 08 Sep '18, 13:52

powered by OSQA