Ros threading to have multiple processes?
So basically, what I want to have is this:
1) Have ROS collect data, and process this data into a vector. (This is done)
2) Once the data has been recorded, write the vector to a text file (Not done)
The problem that I have is, how do I stop ros from spinning? How can I then just simply run the function which writes the text to the file?
I've been thinking along the lines of threading, I create a thread that subscribes handles the callback function and another thread that handles writing to the text file. So in essence, the plan would be to have thread1
run for a set amount of time, then halt thread1
and begin to start thread2
Is this possible using ROS? And, is this the only method to solving the above?
Thanks
Do you want to do 1) and 2) repeatedly, or just once? In any case try checking out the suggestion by @ahendrix.