Skip to content

RRT

python_motion_planning.global_planner.sample_search.rrt.RRT

Bases: SampleSearcher

Class for RRT motion planning.

Parameters:

Name Type Description Default
start tuple

start point coordinate

required
goal tuple

goal point coordinate

required
env Env

environment

required
max_dist float

Maximum expansion distance one step

0.5
sample_num int

Maximum number of sample points

10000
goal_sample_rate float

heuristic sample

0.05

Examples:

Python Console Session
>>> import python_motion_planning as pmp
>>> planner = pmp.RRT((5, 5), (45, 25), pmp.Map(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] Rapidly-Exploring Random Trees: A New Tool for Path Planning

extractPath(closed_list)

Extract the path based on the CLOSED list.

Parameters:

Name Type Description Default
closed_list dict

CLOSED list

required

Returns cost (float): the cost of planning path path (list): the planning path

generateRandomNode()

Generate a random node to extend exploring tree.

Returns:

Name Type Description
node Node

a random node based on sampling

getNearest(node_list, node)

Get the node from node_list that is nearest to node.

Parameters:

Name Type Description Default
node_list list

exploring list

required
node Node

currently generated node

required

Returns:

Name Type Description
node Node

nearest node

plan()

RRT motion plan function.

Returns:

Name Type Description
cost float

path cost

path list

planning path

expand list

expanded (sampled) nodes list

run()

Running both plannig and animation.