2
$\begingroup$

In this paper the mapping between generalized forces and external torques for a rigid body (when the rotation is described by a quaternion) is derived:

$$\textit{F}_Q = 2\textbf{G}^TT'$$

where $\textit{F}_Q$ is a vector of generalized forces (quaternion elements as generalized coordinates) and $T'$ is a vector of external torque and $\textbf{G}$ is the matrix that maps between those two

$$G = \begin{bmatrix}-Q_1 & Q_0 & Q_3 & -Q_2\\ -Q_2&-Q_3& Q_0& Q_1 \\ -Q_3& Q_2& -Q_1& Q_0\end{bmatrix}.$$

I have derived a vector of generalized forces, I mapped it to a vector of external torques, which works correctly. However, when I mapped the external torques back to generalized forces, the generalized forces were different. Does that mean that this mapping is not unique and different generalized forces in terms of quaternion can rotation represent the same external torques applied to a rigid body?

Edit:

I am creating a biomechanical model. My Equations of motion (for 1 joint) are:

$$\textbf{M}(Q)\dot{q}=f(q)$$

where $q = (Q_0,Q_1,Q_2,Q_3,\omega_x,\omega_y,\omega_z)^T$, $\textbf{M}(Q)$ is joint-space mass matrix and $f(q)$ are the external forces ($\omega_x$, $\omega_y$, $\omega_z$ are angular velocities). To add a contribution of muscle force to the equations of motion, I calculate the muscle length $l_m = f(Q_0,Q_1,Q_2,Q_3)$, then I calculate the $4 \times 1$ jacobian $J_Q$ w.r.t. the quaternion coordinates

$$J_Q = \frac{\partial l_m(\textbf{Q})}{\partial Q_i} $$

from this I calculate $3 \times 1$ vector of external torques

$$\tau_E = \frac{1}{2} G J_Q F_m$$

where $F_m$ is a scalar muscle force. Then I can finish my equations of motion:

$$ \textbf{M}(Q)\dot{q}=f(q)+ \begin{pmatrix} \textbf{0}^{4 \times 1} \\ \tau_E^{3 \times 1} \end{pmatrix} $$

and it works perfectly. For some reason I need to map the $3 \times 1$ external torque back to $4 \times 1$ generalized forces (if I can call it this way). And this mapping back doesn't give the same forces as the one calculated by using the jacobian of muscle lengths.

$\endgroup$
6
  • $\begingroup$ „However, when I mapped the external torques back to generalized forces“ which equation you use ? the determinate of $~\mathbf G\,\mathbf G^T=0~$, thus you can't solve the equation for $~\mathbf T'~$ ? $\endgroup$
    – Eli
    Commented Jul 16 at 21:55
  • $\begingroup$ That is not a square matrix. There should be some degrees of freedom not pinned down. This problem is particularly well-described in geometric algebra; in fact, I think I recognise that matrix as a truncated version of what is happening in the Kustaanheimo-Stiefel transformation that maps a Hydrogen atom problem to the QHO. There is a gauge freedom involved. $\endgroup$ Commented Jul 17 at 4:16
  • $\begingroup$ $\textbf{G}\textbf{G}^T = \textbf{I}$, but the determinate of $\textbf{G}^T\textbf{G} = 0$. Well quaternion is 4 degrees of freedom to describe 3 rotations but the quaternion must be unit which removes 1 dof. Here there are 4 generalized forces to describe 3 external torques but without any constraint (?) so maybe there might be a problem. $\endgroup$
    – blenderman
    Commented Jul 17 at 9:52
  • $\begingroup$ not clear for me did you used the Euler equation $ ~\mathbf I\,\mathbf{\dot{\omega}}+\omega\times\,\mathbf I\,\omega=\mathbf \tau_{\rm{E}}~$ is $~M(Q)~$ invertible ? $\endgroup$
    – Eli
    Commented Jul 18 at 10:51
  • $\begingroup$ The final equations of motion are large as there are 4 spherical joints, I used Kane's method to solve the equations of motion. $M(Q)$ is invertible, but I plan to solve the simulation using implicit solvers. $\endgroup$
    – blenderman
    Commented Jul 18 at 11:01

1 Answer 1

1
$\begingroup$

$\def \b {\mathbf}$ Starting with the Euler equations $$ \b I\,\b{\dot{\omega}}+\omega\times\,\b I\,\omega=\b\tau_{\rm{E}}\tag 1$$

with

$$\omega=2\,\b Q\,\b{\dot{z}}\tag 2$$ where $$\b Q= \left[ \begin {array}{cccc} -b&a&-d&c\\ -c&d&a&-b \\ -d&-c&b&a\end {array} \right] \quad \b{\dot{z}}= \begin{bmatrix} \dot{a} \\ \dot{b} \\ \dot{c} \\ \dot{d} \\ \end{bmatrix}$$

the constraint equation for the quaternions is:

$$ a^2+b^2+c^2+d^2=1\quad, a\,\dot a+b\,\dot b+c\,\dot c+d\,\dot d=0$$

from here you obtain

$$ \b{\dot{z}}= \begin{bmatrix} \dot{a} \\ \dot{b} \\ \dot{c} \\ \dot{d} \\ \end{bmatrix}= \underbrace{\left[ \begin {array}{ccc} -{\frac {b}{a}}&-{\frac {c}{a}}&-{\frac {d }{a}}\\1&0&0\\ 0&1&0 \\0&0&1\end {array} \right] }_{\b T} \,\underbrace{\begin{bmatrix} \dot{b} \\ \dot{c} \\ \dot{d} \\ \end{bmatrix}}_{\b{\dot{q}}} $$ hence equation (2)

$$\omega=\underbrace{2\,\b Q\,\b T}_{\b J (3\times 3)}\,\b{\dot{q}}$$

the generalize torque is:

$$\b\tau_G=\b J^T\b\tau_E\quad, \b\tau_E=\left(\b J^T\right)^{-1}\b\tau_G$$


the determinate of $~\b J~$ is equal to $~\frac 8a~$

how to simulate

from the constraint equation

\begin{align*} &\dot{a}=-\frac{1}{a}\,(b+c+d) \end{align*} and with $~\omega=\b J\,\b{\dot{q}}~$ you obtain

\begin{align*} &\begin{bmatrix} \dot{b} \\ \dot{c} \\ \dot{d} \\ \end{bmatrix} =\frac 12\,\begin{bmatrix} a & d & -c \\ -d & a & b \\ c & -b & a \\ \end{bmatrix}\,\begin{bmatrix} \omega_x \\ \omega_y \\ \omega_z \\ \end{bmatrix} \end{align*}

those are 4 first order differential equations for the quaternions.

additional form equation (1) you obtain 3 first order differential equations for the angular velocity $~\b \omega~$ so altogether 7 first order differential equation. notice that the initial conditions must fellfield the constraint equation $~a(0)^2+b(0)^2+c(0)^2+d(0)^2=1~$ and also you have to check it during the simulation

$~a(t)^2+b(t)^2+c(t)^2+d(t)^2=1~$

the rotation matrix between body system and inertial system is a function of the quaternions

\begin{align*} &\b S= \left[ \begin {array}{ccc} {a}^{2}+{b}^{2}-{c}^{2}-{d}^{2}&2\,bc+2\,a d&2\,bd-2\,ac\\ 2\,bc-2\,ad&{a}^{2}+{c}^{2}-{d}^{2}- {b}^{2}&2\,cd+2\,ab\\ 2\,bd+2\,ac&2\,cd-2\,ab&{a}^{2 }+{d}^{2}-{b}^{2}-{c}^{2}\end {array} \right] \end{align*}

$\endgroup$
20
  • $\begingroup$ This seems like a nice approach. However, now you get 3 generalized torques for 4 generalized coordinates (of the quaternion). How do I interpret this ? $\endgroup$
    – blenderman
    Commented Jul 17 at 19:33
  • $\begingroup$ That makes sense, I always didn't know if I can call the quaternion coordinates generalized coordinates. However I am not exactly sure how I would use this solution to my problem. I tried to edit my question si it gives insight into my problem. $\endgroup$
    – blenderman
    Commented Jul 18 at 9:32
  • $\begingroup$ I will add the equations to do the dynamic simulation $\endgroup$
    – Eli
    Commented Jul 18 at 10:27
  • $\begingroup$ Thanks, whis will help with the simulation. However, my inital problem was somewhat different. Normally I would calculate the muscle lengths and then jacobian, multiplied it by muscle force and map it to external torques. However, I have muscle lengths and muscle lengths jacobians using Euler angles (those are exported from somewhere), which I need to map into muscle lengths and muscle lengths jacobians using quaternions. It is because I am doing a polynomial fitting of these lengths and moment arms to get continuous function. I hope you understood. $\endgroup$
    – blenderman
    Commented Jul 18 at 11:34
  • 1
    $\begingroup$ Oh I understand. Now it's working perfectly, thank you very much ! $\endgroup$
    – blenderman
    Commented Jul 18 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.