Robot Mapping and Navigation in MATLAB
7 views (last 30 days)
Show older comments
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.
0 Comments
Answers (3)
Joseph
on 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.
0 Comments
Chris
on 9 Jun 2020
Edited: Chris
on 9 Jun 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
0 Comments
kalpesh
on 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
0 Comments
See Also
Categories
Find more on SLAM in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!