# Kinematics


```python
import sympy
from sympy import *
sympy.init_printing()
```


```python
def Rx(t):
    return Matrix([ [1, 0, 0],
                    [0, cos(t), -sin(t)],
                    [0, sin(t), cos(t)]])
                    
def Ry(t):
    return Matrix([ [cos(t), 0, sin(t)],
                    [0, 1, 0],
                    [-sin(t), 0, cos(t)]])
                    
def Rz(t):
    return Matrix([ [cos(t), -sin(t), 0],
                    [sin(t), cos(t), 0],
                    [0, 0, 1]])
```


```python
theta1 = Symbol('theta1')
theta2 = Symbol('theta2')
theta3 = Symbol('theta3')
```


```python
x1, y1, z1 = symbols('x1 y1 z1')
x2, y2, z2 = symbols('x2 y2 z2')
x3, y3, z3 = symbols('x3 y3 z3')
```


```python
l1, l2 = symbols('l1 l2')
```


```python
Rx(theta2).dot(Matrix([[0], [0], [-l1]]))
```


```python
temp = Rx(theta2).dot(Matrix([[0], [0], [-l1]]))
Ry(theta1).dot(temp)
```


```python
Rx(theta2).dot(Ry(theta1))
```


```python
p3 = Matrix([[-l2 * sin(theta3)], [0], [-l1 -l2 * cos(theta3)]])

```


```python
Rx(theta2).dot(Ry(theta1)).dot(p3)
```


```python

a = Ry(theta1).dot(Rx(theta2))
a = Matrix(a)
a.rows = 3 
a.cols = 3
Matrix(a.dot(p3))
```




$$\left[\begin{matrix}- l_{2} \sin{\left (\theta_{3} \right )} \cos{\left (\theta_{1} \right )} - \left(- l_{1} - l_{2} \cos{\left (\theta_{3} \right )}\right) \sin{\left (\theta_{1} \right )} \cos{\left (\theta_{2} \right )}\\\left(- l_{1} - l_{2} \cos{\left (\theta_{3} \right )}\right) \sin{\left (\theta_{2} \right )}\\- l_{2} \sin{\left (\theta_{1} \right )} \sin{\left (\theta_{3} \right )} + \left(- l_{1} - l_{2} \cos{\left (\theta_{3} \right )}\right) \cos{\left (\theta_{1} \right )} \cos{\left (\theta_{2} \right )}\end{matrix}\right]$$




```python
Rx(theta2).dot(p3)
```


```python
Rx(theta2).dot(p3)
```


```python
x1, y1, z1 = Rx(theta2).dot(p3)

```


```python
x1
```


```python
y1
```


```python
z1
```

### I'm going to try to fix other people's problems.


```python
l1, l2, l3 = symbols('l1 l2 l3')
```


```python
x1 = l1 * cos(theta1)
```


```python
z1 = -l1 * sin(theta1)
```


```python
y1 = 0
```


```python
a = Rz(theta2).dot(p3)
b = Ry(theta1).dot(a)
b
```


```python
a = Rz(theta2).dot(Ry(theta1))
a = Matrix(a)
a.rows = 3
a.cols = 3
b = a.dot(p3)
b = Matrix(b)
b
```




$$\left[\begin{matrix}- l_{2} \sin{\left (\theta_{3} \right )} \cos{\left (\theta_{1} \right )} \cos{\left (\theta_{2} \right )} - \left(- l_{1} - l_{2} \cos{\left (\theta_{3} \right )}\right) \sin{\left (\theta_{1} \right )} \cos{\left (\theta_{2} \right )}\\l_{2} \sin{\left (\theta_{2} \right )} \sin{\left (\theta_{3} \right )} \cos{\left (\theta_{1} \right )} + \left(- l_{1} - l_{2} \cos{\left (\theta_{3} \right )}\right) \sin{\left (\theta_{1} \right )} \sin{\left (\theta_{2} \right )}\\- l_{2} \sin{\left (\theta_{1} \right )} \sin{\left (\theta_{3} \right )} + \left(- l_{1} - l_{2} \cos{\left (\theta_{3} \right )}\right) \cos{\left (\theta_{1} \right )}\end{matrix}\right]$$




```python
p1 = Matrix([[0], [0], [-l1]])
```


```python
a = Rz(theta2).dot(Ry(theta1))
a = Matrix(a)
a.rows = 3
a.cols = 3
b = a.dot(p1)
b = Matrix(b)
b
```




$$\left[\begin{matrix}l_{1} \sin{\left (\theta_{1} \right )} \cos{\left (\theta_{2} \right )}\\- l_{1} \sin{\left (\theta_{1} \right )} \sin{\left (\theta_{2} \right )}\\- l_{1} \cos{\left (\theta_{1} \right )}\end{matrix}\right]$$




```python

```

8fca50b16b4639a7447938f04e2ab86fdded5df0
ipynb
Jupyter Notebook
notebook/.ipynb_checkpoints/Kinematics-checkpoint.ipynb
bobbyluig/eclipse
ed2d3ed40b878eaddaf8997749fde5a11428964e
MIT
2018-12-11T19:09:57.000Z
2022-03-04T00:28:40.000Z
notebook/.ipynb_checkpoints/Kinematics-checkpoint.ipynb
bobbyluig/Eclipse
ed2d3ed40b878eaddaf8997749fde5a11428964e
MIT
notebook/.ipynb_checkpoints/Kinematics-checkpoint.ipynb
bobbyluig/Eclipse
ed2d3ed40b878eaddaf8997749fde5a11428964e
MIT
2020-07-10T07:20:04.000Z
2020-07-10T07:20:04.000Z
Qwen/Qwen-72B
1. YES
2. YES