PathPlanning icon indicating copy to clipboard operation
PathPlanning copied to clipboard

rrt algorith mistake

Open Dmitry-Diordychuk opened this issue 3 years ago • 3 comments

In line 54 there is a minor mistake. There is must be if dist <= self.step_len and not self.utils.is_collision(node_new, self.s_goal): instead if dist <= self.step_len: because otherwise, if there is obstacle in a dist, than the last node will be connected trought it.

Dmitry-Diordychuk avatar Dec 14 '20 11:12 Dmitry-Diordychuk

Thanks very much! I have updated the code.

zhm-real avatar Dec 14 '20 20:12 zhm-real

Also, in function extract_path() (line 84) you miss node_end. Need to be something like:

def extract_path(self, node_end):
    path = [(self.s_goal.x, self.s_goal.y), (node_end.x, node_end.y)]
    node_now = node_end

    while node_now.parent is not None:
        node_now = node_now.parent
        path.append((node_now.x, node_now.y))

    return path

Dmitry-Diordychuk avatar Dec 15 '20 14:12 Dmitry-Diordychuk

Also, in function extract_path() (line 84) you miss node_end. Need to be something like:

def extract_path(self, node_end):
    path = [(self.s_goal.x, self.s_goal.y), (node_end.x, node_end.y)]
    node_now = node_end

    while node_now.parent is not None:
        node_now = node_now.parent
        path.append((node_now.x, node_now.y))

    return path

Nb thanks a lot

Linusonn avatar Apr 14 '21 03:04 Linusonn