In [1]:
import time
import sys
Operation | Does |
---|---|
$$ \boldsymbol{q} = \boldsymbol{a} \otimes \boldsymbol{b} = \boldsymbol{a}_v b_0 + \boldsymbol{b}_v a_0 + \boldsymbol{a}_v \times \boldsymbol{b}_v + a_0 b_0 - \boldsymbol{a}_v \cdot \boldsymbol{b}_v $$ | "Add" rotation $\boldsymbol{a}$ onto rotation $\boldsymbol{b}$ |
$$\boldsymbol{q}_e = \boldsymbol{q}^* \otimes \boldsymbol{\hat{q}}$$ | Gives the rotation that will move $\boldsymbol{\hat{q}}$ to $\boldsymbol{q}$ |
Section | Given | Problem |
---|---|---|
Propagation | Position $\boldsymbol{q}(k)$ and velocity $\boldsymbol{\omega}(k)$ | Predict $\boldsymbol{q}(k+1)$ |
Estimator/Controller | Where we are $\boldsymbol{\hat{q}}$ and where we should be $\boldsymbol{q}, \boldsymbol{q}_d$ | Calculate $k(\boldsymbol{q}^* \otimes \boldsymbol{\hat{q}})$ where $0 < k < 1$ |
Controller | Estimated attitude $\boldsymbol{\hat{q}}$ | Quantify nutation $\boldsymbol{q}_n$ where $\boldsymbol{\hat{q}} = \boldsymbol{q}_n \otimes \boldsymbol{q}_r$ |
Nutation $\boldsymbol{q}_n$ | Calculate nutation correction $\boldsymbol{M}$ |
Taylor Series Expansion:
Section | Given | Problem |
---|---|---|
Estimator/Controller | Where we are $\boldsymbol{\hat{q}}$ and where we should be $\boldsymbol{q}, \boldsymbol{q}_d$ | Calculate $k(\boldsymbol{q}^* \otimes \boldsymbol{\hat{q}})$ where $0 < k < 1$ |
In [2]:
from TSatPy.State import Quaternion
from TSatPy.StateOperator import QuaternionGain
# Pick any random rotational error here
q_e = Quaternion([1,-2,4], radians=2.3)
e, r = q_e.to_rotation()
print "Error quaternion is a %s radian rotation about [%g, %g, %g]^T\n" % (r, e[0,0], e[1,0], e[2,0])
def test(q_e, gain):
e_new, r_new = (QuaternionGain(gain) * q_e).to_rotation()
print_args = (gain*100, r_new, e_new[0,0], e_new[1,0], e_new[2,0])
sys.stdout.write("%d%% a %s radian rotation about [%g, %g, %g]^T\n" % print_args)
sys.stdout.flush()
time.sleep(0.2)
N = 10
null = [test(q_e, gain/float(N)) for gain in xrange(1, N+1)]
Section | Given | Problem |
---|---|---|
Controller | Estimated attitude $\boldsymbol{\hat{q}}$ | Quantify nutation $\boldsymbol{q}_n$ where $\boldsymbol{\hat{q}} = \boldsymbol{q}_n \otimes \boldsymbol{q}_r$ |
In [3]:
from TSatPy.State import Quaternion
yaw = Quaternion([0,0,1], radians=0.2)
pitch = Quaternion([0,1,0], radians=0.1)
print("yaw: %s" % (yaw))
print("pitch: %s\n" % (pitch))
q = pitch * yaw
print("q: %s\n" % (q))
q_r, q_n = q.decompose()
print("q_r: %s" % (q_r))
print("q_n: %s" % (q_n))
Section | Given | Problem |
---|---|---|
Controller | Nutation $\boldsymbol{q}_n$ | Calculate nutation correction $\boldsymbol{M}$ |
The proportional moment correction term is
Where $\boldsymbol{\hat{e}}$ is the Euler axis
In [ ]: