@@ -119,7 +119,7 @@ def rear_wheel_feedback_control(state, e, k, yaw_ref):
119119 return delta
120120
121121
122- def simulate (track , goal ):
122+ def simulate (path_ref , goal ):
123123 T = 500.0 # max simulation time
124124 goal_dis = 0.3
125125
@@ -133,11 +133,11 @@ def simulate(track, goal):
133133 t = [0.0 ]
134134 goal_flag = False
135135
136- s = np .arange (0 , track .length , 0.1 )
137- e , k , yaw_ref , s0 = track .calc_track_error (state .x , state .y , 0.0 )
136+ s = np .arange (0 , path_ref .length , 0.1 )
137+ e , k , yaw_ref , s0 = path_ref .calc_track_error (state .x , state .y , 0.0 )
138138
139139 while T >= time :
140- e , k , yaw_ref , s0 = track .calc_track_error (state .x , state .y , s0 )
140+ e , k , yaw_ref , s0 = path_ref .calc_track_error (state .x , state .y , s0 )
141141 di = rear_wheel_feedback_control (state , e , k , yaw_ref )
142142
143143 speed_ref = calc_target_speed (state , yaw_ref )
@@ -165,9 +165,9 @@ def simulate(track, goal):
165165 # for stopping simulation with the esc key.
166166 plt .gcf ().canvas .mpl_connect ('key_release_event' ,
167167 lambda event : [exit (0 ) if event .key == 'escape' else None ])
168- plt .plot (track .X (s ), track .Y (s ), "-r" , label = "course" )
168+ plt .plot (path_ref .X (s ), path_ref .Y (s ), "-r" , label = "course" )
169169 plt .plot (x , y , "ob" , label = "trajectory" )
170- plt .plot (track .X (s0 ), track .Y (s0 ), "xg" , label = "target" )
170+ plt .plot (path_ref .X (s0 ), path_ref .Y (s0 ), "xg" , label = "target" )
171171 plt .axis ("equal" )
172172 plt .grid (True )
173173 plt .title ("speed[km/h]:{:.2f}, target s-param:{:.2f}" .format (round (state .v * 3.6 , 2 ), s0 ))
@@ -196,10 +196,10 @@ def main():
196196 ay = [0.0 , 0.0 , 5.0 , 6.5 , 3.0 , 5.0 , - 2.0 ]
197197 goal = [ax [- 1 ], ay [- 1 ]]
198198
199- track = CubicSplinePath (ax , ay )
200- s = np .arange (0 , track .length , 0.1 )
199+ reference_path = CubicSplinePath (ax , ay )
200+ s = np .arange (0 , reference_path .length , 0.1 )
201201
202- t , x , y , yaw , v , goal_flag = simulate (track , goal )
202+ t , x , y , yaw , v , goal_flag = simulate (reference_path , goal )
203203
204204 # Test
205205 assert goal_flag , "Cannot goal"
@@ -208,7 +208,7 @@ def main():
208208 plt .close ()
209209 plt .subplots (1 )
210210 plt .plot (ax , ay , "xb" , label = "input" )
211- plt .plot (track .X (s ), track .Y (s ), "-r" , label = "spline" )
211+ plt .plot (reference_path .X (s ), reference_path .Y (s ), "-r" , label = "spline" )
212212 plt .plot (x , y , "-g" , label = "tracking" )
213213 plt .grid (True )
214214 plt .axis ("equal" )
@@ -217,14 +217,14 @@ def main():
217217 plt .legend ()
218218
219219 plt .subplots (1 )
220- plt .plot (s , np .rad2deg (track .calc_yaw (s )), "-r" , label = "yaw" )
220+ plt .plot (s , np .rad2deg (reference_path .calc_yaw (s )), "-r" , label = "yaw" )
221221 plt .grid (True )
222222 plt .legend ()
223223 plt .xlabel ("line length[m]" )
224224 plt .ylabel ("yaw angle[deg]" )
225225
226226 plt .subplots (1 )
227- plt .plot (s , track .calc_curvature (s ), "-r" , label = "curvature" )
227+ plt .plot (s , reference_path .calc_curvature (s ), "-r" , label = "curvature" )
228228 plt .grid (True )
229229 plt .legend ()
230230 plt .xlabel ("line length[m]" )
0 commit comments