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

feat(freespace_planning_algorithms): use distance to nearest obstacle to improve path planning #8089

Conversation

mkquda
Copy link
Contributor

@mkquda mkquda commented Jul 17, 2024

Description

Current A-star planner does not use any information regarding distance to obstacle for path planning, it only checks for collision for each expanded node.
As a result generated path can navigate close to obstacles and cause the vehicle to stop frequently as it follows the path.

Changes

  • Includes changes from preceding PR
  • Compute an EDT (euclidean distance transform) map to store the distance to nearest obstacle for each grid cell
  • Use EDT data to add cost to account for closeness to obstacles
  • Use EDT value to minimize collision check necessity (by comparing EDT value to vehicle largest and smallest dimensions)
  • Use distance to obstacle and distance to goal to vary node expansion distance (shorter primitives near obstacles / goal, longer primitives far from obstacles / goal)

Related links

Preceding PR's:

How was this PR tested?

tested on psim.
compared performance with unit tests: (see here for complete comparison)

Notes for reviewers

This PR includes changes from a preceding PR. So please review the PR's in order.

Interface changes

ROS Parameter Changes

Additions and removals

Change type Parameter Name Type Default Value Description
Added adapt_expansion_distance bool true flag to enable / disable variable A-star expansion distance
Added obstacle_distance_weight double 1.5 additional cost factor for closeness to obstacles

Effects on system behavior

When using free space planner, path should navigate away from obstacles when possible.

mkquda added 30 commits July 1, 2024 16:06
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
…61-use-edt-map-to-improve-collision-check-performance

Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
…61-use-edt-map-to-improve-collision-check-performance
Signed-off-by: mohammad alqudah <[email protected]>
…61-use-edt-map-to-improve-collision-check-performance

Signed-off-by: mohammad alqudah <[email protected]>
Signed-off-by: mohammad alqudah <[email protected]>
…61-use-edt-map-to-improve-collision-check-performance
…61-use-edt-map-to-improve-collision-check-performance
Signed-off-by: mohammad alqudah <[email protected]>
…61-use-edt-map-to-improve-collision-check-performance
Copy link
Contributor

@maxime-clem maxime-clem left a comment

Choose a reason for hiding this comment

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

Tested the PR and the freespace planning looks good.

Copy link

@armaganarsln armaganarsln left a comment

Choose a reason for hiding this comment

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

Can you please test with this issue:

@mkquda mkquda requested a review from kosuke55 August 5, 2024 06:49
@maxime-clem
Copy link
Contributor

@armaganarsln If it is okay I will dismiss your request for changes so that we can move forward with improving the freespace planner.
The tests you requested show that the current parking feature still has issues, but improvements to parking should be done in separate PRs.

@maxime-clem maxime-clem dismissed armaganarsln’s stale review August 14, 2024 02:53

Let's not block freespace planner improvements because of parking issues

@mkquda mkquda merged commit 2a050d7 into autowarefoundation:main Aug 14, 2024
28 of 30 checks passed
@mkquda mkquda deleted the RT1-6961-use-edt-map-to-improve-collision-check-performance branch August 14, 2024 04:14
@armaganarsln
Copy link

@armaganarsln If it is okay I will dismiss your request for changes so that we can move forward with improving the freespace planner. The tests you requested show that the current parking feature still has issues, but improvements to parking should be done in separate PRs.

For me its ok as long as in the end the tests are made in simulation. Do you want me to delete my change requests on the other PRs as well?

xtk8532704 pushed a commit to tier4/autoware.universe that referenced this pull request Aug 15, 2024
… to improve path planning (autowarefoundation#8089)

* refactor freespace planning algorithms

Signed-off-by: mohammad alqudah <[email protected]>

* fix error

Signed-off-by: mohammad alqudah <[email protected]>

* use vector instead of map for a-star node graph

Signed-off-by: mohammad alqudah <[email protected]>

* remove unnecessary parameters

Signed-off-by: mohammad alqudah <[email protected]>

* precompute average turning radius

Signed-off-by: mohammad alqudah <[email protected]>

* add threshold for minimum distance between direction changes

Signed-off-by: mohammad alqudah <[email protected]>

* apply curvature weight and change in curvature weight

Signed-off-by: mohammad alqudah <[email protected]>

* store total cost instead of heuristic cost

Signed-off-by: mohammad alqudah <[email protected]>

* fix reverse weight application

Signed-off-by: mohammad alqudah <[email protected]>

* fix parameter description in README

Signed-off-by: mohammad alqudah <[email protected]>

* implement edt map to store distance to nearest obstacle for each grid cell

Signed-off-by: mohammad alqudah <[email protected]>

* use obstacle edt in collision check

Signed-off-by: mohammad alqudah <[email protected]>

* add cost for distance to obstacle

Signed-off-by: mohammad alqudah <[email protected]>

* fix formats

Signed-off-by: mohammad alqudah <[email protected]>

* add missing include

Signed-off-by: mohammad alqudah <[email protected]>

* refactor functions

Signed-off-by: mohammad alqudah <[email protected]>

* add missing include

Signed-off-by: mohammad alqudah <[email protected]>

* precompute number of margin cells to reduce out of range vertices check necessity

Signed-off-by: mohammad alqudah <[email protected]>

* add reset data function

Signed-off-by: mohammad alqudah <[email protected]>

* add member function set() to AstarNode struct

Signed-off-by: mohammad alqudah <[email protected]>

* implement adaptive expansion distance

Signed-off-by: mohammad alqudah <[email protected]>

* remove unnecessary code

Signed-off-by: mohammad alqudah <[email protected]>

* interpolate nodes with large expansion distance

Signed-off-by: mohammad alqudah <[email protected]>

* minor refactor

Signed-off-by: mohammad alqudah <[email protected]>

* ensure expansion distance is larger than grid cell diagonal

Signed-off-by: mohammad alqudah <[email protected]>

* compute collision free distance to goal map

Signed-off-by: mohammad alqudah <[email protected]>

* use obstacle edt when computing collision free distance map

Signed-off-by: mohammad alqudah <[email protected]>

* minor refactor

Signed-off-by: mohammad alqudah <[email protected]>

* fix expansion cost function

Signed-off-by: mohammad alqudah <[email protected]>

* set distance map before setting start node

Signed-off-by: mohammad alqudah <[email protected]>

* refactor detect collision function

Signed-off-by: mohammad alqudah <[email protected]>

* add missing variable initialization

Signed-off-by: mohammad alqudah <[email protected]>

* remove declared but undefined function

Signed-off-by: mohammad alqudah <[email protected]>

* remove unnecessary checks

Signed-off-by: mohammad alqudah <[email protected]>

* minor fix

Signed-off-by: mohammad alqudah <[email protected]>

* refactor computeEDTMap function

Signed-off-by: mohammad alqudah <[email protected]>

* remove unnecessary code

Signed-off-by: mohammad alqudah <[email protected]>

* set min and max expansion distance after setting costmap

Signed-off-by: mohammad alqudah <[email protected]>

* refactor detectCollision function

Signed-off-by: mohammad alqudah <[email protected]>

* remove unused function

Signed-off-by: mohammad alqudah <[email protected]>

* change default parameter values

Signed-off-by: mohammad alqudah <[email protected]>

* fix computeEDTMap function

Signed-off-by: mohammad alqudah <[email protected]>

* rename parameter

Signed-off-by: mohammad alqudah <[email protected]>

* use linear function for obstacle distance cost

Signed-off-by: mohammad alqudah <[email protected]>

* fix rrtstar obstacle check

Signed-off-by: mohammad alqudah <[email protected]>

* remove redundant return statements

Signed-off-by: mohammad alqudah <[email protected]>

* check goal pose validity before setting collision free distance map

Signed-off-by: mohammad alqudah <[email protected]>

* declare variables as const where necessary

Signed-off-by: mohammad alqudah <[email protected]>

* compare front and back lengths when setting min and max dimension

Signed-off-by: mohammad alqudah <[email protected]>

* add docstring and citation for computeEDTMap function

Signed-off-by: mohammad alqudah <[email protected]>

* suppress spell check

Signed-off-by: mohammad alqudah <[email protected]>

---------

Signed-off-by: mohammad alqudah <[email protected]>
Co-authored-by: Maxime CLEMENT <[email protected]>
Signed-off-by: xtk8532704 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:planning Route planning, decision-making, and navigation. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) type:documentation Creating or refining documentation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants