copy
Copy lidar SLAM object
Description
creates a deep copy of newSlamObj
= copy(slamObj
)slamObj
with the same properties.
Any changes made to newSlamObj
are not reflected in
slamObj
.
Examples
Create a lidarSLAM
object.
slamObj = lidarSLAM
slamObj = lidarSLAM with properties: PoseGraph: [1×1 poseGraph] MapResolution: 20 MaxLidarRange: 8 OptimizationFcn: @optimizePoseGraph LoopClosureThreshold: 100 LoopClosureSearchRadius: 8 LoopClosureMaxAttempts: 1 LoopClosureAutoRollback: 1 OptimizationInterval: 1 MovementThreshold: [0 0] ScanRegistrationMethod: 'BranchAndBound' TranslationSearchRange: [4 4] RotationSearchRange: 1.5708
Create a copy of the lidar SLAM object.
slamObjNew = copy(slamObj)
slamObjNew = lidarSLAM with properties: PoseGraph: [1×1 poseGraph] MapResolution: 20 MaxLidarRange: 8 OptimizationFcn: @optimizePoseGraph LoopClosureThreshold: 100 LoopClosureSearchRadius: 8 LoopClosureMaxAttempts: 1 LoopClosureAutoRollback: 1 OptimizationInterval: 1 MovementThreshold: [0 0] ScanRegistrationMethod: 'BranchAndBound' TranslationSearchRange: [4 4] RotationSearchRange: 1.5708
Load laser scan data from a file.
load("offlineSlamData.mat");
To set up the SLAM algorithm:
Specify the lidar range, map resolution, loop closure threshold, and search radius.
Tune these parameters for your specific robot and environment.
Create the
lidarSLAM
object with these parameters.
maxLidarRange = 8; mapResolution = 20; slamObj = lidarSLAM(mapResolution,maxLidarRange); slamObj.LoopClosureThreshold = 210; slamObj.LoopClosureSearchRadius = 8;
Add scans iteratively to the SLAM object.
for i = 1:numel(scans) addScan(slamObj,scans{i}); end
Create a copy of the SLAM object. Display the underlying pose graph of the SLAM object.
slamObj2 = copy(slamObj); slamObj2.PoseGraph
ans = poseGraph with properties: NumNodes: 71 NumEdges: 83 NumLoopClosureEdges: 13 LoopClosureEdgeIDs: [31 36 63 65 67 69 71 73 75 77 79 81 83] LandmarkNodeIDs: [1×0 double]
Remove the first two loop closures by specifying their edge IDs.
lcEdgeIDs = slamObj2.PoseGraph.LoopClosureEdgeIDs(1:2); removeLoopClosures(slamObj2,lcEdgeIDs)
Plot the pose graphs of the SLAM object before and after removing the loop closures.
subplot(2,1,1) show(slamObj.PoseGraph); subplot(2,1,2) show(slamObj2.PoseGraph);
Input Arguments
Lidar SLAM object, specified as a lidarSLAM
object. The
object contains the SLAM algorithm parameters, sensor data, and underlying
pose graph used to build the map.
Output Arguments
Lidar SLAM object, returned as a lidarSLAM
object.
Extended Capabilities
Use this syntax when constructing lidarSLAM
objects for code
generation:
specifies the upper bound on the number of accepted scans allowed when generating
code. slamObj=
lidarSLAM(mapResolution,maxLidarRange,maxNumScans)
maxNumScans
is a positive integer. This scan limit is only
required when generating code.
Version History
Introduced in R2019b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)