Robot Mapping and Navigation in MATLAB

9 次查看(过去 30 天)
Hi,
I am trying to create 'robot mapping with known poses' algorithm using lidar sensor.
For reference I am following the code given on this link: https://in.mathworks.com/help/robotics/examples/mapping-with-known-poses.html
Under the section: Update map by taking sensor measurements, is where the lidar part comes in. As I am currently not aware of how to use the lidar function to scan the map, can someone guide me with this?
Huge thanks for taking time to help me with the problem.

回答(3 个)

Joseph
Joseph 2020-3-28
Hi Jasraj,
You need to clarify your question a bit more.
In the beginning, we can see that sensor was defined:
sensor = rangeSensor;
sensor.Range = [0,10];
and then we called the function exampleHelperDiffDriveCtrl:
exampleHelperDiffDriveCtrl(diffDrive,controller,initPose,goal,refMap,map,refFigure,mapFigure,sensor)
If you look at the function itself, then you can see that the inputs are:
function exampleHelperDiffDriveControl(diffDrive,ppControl,initPose,goal,map1,map2,fig1,fig2,lidar)
so here, essentially rangeSensor/sensor was passed as lidar. And then if you follow along you'll see that:
[ranges, angles] = lidar(position, map1);
scan = lidarScan(ranges,angles);
If you want to learn more then look into what does lidarScan do with the outputs of lidar in the documentation here. Playing with the examples by changing parameters and reading the documentation should serve you well.

Chris
Chris 2020-6-9
编辑:Chris 2020-6-9
Hey,
you have to use the lidarScan function to create the input data for the SLAM algorithm.
With start I defined the start value, it's 1. With the steps value I defined the final index of measurement data.
For example if i want to have 230 samples in 1 scan: start=1, steps=230.
Hope the answer is not too late and it still can help you.
if(ii==steps)
scan{1,i}=lidarScan(distancearray(start:steps,1),angleradarray(start:steps,1));
[isScanAccepted, loopClosureInfo, optimizationInfo] = addScan(slamAlg, scan{i});
if ~isScanAccepted
continue;
end

kalpesh
kalpesh 2023-3-29
if(ii==steps)
scan{1,i}=lidarScan(distancearray(start:steps,1),angleradarray(start:steps,1));
[isScanAccepted, loopClosureInfo, optimizationInfo] = addScan(slamAlg, scan{i});
if ~isScanAccepted
continue;
end

类别

Help CenterFile Exchange 中查找有关 Robotics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by