0
$\begingroup$

Rosanswers logo

I have a ros application that subscribes to a published topic, when starting the application every now and then the subscriber will not go into the callback associated with it. I know this because I am subscribing to periodic data and I have a counter in the callback, sometimes the counter is not being incremented. I do not see any errors doing roswtf and using rostopic info on the topic shows that the subscriber is properly subscribed. I am only able to recover from it by detecting it and then restarting the system. I am currently testing to see if the ros::Subscriber returns false when it is initialized when this problem occurs (havent gotten the error to happen yet). My question is, is there any way I can know if this problem happens and if so, is there any way I can recover from it? Also, is there any way to prevent this from happening?


Originally posted by bill f on ROS Answers with karma: 36 on 2017-09-12

Post score: 0


Original comments

Comment by Ruben Alves on 2017-10-02:
Could you share your code here?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I resolved this issue, it seems to be specifically when the subscriber has a queue size of 1, if it fills up before the callback is serviced then that slot is forever full and all inbound messages are dropped. Changing the queue size to something larger than 1 resolved the issue.


Originally posted by bill f with karma: 36 on 2017-10-30

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by أسامة الادريسي on 2017-11-04:
Thank you this is very helpful

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.