Roadmap - how to save the graph generated?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
mirella melo
el 3 de Dic. de 2020
Comentada: Karsh Tharyani
el 10 de Dic. de 2020
Hello. I have two occupancy grid. In one, I expect to generate a roadmap (PRM - probabilistic roadmap) with 100 nodes. Later, I want to reproduce the same nodes in the second map.
1: I'd like to handle the X Y variable of all nodes randomly generated in grid_1. How can I do that, please? Also, how to know the total number of paths generated?
2: Although I can't handle the random nodes, I'm able to replicate them using rng (random number generator), but in case the node in the second map is located in an occupated area, the algorithm generates another random number, which this is not what I want. For example, in grid_1, 100 nodes were generated. From those, only 90 is located in the free area on the grid_2, so I'd like to reproduce only those 90.
So far, this is how my code is:
image_1 = imread('image_1.pgm');
image_1 = image_1 < 250; % convert it to binary
map_1 = binaryOccupancyMap(image_1, 0.05); % convert it to occupancy grid map
rng(1) % save the random number generator
prm_1 = mobileRobotPRM(map_1, 100); % PRM
show(prm_1) % show paths, nodes and grid all together
image_2 = imread('image_2.pgm'); % load a different but pretty similar grid map image
image_2 = image_2 < 250;
map_2 = binaryOccupancyMap(image_2, 0.05);
rng(1) % use the saved random number generated
prm_2 = mobileRobotPRM(map_2, 100);
show(prm_2)
And this is my images:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/442963/image.png)
Thanks in advance!!
0 comentarios
Respuesta aceptada
Karsh Tharyani
el 7 de Dic. de 2020
Editada: Karsh Tharyani
el 7 de Dic. de 2020
Hi Mirella,
Thanks for your question. Please feel free to comment above in case I misunderstood something.
1) Currently, mobileRobotPRM doesn't output the underlying connectivity i.e., the nodes and the edges. If it did, one could obtain the node information (the coordinates on the map). Additionally, one could also obtain all the possible paths between a start and goal location from the output graph.
2) As you rightly pointed out, in order to generate the same set of nodes, you would have to fix the random number generator. However, please note that your maps are not identical (from what I see above). Thus, during the random nodes generation, if a node is occupied, another location will be randomly chosen in the map(this ensures that there are exactly "n=100" nodes generated in the roadmap). Even if you manage to get the same set of nodes, the underlying connectivity can also be different if the edges are not free. If an iteration counter was given instead, you could probably get around this.
I shall convey these requests to the respective team and these might be incorporated in a future release of MATLAB.
Please let me know if this answers your question.
Best,
Karsh
2 comentarios
Karsh Tharyani
el 10 de Dic. de 2020
Hi Mirella,
It seems like you are trying to compare "navigability" of two maps, which is quite open-ended and really depends on your application.
I would suggest reaching out to Technical Support https://www.mathworks.com/support/contact_us.html. describing your workflow to them, and conveying any specific analyses/metrics that your workflow demands.
Best,
Karsh
Más respuestas (0)
Ver también
Categorías
Más información sobre Motion Planning en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!