Skip to content

VoronoiPlanner

python_motion_planning.global_planner.graph_search.voronoi.VoronoiPlanner

Bases: GraphSearcher

Class for Voronoi-based motion planning.

Parameters:

Name Type Description Default
start tuple

start point coordinate

required
goal tuple

goal point coordinate

required
env Env

environment

required
heuristic_type str

heuristic function type, default is euclidean

'euclidean'
n_knn int

number of edges from one sampled point

10
max_edge_len float

maximum edge length

10.0
inflation_r float

inflation range

1.0

Examples:

Python Console Session
>>> import python_motion_planning as pmp
>>> planner = pmp.VoronoiPlanner((5, 5), (45, 25), pmp.Grid(51, 31))
>>> cost, path, _ = planner.plan()     # planning results only
>>> planner.plot.animation(path, str(planner), cost, expand)  # animation
>>> planner.run()       # run both planning and animation

extractPath(closed_list)

Extract the path based on the CLOSED list.

Parameters:

Name Type Description Default
closed_list dict

CLOSED list

required

Returns:

Name Type Description
cost float

the cost of planning path

path list

the planning path

getShortestPath(road_map, dijkstra=True)

Calculate shortest path using graph search algorithm(A*, Dijkstra, etc).

Parameters:

Name Type Description Default
road_map dict

road map for voronoi diagram, which store KNN for one voronoi node

required
dijkstra bool

using Dijkstra if true, else A*

True

Returns:

Name Type Description
cost float

path cost

path list

planning path

isCollision(node1, node2)

Judge collision when moving from node1 to node2.

Parameters:

Name Type Description Default
node1 Node

start node

required
node2 Node

end node

required

Returns:

Name Type Description
collision bool

True if collision exists else False

plan()

Voronoi-based motion plan function.

Returns:

Name Type Description
cost float

path cost

path list

planning path

expand list

voronoi sampled nodes

run()

Running both plannig and animation.