I would like to know whether it is safe or bad practice to spin ROS inside a while loop that exists inside a service callback. I am unable to use actions for this particular goal, and have confirmed that spinOnce inside the loop behaves as I expected, but before I go further I wanted to see if I was missing anything. Basically, there will be another process that will break the while loop and return either true or false based on the purpose of the break.
Edit: This question originally pertained to C++ packages, but has since also started to focus on python. Basically, I may have a service that is called, but should not respond until another action has finished (communications). I do not want this pause to effect other functions of the package, so I would like to find a way to have the service wait on responding, but spin ROS and let other callbacks react. I see that AsyncSpinner may be a good solution, but not sure of one for python.
Originally posted by orion on ROS Answers with karma: 213 on 2014-01-16
Post score: 0