Main Content

traversabilityMap

Create traversability map using digital elevation data of terrain

Since R2025a

Description

The traversabilityMap object creates a traversability map object from digital elevation model (DEM) data of uneven terrain and assess terrain navigability through geometric properties such as slope, step height, and roughness. You can specify thresholds and relative cost weights for these properties and visualize the resulting traversability map using the show function.

Conversion of point cloud data to digital elevation model to traversability map

The traversability map estimates the navigability of offroad terrain by calculating traversability costs based on terrain digital elevation model at specific grid locations using point cloud data.

Creation

Description

map = traversabilityMap creates a traversabilityMap for a flat terrain of length and width equal to 100 meters and default resolution of 1 cell per meter.

map = traversabilityMap(elevmodel) creates a traversabilityMap object from a 2-D matrix, elevmodel, containing the digital elevation model for a terrain with default resolution of 1 cell per meter. The first dimension of elevmodel matrix corresponds to the y-axis and second dimension to the x-axis.

map = traversabilityMap(elevmodel,res) creates a traversabilityMap object from a 2-D matrix, elevmodel, containing the digital elevation model for a terrain with the Resolution property, specified as cells per meter.

example

map = traversabilityMap(___,Name=Value) specifies properties using one or more name-value arguments.

Input Arguments

expand all

Digital elevation model of terrain, specified as a 2-D matrix.

Properties

expand all

Slope threshold of traversability map, stored as a two-element vector of the form [safe threshold value, critical threshold value] in radians. The critical threshold value must be greater than or equal to the safe threshold value.

To disable slope for traversability estimation, set SlopeThreshold to inf.

Data Types: double

Slope threshold of traversability map, stored as a two-element vector of the form [safe threshold value, critical threshold value] in meters. The critical threshold value must be greater than or equal to the safe threshold value.

To disable roughness for traversability estimation, set RoughnessThreshold to inf.

Data Types: double

Size of the square window used in meters, specified as a two-element vector of the form D/(map.Resolution).

The algorithm computes the step height using [k x k] neighbors, where k is equal to round(StepHeightWindowSize*Resolution). The value k must be an odd number to ensure equal number of neighbors around a given cell. If k is even, the algorithm converts it to an even number by adding 1. The minimum value of k must be 3.

Data Types: double

Step height threshold of traversability map, stored as a two-element vector of the form [safe threshold value, critical threshold value] in meters. The critical threshold value must be greater than or equal to the safe threshold value.

To disable step height for traversability estimation, set StepHeightThreshold to inf.

Data Types: double

Weight assigned to slope, roughness, and step height costs to compute the costs between safe and critical thresholds, specified as a three-element vector of the form [slope cost weight, roughness cost weight, step height cost weight].

If you provide a scalar value, the traversabilityMap object applies this value uniformly to all costs. During cost computation, the weights are normalized to ensure the total cost remains less than 1.

If any critical thresholds for slope, roughness, or step height are set to inf, the corresponding weight is ignored, and the remaining weights are normalized.

Data Types: double

Location of the bottom-left corner of the grid in local coordinates, specified as a two-element vector, [xLocal yLocal].

Data Types: double

This property is read-only.

Grid resolution, specified as a scalar in cells per meter.

This property is read-only.

Minimum and maximum values of x-coordinates in local frame, specified as a two-element vector of the form [min max].

This property is read-only.

Minimum and maximum values of y-coordinates in local frame, specified as a two-element vector of the form [min max].

Object Functions

copyCreate copy of traversability map
getMapDataRetrieve data from traversability map layer
showDisplay terrain traversability map layer

Examples

collapse all

Create traversability map with a sample digital elevation model (DEM) and set the map resolution.

The resolution sets the size of each grid cell in meters. A smaller value of resolution gives finer details.

resolution = 1.25; % cells per meter
[xdata, ydata] = meshgrid(0:resolution:100, flip(0:resolution:100)); % x and y axes data of the terrain
elevationModel = peaks(size(xdata,1)); % Terrain elevation in meters
elevationModel(elevationModel<0) = 0; % Discard valleys

Visualize digital elevation model (DEM) of the terrain.

figure;
surf(xdata, ydata, elevationModel, EdgeColor="none");
xlabel('X [m]')
ylabel('Y [m]')
zlabel('Elevation [m]')
view(2)
colorbar

Create traversability map from the digital elevation model (DEM).

map = traversabilityMap(elevationModel, resolution)
map = 
  traversabilityMap with properties:

          SlopeThreshold: [0.2000 0.3000]
      RoughnessThreshold: [0.1000 0.2000]
     StepHeightThreshold: [1.1352 1.7323]
    StepHeightWindowSize: 5.6000
              CostWeight: [1 1 1]
       GridOriginInLocal: [0 0]
              Resolution: 1.2500
            XLocalLimits: [0 64.8000]
            YLocalLimits: [0 64.8000]

Display the traversability map.

show(map, "local")

Enable SlopeThreshold and set the safe and critical values.

Flexible threshold values allow intermediate terrains with moderate slopes (e.g., between 10° and 15°) to have a cost but remain traversable. In this case, areas with slope ≤ 10° are considered safe whereas areas with slope > 15° are non-traversable. Areas between the safe and critical thresholds are assigned intermediate cost values.

safeSlope = 10 * pi / 180;
criticalSlope = 15 * pi / 180;
map.SlopeThreshold = [safeSlope, criticalSlope];

Set the StepHeightThreshold and RoughnessThreshold to infinity to disable their influence.

map.StepHeightThreshold = inf; % No limit on step height
map.RoughnessThreshold = inf; % No limit on roughness

Display the updated traversability map in the local coordinate frame.

show(map, "local")

Access traversability data for analysis or debugging. Extract the data for a window whose bottom-left corner is at [X,Y] = [20,30] metres and its [Width,Height] = [5,7] metres.

costData = cost(map, [20,30], [5,7]);
disp("Traversability Cost Data:");
Traversability Cost Data:
disp(costData);
    0.8802    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000
         0    1.0000    1.0000    1.0000    1.0000    1.0000    1.0000
         0         0    1.0000    1.0000    1.0000    1.0000    1.0000
         0         0         0    1.0000    1.0000    1.0000    1.0000
         0         0         0    0.7495    1.0000    1.0000    1.0000
         0         0         0         0    1.0000    1.0000    1.0000
         0         0         0         0         0    1.0000    1.0000
         0         0         0         0         0    0.8712    1.0000
         0         0         0         0         0         0    1.0000

To configure strict slope threshold, set identical values for safe and critical threshold limits. This use case is applicable for offroad vehicles designed for flat terrains or with low tolerance for inclines.

strictSlope = 10 * pi / 180;
map.SlopeThreshold = [strictSlope, strictSlope];

Visualize the updated traversability map. You can access the traversability data by using getMapData.

show(map, "local")

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");

References

[1] Chilian, Annett, and Heiko Hirschmuller. “Stereo Camera Based Navigation of Mobile Robots on Rough Terrain.” In 2009 IEEE/RSJ International Conference on Intelligent Robots and Systems, 4571–76. St. Louis, MO: IEEE, 2009. https://doi.org/10.1109/IROS.2009.5354535.

[2] Guan, Tianrui, Zhenpeng He, Ruitao Song, Dinesh Manocha, and Liangjun Zhang. “TNS: Terrain Traversability Mapping and Navigation System for Autonomous Excavators.” In Robotics: Science and Systems XVIII. Robotics: Science and Systems Foundation, 2022. https://doi.org/10.15607/RSS.2022.XVIII.049.

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