Main Content

removeLoopClosures

Remove loop closures from pose graph

Description

removeLoopClosures(slamObj) removes all loop closures from the underlying pose graph in slamObj.

removeLoopClosures(slamObj,lcEdgeIDs) removes the loop closure edges with the specified IDs from the underlying pose graph in slamObj.

example

Examples

collapse all

Load laser scan data from a file.

load("offlineSlamData.mat");

To set up the SLAM algorithm:

  1. Specify the lidar range, map resolution, loop closure threshold, and search radius.

  2. Tune these parameters for your specific robot and environment.

  3. 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: [1x0 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);

Figure contains 2 axes objects. Axes object 1 with xlabel X, ylabel Y contains 42 objects of type line, text. One or more of the lines displays its values using only markers Axes object 2 with xlabel X, ylabel Y contains 36 objects of type line, text. One or more of the lines displays its values using only markers

Input Arguments

collapse all

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

Loop closure edge IDs, specified as a vector of positive integers. To find specific edge IDs, use findEdgeID on the underlying poseGraph object defined in slamObj.

Extended Capabilities

Version History

Introduced in R2019b