You are on page 1of 2

5/3/2019 RR Inverse Kinematics

In [10]: from math import *


import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline

Círculo de radio r = 150 mm, centrado en (0,0)


In [23]: l1,l2 = 100,100

for t in np.linspace(0, 2*np.pi, 20):


px,py = 150*cos(t), 150*sin(t)
K = (px**2 + py**2 - l1**2 - l2**2) / (2*l1*l2)
t2 = atan2(sqrt(1-K**2), K)
t1 = atan2( py*l1 + py*l2*cos(t2) - px*l2*sin(t2) , px*l1 + px*l2*cos(t2) + py*l2*sin(t2) )
plt.plot([0, l1*cos(t1), l1*cos(t1) + l2*cos(t1+t2)], [0, l1*sin(t1), l1*sin(t1) + l2*sin(t1+t2)], "b
plt.plot([l1*cos(t1) + l2*cos(t1+t2)], [l1*sin(t1) + l2*sin(t1+t2)], "r-o")

plt.grid(ls="--")
plt.axis("equal");

Círculo de radio r = 50 mm, centrado en (150,180)


In [26]: l1,l2 = 200,200

for t in np.linspace(0, 2*np.pi, 20):


px,py = 50*cos(t) + 150, 50*sin(t) + 180
K = (px**2 + py**2 - l1**2 - l2**2) / (2*l1*l2)
t2 = atan2(sqrt(1-K**2), K)
t1 = atan2( py*l1 + py*l2*cos(t2) - px*l2*sin(t2) , px*l1 + px*l2*cos(t2) + py*l2*sin(t2) )
plt.plot([0, l1*cos(t1), l1*cos(t1) + l2*cos(t1+t2)], [0, l1*sin(t1), l1*sin(t1) + l2*sin(t1+t2)], "b
plt.plot([l1*cos(t1) + l2*cos(t1+t2)], [l1*sin(t1) + l2*sin(t1+t2)], "r-o")

plt.grid(ls="--")
plt.axis("equal");

http://localhost:8888/notebooks/Google%20Drive/Scribd%20Gen/RR%20Inverse%20Kinematics.ipynb 1/2
5/3/2019 RR Inverse Kinematics

Línea horizontal
In [32]: l1,l2 = 200,200

for t in np.linspace(-100, 100, 20):


px,py = 2*t, 300
K = (px**2 + py**2 - l1**2 - l2**2) / (2*l1*l2)
t2 = atan2(sqrt(1-K**2), K)
t1 = atan2( py*l1 + py*l2*cos(t2) - px*l2*sin(t2) , px*l1 + px*l2*cos(t2) + py*l2*sin(t2) )
plt.plot([0, l1*cos(t1), l1*cos(t1) + l2*cos(t1+t2)], [0, l1*sin(t1), l1*sin(t1) + l2*sin(t1+t2)], "b
plt.plot([l1*cos(t1) + l2*cos(t1+t2)], [l1*sin(t1) + l2*sin(t1+t2)], "r-o")

plt.grid(ls="--")
plt.axis("equal");

In [ ]:

http://localhost:8888/notebooks/Google%20Drive/Scribd%20Gen/RR%20Inverse%20Kinematics.ipynb 2/2

You might also like