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

is there a way to publish topics of the same node at different rates

asked 2017-05-14 07:55:37 -0500

johnd gravatar image

I have a single node publishing 5 topics and would like to publish them at different rates. (Python)

edit retag flag offensive close merge delete

Comments

4

Probably not something you'll want to hear, but what have you tried yourself already? How much programming experience do you have? If I say: sure, just use different threads / timer callbacks, does that mean anything to you?

gvdhoorn gravatar image gvdhoorn  ( 2017-05-14 08:03:27 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-05-15 11:05:31 -0500

lucasw gravatar image

http://wiki.ros.org/rospy/Overview/Ti...

def update1(event):
    pub1.publish(msg1)

def update2(event):
    pub2.publish(msg2)

def update3(event):
    pub3.publish(msg3)
...

rospy.Timer(rospy.Duration(1.0 / rate1), update1)
rospy.Timer(rospy.Duration(1.0 / rate2), update2)
rospy.Timer(rospy.Duration(1.0 / rate3), update3)
...
edit flag offensive delete link more

Question Tools

Stats

Asked: 2017-05-14 07:55:37 -0500

Seen: 1,056 times

Last updated: May 15 '17