Convert to occupancyMap3D

81 visualizaciones (últimos 30 días)
MINJUN SO
MINJUN SO el 25 de Mzo. de 2021
Comentada: David Meira Pliego el 12 de Abr. de 2021
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 comentario
MINJUN SO
MINJUN SO el 25 de Mzo. de 2021
If there is no exist method, pls comment "there is no answer" or let me show another way.

Iniciar sesión para comentar.

Respuestas (1)

Aditya Patil
Aditya Patil el 30 de Mzo. de 2021
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 comentario
David Meira Pliego
David Meira Pliego el 12 de Abr. de 2021
Do you know any other way to convert a ptCloud map into a Occupancy map?. Thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Mapping en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by