hi everyone, my name is João and i'm working on map merge for multi-robot slam. I'm testing on ROS and i found this topic about dereferencing boost::shared_prt<>. i want to do alignment of 2 parcial maps to one global map. The parcial maps are subscribed from robot_0/map and robot_1/map... my problem i think is in the callback function, because the type is (const nav_msgs::OccupancyGrid::ConstPtr& mp_0) and i m trying to get with a (boost::shared_ptr<nav_msgs::OccupancyGrid>). i already spend much time with this without success... i hope someone could give me a solution for this
######################## CODE #####################################
using std::vector;
using boost::assign:
perator+=;
using occupancy_grid_utils::Cell;
typedef vector<Cell> Path;
typedef boost::shared_ptr<nav_msgs::OccupancyGrid> GridPtr;
typedef boost::shared_ptr<nav_msgs::OccupancyGrid const> GridConstPtr;
//GridPtr g0, g1;
GridPtr g0(new nav_msgs::OccupancyGrid());
GridPtr g1(new nav_msgs::OccupancyGrid());
//GridConstPtr GridPtr_0, GridPtr_1;
/**
* CALLBACK para receber os mapas!
*/
void mp_0Callback(const nav_msgs::OccupancyGrid::ConstPtr& mp_0){
//ROS_INFO("CELL=%d",mp_0->data[0]);
//Grid_0 = *mp_0;
//GridPtr_0 = mp_0;
g0 = boost::const_pointer_cast<nav_msgs::OccupancyGrid>(mp_0);
//ROS_INFO("CELL(0,r0)=%d",GridPtr_0->data[0]);
}
void mp_1Callback(const nav_msgs::OccupancyGrid::ConstPtr& mp_1){
//GridPtr_1 = mp_1;
g1 = boost::const_pointer_cast<nav_msgs::OccupancyGrid>(mp_1);
//ROS_INFO("CELL(0,r1)=%d",GridPtr_1->data[0]);
}
######################################