Set the radius for visualization of the current location and the distance threshold to update the submap.
radius = 0.5;
distThresh = 15;
Loop over the point clouds, localize them in the map, and update the selected submap as needed.
numScans = numel(ptCloudScans);
for n = 1:numScans
ptCloud = ptCloudScans(n);
initPose = initPoseEsts(n);
poseTranslation = initPose.Translation;
[isInside,distToEdge] = isInsideSubmap(ndtMap,poseTranslation);
submapNeedsUpdate = ~isInside ... % Current pose is outside submap
|| any(distToEdge(1:2) < distThresh); % Current pose is close to submap edgeif submapNeedsUpdate
ndtMap = selectSubmap(ndtMap,poseTranslation,sz);
end% Localize the point cloud scan in the map.
currPose = findPose(ndtMap,ptCloud,initPose);
% Display the position of the estimate as a circle.
pos = [currPose.Translation(1:2) radius];
showShape('circle',pos,'Color','r');
% Pause to view the change.
pause(0.05)
end
NDT map, returned as a pcmapndt object with an updated
SelectedSubmap property.
If a region of the selected submap is outside of the limits of the map,
the selected submap is constrained to the map limits as described by the
XLimits, YLimits, and
ZLimits properties of the pcmapndt object.
Tips
Use a submap size large enough to include the uncertainty of the position
estimates and the range of the sensor used with findPose. A larger submap can increase computation time during
each call to the findPose function, but it can also reduce the frequency of
submap updates.
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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.