필터 지우기
필터 지우기

Convert to occupancyMap3D

조회 수: 78 (최근 30일)
MINJUN SO
MINJUN SO 2021년 3월 25일
댓글: David Meira Pliego 2021년 4월 12일
First now, I convert stl file(from CATIA) to .mat file (class: pde.DiscreteGeometry).
And I want to convert this .mat file to 3D occupancy Map.
How can I solve this problem?
My goal is that I want to build real map on 3D occupancy Map.
And I'm trying this example RRT code which is loaded on MathWorks.
mapData = load("uavMapCityBlock.mat","omap");
omap = mapData.omap;
% Consider unknown spaces to be unoccupied
omap.FreeThreshold = omap.OccupiedThreshold;
inflate(omap,1)
figure("Name","CityBlock")
show(omap)
At first line, "uavMapCityBlock.mat" is a occupancyMap3D class. And I want to change that .mat file to my converted file which I'm asking you guys.
pls understanding my short english skill. thanks :)
  댓글 수: 1
MINJUN SO
MINJUN SO 2021년 3월 25일
If there is no exist method, pls comment "there is no answer" or let me show another way.

댓글을 달려면 로그인하십시오.

답변 (1개)

Aditya Patil
Aditya Patil 2021년 3월 30일
There is currently no direct function to convert stl to occupancy matrix/grid.
As a workaround, if you create the stl file using large number of points, you should be able to pass to points to insertPointCloud function, as follows
gm = importGeometry('ForearmLink.stl');
points = gm.Vertices;
omap = occupancyMap3D;
pose = [0 0 0 1 0 0 0];
maxrange = 100;
insertPointCloud(omap, pose, points, maxrange);
show(omap);
However, this won't work very well for stl files with low number of vertices. So instead, you can create an alphashape with points, and then check for occupancy. The accuracy of method below will depend upon how well the alphaShape is created. Try different values from alphaShape parameters to get a better result.
gm = importGeometry('ForearmLink.stl');
points = gm.Vertices;
shp = alphaShape(points, 23);
plot(shp);
[X,Y,Z]= meshgrid(-150:150, -150:150, -150:150);
insideMat = inShape(shp, X, Y, Z);
insideId = find(insideMat);
[Xoc, Yoc, Zoc] = ind2sub(size(X), insideId);
pcshow([Xoc, Yoc, Zoc])
  댓글 수: 1
David Meira Pliego
David Meira Pliego 2021년 4월 12일
Do you know any other way to convert a ptCloud map into a Occupancy map?. Thanks

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Mapping에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by