DNode¶
src.python_motion_planning.global_planner.graph_search.d_star.DNode
¶
Bases: Node
Class for D* nodes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current
|
tuple
|
current coordinate |
required |
parent
|
tuple
|
coordinate of parent node |
required |
t
|
str
|
state of node, including |
required |
h
|
float
|
cost from goal to current node |
required |
k
|
float
|
minimum cost from goal to current node in history |
required |
Source code in src\python_motion_planning\global_planner\graph_search\d_star.py
Python
class DNode(Node):
"""
Class for D* nodes.
Parameters:
current (tuple): current coordinate
parent (tuple): coordinate of parent node
t (str): state of node, including `NEW` `OPEN` and `CLOSED`
h (float): cost from goal to current node
k (float): minimum cost from goal to current node in history
"""
def __init__(self, current: tuple, parent: tuple, t: str, h: float, k: float) -> None:
self.current = current
self.parent = parent
self.t = t
self.h = h
self.k = k
def __add__(self, node):
return DNode((self.x + node.x, self.y + node.y),
self.parent, self.t, self.h + node.h, self.k)
def __str__(self) -> str:
return "----------\ncurrent:{}\nparent:{}\nt:{}\nh:{}\nk:{}\n----------" \
.format(self.current, self.parent, self.t, self.h, self.k)