Roadmap — how to save the graph generated?

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:

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

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.

--

--

--

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The majority of people these days own a smartphone and most of them are using it as much more than…

Chia Plotting Optimization

sort.Sort() interface in GoLang

Cloud Adoption Framework

7 Simple Steps to Create a Highly Flexible and Expandable .NET 5.0 Web API

MINX Transfer 2021

Showcase of the ABN AMRO Developer Portal at API the Docs

Autoware.auto with easiness on Yonohub

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

More from Medium

An Article a Day: Meinecke et al (2021)

MATLAB projects for Computer Science/Engineering using these numerical method techniques?

What can I do with Data Science?

Countries’ credit rating dataset, pt. 1: wrangling & cleaning