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:
Thanks in advance!!
Best Answer