Probabilistic Roadmap (PRM)¶
The PRM (Probabilistic Roadmap) solver implements a multi-query roadmap-based motion planner. It constructs a reusable graph representation of the free configuration space by sampling landmark configurations and attempting local path connections between each landmark and its
-nearest neighbors.
Architectural Design & Algorithm Flow¶
Base Contract: Inherits from
SamplingSolver.Multi-Robot C-Space: Operates in composite
-dimensional space using Point_d, mapping single- or multi-robot scenes into composite configurations.Roadmap Construction Phase: 1. Add start configuration
and end configuration
to the roadmap graph.
2. Sample
collision-free points using injected Sampler. 3. Query
nearest neighbors for every node using NearestNeighbors. 4. Perform local edge validation withdiscopygal.geometry_utils.collision_detectionand insert valid edges intoRoadmap.Graph Search Phase: Runs
search on the constructed roadmap to extract the shortest collision-free path.
PRM Roadmap Construction & Search Pipeline¶
Parameters & Configuration¶
Parameter |
Description |
Default |
Type |
|---|---|---|---|
|
Number of collision-free landmarks to sample |
|
|
|
Number of nearest neighbors to connect per milestone |
|
|
|
Sampling strategy distribution |
|
|
|
Distance metric policy |
|
Usage Example¶
from discopygal.solvers.prm.prm import PRM
from discopygal.solvers_infra import Scene
# Load scene and construct solver
solver = PRM.init_solver(num_landmarks=2000, k_nn=20)
path_collection = solver.solve(scene)
API Reference¶
- class discopygal.solvers.prm.prm.PRM(num_landmarks, k_nn, **kwargs)¶
Bases:
SamplingSolverThe basic implementation of a Probabilistic Road Map (PRM) solver. Supports multi-robot motion planning, though might be inefficient for more than two-three robots.
- Parameters:
num_landmarks (
int) – number of landmarks to samplek_nn (
int) – number of nearest neighbors to connect (k nearest neighbors)nearest_neighbors (
NearestNeighborsorNone) – a nearest neighbors algorithm. if None then use sklearn implementationmetric (
MetricorNone) – a metric for weighing edges, can be different then the nearest_neighbors metric! If None then use euclidean metricsampler (
Sampler) – sampling algorithm/method. if None then use uniform sampling
- build_roadmap() Roadmap¶
Build a probabilistic roadmap for the robot in a given scene (sample random points and connect neighbors)
- Returns:
roadmap for the given scene
- Type:
Roadmap
- classmethod get_arguments()¶
Return a list of arguments and their description, defaults and types. Can be used by a GUI to generate fields dynamically. Should be overridded by solvers.
- Returns:
arguments dict
- Return type:
dict