Main Content

occupancyMap3D

Create 3-D occupancy map

Description

TheoccupancyMap3Dclass stores a 3-D map and map information. The map is stored as probabilistic values in anoctree data structure. The class handles arbitrary environments and expands its size dynamically based on observation inputs. You can add observations as point clouds or as specificxyzlocations. These observations update the probability values. Probabilistic values represent the occupancy of locations. The octree data structure trims data appropriately to remain efficient both in memory and on disk.

Creation

Description

omap= occupancyMap3Dcreates an empty 3-D occupancy map with no observations and default property values.

example

omap= occupancyMap3D(res)specifies a map resolution in cells/meter and sets theResolutionproperty.

omap= occupancyMap3D(res,Name,Value)creates an object with additional options specified by one or moreName,Valuepair arguments. For example,'FreeThreshold',0.25sets the threshold to consider cells obstacle-free as a probability value of 0.25. Enclose each property name in quotes.

Properties

expand all

Grid resolution in cells per meter, specified as a scalar. Specify resolution on construction. Inserting observations with precisions higher than this value are rounded down and applied at this resolution.

Threshold to consider cells as obstacle-free, specified as a positive scalar. Probability values below this threshold are considered obstacle-free.

Threshold to consider cells as occupied, specified as a positive scalar. Probability values above this threshold are considered occupied.

Saturation limits on probability values, specified as a[min max]vector. Values above or below these saturation values are set to theminormaxvalues. This property reduces oversaturating of cells when incorporating multiple observations.

Object Functions

checkOccupancy Check if locations are free or occupied
getOccupancy Get occupancy probability of locations
inflate Inflate map
insertPointCloud Insert 3-D points or point cloud observation into map
rayIntersection Find intersection points of rays and occupied map cells
setOccupancy Set occupancy probability of locations
show Show occupancy map
updateOccupancy Update occupancy probability at locations

Examples

collapse all

TheoccupancyMap3Dobject stores obstacles in 3-D space, using sensor observations to map an environment. Create a map and add points from a point cloud to identify obstacles. Then inflate the obstacles in the map to ensure safe operating space around obstacles.

Create anoccupancyMap3Dobject with a map resolution of 10 cells/meter.

map3D = occupancyMap3D(10);

Define a set of 3-D points as an observation from a pose[x y z qw qx qy qz]. This pose is for the sensor that observes these points and is centered on the origin. Define two sets of points to insert multiple observations.

pose = [ 0 0 0 1 0 0 0]; points = repmat((0:0.25:2)', 1, 3); points2 = [(0:0.25:2)' (2:-0.25:0)' (0:0.25:2)']; maxRange = 5;

Insert the first set of points usinginsertPointCloud. The function uses the sensor pose and the given points to insert observations into the map. The colors displayed correlate to the height of the point only for illustrative purposes.

insertPointCloud(map3D,pose,points,maxRange) show(map3D)

Figure contains an axes. The axes with title Occupancy Map contains an object of type patch.

Insert the second set of points. The ray between the sensor pose (origin) and these points overlap points from the previous insertion. Therefore, the free space between the sensor and the new points are updated and marked as free space.

insertPointCloud(map3D,pose,points2,maxRange) show(map3D)

Figure contains an axes. The axes with title Occupancy Map contains an object of type patch.

Inflate the map to add a buffer zone for safe operation around obstacles. Define the vehicle radius and safety distance and use the sum of these values to define the inflation radius for the map.

vehicleRadius = 0.2; safetyRadius = 0.3; inflationRadius = vehicleRadius + safetyRadius; inflate(map3D, inflationRadius); show(map3D)

Figure contains an axes. The axes with title Occupancy Map contains an object of type patch.

Algorithms

expand all

References

阿明,[1]霍农Kai m .玉木麻仁Bennewitz,Cyrill Stachniss, and Wolfram Burgard. "OctoMap: an efficient probabilistic 3D mapping framework based on octrees."Autonomous Robots, Vol. 34, No. 3, 2013, pp. 189–206.. doi:10.1007/s10514-012-9321-0.

Extended Capabilities

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

Introduced in R2019b