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

[rospy] Disable message queue

asked 2013-04-09 23:20:25 -0600

liborw gravatar image

Hi,

I have a some computation that takes a while connected to topic. I wan't that next message for computation is as fresh as possible. I have tried setting the queue to zero which results in error and setting it to one doest much help.

sub = rospy.Subscriber("~input",i nput_cb, queue_size = 1)

Test output:

[INFO] [WallTime: 1365585376.358492] msg is 0.2299852 s old!
[INFO] [WallTime: 1365585377.532643] msg is 1.3721399 s old!
[INFO] [WallTime: 1365585378.706446] msg is 1.4059465 s old!
[INFO] [WallTime: 1365585379.863709] msg is 2.5273464 s old!
[INFO] [WallTime: 1365585383.380832] msg is 2.5602341 s old!
[INFO] [WallTime: 1365585385.704427] msg is 2.5397372 s old!
[INFO] [WallTime: 1365585386.877181] msg is 2.5365553 s old!
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2013-04-10 01:28:57 -0600

I'm not sure what's wrong with that code, but you can achieve what you want to do by using rospy.wait_for_message instead of a Subscriber.

edit flag offensive delete link more
1

answered 2013-04-12 06:00:42 -0600

tfoote gravatar image

Your delay may be coming from the publisher queue as well. You should make sure that it is small/size 1 too.

edit flag offensive delete link more

Comments

What if your publisher is a python node? There is no queue size parameter for publishers in rospy.

juancamilog gravatar image juancamilog  ( 2013-08-13 20:00:34 -0600 )edit

Question Tools

Stats

Asked: 2013-04-09 23:20:25 -0600

Seen: 813 times

Last updated: Apr 12 '13