Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This will get you the center of the grid cell:

map_x_coordinate_in_meters = (gridcell_x_coordinate * map.info.resolution) +
                             map_.info.origin.position.x +

map.info.resolution / 2; map_y_coordinate_in_meters = (gridcell_y_coordinate * map.info.resolution) + map.info.origin.position.y + map.info.resolution/ 2;

This will get you the center of the grid cell:

map_x_coordinate_in_meters = (gridcell_x_coordinate * map.info.resolution) +
                             map_.info.origin.position.x +
+

map.info.resolution / 2; map.info.resolution / 2; map_y_coordinate_in_meters = (gridcell_y_coordinate * map.info.resolution) + map.info.origin.position.y + map.info.resolution/ 2;

2;

This will get you the center of the grid cell:

map_x_coordinate_in_meters = (gridcell_x_coordinate * map.info.resolution) +
                             map_.info.origin.position.x + 
                             map.info.resolution / 2;
map_y_coordinate_in_meters = (gridcell_y_coordinate * map.info.resolution) +
                             map.info.origin.position.y +
                             map.info.resolution/ 2;

You are correct, a grid contains a lot of "map points" and that information was lost when codifying in a lower resolution (the grid) so you can only choose where the output map point is.

This will get you the center of the grid cell:

map_x_coordinate_in_meters = (gridcell_x_coordinate * map.info.resolution) +
                             map_.info.origin.position.x map.info.origin.position.x + 
                             map.info.resolution / 2;
map_y_coordinate_in_meters = (gridcell_y_coordinate * map.info.resolution) +
                             map.info.origin.position.y +
                             map.info.resolution/ 2;

You are correct, a grid contains a lot of "map points" and that information was lost when codifying in a lower resolution (the grid) so you can only choose where the output map point is.

This will get you the center of the grid cell:cel with "map" being a nav_msgs/OccupancyGridl:

map_x_coordinate_in_meters = (gridcell_x_coordinate * map.info.resolution) +
                             map.info.origin.position.x + 
                             map.info.resolution / 2;
map_y_coordinate_in_meters = (gridcell_y_coordinate * map.info.resolution) +
                             map.info.origin.position.y +
                             map.info.resolution/ 2;

You are correct, a grid contains a lot of "map points" and that information was lost when codifying in a lower resolution (the grid) so you can only choose where the output map point is.

This will get you the center of the grid cel with "map" being a nav_msgs/OccupancyGridl:nav_msgs/OccupancyGrid:

map_x_coordinate_in_meters = (gridcell_x_coordinate * map.info.resolution) +
                             map.info.origin.position.x + 
                             map.info.resolution / 2;
map_y_coordinate_in_meters = (gridcell_y_coordinate * map.info.resolution) +
                             map.info.origin.position.y +
                             map.info.resolution/ 2;

You are correct, a grid contains a lot of "map points" and that information was lost when codifying in a lower resolution (the grid) so you can only choose where the output map point is.

This will get you the center of the grid cel cell with "map" being a nav_msgs/OccupancyGrid:

map_x_coordinate_in_meters = (gridcell_x_coordinate * map.info.resolution) +
                             map.info.origin.position.x + 
                             map.info.resolution / 2;
map_y_coordinate_in_meters = (gridcell_y_coordinate * map.info.resolution) +
                             map.info.origin.position.y +
                             map.info.resolution/ 2;

You are correct, a grid contains a lot of "map points" and that information was lost when codifying in a lower resolution (the grid) so you can only choose where the output map point is.