Message vs. Message::Ptr
Hello, I do have troubles understanding the concept of messages regarding pointers. In this tutorial at the chatterCallback the argument msg is from type ::ConstPtr. What exactly does this ::ConstPtr mean? why is it not just const st_msgs::String? Also I saw that sometimes instead of String::ConstPtr StringConstPtr is used. Whats the difference here. As I realy would like to understand this concept with Message::ConstPtr, Message::Ptr, MessagePtr, MessageConstPtr I look for some kind of tutorial but can't find anything.
To give some example what my current problem is, here some code that does compile without troubles, but as soon as I run the code the node dies.
nav_msgs::OccupancyGrid::Ptr occGrid; [ORIGINAL = FALSE]
nav_msgs::OccupancyGrid::Ptr occGrid(new nav_msgs::OccupancyGrid()); [EDIT = WORKING]
for (int i=0; i<100; i++) {
occGrid->data.push_back(0);
}
/* fill header and info field */
gridmap_2d::GridMap2DPtr map( new gridmap_2d::GridMap2D(occGrid));
/* use map as function argument */
As I realy would like to understand this ::Ptr issue a link to some tutorials or useful readings would be great!
Thanks Johannes