Ask Your Question
5

Throttle message rate for subscribers

asked 2011-09-20 20:06:21 -0600

I have a publisher with a high data rate (approx. 100 Hz) and multiple subscribers. One of them requires the full data rate, while another is quite happy with one message per second.

My simple solution for the latter is to process every 100th message only, but I was wondering if ROS provides a more elegant solution, such as a message filter or a subscription option which lets me choose the desired message rate.

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
3

answered 2011-09-20 20:36:19 -0600

In fact, ROS does. What you're looking for is the drop node from topic_tools.

edit flag offensive delete link more

Comments

Thanks for the link. In this particular instance, I would prefer a way to control the rate from within my own node (C++), but I'll keep this package in mind for future reference.
roehling gravatar imageroehling ( 2011-09-20 21:32:05 -0600 )edit
2

answered 2011-09-21 02:41:41 -0600

joq gravatar image

For future reference, REP 106 on polled topics is proposed for Fuerte.

Among other things, that will allow an individual subscriber to request that the publisher transmit messages at a lower frequency.

edit flag offensive delete link more

Comments

the REP has been updated to Withdrawn because the proposed functionality will not be implemented for the current ROS client libraries`

lucasw gravatar imagelucasw ( 2017-07-30 10:11:33 -0600 )edit
0

answered 2011-10-25 07:26:23 -0600

Constantin S gravatar image

Answer/Question. Is there a problem with throttling your subscriber using a sleep statement? Put your subscriber to sleep for 1 second, then poll the topic for the newest message? Or do the callbacks wake sleeping subscribers? Or after sleeping do you get the oldest (as opposed to the newest) message in the queue ... which I guess you could handle by setting the queue to size 1.

edit flag offensive delete link more

Comments

I gave this a try in response to #q267413 : https://github.com/lucasw/topic_throttle it looks to be working ok and uses a little less cpu than regular topic_tools throttle (which invokes a callback at the full publisher rate). But maybe it is still a bad approach for some reason?

lucasw gravatar imagelucasw ( 2017-07-30 10:15:36 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2011-09-20 20:06:21 -0600

Seen: 5,560 times

Last updated: Oct 25 '11