-
Notifications
You must be signed in to change notification settings - Fork 690
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
perf(freespace_planning_algorithms): update the astar search algorithm #6526
Conversation
4e9c5da
to
77e3e4d
Compare
This pull request has been automatically marked as stale because it has not had recent activity. |
@takayuki5168 @mkquda hello, @NorahXiong from AutoCore will take over this task, do you have anything to share on this PR? |
@xmfcx @takayuki5168
|
@mkquda thanks for letting us know, I will close this PR then ✅ |
Description
The current A start implementation does not account for exploring opened nodes and only explores those with node status:
None
.Open
nodes need to be explored based on a lowermove_cost (gc+hc)
than thegc
cost of next node. A cost for turningmove_cost_is_turn
is also introduced to penalize turning over going straight in addition to cost for reversing.A Priority Queue is used to store open nodes in the algorithm, but
std::priority_queue
does not give you the ability to update node parameters and it automatically resorts the queue. Queue resorting only happens on queue.push(node), when a new node is pushed into the queue. So as a work around instead of updating nodes (when algo wants to revisit open nodes), a new reference to the same node is instead pushed into the queue. This new reference pushed will always get popped out of the queue first due to its lesser cost, here itsNodeStatus
will be set toClosed
. When the algorithm pops the old duplicate node left in the queue, a flag check whether itsNodeStatus
isClosed
or not. If closed the node is discarded without processing.Tests performed
The
freespace_planning_algorithms/test/src/test_freespace_planning_algorithms.cpp
tests were run to gauge the new astar trajectories generated. The new trajectories are found to be shorter, uses less fwd, back segments and were more smoother than previous ones. The algorithm now explores all open nodes, this leads to increased computation time but optimal paths are generated.It was further found that by using curve weights, the amount of explored nodes drastically increases. But a smoother and much straighter optimal path is generated. To allow user to switch between using curve weights or not, also to switch between new complete astar and the old astar that only uses unexplored nodes, the following search configurations are introduced in
freespace_planner.param.yaml
:The user can modify these parameters to balance path optimality and run time.
Comparison images between different configs are shown below for the tests:
Effects on system behavior
The astart search takes longer but finds the optimal path.
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.