PathPlanning
PathPlanning copied to clipboard
I have a question of "rrt_star.py" in rrt_2D.
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(): using max():
Is it my understanding of your code is wrong, I hope to get your help.
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?