Nodelets general confusion
Hello,
I am trying to understand the whole nodelet concept, since there are bits here and there all over forums but I cannot find one whole info about it.
What I know so far:
Why use nodelets: zero-copy communication, no serialization of data, only thing sent is the pointer
A little bit harder to implement, but nothing hardcore.
What I believe:
Zero-copy communication works ONLY between nodelets, and they MUST be loaded inside of single node. Otherwise they work as regular nodes.
Nodelet manager is any node, which is responsible for loading the nodelets.
Why am I even asking:
I am working with Velodyne VLP-16 LIDAR. They have transform_nodelet, which publishes lidar data to PointCloud2 format. I would like to read that data inside of my NODE, but what I understood so far is, if I load transform_nodelet from my NODE and if I subscribe to "velodyne_points" topic (which transform_nodelet publishes to) from my NODE, I would not be using zero-copy message, because it is NODE, not nodelet. Is this true?
Then if I were to implement my NODE as nodelet and if I wanted to publish my processed data to another topic, there is one other thing I don't understand. I've read, that if the whole nodelet concept should work, the callbacks have to have constPtr& as argument and the publisher should not change the data he just sent. So what I am confused about is, how to actually create messages and send them from nodelets. Should I always do something like:
CustomMes *message = new CustomMes();
message->mem = 5; //for example
publisher.publish(*message);
So if I will be creating another message, I won't be overwriting over the one already sent. Do I understand this correctly?
Also, what is the point of having handle to node_manager, and private nodelet_node_handle? Does it matter from which handle do I subscribe, or publish?