Grid Coordinates from World Coordinate Inputs
When setting occupancy locations, you can input the locations in either grid or world coordinates. However, based on the limits of the grid, the locations are set to the closest grid locations. Edges of the grid belong to the lower-left grid location.
Show how locations are intepreted on the grid by creating an occupancy grid and setting points as occupied by obstacles. Then, plot the orginial input points over the map to show how they are interpreted. If any point within the grid cell is set as occupied, the entired grid cell is set as occupied.
Create an occupancy grid map and set obstacle locations.
map = robotics.BinaryOccupancyGrid(10,10,5); xy = [5 5; 4.3 4.4; 5.6 5.3]; setOccupancy(map,xy,1);
Display the map, orginial points, and set the axes limits to zoom in. You can see how the edge points affect the entire grid location status.
show(map); hold on plot(xy(:,1),xy(:,2),'xr','MarkerSize', 20) grid on set(gca,'XTick',0:0.2:10,'YTick',0:0.2:10) xlim([4 6]) ylim([4 6])