Main Content

show

Display terrain traversability map layer

Since R2025a

Description

show(map) displays the traversability grid map map in the current axes.

show(map,frame) displays the traversability grid map map in the current axes, with the axes labels representing the specified reference frame.

himage = show(___) returns the handle to the image object created by show.

show(___,Name=Value) specifies additional options specified by one or more name-value arguments.

example

Examples

collapse all

Create a sample digital elevation model and define the resolution of the map. The resolution determines the grid cell size in meters, balancing detail, and computation cost.

load("pitMineDEM.mat", "elevationModel", "resolution")

Create the traversability map object for terrain navigability analysis and visualization.

map = traversabilityMap(elevationModel, resolution);

Define thresholds for terrain properties such as slope, step height, and roughness.

In this case, areas with slope lesser than or equal to 10° are considered safe whereas areas with slope greater than 15° are non-traversable.

map.SlopeThreshold = [10, 15] * pi / 180;  % in radians

Areas with a step height below 1m are considered safe, while those above 2m are considered critical, within a window size of 6m. We assume this window size for step height computation to be equal to the length of the vehicle.

map.StepHeightThreshold = [1, 2]; % in metres
map.StepHeightWindowSize = 6; % in metres

Areas with roughness below 0.1 are considered safe and that above 0.3 are considered critical.

map.RoughnessThreshold = [0.1, 0.3]; % in metres

Assign custom cost weights to these terrain properties. The cost weights assign a relative importance to each property in computing the overall traversability cost of terrain. These weights are normalized, meaning their sum should ideally equal 1 for intuitive scaling.

For an offroad vehicle, set the cost weight of slope to 0.7 to prioritize avoiding steep slopes, step height to 0.2 assuming that the vehicle can handle moderate steps but should still avoid large ones, and roughness to 0.1 as an uneven terrain such as gravel, is less critical to the vehicle's ability to move.

map.CostWeight = [0.7, 0.2, 0.1];

Display the map with a colorbar to visualize the cost distribution.

figure;
ax = show(map, "grid");

Input Arguments

collapse all

Map representation, specified as a object. This object represents the environment of the vehicle.

Map reference frame, specified as either "local" or "grid". The map axes labels represent the specified reference frame.

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'Parent',axHandle

Axes to plot the map specified as either an Axes or UIAxesobject. See axes or uiaxes.

Option to enable colorbar corresponding to Colormap input, specified as a scalar logical.

Colormap values used for the pixel values in the image, specified as a N-by-3 matrix. If no colormap values are provided, the pixel values in the image takes the current colormap of the axes.

Update existing map plot, specified as 0 or 1. If you previously plotted your map on your figure, set to 1 for a faster update to the figure. This is useful for updating the figure in a loop for fast animations.

Extended Capabilities

expand all

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

Version History

Introduced in R2025a

See Also

Objects

Functions