@@ -101,9 +101,11 @@ def parse_tracker_csv(filename):
101101 vehicle_time = data [:, 19 ]
102102 cte = data [:, 20 ]
103103 x_actual , y_actual = data [:, 2 ], data [:, 5 ]
104- x_desired , y_desired = data [:, 11 ], data [:, 14 ]
104+ # x_desired, y_desired = data[:, 11], data[:, 14] ### PP
105+ x_desired , y_desired = data [:, 8 ], data [:, 11 ] #Stanley
105106 speed_actual = data [:, - 1 ]
106- return vehicle_time , cte , x_actual , y_actual , x_desired , y_desired , speed_actual
107+ des_speed = data [:, - 13 ]
108+ return vehicle_time , cte , x_actual , y_actual , x_desired , y_desired , speed_actual , des_speed
107109
108110def compute_derivative (times , values ):
109111 """
@@ -195,13 +197,13 @@ def plot_position(axis, x_actual, y_actual, x_desired=None, y_desired=None, safe
195197 """Plots vehicle actual and desired positions vs. time"""
196198 # position_error = np.sqrt((x_desired - x_actual) ** 2 + (y_desired - y_actual) ** 2)
197199
198- # axis.plot(y_desired, x_desired, linestyle='--', color='blue', label='Desired')
199- axis .plot (y_actual , x_actual , color = "black" , linewidth = 0.8 , alpha = 0.5 ) # , label='Actual')
200+ axis .plot (y_desired , x_desired , linestyle = '--' , color = 'blue' , label = 'Desired' )
201+ axis .plot (y_actual , x_actual , color = "black" , linewidth = 0.8 , alpha = 0.5 , label = 'Actual' )
200202
201203 axis .set_xlabel ("Y Position (m)" )
202204 axis .set_ylabel ("X Position (m)" )
203205 axis .set_title ("GEM Position" )
204- # axis.legend()
206+ axis .legend ()
205207 axis .grid (True )
206208
207209def plot_speeds (axis , time , speed_actual , comptued_speed = None ):
@@ -255,7 +257,8 @@ def plot_gg_diagram(axis, longitudinal_gs, lateral_gs):
255257
256258 log_dir = sys .argv [1 ]
257259 behavior_file = os .path .join (log_dir , "behavior.json" )
258- tracker_file = os .path .join (log_dir , "PurePursuitTrajectoryTracker_debug.csv" )
260+ tracker_file = os .path .join (log_dir , "StanleyTrajectoryTracker_debug.csv" )
261+ # tracker_file = os.path.join(log_dir, "PurePursuitTrajectoryTracker_debug.csv")
259262
260263 # if behavior.json doesn't exist, print error and exit
261264 if not os .path .exists (behavior_file ):
@@ -270,12 +273,15 @@ def plot_gg_diagram(axis, longitudinal_gs, lateral_gs):
270273 times , xs , ys = remove_duplicate_positions (times , xs , ys )
271274 longitudinal_gs , lateral_gs , vs , lat_accels , long_accels , times , valid_mask = compute_gs (times , xs , ys , speeds , accelerations , heading_rates )
272275
273- # vehicle_time, cte, x_actual, y_actual, x_desired, y_desired, speed_actual = parse_tracker_csv(tracker_file)
276+ vehicle_time , cte , x_actual , y_actual , x_desired , y_desired , speed_actual , des_speed = parse_tracker_csv (tracker_file )
274277
275278 fig , axs = plt .subplots (2 , 2 , figsize = (12 , 8 ))
276279 plot_gg_diagram (axs [0 , 0 ], longitudinal_gs , lateral_gs )
277- plot_position (axs [0 , 1 ], xs , ys )#, x_desired, y_desired)
278- plot_speeds (axs [1 , 0 ], times , vs )
280+ # plot_position(axs[0, 1], xs, ys) #, x_desired, y_desired)
281+ plot_position (axs [0 , 1 ], x_actual , y_actual , x_desired , y_desired )
282+ # plot_speeds(axs[1, 0], times, vs)
283+ plot_speeds (axs [1 , 0 ], vehicle_time , des_speed , speed_actual )
284+
279285 plot_accelerations (axs [1 , 1 ], long_accels , times )
280286 plt .tight_layout ()
281287 name = "gg_diagram.png"
0 commit comments