-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Bidirectional A* #313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bidirectional A* #313
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks great example. PTAL
|
||
c_id_A = min( | ||
open_set_A, | ||
key=lambda o: open_set_A[o].cost + self.calc_heuristic(current_B, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readability is not good a little bit, can you make a function to calc a final cost?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it okay ?
|
||
c_id_B = min( | ||
open_set_B, | ||
key=lambda o: open_set_B[o].cost + self.calc_heuristic(current_A, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same upper comment.
|
||
child_node_B = self.Node(current_B.x + self.motion[i][0], | ||
current_B.y + self.motion[i][1], | ||
current_B.cost + self.motion[i][2], c_id_B) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same upper comment.
if n_id_B in closed_set_B: | ||
continue_B = True | ||
|
||
if not(continue_A): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not(continue_A): | |
if not continue_A: |
|
||
if not(continue_A): | ||
if n_id_A not in open_set_A: | ||
open_set_A[n_id_A] = child_node_A # discovered a new node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8 too long line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops forgot to parse with autopep8, done now.
# This path is the best until now. record it | ||
open_set_A[n_id_A] = child_node_A | ||
|
||
if not(continue_B): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not(continue_B): | |
if not continue_B: |
|
||
if not(continue_B): | ||
if n_id_B not in open_set_B: | ||
open_set_B[n_id_B] = child_node_B # discovered a new node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8 too long line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTAL
grid_size = 2.0 # [m] | ||
robot_radius = 1.0 # [m] | ||
|
||
# set obstable positions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
obstacle?
|
||
child_node_A = self.Node(current_A.x + self.motion[i][0], | ||
current_A.y + self.motion[i][1], | ||
current_A.cost + self.motion[i][2], c_id_A) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pep8 error.
Could you move the the last "c_id_A" to the next line?
|
||
child_node_B = self.Node(current_B.x + self.motion[i][0], | ||
current_B.y + self.motion[i][1], | ||
current_B.cost + self.motion[i][2], c_id_B) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as upper comment.
|
||
return rx, ry | ||
|
||
def calc_final_path_bidir(self, meetnode_A, meetnode_B, closed_set_A, closed_set_B): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calc_final_bidirectional_path?
@guilyx Thank you so much!! LGTM. I will merge it. |
Implement Bidirectional A* algorithm. (two A* searching for the last node added to the other's closed set).