Robot Mapping and Navigation in MATLAB

8 vues (au cours des 30 derniers jours)
Jasraj Soni
Jasraj Soni le 12 Mar 2020
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.

Réponses (3)

Joseph
Joseph le 28 Mar 2020
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 le 9 Juin 2020
Modifié(e) : Chris le 9 Juin 2020
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 le 29 Mar 2023
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

Community Treasure Hunt

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

Start Hunting!

Translated by