PathPlanning icon indicating copy to clipboard operation
PathPlanning copied to clipboard

I have a question of "rrt_star.py" in rrt_2D.

Open KuKuKI233 opened this issue 2 years ago • 1 comments

rrt_star.py : this part of code

def find_near_neighbor(self, node_new):
        n = len(self.vertex) + 1
        r = min(self.search_radius * math.sqrt((math.log(n) / n)), self.step_len)
        dist_table = [math.hypot(nd.x - node_new.x, nd.y - node_new.y) for nd in self.vertex]
        dist_table_index = [ind for ind in range(len(dist_table)) if dist_table[ind] <= r and
                            not self.utils.is_collision(node_new, self.vertex[ind])]
        return dist_table_index

r is the search radius to search for potential best parent nodes,but I don‘t think it should use min() function. I guess the function of the code about r is that as the vertex increases, the radius of the search for the parent node also increases. But it should use max() function. Maybe there is something I misunderstood, but using max() works better works more in principle..

using min(): 屏幕截图 2022-03-07 172100 using max(): 屏幕截图 2022-03-07 171957

Is it my understanding of your code is wrong, I hope to get your help.

KuKuKI233 avatar Mar 07 '22 09:03 KuKuKI233

r is calculated correctly. If max works better then you might have chosen a too large step size. Then max always picks the step size as r, otherwise, for a small step size, it is scaled to the tree's cardinality, right?

zweistein avatar Jun 27 '22 20:06 zweistein