Skip to content

Commit 51689d6

Browse files
authored
Issue AtsushiSakai#523 fix (Reeds-Shepp planner handling length=0 case) (AtsushiSakai#524)
* Without equals sign, sometimes get points that are in the wrong direction - relative to the points before and after it- when change in x or change in y along path is 0 * Created test script for dubins path generator * Made len == 0 it's own case, also changed 'l' to 'len' to appease travisCI * More variable renaming to appease CI * Broke == 0 into its own case in dubins planner, also Renaming files to appease CI * Reverting some naming changes * Turns out theres already a test for dubins.. not sure how I missed that * Note to self: run the test cases on your own before throwing them at CI * Added handling of length=0 case in generate_local_course() * Missed reverting 'mode' back to 'm' in one spot * Addressing style issues (line length)
1 parent 8f3337e commit 51689d6

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

PathPlanning/DubinsPath/dubins_path_planning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def generate_local_course(total_length, lengths, mode, max_curvature,
255255
ll = 0.0
256256

257257
for (m, length, i) in zip(mode, lengths, range(len(mode))):
258-
if length == 0:
258+
if length == 0.0:
259259
continue
260260
elif length > 0.0:
261261
dist = step_size

PathPlanning/ReedsSheppPath/reeds_shepp_path_planning.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,10 @@ def generate_local_course(total_length, lengths, mode, max_curvature, step_size)
285285

286286
ll = 0.0
287287

288-
for (m, l, i) in zip(mode, lengths, range(len(mode))):
289-
if l > 0.0:
288+
for (m, length, i) in zip(mode, lengths, range(len(mode))):
289+
if length == 0.0:
290+
continue
291+
elif length > 0.0:
290292
d = step_size
291293
else:
292294
d = -step_size
@@ -300,17 +302,19 @@ def generate_local_course(total_length, lengths, mode, max_curvature, step_size)
300302
else:
301303
pd = d - ll
302304

303-
while abs(pd) <= abs(l):
305+
while abs(pd) <= abs(length):
304306
ind += 1
305307
px, py, pyaw, directions = interpolate(
306-
ind, pd, m, max_curvature, ox, oy, oyaw, px, py, pyaw, directions)
308+
ind, pd, m, max_curvature, ox, oy, oyaw,
309+
px, py, pyaw, directions)
307310
pd += d
308311

309-
ll = l - pd - d # calc remain length
312+
ll = length - pd - d # calc remain length
310313

311314
ind += 1
312315
px, py, pyaw, directions = interpolate(
313-
ind, l, m, max_curvature, ox, oy, oyaw, px, py, pyaw, directions)
316+
ind, length, m, max_curvature, ox, oy, oyaw,
317+
px, py, pyaw, directions)
314318

315319
# remove unused data
316320
while px[-1] == 0.0:
@@ -390,7 +394,8 @@ def main():
390394
step_size = 0.1
391395

392396
px, py, pyaw, mode, clen = reeds_shepp_path_planning(
393-
start_x, start_y, start_yaw, end_x, end_y, end_yaw, curvature, step_size)
397+
start_x, start_y, start_yaw, end_x, end_y, end_yaw,
398+
curvature, step_size)
394399

395400
if show_animation: # pragma: no cover
396401
plt.cla()

0 commit comments

Comments
 (0)