irsim.lib.path_planners.a_star#
A* grid planning
- author: Atsushi Sakai(@Atsushi_twi)
Nikos Kanargias (nkana@tee.gr)
adapted by: Reinis Cimurs
See Wikipedia article (https://en.wikipedia.org/wiki/A*_search_algorithm)
Classes#
Initialize A* planner. |
Module Contents#
- class irsim.lib.path_planners.a_star.AStarPlanner(env_map: irsim.world.map.Map, resolution: float)[source]#
Initialize A* planner.
- Parameters:
env_map (Map) β Environment map where planning takes place.
resolution (float) β Grid resolution in meters.
- resolution#
- obstacle_list#
- x_width#
- y_width#
- motion#
- class Node(x: int, y: int, cost: float, parent_index: int)[source]#
Node class
Initialize Node
- Parameters:
x (float) β x position of the node
y (float) β y position of the node
cost (float) β heuristic cost of the node
parent_index (int) β Nodes parent index
- x#
- y#
- cost#
- parent_index#
- planning(start_pose: numpy.ndarray, goal_pose: numpy.ndarray, show_animation: bool = True) tuple[list[float], list[float]][source]#
A star path search
- Parameters:
start_pose (np.array) β start pose [x,y]
goal_pose (np.array) β goal pose [x,y]
show_animation (bool) β If true, shows the animation of planning process
- Returns:
xy position array of the final path
- Return type:
(np.array)
- calc_final_path(goal_node: Node, closed_set: dict) tuple[list[float], list[float]][source]#
Generate the final path
- Parameters:
goal_node (Node) β final goal node
closed_set (dict) β dict of closed nodes
- Returns:
list of x positions of final path ry (list): list of y positions of final path
- Return type:
rx (list)
- calc_grid_position(index: int, min_position: float) float[source]#
calc grid position
- Parameters:
index (int) β index of a node
min_position (float) β min value of search space
- Returns:
position of coordinates along the given axis
- Return type:
(float)
- calc_xy_index(position: float, min_pos: float) int[source]#
calc xy index of node
- Parameters:
position (float) β position of a node
min_pos (float) β min value of search space
- Returns:
index of position along the given axis
- Return type:
(int)
- calc_grid_index(node: Node) int[source]#
calc grid index of node
- Parameters:
node (Node) β node to calculate the index for
- Returns:
grid index of the node
- Return type:
(float)
- verify_node(node: Node) bool[source]#
Check if node is acceptable - within limits of search space and free of collisions
- Parameters:
node (Node) β node to check
- Returns:
True if node is acceptable. False otherwise
- Return type:
(bool)