roslibpy icon indicating copy to clipboard operation
roslibpy copied to clipboard

How can I publish the messages at a certain frequency ?

Open aakashsehgal opened this issue 6 years ago • 5 comments

I have a subscriber node in ROS where a callback is implemented which makes it dependent on the frequency of the publisher. Now I want to publish messages to this subscriber node through rosbridge and i am using roslibpy for that.

Currently I am using the sleep function but i want to avoid using that.

What is basically the throttle_rate parameter. I tried to play with this but did not help. Is there some ros::rate() type of functionality with which i can send messages at a certain fixed frequency ?

Also, if no sleep is used, then what is the default rate of publishing ?

When I use rostopic hz on the ros side, then it shows me somewhere around 850ms

System Information

Windows 10, ROS melodic

aakashsehgal avatar Jan 14 '19 14:01 aakashsehgal

+1 on the rate param appearing to have no effect. See https://answers.ros.org/question/313844/roslibpy-why-does-tfclient-seem-to-ignore-the-rate-parameter/. Also: we've found this to be a very useful library; thanks for putting it out there.

rarmstrong22 avatar Jan 28 '19 19:01 rarmstrong22

What is basically the throttle_rate parameter

throttle_rate is only used for subscriptions. Beware, it is not actually a rate, but the interval in milliseconds!

Is there some ros::rate() type of functionality with which i can send messages at a certain fixed frequency ?

One option: Timer.

mathias-luedtke avatar Jan 28 '19 19:01 mathias-luedtke

Beware, it is not actually a rate, but the interval in milliseconds!

Ah! Is this also true for the rate paramter to TFClient? (I guess I could just look in the code :)

rarmstrong22 avatar Jan 28 '19 20:01 rarmstrong22

Ah! Is this also true for the rate paramter to TFClient

No, I am talking about throttle_rate. Your problem is unrelated to this issue.

mathias-luedtke avatar Jan 28 '19 20:01 mathias-luedtke

No, I am talking about throttle_rate. Your problem is unrelated to this issue.

Just looked in tf2_web_republisher and I can see it now; thanks.

rarmstrong22 avatar Jan 28 '19 20:01 rarmstrong22