ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I had my problem fixed. I used the second method that I discussed in my question( the one that says b).
From my understand the issue could be that no more messages/data was being available on that topic. Thus there was no data for the subscriber to trigger the callback.
Thus I simply check if the callback was called or not using a variable(global) before calling spinOnce and change the variable value inside the callback function, and after my spinOnce function i check the value of this variable.