@@ -250,7 +250,7 @@ def main(): # pragma: no cover
250250 yaw = [state .yaw ]
251251 v = [state .v ]
252252 t = [0.0 ]
253- target_ind = calc_target_index (state , cx , cy )
253+ target_ind , dis = calc_target_index (state , cx , cy )
254254
255255 while T >= time and lastIndex > target_ind :
256256 ai = PIDControl (target_speed , state .v )
@@ -291,43 +291,6 @@ def main(): # pragma: no cover
291291 plt .show ()
292292
293293
294- def main2 (): # pragma: no cover
295- import pandas as pd
296- data = pd .read_csv ("rrt_course.csv" )
297- cx = np .array (data ["x" ])
298- cy = np .array (data ["y" ])
299- cyaw = np .array (data ["yaw" ])
300-
301- target_speed = 10.0 / 3.6
302-
303- goal = [cx [- 1 ], cy [- 1 ]]
304-
305- cx , cy , cyaw = extend_path (cx , cy , cyaw )
306-
307- speed_profile = calc_speed_profile (cx , cy , cyaw , target_speed )
308-
309- t , x , y , yaw , v , a , d , flag = closed_loop_prediction (
310- cx , cy , cyaw , speed_profile , goal )
311-
312- plt .subplots (1 )
313- plt .plot (cx , cy , ".r" , label = "course" )
314- plt .plot (x , y , "-b" , label = "trajectory" )
315- plt .plot (goal [0 ], goal [1 ], "xg" , label = "goal" )
316- plt .legend ()
317- plt .xlabel ("x[m]" )
318- plt .ylabel ("y[m]" )
319- plt .axis ("equal" )
320- plt .grid (True )
321-
322- plt .subplots (1 )
323- plt .plot (t , [iv * 3.6 for iv in v ], "-r" )
324- plt .xlabel ("Time[s]" )
325- plt .ylabel ("Speed[km/h]" )
326- plt .grid (True )
327- plt .show ()
328-
329-
330294if __name__ == '__main__' : # pragma: no cover
331295 print ("Pure pursuit path tracking simulation start" )
332- # main()
333- main2 ()
296+ main ()
0 commit comments