Extracting x and y values from mobileRobotPRM

6 views (last 30 days)
I am trying to extract a list of x and y values for the points generated by the mobileRobotPRM function. I have the rng state saved so the same plot is produced each time, but I cannot find a way to automatically generate or extract a list of the x and y values of each the points created.
This is my code to create the file:
load('HDmap.mat') % this loads a file containing:
% 'map'- a 1x1 binaryOccupancyMap
% 'rngState' - the rng seed used to create the prm
% PRM
rng(rngState);
prm = mobileRobotPRM(map,60^2);
prm.ConnectionDistance = 4.5;
show(prm)
  1 Comment
safaa sadi
safaa sadi on 18 Mar 2023
I've been face same issue during involve in some processing, the way i got the coordinates of each node generated on map is by trace the (get.NumNodes(obj)) in line 338 inside mobileRobotPRM structure.
hope this help

Sign in to comment.

Answers (1)

Sakshay
Sakshay on 2 Dec 2022
Hello John,
As per my understanding, you are trying to extract the xy coordinates of the path (nodes) generated by the "mobileRobotPRM".
The "mobileRobotPRM" object is a roadmap path planner object for the environment map specified in the "Map" property. The object uses the map to generate a roadmap, which is a network graph of possible paths in the map based on free and occupied spaces. After the map is defined, the "mobileRobotPRM" path planner generates the specified number of nodes throughout the free spaces in the map. After defining a start and end location, to find an obstacle-free path using this network of connections, the "findPath" method is used. A sample code for the same would look something like:
% Load the map
load('HDmap.mat');
% Create PRM Object
prm = mobileRobotPRM(map,60^2);
prm.ConnectionDistance = 4.5;
% Define start and end location
startLocation = [4.0 2.0];
endLocation = [24.0 20.0];
% Calculate the path
% This path contains the xy coordinates of the nodes
path = findpath(prm, startLocation, endLocation)
% Display the map, road maps and final path
show(prm);
You can refer to the following documentation that describes building such an example for a Differential Drive Robot:
  1 Comment
John Jones
John Jones on 2 Dec 2022
Thank you for your response, however I am trying to extract the xy coordinates of all the nodes generated by the mobileRobotPRM, not just those on the path generated by the findpath function.
Due to the nature of the project, I will be using a separate path planning algorithm, so want to be able to generate the PRM nodes and network using the inbuilt function in this toolbox, but then extract that information afterwards.

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!