Convert to occupancyMap3D

7 次查看(过去 30 天)
MINJUN SO
MINJUN SO 2021-3-25
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