Calling ros::spinOnce() in nodelets?
Is it possible to integrate a while(true){ros::spinOnce(); ..}
loop into a nodelet? I've based mine on the velodyne_driver nodelet, which runs a separate thread which polls the device object.
That while loop never sleeps though, and as the camera driver is a publisher, it doesn't have any callbacks to process, so there is no ros::spinOnce()
either. I was wondering if that could be added there (to be able to handle callbacks) or if that would clash with the nodelet's manager?
EDIT: I know the manager handles the spin logic, it actually calls spinOnce()
after a 1e6 us usleep (which is equal to what ros::spin()
does). What I'm really after is a way to reduce that sleep time. I'm guessing that is not possible without changing and recompiling the nodelet manager, but hoping I'm wrong.
EDIT2: ^ all wrong. See @Lorenz's answer.