mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:22 -04:00
add comment for stopping the simulation
This commit is contained in:
@@ -546,6 +546,7 @@ def animation(plant, controller, dt):
|
||||
steer = math.atan2(controller.history_u_2[t] * WB / v, 1.0)
|
||||
|
||||
plt.cla()
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
plt.plot(plant.history_x, plant.history_y, "-r", label="trajectory")
|
||||
|
||||
@@ -224,6 +224,7 @@ def do_simulation(cx, cy, cyaw, ck, speed_profile, goal):
|
||||
|
||||
if target_ind % 1 == 0 and show_animation:
|
||||
plt.cla()
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
plt.plot(cx, cy, "-r", label="course")
|
||||
|
||||
@@ -203,6 +203,7 @@ def closed_loop_prediction(cx, cy, cyaw, ck, speed_profile, goal):
|
||||
|
||||
if target_ind % 1 == 0 and show_animation:
|
||||
plt.cla()
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
plt.plot(cx, cy, "-r", label="course")
|
||||
|
||||
@@ -429,6 +429,7 @@ def do_simulation(cx, cy, cyaw, ck, sp, dl, initial_state):
|
||||
|
||||
if show_animation: # pragma: no cover
|
||||
plt.cla()
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
if ox is not None:
|
||||
|
||||
@@ -93,6 +93,7 @@ def plot_vehicle(x, y, theta, x_traj, y_traj): # pragma: no cover
|
||||
|
||||
plt.plot(x_traj, y_traj, 'b--')
|
||||
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
|
||||
|
||||
@@ -166,6 +166,7 @@ def main():
|
||||
|
||||
if show_animation: # pragma: no cover
|
||||
plt.cla()
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
plot_arrow(state.x, state.y, state.yaw)
|
||||
|
||||
@@ -149,6 +149,7 @@ def closed_loop_prediction(cx, cy, cyaw, ck, speed_profile, goal):
|
||||
|
||||
if target_ind % 1 == 0 and show_animation:
|
||||
plt.cla()
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
plt.plot(cx, cy, "-r", label="course")
|
||||
|
||||
@@ -186,6 +186,7 @@ def main():
|
||||
|
||||
if show_animation: # pragma: no cover
|
||||
plt.cla()
|
||||
# for stopping simulation with the esc key.
|
||||
plt.gcf().canvas.mpl_connect('key_release_event',
|
||||
lambda event: [exit(0) if event.key == 'escape' else None])
|
||||
plt.plot(cx, cy, ".r", label="course")
|
||||
|
||||
Reference in New Issue
Block a user