Skip to content

AStar

python_motion_planning.global_planner.graph_search.a_star.AStar

Bases: GraphSearcher

Class for A* 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

'euclidean'

Examples:

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

[1] A Formal Basis for the heuristic Determination of Minimum Cost Paths

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 planned path

path list

the planning path

getNeighbor(node)

Find neighbors of node.

Parameters:

Name Type Description Default
node Node

current node

required

Returns:

Name Type Description
neighbors list

neighbors of current node

plan()

A* motion plan function.

Returns:

Name Type Description
cost float

path cost

path list

planning path

expand list

all nodes that planner has searched

run()

Running both planning and animation.