Skip to content

Commit 1dd9bad

Browse files
committed
fix pure_pursuit distance bug
1 parent 1639032 commit 1dd9bad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

PathTracking/pure_pursuit/pure_pursuit.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
k = 0.1 # look forward gain
1313
Lfc = 1.0 # look-ahead distance
14-
Kp = 1.0 # speed propotional gain
14+
Kp = 1.0 # speed proportional gain
1515
dt = 0.1 # [s]
1616
L = 2.9 # [m] wheel base of vehicle
1717

@@ -84,9 +84,9 @@ def calc_target_index(state, cx, cy):
8484

8585
# search look ahead target point index
8686
while Lf > L and (ind + 1) < len(cx):
87-
dx = cx[ind + 1] - cx[ind]
88-
dy = cy[ind + 1] - cy[ind]
89-
L += math.sqrt(dx ** 2 + dy ** 2)
87+
dx = cx[ind] - state.x
88+
dy = cy[ind] - state.y
89+
L = math.sqrt(dx ** 2 + dy ** 2)
9090
ind += 1
9191

9292
return ind

0 commit comments

Comments
 (0)