In [1]:
from miscpy.utils.sympyhelpers import *
init_printing()
In [2]:
th,ph,psi,thd,phd,psid = symbols('theta,phi,psi,thetadot,phidot,psidot')
w1,w2,w3 = symbols('omega_1,omega_2,omega_3')
In [3]:
cCi = Matrix(([cos(th),sin(th),0],[-sin(th),cos(th),0],[0,0,1]))
sCc = Matrix(([cos(ph),0,-sin(ph)],[0,1,0],[sin(ph), 0, cos(ph)]));cCi,sCc
Out[3]:
${}^\mathcal{S}C^{\mathcal{I}} ={}^\mathcal{S}C^{\mathcal{C}}{}^\mathcal{C}C^{\mathcal{I}} $
In [4]:
sCi = sCc*cCi; sCi
Out[4]:
In [5]:
aCi = Matrix(([cos(psi),sin(psi),0],[-sin(psi),cos(psi),0],[0,0,1]))
cCa = Matrix(([cos(th),0,-sin(th)],[0,1,0],[sin(th), 0, cos(th)]))
bCc = Matrix(([cos(ph),sin(ph),0],[-sin(ph),cos(ph),0],[0,0,1])); bCc, cCa, aCi
Out[5]:
${}^\mathcal{B}C^{\mathcal{I}} ={}^\mathcal{B}C^{\mathcal{C}}{}^\mathcal{C}C^{\mathcal{A}}{}^\mathcal{A}C^{\mathcal{I}} $
In [6]:
bCi = bCc*cCa*aCi; bCi
Out[6]:
Expressed in terms of only $\mathcal{B}$ frame unit vectors:
In [7]:
w = psid*bCi*Matrix([0,0,1]) + thd*bCc*Matrix([0,1,0]) + phd*Matrix([0,0,1]); w
Out[7]:
Defining ${}^{\mathcal{I}}\boldsymbol{\omega}^\mathcal{B} = \omega_1 \mathbf{b}_1 + \omega_2 \mathbf{b}_2 + \omega_3 \mathbf{b}_3$ And solving for $\dot\psi,\dot\theta,\dot\phi$ in terms of $\omega_1,\omega_2\omega_3$:
In [8]:
solve(w - Matrix([w1,w2,w3]),([thd,psid,phd]))
Out[8]: