Unable to output the costmap_2d occupancy grid array
Here's how my code looks -
costmap_2d::Costmap2DROS *global_costmap = new costmap_2d::Costmap2DROS("global_costmap", buffer);
I have specified the following params in my configuration file -
global_frame: odom
rolling_window: true
track_unknown_space: true
plugins:
- {name: obstacles_laser, type: "costmap_2d::ObstacleLayer"}
- {name: inflation, type: "costmap_2d::InflationLayer"}
I am able to publish the occupancy grid using the terminal by running rostopic echo -n1 /global_costmap/costmap.
However, when I add the following line to my code -
unsigned char* global_og = global_costmap->getCostmap()->getCharMap() ;
cout << global_og[10] << endl;
I see some strange characters being published.