Skip to content

Commit 82c55d4

Browse files
committed
Made old index global
1 parent d5d026d commit 82c55d4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

PathTracking/pure_pursuit/pure_pursuit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,16 @@ def pure_pursuit_control(state, cx, cy, pind):
7474
return delta, ind
7575

7676
def calc_distance(state, point_x, point_y):
77+
7778
dx = state.rear_x - point_x
7879
dy = state.rear_y - point_y
79-
return math.sqrt(distance_x ** 2 + distance_y ** 2)
80+
return math.sqrt(dx ** 2 + dy ** 2)
8081

8182

8283
def calc_target_index(state, cx, cy):
8384

85+
global old_nearest_point_index
86+
8487
if old_nearest_point_index is None:
8588
# search nearest point index
8689
dx = [state.rear_x - icx for icx in cx]

0 commit comments

Comments
 (0)