Skip to content
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

Fix A* star selection logic #22

Open
wants to merge 11 commits into
base: feature/clang_format_reorder_includes
Choose a base branch
from

Conversation

victorreijgwart
Copy link
Member

This PR fixes A*'s best-path selection comparison, which was wrongly inverted.
Unsurprisingly this significantly improves performance, especially when the linked skeleton graph becomes large.

This bug also affects mav_voxblox_planning and the other packages in our stack that are derived from it. Corresponding PRs will be opened there.

@victorreijgwart victorreijgwart requested a review from Schmluk March 17, 2021 22:51
Copy link
Contributor

@Schmluk Schmluk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice catch! Only one minor comment.

g_score_map[current_vertex_id] =
(t_odom_current_vertex - start_point).norm();
f_score_map[current_vertex_id] =
(goal_point - t_odom_current_vertex).norm();
f_score_map[current_vertex_id] = h_score;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentionally called h_score and then assigned to the f_score_map? I'm not too familiar with the terminology but might lead to confusions.

Copy link
Member Author

@victorreijgwart victorreijgwart Mar 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, the update equation here should be f[neighbor] = g[neighbor] + h[neighbor]. The code above only initializes the starting vertices and will result in all of them being expanded before any regular vertex, so it won't affect the result. But I agree it's confusing and there's no advantage of not using the standard update equation.
In general, this whole getPathBetweenVertices(...) method grew organically and got quite messy. I'll do some refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants