Hi Nick,

On Sat, Dec 4, 2010 at 12:36 PM, Nicholas Butko <nbutko@ucsd.edu> wrote:

On Dec 4, 2010, at 12:14 PM, Radu Bogdan Rusu wrote:

>
> On 12/04/2010 12:12 PM, Nicholas Butko wrote:
>>>
>>>> But, does a nodelet run as standalone basically run just as well as an
>>>> ordinary node? If the overhead of the standalone nodelet is zero in
>>>> terms of speed and small in terms of memory footprint (are those valid
>>>> assumptions?), then creating a node from the beginning as a nodelet
>>>> seems like the way to go as you can easily combine it with a nodelet
>>>> manager down the road, without a recompile.
>>>
>>>
>>> Yup!
>>>
>>
>> Then, is there any advantage to creating nodes as nodes instead of nodelets?
>
> Sure. If a nodelet dies, the entire process might die. Nodes are more "robust", as you can restart/respawn them individually.

Could you achieve the same behavior by having a separate nodelet manager for each nodelet? For example, would it be easy to write a shell script that starts a uniquely named nodelet manager and assigns a single nodelet to it? Call such a script "rosrun_nodelet" for example. Then you could run a single piece of code as a nodelet or a node.
 
The nodelets have a standalone mode which is exactly that.  Use the standalone argument. 

nodelet usage:
nodelet load pkg/Type manager - Launch a nodelet of type pkg/Type on manager manager
nodelet standalone pkg/Type   - Launch a nodelet of type pkg/Type in a standalone node
nodelet unload name manager   - Unload a nodelet a nodelet by name from manager
nodelet manager               - Launch a nodelet manager node


I am thinking of transferring a bunch of my nodes to nodelets, and I guess I want to know what people at WG are finding "best practices" are. Do you find yourself coding every new node as a nodelet, or only when it's absolutely necessary? Are there any good strategies for hybrid nodes/lets? How easy is it to write a main function that "runs" a nodelet as a node?


Nodelets cannot be run as nodes themselves.  When designing roscpp and rospy we worked hard not to wrap your main thread while nodelets require the manager and do not give access to the main thread.  You can instantiate a nodelet manager as a Class in any node so any node can be a hybrid.  And the hybrid nodes still get the transport efficiencies.  This was specifically designed with the thought of being able to load processing into nodes like drivers. So raw data would never go over the network. 

Tully