Allow ros console macros to be reused for node / nodelet code
Low priority, wait til rainy day:
It would be nice to automatically handle the appropriate behavior based on if the software was running from a node or a nodelet.
It seems the best way to write a nodelet is to:
- Underlying ROS agnostic library
- ROS Class around library that uses nodehandles
- Nodelet that instantiates class
- Node that instantiates class
This provides the advantages of nodelets while still allowing stable debugging and separation with a pure node implementation. This helps to allow easier problem identification and more flexible use over other implementations that either load a nodelet programatically or duplicate often complex wrapper code
However, for step 2) Using the rosconsole macros is difficult, as the Class does not know if its a nodelet for a node. It could be possible to define in the class, all of the possible combinations and provide new macros based on a "is_nodelet" variable, but it would be cleaner for users if this was either automatically detected or had a standardized header and interface available.
Here's an example of this layout. Note that currently I use ROS_****, even inside the nodelet. This causes the output to look like it's from the manager. https://github.com/ros-perception/depthimage_to_laserscan
tl;dr: It would be great to reuse ROS_INFO for both nodelets and nodes and have the getName() autodetect where its coming from.
The API of nodes and nodelets is by design different. It is unlikely that this will be changed in the near future (without breaking API). Therefore marking this with milestone untargeted.