On Tue, Nov 9, 2010 at 1:18 PM, Josh Faust wrote: >>  * Are the callbacks invoked in the nodelet thread (by default), >> similar to a node? (I assume "yes".) > > This depend on which nodehandle you use.  The one returned by > get(Private)NodeHandle() guarantees that callbacks will not happen in > multiple threads at once, but the thread they're called from may be > different from call to call. > The one returned by getMT(Private)NodeHandle() allows callbacks in multiple > threads at the same time. That helps. The documentation could use a bit more detail about the threading model: http://www.ros.org/doc/api/nodelet/html/classnodelet_1_1Nodelet.html >>  * Is there any special hook for shutting down a nodelet? I don't see >> anything like an onExit() method. > > The destructor. Sure. I assume the callbacks just don't get called any more.  But, a device thread (see below) needs to know when to terminate. Does it still check ros::ok() or ros::shutdown()? >>  * Can a device driver run its entire main loop in the onInit() method >> using "while (ros::ok()) { ... }"? > > No, onInit() needs to return.  If you need to do some kind of polling loop > you need to start your own thread. OK, thanks. That seems to explain most of the problems I am seeing. Presumably, this thread will *not* be serialized with respect to callbacks. So, I will need my own locks in some situations. --  joq