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

subscriber fails

asked 2017-09-12 15:28:40 -0600

bill f gravatar image

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?

edit retag flag offensive close merge delete



Could you share your code here?

Ruben Alves gravatar image Ruben Alves  ( 2017-10-02 06:50:00 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-10-30 09:19:39 -0600

bill f gravatar image

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.

edit flag offensive delete link more


Thank you this is very helpful

أسامة الادريسي gravatar image أسامة الادريسي  ( 2017-11-04 01:41:58 -0600 )edit

Question Tools

1 follower


Asked: 2017-09-12 15:28:40 -0600

Seen: 469 times

Last updated: Oct 30 '17