Main Content

matchScansGrid

估计姿势是en two lidar scans using grid-based search

Description

example

pose= matchScansGrid(currScan,refScan)finds the relative pose between a referencelidarScanand a currentlidarScanobject using a grid-based search.matchScansGridconverts lidar scan pairs into probabilistic grids and finds the pose between the two scans by correlating their grids. The function uses a branch-and-bound strategy to speed up computation over large discretized search windows.

[pose,stats] = matchScansGrid(___)returns additional statistics about the scan match result using the previous input arguments.

[___] = matchScansGrid(___,Name,Value)specifies options using one or moreName,Valuepair arguments. For example,'InitialPose',[1 1 pi/2]specifies an initial pose estimate for scan matching.

Examples

collapse all

Perform scan matching using a grid-based search to estimate the pose between two laser scans. Generate a probabilistic grid from the scans and estimate the pose difference from those grids.

load the laser scan data. These two scans are from an actual lidar sensor with changes in the robot pose and are stored aslidarScanobjects.

loadlaserScans.matscanscan2plot(scan) holdonplot(scan2) holdoff

Figure contains an axes object. The axes object with title LiDAR Scan contains 2 objects of type line.

UsematchScansGridto estimate the pose between the two scans.

relPose = matchScansGrid(scan2,scan);

Using the estimated pose, transform the current scan back to the reference scan. The scans overlap closely when you plot them together.

scan2Tformed = transformScan(scan2,relPose); plot(scan) holdonplot(scan2Tformed) holdoff

Figure contains an axes object. The axes object with title LiDAR Scan contains 2 objects of type line.

Input Arguments

collapse all

Current lidar scan readings, specified as alidarScanobject.

你的激光雷达扫描可以包含InfandNaNvalues, but the algorithm ignores them.

Reference lidar scan readings, specified as alidarScanobject.

你的激光雷达扫描可以包含InfandNaNvalues, but the algorithm ignores them.

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis 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 encloseNamein quotes.

Example:'InitialPose',[1 1 pi/2]

Initial guess of the current pose relative to the reference laser scan, specified as the comma-separated pair consisting of'InitialPose'and an[x y theta]vector.[x y]is the translation in meters andthetais the rotation in radians.

Grid cells per meter, specified as the comma-separated pair consisting of'Resolution'and a positive integer. The accuracy of the scan matching result is accurate up to the grid cell size.

Maximum range of lidar sensor, specified as the comma-separated pair consisting of'MaxRange'and a positive scalar.

Search range for translation, specified as the comma-separated pair consisting of'TranslationSearchRange'and an[x y]vector. These values define the search window in meters around the initial translation estimate given inInitialPose. If theInitialPoseis given as[x0 y0], then the search window coordinates are[x0-x x0+x]and[y0-y y0+y]. This parameter is used only whenInitialPoseis specified.

Search range for rotation, specified as the comma-separated pair consisting of'RotationSearchRange'and a positive scalar. This value defines the search window in radians around the initial rotation estimate given inInitialPose. If theInitialPoserotation is given asth0, then the search window is[th0-a th0+a], whereais the rotation search range. This parameter is used only whenInitialPoseis specified.

Output Arguments

collapse all

Pose of current scan relative to the reference scan, returned as an[x y theta]vector, where[x y]is the translation in meters andthetais the rotation in radians.

Scan matching statistics, returned as a structure with the following field:

  • Score— Numeric scalar representing the score while performing scan matching. This score is an estimate of the likelihood that the transformed current scan matches the reference scan.Scoreis always nonnegative. Larger scores indicate a better match, but values vary depending on the lidar data used.

  • Covariance— Estimated covariance representing the confidence of the computed relative pose, returned as a 3-by-3 matrix.

References

[1] Hess, Wolfgang, Damon Kohler, Holger Rapp, and Daniel Andor. "Real-Time Loop Closure in 2D LIDAR SLAM."2016 IEEE International Conference on Robotics and Automation (ICRA). 2016.

Extended Capabilities

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

Version History

Introduced in R2020b

See Also

Functions

Classes