# Rotational Spring Arbitrary Motion

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.

I was thinking about the following. Consider two reference frames, A and B, connected to body 1 and 2, respectively

For a simple rotation ##\psi## around the ##Z_B##-axis the moment due to the spring will be in the negative ##Z_B## direction:
$$M_B = \begin{bmatrix} 0 \\ 0 \\ -k_z \psi \end{bmatrix}$$
And for body A the moment will have opposite sign.

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.