Ask Your Question
2

[rospy] Disable message queue

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

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 -0500

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 -0500

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 imagejuancamilog ( 2013-08-13 20:00:34 -0500 )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

Stats

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

Seen: 502 times

Last updated: Apr 12 '13