Main Content

syncWith

Sync map with overlapping map

Description

mat = syncWith(map,sourcemap) updates map with data from another binaryOccupancyMap object, sourcemap. Locations in map that are also found in sourcemap are updated. All other cells in map are set to map.DefaultValue.

example

Examples

collapse all

This example shows how to sync two overlapping maps using the syncWith function.

2-D occupancy maps are used to represent and visualize robot workspaces. In this example 2-D occupancy maps are created using existing map grid values stored inside exampleMaps.mat.

load('exampleMaps.mat');

Create and display a new empty 2-D occupancy map object using binaryOccupancyMap function.

map1 = binaryOccupancyMap(70,70); 
show(map1) 
title('New Map')

Figure contains an axes object. The axes object with title New Map, xlabel X [meters], ylabel Y [meters] contains an object of type image.

Create and display 2-D occupancy map using the map grid values stored in complexMap.

map2 = binaryOccupancyMap(complexMap); 
show(map2)
title('Complex Map')

Figure contains an axes object. The axes object with title Complex Map, xlabel X [meters], ylabel Y [meters] contains an object of type image.

Now update map1 with map2 using the syncWith function.

syncWith(map1,map2);
show(map1)

Figure contains an axes object. The axes object with title Binary Occupancy Grid, xlabel X [meters], ylabel Y [meters] contains an object of type image.

Input Arguments

collapse all

Map representation, specified as a binaryOccupancyMap object.

Map representation, specified as a binaryOccupancyMap object.

Extended Capabilities

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

Version History

Introduced in R2019b

See Also

| (Navigation Toolbox)