Extracting x and y values from mobileRobotPRM

3 次查看(过去 30 天)
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 个评论
safaa sadi
safaa sadi 2023-3-18
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

请先登录,再进行评论。

回答(1 个)

Sakshay
Sakshay 2022-12-2
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 个评论
John Jones
John Jones 2022-12-2
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.

请先登录,再进行评论。

标签

Community Treasure Hunt

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

Start Hunting!

Translated by