Torsional spring and Euler angles I have a question about the moments generated by torsional springs. Consider an inertial reference frame A and a body fixed reference frame B. The frames are connected by 3 rotational springs acting around all three axes.
For a simple rotation $\psi$ around  the $Z_B$-axis the moment will be in the negative $Z_B$ direction:
$$
M_B = \begin{bmatrix} 0 \\ 0 \\ -k_z \psi \end{bmatrix}
$$
My question is how this can be extended to an arbitrary rotation. For example, using a ZYX Euler rotation, denoted by angles $\psi$, $\theta$, and $\phi$ (commonly called yaw, pitch, roll), the moment could be described as:
$$
M_B = \begin{bmatrix} -k_x \phi \\ -k_y \theta \\ -k_z \psi \end{bmatrix}
$$
However, this gives the impression that the moment is dependent on the order of rotation. Any rotation can be represented by 12 different sets of angles. For example, if an XYX rotation was considered (with angles corresponding to the same orientation of the B-frame) then the moment would be different than before (no moment in the Z-axis), while the rotation is the same.
Does anybody have an idea how to model such a torsional spring? Am I on the right track?

EDIT
Maybe I should edit my question. What I want to do is model the rotational behaviour of two bodies (1 and 2). They are connected by three virtual rotational springs (representing a link between them). For a normal (translational) spring the forces on body 1 in X, Y, and Z would be easily calculated as:
$$
\mathbf{F}_1 = -\mathbf{K}(\mathbf{q}_1 -\mathbf{q}_2)
$$
with $\mathbf{q}_1 = \begin{bmatrix} q_{1x} & q_{1y} & q_{1z} \end{bmatrix}^T$ and $\mathbf{q}_2 = \begin{bmatrix} q_{2x} & q_{2y} & q_{2z} \end{bmatrix}^T$ the displacements of body 1 and 2, respectively. And $\mathbf{K}$ the 3x3 diagonal matrix containing the spring constants. The translational motion of the bodies is then described as:
$$
\mathbf{m}_1 \ddot{\mathbf{q}}_1 = -\mathbf{K}(\mathbf{q}_1 -\mathbf{q}_2)\\
\mathbf{m}_2 \ddot{\mathbf{q}}_2 = -\mathbf{K}(\mathbf{q}_2 -\mathbf{q}_1)
$$
with $\mathbf{m}_1$ and $\mathbf{m}_2$ the diagnonal mass matrices of body 1 and 2.
Now, I want to do something similar for the rotational motion as a result of the torsional springs. So, the motion of by 1 and 2 is described by:
$$
\dot{\boldsymbol{\omega}}_1 \mathbf{I}_1 + \boldsymbol{\omega}_1 \times \mathbf{I}_1 \boldsymbol{\omega}_1 = \mathbf{M}_1 \\
\dot{\boldsymbol{\omega}}_2 \mathbf{I}_2 + \boldsymbol{\omega}_2 \times \mathbf{I}_2 \boldsymbol{\omega}_2 = \mathbf{M}_2
$$
with $\boldsymbol{\omega}$ the angular velocities of the bodies (expressed in a body frame), $\mathbf{I}$ the moments of inertia (expressed in a body frame) and $\mathbf{M}_1$ and $\mathbf{M}_2$ are the moments resulting from the torsional springs.
I'm looking for a method to calculate these moments.
 A: To answer your question you need the 3×3 Jacobian $J$ which connects the joint angle speeds $\dot{q}=(\dot{\varphi},\dot{\psi},\dot{\theta})$ with the rotational velocity of the body $$ \vec{\omega} = J \dot{q}$$
Since the springs need to act against the relative motion the spring torques $\tau = {\bf k}\dot{q}$ need to be along the motion axes (where ${\bf k}$ is a 3×3 diagonal matrix with the torsional spring rates). Notice $\tau$ is not a vector. To get to the vector moments supporting the joints you need to find $\vec{M}$ with $$\tau = J^{\top} \vec{M}$$
(See https://studywolf.wordpress.com/2013/09/02/robot-control-jacobians-velocity-and-force/)
This is done with the pseudo inverse
$$ \vec{M} = {\bf I}J \left( J^\top {\bf I} J\right)^{-1} \tau$$
where ${\bf I}$ is the 3×3 rotational inertia matrix rotated in the world coordinate system (with ${\bf I} = E I_{body} E^\top$ given the 3×3 rotation matrix $E(\varphi,\psi,\theta)$).
To validate this result, do the following
$$ \tau = J^\top \vec{M} = J^\top {\bf I}J \left( J^\top {\bf I} J\right)^{-1} \tau  \equiv \tau $$
