Skip to content

LNode

src.python_motion_planning.global_planner.graph_search.lpa_star.LNode

Bases: Node

Class for LPA* nodes.

Parameters:

Name Type Description Default
current tuple

current coordinate

required
g float

minimum cost moving from start(predict)

required
rhs float

minimum cost moving from start(value)

required
key list

priority

required
Source code in src\python_motion_planning\global_planner\graph_search\lpa_star.py
Python
class LNode(Node):
    """
    Class for LPA* nodes.

    Parameters:
        current (tuple): current coordinate
        g (float): minimum cost moving from start(predict)
        rhs (float): minimum cost moving from start(value)
        key (list): priority
    """
    def __init__(self, current: tuple, g: float, rhs: float, key: list) -> None:
        self.current = current
        self.g = g
        self.rhs = rhs
        self.key = key

    def __add__(self, node):
        return LNode((self.x + node.x, self.y + node.y), 
                      self.g, self.rhs, self.key)

    def __lt__(self, node) -> bool:
        return self.key < node.key

    def __str__(self) -> str:
        return "----------\ncurrent:{}\ng:{}\nrhs:{}\nkey:{}\n----------" \
            .format(self.current, self.g, self.rhs, self.key)