✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
更多Matlab仿真内容点击👇
⛄ 内容介绍
使用 Robotics System Toolbox™ 开发环境地图并定位机器人或自动驾驶汽车的姿态以进行自主导航。
⛄ 部分代码
load('offlineSlamData.mat');
mapResolotion = 20;
maxLidarRange = 8;
lidarSlam = robotics.LidarSLAM(mapResolotion, maxLidarRange);
lidarSlam.LoopClosureThreshold = 205;
lidarSlam.LoopClosureSearchRadius = 8;
%%
ax = newplot;
show(lidarSlam, 'Parent', ax);
title(ax, {'Map of the Environment','Pose Graph for Intial 10 Scans'});
firstTimeLCDetected = false;
ax = newplot;
for i=10:length(scans)
[isScanAccepted, loopClosureInfo, optimizationInfo] = addScan(lidarSlam, scans{i});
if ~isScanAccepted
continue;
end
% visualize the first detected loop closure, if you want to see the
% complete map building process, remove the if condition below
if optimizationInfo.IsPerformed && ~firstTimeLCDetected
show(lidarSlam, 'Poses', 'off', 'Parent', ax); hold on;
lidarSlam.PoseGraph.show('Parent', ax);
firstTimeLCDetected = true;
drawnow
end
end
title(ax, 'First loop closure');
figure
ax = newplot;
show(lidarSlam, 'Parent', ax);
title(ax, {'Final Built Map of the Environment', 'Trajectory of the Robot'});
⛄ 运行结果
⛄ 参考文献
[1]夏鹏. 浅谈自动驾驶车辆电子地图的构建[J]. 汽车制造业, 2019(8):4.