Main Content

addScan

Add 2-D lidar scan to map

Since R2022b

Description

addScan(scanMapObj,currScan) adds the specified 2-D lidar scan currScan to the most recent scan of the lidarscanmap object scanMapObj. The function uses scan matching to correlate this scan to the most recent one, then adds the scan to the scanMapObj.

example

addScan(scanMapObj,currScan,relPose) specifies the relative pose between the input scan and the most recent scan of the map.

addScan(___,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example, addScan(scanMapObj,currScan,ScanID=5) adds the input scan relative to the fifth scan in scanMapObj.

isScanAdded = addScan(___) returns an indication of whether the input scan is added or rejected.

Examples

collapse all

Load a MAT file containing 2-D lidar scans into the workspace.

data = load("wareHouse.mat");
scans = data.wareHouseScans;

Create a lidarscanmap object.

scanMapObj = lidarscanmap;

Add the first 15 scans from the input data to the scanMapObj object by using the addScan function.

for currentID = 1:15
    addScan(scanMapObj,scans{currentID});
end

Visualize the map and the sensor trajectory.

figure
show(scanMapObj);

Figure contains an axes object. The axes object contains 16 objects of type line. One or more of the lines displays its values using only markers

Input Arguments

collapse all

Map of 2-D lidar scans, specified as a lidarscanmap object

Input scan to add to the map, specified as a lidarScan object.

Relative pose between the input scan and the most recent scan of the map, specified as a three-element vector of the form [x y Θ], where x and y define the translational offset in meters, and Θ defines the rotational offset of the input scan in radians.

Name-Value Arguments

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.

Example: addScan(scanMapObj,currScan,ScanID=5) adds the input scan relative to the fifth scan in the scanMapObj object.

Initial estimate for relative pose between the input scan and the most recent scan of the map, specified as a three-element vector of the form [x y Θ], where x and y define the translational offset in meters, and Θ defines the rotational offset between the scans in radians. The values are relative to the world origin.

The function computes the relative pose faster when the RelPoseEstimate is close to the true relative pose.

Note

Use RelPoseEstimate only when you do not specify the relPose input.

Tolerance for the relative pose estimate between the input scan and the most recent scan of the map, specified as a three-element vector of the form [x y Θ], where x and y define the translational tolerance in meters, and Θ defines the rotational tolerance in radians.

If you do not specify this value, the function internally computes it as [scanMapObj.MaxLidarRange/2 scanMapObj.MaxLidarRange/2 pi/2].

Note

Use PoseTolerance only when you do not specify the relPose input.

Uncertainty in the relative pose measurement between the input scan and the most recent scan of the map, specified as a 3-by-3 positive definite matrix.

Minimum pose change required to add the input scan to the map, specified as a two-element vector of the form [translation rotation], where translation and rotation specify the translational and the rotational thresholds, respectively. The function adds the input scan to the scanMapObj object only when the relative pose change of the input scan exceeds both values in the MovementThreshold.

Scan ID of the scan to which the input scan is relative to, specified as a positive integer. The value must be in the range [1, scanMapObj.NumScans]. By default, the function adds the input scan relative to the last scan in the scanMapObj object.

Note

You can specify ScanID only when the scanMapObj object has at least one scan.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Output Arguments

collapse all

Check if the input scan is added to the scanMapObj object, returned as a logical true or false. The function returns true when the scan is added to the map.

Version History

Introduced in R2022b