# [A rolling disc with Kane’s method ](https://docs.sympy.org/latest/modules/physics/mechanics/examples/rollingdisc_example_kane.html)

## 系統參數

### Function of time
* Angle $q_1(t),~q_2(t),~q_3(t)$
* $u_1(t),~u_2(t),~u_3(t)$

### Scalars
* radius: r
* mass: m
* gravity: g
* time: t


```python
from sympy import symbols, sin, cos, tan
from sympy.physics.mechanics import *
q1, q2, q3, u1, u2, u3  = dynamicsymbols('q1 q2 q3 u1 u2 u3')
q1d, q2d, q3d, u1d, u2d, u3d = dynamicsymbols('q1 q2 q3 u1 u2 u3', 1)
r, m, g, t = symbols('r m g t')
```

## 座標轉換

### Yaw-Row-Pitch rotation sequence(3-1-2)


```python
N = ReferenceFrame('N') # the inertia frame
Y = N.orientnew('Y', 'Axis', [q1, N.z]) # yaw angle q1
L = Y.orientnew('L', 'Axis', [q2, Y.x]) # roll angle q2
R = L.orientnew('R', 'Axis', [q3, L.y]) # pitch angle q3
```

#### ang_vel_in(otherframe):
Returns the angular velocity vector of the ReferenceFrame.

#### set_ang_vel(otherframe, value):
Define the angular velocity vector in a ReferenceFrame.

#### set_ang_acc(otherframe, value):
Define the angular acceleration Vector in a ReferenceFrame.


```python
w_R_N_qd = R.ang_vel_in(N) # angular velocity of frame R w.r.t inertia frame N
R.set_ang_vel(N, u1 * L.x + u2 * L.y + u3 * L.z) #
```


```python
w_R_N_qd
```




$\displaystyle \frac{d}{d t} \operatorname{q_{3}}{\left(t \right)}\mathbf{\hat{l}_y} + \frac{d}{d t} \operatorname{q_{2}}{\left(t \right)}\mathbf{\hat{y}_x} + \frac{d}{d t} \operatorname{q_{1}}{\left(t \right)}\mathbf{\hat{n}_z}$



a68deec806785bc61c62536775d93d4705640569
ipynb
Jupyter Notebook
.ipynb_checkpoints/Sympy document examples-checkpoint.ipynb
HSJNYCU/Rolling_Disc
9ba4e07a3a2673bfe9d289c07fa81470829c76fd
MIT
.ipynb_checkpoints/Sympy document examples-checkpoint.ipynb
HSJNYCU/Rolling_Disc
9ba4e07a3a2673bfe9d289c07fa81470829c76fd
MIT
.ipynb_checkpoints/Sympy document examples-checkpoint.ipynb
HSJNYCU/Rolling_Disc
9ba4e07a3a2673bfe9d289c07fa81470829c76fd
MIT
Qwen/Qwen-72B
1. YES
2. YES