Main Content

grid2world

Convert grid indices to world coordinates

Description

example

xy = grid2world(map,ij) converts a [row col] array of grid indices, ij, to an array of world coordinates, xy.

Examples

collapse all

Create an empty binary occupancy map with a width and height of 10 meters.

map = binaryOccupancyMap(10,10);

Get world coordinates from grid indices.

[i,j] = meshgrid(1:5);
xyWorld = grid2world(map,[i(:) j(:)]);

Input Arguments

collapse all

Map representation, specified as a binaryOccupancyMap object. This object represents the environment of the robot. The object contains a matrix grid with binary values indicating obstacles as true (1) and free locations as false (0).

Grid positions, specified as an n-by-2 vertical array of [i j] pairs in [rows cols] format, where n is the number of grid positions.

Output Arguments

collapse all

World coordinates, specified as an n-by-2 vertical array of [x y] pairs, where n is the number of world coordinates.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced in R2015a