1616
1717# NOTE: *_pose is a 3-array: 0 - x coord, 1 - y coord, 2 - orientation angle \theta
1818
19+ show_animation = True
20+
1921
2022class eta3_path (object ):
2123 """
@@ -184,11 +186,13 @@ def test1():
184186 for i , u in enumerate (ui ):
185187 pos [:, i ] = path .calc_path_point (u )
186188
187- # plot the path
188- plt .plot (pos [0 , :], pos [1 , :])
189- plt .pause (1.0 )
189+ if show_animation :
190+ # plot the path
191+ plt .plot (pos [0 , :], pos [1 , :])
192+ plt .pause (1.0 )
190193
191- plt .close ("all" )
194+ if show_animation :
195+ plt .close ("all" )
192196
193197
194198def test2 ():
@@ -212,11 +216,13 @@ def test2():
212216 for i , u in enumerate (ui ):
213217 pos [:, i ] = path .calc_path_point (u )
214218
215- # plot the path
216- plt .plot (pos [0 , :], pos [1 , :])
217- plt .pause (1.0 )
219+ if show_animation :
220+ # plot the path
221+ plt .plot (pos [0 , :], pos [1 , :])
222+ plt .pause (1.0 )
218223
219- plt .close ("all" )
224+ if show_animation :
225+ plt .close ("all" )
220226
221227
222228def test3 ():
@@ -273,14 +279,16 @@ def test3():
273279 pos [:, i ] = path .calc_path_point (u )
274280
275281 # plot the path
276- plt .figure ('Path from Reference' )
277- plt .plot (pos [0 , :], pos [1 , :])
278- plt .xlabel ('x' )
279- plt .ylabel ('y' )
280- plt .title ('Path' )
281- plt .pause (1.0 )
282-
283- plt .show ()
282+
283+ if show_animation :
284+ plt .figure ('Path from Reference' )
285+ plt .plot (pos [0 , :], pos [1 , :])
286+ plt .xlabel ('x' )
287+ plt .ylabel ('y' )
288+ plt .title ('Path' )
289+ plt .pause (1.0 )
290+
291+ plt .show ()
284292
285293
286294def main ():
0 commit comments