Optimize a pose graph based on the nodes and edge constraints. Trim loop closed based on their edge residual errors.
Load the data set that contains a 2-D pose graph. Inspect the poseGraph
object to view the number of nodes and loop closures.
poseGraph with properties:
NumNodes: 120
NumEdges: 193
NumLoopClosureEdges: 74
LoopClosureEdgeIDs: [1x74 double]
Plot the pose graph with IDs off. Red lines indicate loop closures identified in the dataset. The poses in the graph should follow a grid pattern, but show evidence of drift over time.
Optimize the pose grap using the optimizePoseGraph
function. By default, this function uses the "builtin-trust-region"
solver. Because the pose graph contains some bad loop closures, the resulting pose graph is actual not desirable.
Look at the edge residual errors for the original pose graph. Large outlier error values at the end indicate bad loop closures.
Certain loop closures should be trimmed from the pose graph based on their residual error. Use the trimLoopClosures
function to trim therse bad loop closures. Set the maximum and truncation threshold for the trimmer parameters. This threshold is set based on the measurement accuracy and should be tuned for your system.
Use the trimLoopClosures
function with the trimmer parameters and solver options.
From the trimInfo
output, plot the loop closures removed from the optimized pose graph. By plotting with the residual errors plot before, you can see the large error loop closures were removed.
Show the new pose graph with the bad loop closures trimmed.