File tree Expand file tree Collapse file tree
PathTracking/pure_pursuit Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ def search_target_index(self, state):
8080 # search nearest point index
8181 dx = [state .rear_x - icx for icx in self .cx ]
8282 dy = [state .rear_y - icy for icy in self .cy ]
83- d = [ idx ** 2 + idy ** 2 for ( idx , idy ) in zip ( dx , dy )]
84- ind = d . index ( min ( d ) )
83+ d = np . hypot ( dx , dy )
84+ ind = np . argmin ( d )
8585 self .old_nearest_point_index = ind
8686 else :
8787 ind = self .old_nearest_point_index
@@ -100,9 +100,7 @@ def search_target_index(self, state):
100100
101101 # search look ahead target point index
102102 while Lf > L and (ind + 1 ) < len (self .cx ):
103- dx = self .cx [ind ] - state .rear_x
104- dy = self .cy [ind ] - state .rear_y
105- L = math .hypot (dx , dy )
103+ L = state .calc_distance (self .cx [ind ], self .cy [ind ])
106104 ind += 1
107105
108106 return ind
You can’t perform that action at this time.
0 commit comments