Execute code after finished subscription.

asked 2020-12-20 14:10:12 -0500

fotiskallinteris gravatar image

Hello everyone, i am having the following issue:

I want to subscribe to a topic, /move_base/global_costmap/costmap more specifically, in order to get the data and save it in an object of my class. After finished subscription and got the data I want to move on and make some transformations on the data. I want the transformation to be done outside the callback function. My problem is that when i try access that object, before it hasnt finished subscription it results in an error. I have tried to put a ros::spin() and the a shutdown() inside the callback but the code after spin() is never executed. How can I overcome this issue? Thank you!

edit retag flag offensive close merge delete

Comments

Can you post your code here? Also, please format the code properly after posting;

skpro19 gravatar image skpro19  ( 2021-05-02 13:09:29 -0500 )edit