Skip to content

Commit 570dbec

Browse files
committed
Merge branch 'master' of github.com:AtsushiSakai/PythonRobotics
2 parents f19fdac + edf9e99 commit 570dbec

File tree

57 files changed

+264
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+264
-120
lines changed

.github/workflows/greetings.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

AerialNavigation/drone_3d_trajectory_following/Quadrotor.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import numpy as np
99
import matplotlib.pyplot as plt
1010

11-
1211
class Quadrotor():
1312
def __init__(self, x=0, y=0, z=0, roll=0, pitch=0, yaw=0, size=0.25, show_animation=True):
1413
self.p1 = np.array([size / 2, 0, 0, 1]).T
@@ -24,6 +23,10 @@ def __init__(self, x=0, y=0, z=0, roll=0, pitch=0, yaw=0, size=0.25, show_animat
2423
if self.show_animation:
2524
plt.ion()
2625
fig = plt.figure()
26+
# for stopping simulation with the esc key.
27+
fig.canvas.mpl_connect('key_release_event',
28+
lambda event: [exit(0) if event.key == 'escape' else None])
29+
2730
self.ax = fig.add_subplot(111, projection='3d')
2831

2932
self.update_pose(x, y, z, roll, pitch, yaw)
@@ -81,4 +84,4 @@ def plot(self): # pragma: no cover
8184
plt.ylim(-5, 5)
8285
self.ax.set_zlim(0, 10)
8386

84-
plt.pause(0.001)
87+
plt.pause(0.001)

AerialNavigation/rocket_powered_landing/rocket_powered_landing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,9 @@ def plot_animation(X, U): # pragma: no cover
567567

568568
fig = plt.figure()
569569
ax = fig.gca(projection='3d')
570+
# for stopping simulation with the esc key.
571+
fig.canvas.mpl_connect('key_release_event',
572+
lambda event: [exit(0) if event.key == 'escape' else None])
570573

571574
for k in range(K):
572575
plt.cla()

ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ def astar_torus(grid, start_node, goal_node):
162162
for i in range(1, len(route)):
163163
grid[route[i]] = 6
164164
plt.cla()
165+
# for stopping simulation with the esc key.
166+
plt.gcf().canvas.mpl_connect('key_release_event',
167+
lambda event: [exit(0) if event.key == 'escape' else None])
165168
plt.imshow(grid, cmap=cmap, norm=norm, interpolation=None)
166169
plt.show()
167170
plt.pause(1e-2)
@@ -262,4 +265,4 @@ def plot(self, obstacles=[]): # pragma: no cover
262265

263266

264267
if __name__ == '__main__':
265-
main()
268+
main()

ArmNavigation/arm_obstacle_navigation/arm_obstacle_navigation_2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def astar_torus(grid, start_node, goal_node):
193193
for i in range(1, len(route)):
194194
grid[route[i]] = 6
195195
plt.cla()
196+
# for stopping simulation with the esc key.
197+
plt.gcf().canvas.mpl_connect('key_release_event',
198+
lambda event: [exit(0) if event.key == 'escape' else None])
196199
plt.imshow(grid, cmap=cmap, norm=norm, interpolation=None)
197200
plt.show()
198201
plt.pause(1e-2)

ArmNavigation/n_joint_arm_to_point_control/NLinkArm.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def update_points(self):
5151

5252
def plot(self): # pragma: no cover
5353
plt.cla()
54+
# for stopping simulation with the esc key.
55+
plt.gcf().canvas.mpl_connect('key_release_event',
56+
lambda event: [exit(0) if event.key == 'escape' else None])
5457

5558
for i in range(self.n_links + 1):
5659
if i is not self.n_links:

ArmNavigation/two_joint_arm_to_point_control/two_joint_arm_to_point_control.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ def animation():
114114
def main(): # pragma: no cover
115115
fig = plt.figure()
116116
fig.canvas.mpl_connect("button_press_event", click)
117+
# for stopping simulation with the esc key.
118+
fig.canvas.mpl_connect('key_release_event',
119+
lambda event: [exit(0) if event.key == 'escape' else None])
117120
two_joint_arm()
118121

119122

Bipedal/bipedal_planner/bipedal_planner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ def walk(self, T_sup=0.8, z_c=0.8, a=10, b=1, plot=False):
111111
if c > len(com_trajectory_for_plot):
112112
# set up plotter
113113
plt.cla()
114+
# for stopping simulation with the esc key.
115+
plt.gcf().canvas.mpl_connect('key_release_event',
116+
lambda event: [exit(0) if event.key == 'escape' else None])
114117
ax.set_zlim(0, z_c * 2)
115118
ax.set_aspect('equal', 'datalim')
116119

Localization/ensemble_kalman_filter/ensemble_kalman_filter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ def main():
213213

214214
if show_animation:
215215
plt.cla()
216+
# for stopping simulation with the esc key.
217+
plt.gcf().canvas.mpl_connect('key_release_event',
218+
lambda event: [exit(0) if event.key == 'escape' else None])
216219

217220
for i in range(len(z[:, 0])):
218221
plt.plot([xTrue[0, 0], z[i, 2]], [xTrue[1, 0], z[i, 3]], "-k")

Localization/extended_kalman_filter/extended_kalman_filter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ def main():
191191

192192
if show_animation:
193193
plt.cla()
194+
# for stopping simulation with the esc key.
195+
plt.gcf().canvas.mpl_connect('key_release_event',
196+
lambda event: [exit(0) if event.key == 'escape' else None])
194197
plt.plot(hz[0, :], hz[1, :], ".g")
195198
plt.plot(hxTrue[0, :].flatten(),
196199
hxTrue[1, :].flatten(), "-b")

0 commit comments

Comments
 (0)