Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions PathPlanning/ProbabilisticRoadMap/probabilistic_road_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,18 @@ def generate_roadmap(sample_x, sample_y, rr, obkdtree):

def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
"""
sx: start x position [m]
sy: start y position [m]
gx: goal x position [m]
gx: goal x position [m]
gy: goal y position [m]
ox: x position list of Obstacles [m]
oy: y position list of Obstacles [m]
reso: grid resolution [m]
rr: robot radius[m]
rr: robot radius [m]
road_map: ??? [m]
sample_x: ??? [m]
sample_y: ??? [m]

@return: Two lists of path coordinates ([x1, x2, ...], [y1, y2, ...]), empty list when no path was found
"""

nstart = Node(sx, sy, 0.0, -1)
Expand All @@ -175,9 +181,12 @@ def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
openset, closedset = dict(), dict()
openset[len(road_map) - 2] = nstart

path_found = True

while True:
if not openset:
print("Cannot find path")
path_found = False
break

c_id = min(openset, key=lambda o: openset[o].cost)
Expand Down Expand Up @@ -217,6 +226,9 @@ def dijkstra_planning(sx, sy, gx, gy, ox, oy, rr, road_map, sample_x, sample_y):
openset[n_id].pind = c_id
else:
openset[n_id] = node

if path_found is False:
return [], []

# generate final course
rx, ry = [ngoal.x], [ngoal.y]
Expand Down