Ros订阅者不是最新的 [英] Ros subscriber not up to date

查看:171
本文介绍了Ros订阅者不是最新的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为其中一个图片主题编写了ROS订阅者,并使用以下内容将我的缓冲区设置为:

I have written a ROS subscriber to one of the image topics and I have set my buffer to 1 using:

subscriber =rospy.Subscriber("/camera/rgb/image_mono/compressed",CompressedImage, callback,  queue_size=1)

然而,我的订阅者仍然落后。知道是什么原因造成的吗?我是否正确设置了队列大小?

However my subscriber still lags behind. Any idea what might be causing this? Am I setting the queue size correctly?

推荐答案

该队列用于排队传入的消息。这意味着,如果您的回调需要比新邮件到达更长的时间,则只保留队列大小,其他节点不会处理。

The queue is for queueing incoming messages. This means, if your callback takes longer to proccess than new messages arrive, only queue size is kept, the others are not processed by your node.

我建议在发布之前在发布者节点中打印出一条消息,并在回调方法的顶部打印一条消息。然后,您可以准确地衡量ros处理邮件所需的时间。所有其他时间问题都可能由您的回调方法引起。

I would suggest to print out a message in the publisher node before publishing and a message at the top of your callback method. Then you can exactly measure the time it takes for ros to handle your messages. All other timing issues will be possibly caused by your callback method.

这篇关于Ros订阅者不是最新的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆