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: Hybrid A* behavior when path is not found #1104

Conversation

parmaski
Copy link
Contributor

@parmaski parmaski commented Dec 8, 2024

Reference issue

None

What does this implement/fix?

issue1: car.py

The vehicle goes out of the search grid when its angle is approximately pi, because the yaw angle is not clipped correctly.

Example: set the start position reverse.

@@ -404,7 +404,7 @@ def main():
     # Set Initial parameters
-    start = [10.0, 10.0, np.deg2rad(90.0)]
+    start = [10.0, 10.0, np.deg2rad(-90.0)]
     goal = [50.0, 50.0, np.deg2rad(-90.0)]

Result:

Error(calc_index): -2959
Error(calc_index): -2030
Error(calc_index): -2959
Error(calc_index): -3019
...
issue2: hybrid_a_star.py

hybrid_a_star_planning returns three empty tuples when no route found, despite returns Path class when ok.
This mismatch causes the crash of subsequent plot function.

Example: Surround the vehicle with walls

@@ -382,16 +382,16 @@ def main():
 
     ox, oy = [], []
 
-    for i in range(60):
+    for i in range(15):
         ox.append(i)
         oy.append(0.0)
-    for i in range(60):
-        ox.append(60.0)
+    for i in range(15):
+        ox.append(15.0)
         oy.append(i)
-    for i in range(61):
+    for i in range(16):
         ox.append(i)
-        oy.append(60.0)
-    for i in range(61):
+        oy.append(15.0)
+    for i in range(16):
         ox.append(0.0)
         oy.append(i)

Result:

Error: Cannot find path, No open set
Traceback (most recent call last):
  File "/workspaces/PythonRobotics/PathPlanning/HybridAStar/hybrid_a_star.py", line 440, in <module>
    main()
  File "/workspaces/PythonRobotics/PathPlanning/HybridAStar/hybrid_a_star.py", line 422, in main
    x = path.x_list
        ^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'x_list'
after fix

The program finishes as expected even after applying the two patches above.

Start Hybrid A* planning
start :  [10.0, 10.0, np.float64(-1.5707963267948966)]
goal :  [50.0, 50.0, np.float64(-1.5707963267948966)]
Error: Cannot find path, No open set
/workspaces/PythonRobotics/PathPlanning/HybridAStar/hybrid_a_star.py done!!

graph

Additional information

CheckList

  • Did you add an unittest for your new example or defect fix?
  • Did you add documents for your new example?
  • All CIs are green? (You can check it after submitting)

@parmaski parmaski changed the title fix behavior when path is not found fix: Hybrid A* behavior when path is not found Dec 8, 2024
@parmaski parmaski marked this pull request as ready for review December 8, 2024 10:58
Copy link
Owner

@AtsushiSakai AtsushiSakai left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!!

@AtsushiSakai AtsushiSakai merged commit b137ba1 into AtsushiSakai:master Dec 21, 2024
8 checks passed
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