mapClutter

Generate map with randomly scattered obstacles

Description

map = mapClutter generates a 2-D occupancy map as a binaryOccupancyMap object map, with a width and height of 50 meters and a resolution of 5 cells per meter. The map contains 20 randomly distributed obstacles of types Box and Circle. Generated obstacles have random sizes.

map = mapClutter(numObst) generates a 2-D occupancy map, of the default size and resolution, with a specified number of randomly distributed obstacles, numObst, of default shapes.

map = mapClutter(numObst,shapes) generates a 2-D occupancy map, of the default size and resolution, with a specified number of obstacles, numObst, of specified shapes, shapes.

example

map = mapClutter(___,Name,Value) specifies options using one or more name-value pair arguments in addition to any combination of input arguments from previous syntaxes. For example, 'MapSize',[50 30] generates a randomly distributed obstacle map with a width of 50 meters and height of 30 meters.

Examples

collapse all

Generate a 2-D occupancy map with ten randomly scattered obstacles of types Box, Circle, and Plus. Specify the size of the map as 50 meters wide and 30 meters high with a resolution of 5 cells per meters.

map = mapClutter(10,{'Box','Plus','Circle'},'MapSize',[50 30],'MapResolution',5);

Visualize the generated obstacle map.

show(map)

Input Arguments

collapse all

Number of obstacles, specified as a positive integer.

Data Types: single | double

Obstacle shapes, specified as a string scalar, vector of strings, or cell array of character vectors. The only valid shapes are Box, Circle, and Plus.

When you specify a string scalar, the function generates a map with obstacles of only the specified shape.

Example: "Box"

When you specify a vector of strings or a cell array of character vectors, the function generates a map with obstacles of each specified shape.

Example: ["Box","Plus"]

Example: {'Box','Plus','Circle'}

Data Types: cell | string

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'MapSize',[50 40] generates a randomly distributed obstacle map with a width of 50 meters and height of 30 meters.

Width and height of the generated map, specified as the comma-separated pair consisting of 'MapSize' and a two-element vector of positive real finite numbers of the form [Width,Height]. Specify both values in meters.

Example: 'MapSize',[50 30]

Data Types: single | double

Resolution of the generated map, specified as the comma-separated pair consisting of 'MapResolution' and a positive real scalar in cells per meter.

Example: 'MapResolution',10

Data Types: single | double

Extended Capabilities

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

Introduced in R2020b