For loop contaning a subscriber does just the first iteration
hi there, i want to do spiral trajectory using a PID controller, for that i used a for loop so that at each iteration it gives a new target. I used this code for the PID controller. Inside the for loop in my main code a callback function which is a methode in a class called when subscribing, the problem is that the code manages just the first iteration once the callback function is running it never stops. please any idea how to loop throw all the values Here you can find my code.
I'm not 100% sure I understand your question. But when you says the callback never stops, do you mean it never comes back to the 'main'? If that is your concern, remember that spin() never returns, spinonce() will return.
Please post your complete code when asking a question. If there is a lot of code, then putting it on Github and giving us a link to the repository, or creating a Gist (but never delete it or the question will become useless!) would be easier.
Yeah, Actually thats what i meant it never get back to the main function and i will post the whole code
sorry dont know how to creat a Gist but i posted all the codes i used ( two classes and the main code). And for spinOnce it didn't work, it didn't even run the callback function. please any other ideas!!
You haven't posted all your code. Where are the header files?
The link that I posted above explains how to create a gist.
You should try and reduce your code down a minimal program that has the same problem, fix the problem, then add features.
@Geoffhere it is the link for my code,any suggestion is appreciated