Skip to content

Commit df8e91d

Browse files
Planar 2DOF arm
1 parent 3988e21 commit df8e91d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

RoboticArm/two_joint_arm.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,22 @@ def two_joint_arm():
4949
def plot_arm(theta1, theta2, x, y):
5050
elbow = shoulder + np.array([l1*cos(theta1), l1*sin(theta1)])
5151
wrist = elbow + np.array([l2*cos(theta1+theta2), l2*sin(theta1+theta2)])
52+
5253
plt.cla()
54+
5355
plt.plot([shoulder[0], elbow[0]], [shoulder[1], elbow[1]], 'k-')
5456
plt.plot([elbow[0], wrist[0]], [elbow[1], wrist[1]], 'k-')
57+
5558
plt.plot(shoulder[0], shoulder[1], 'ro')
5659
plt.plot(elbow[0], elbow[1], 'ro')
5760
plt.plot(wrist[0], wrist[1], 'ro')
61+
5862
plt.plot([wrist[0], x], [wrist[1], y], 'g--')
5963
plt.plot(x, y, 'g*')
64+
6065
plt.xlim(-2, 2)
6166
plt.ylim(-2, 2)
67+
6268
plt.show()
6369
plt.pause(dt)
6470

0 commit comments

Comments
 (0)