1 2 3 4\begin{tabular}{lll} 5 \centering 6 Author & O. Bonnefon &2010\\ 7 Revision& section \ref{Sec:NE_motion} to \ref{Sec:NE_TD} V. Acary& 05/09/2011\\ 8 Revision& section \ref{Sec:NE_motion} V. Acary& 01/06/2016\\ 9 Revision& complete edition V. Acary& 06/01/2017\\ 10 11\end{tabular} 12 13\def\glaw{\cdot} 14\def\cg{\sf \small g} 15 16\section{The equations of motion} 17 18 19In the maximal coordinates framework, the most natural choice for the kinematic variables and for the formulation of the equations of motion is the Newton/Euler formalism, where the equation of motion describes the translational and rotational dynamics of each body using a specific choice of parameters. For the translational motion, the position of the center of mass $x_{\cg}\in \RR^3$ and its velocity $v_{\cg} = \dot x_{\cg} \in \RR^3$ is usually chosen. For the orientation of the body is usually defined by the rotation matrix $R$ of the body-fixed frame with respect to a given inertial frame. 20 21For the rotational motion, a common choice is to choose the rotational velocity $\Omega \in \RR^3$ of the body expressed in the body--fixed frame. This choice comes from the formulation of a rigid body motion of a point $X$ in the inertial frame as 22\begin{equation} 23 \label{eq:1} 24 x(t) = \Phi(t,X) = x_{\cg}(t) + R(t) X. 25\end{equation} 26The velocity of this point can be written as 27\begin{equation} 28 \label{eq:2} 29 \dot x(t) = v_{\cg}(t) + \dot R(t) X 30\end{equation} 31Since $R^\top R=I$, we get $R^\top \dot R + \dot R^\top R =0$. We can conclude that it exists a matrix $\tilde \Omega := R^\top \dot R $ such that $\tilde \Omega + \tilde \Omega^\top=0$, i.e. a skew symmetric matrix. The notation $\tilde \Omega$ comes from the fact that there is a bijection between the skew symmetric matrix in $\RR^{3\times3}$ and $\RR^3$ such that 32\begin{equation} 33 \label{eq:3} 34 \tilde \Omega x = \Omega \times x, \quad \forall x\in \RR^3. 35\end{equation} 36The rotational velocity is then related to the $R$ by : 37\begin{equation} 38 \label{eq:angularvelocity} 39 \widetilde \Omega = R^\top \dot R, \text { or equivalently, } \dot R = R \widetilde \Omega 40\end{equation} 41 42Using these coordinates, the equations of motion are given by 43\begin{equation} 44 \label{eq:motion-NewtonEuler} 45 \left\{\begin{array}{rcl} 46 m \;\dot v_{\cg} & = &f(t,x_{\cg}, v_{\cg}, R, \Omega) \\ 47 I \dot \Omega + \Omega \times I \Omega &= & M(t,x_{\cg}, v_{\cg}, R, \Omega) \\ 48 \dot x_{\cg}&=& v_{\cg}\\ 49 \dot R &=& R \widetilde \Omega 50 \end{array} 51 \right. 52\end{equation} 53where $m> 0$ is the mass, $I\in \RR^{3\times 3}$ is the matrix of moments of inertia around the center of mass and the axis of the body--fixed frame. 54 55The vectors $f(\cdot)\in \RR^3$ and $M(\cdot)\in \RR^3$ are the total forces and torques applied to the body. It is important to outline that the total applied forces $f(\cdot)$ has to be expressed in a consistent frame w.r.t. to $v_{\cg}$. In our case, it hae to be expressed in the inertial frame. The same applies for the moment $M$ that has to be expressed in the body-fixed frame. If we consider a moment $m(\cdot)$ expressed in the inertial frame, then is has to be convected to the body--fixed frame thanks to 56\begin{equation} 57 \label{eq:convected_moment} 58 M (\cdot) =R^\top m (\cdot) 59\end{equation} 60 61 62\begin{remark} 63If we perform the time derivation of $RR^\top =I$ rather than $R^\top R=I$, we get $R \dot R^\top + \dot R R^\top =0$. We can conclude that it exists a matrix $\tilde \omega := \dot R R^\top $ such that $\tilde \omega + \tilde \omega^\top=0$, i.e. a skew symmetric matrix. Clearly, we have 64 \begin{equation} 65 \label{eq:4} 66 \tilde \omega = R \tilde \Omega R^\top 67 \end{equation} 68 and it can be proved that is equivalent to $ \omega =R \Omega$. The vector $\omega$ is the rotational velocity expressed in the inertial frame. The equation of motion can also be expressed in the inertial frame as follows 69 \begin{equation} 70 \label{eq:motion-NewtonEuler-inertial} 71 \left\{\begin{array}{rcl} 72 m \;\dot v_{\cg} & = &f(t,x_{\cg}, v_{\cg}, R, R^T \omega) \\ 73 J(R) \dot \omega + \omega \times J(R) \omega &= & m(t,x_{\cg}, v_{\cg}, R, \omega) \\ 74 \dot x_{\cg}&=& v_{\cg}\\ 75 \dot R &=& \widetilde \omega R 76 \end{array} 77 \right. 78\end{equation} 79where the matrix $J(R) = R I R^T$ is the inertia matrix in the inertial frame. 80Defining the angular momentum with respect to the inertial frame as 81\begin{equation} 82 \label{eq:1} 83 \pi(t) = J(R(t)) \omega(t) 84\end{equation} 85the equation of the angular motion is derived from the balance equation of the angular momentum 86\begin{equation} 87 \label{eq:5} 88 \dot \pi(t) = m(t,x_{\cg}, v_{\cg}, R, \omega)). 89\end{equation} 90 91\end{remark} 92 93For a given constant (time invariant) $\tilde \Omega$, let us consider the differential equation 94\begin{equation} 95 \label{eq:5} 96 \begin{cases} 97 \dot R(t) = R \tilde \Omega\\ 98 R(0) = I 99 \end{cases} 100\end{equation} 101Let us recall the definition of the matrix exponential, 102\begin{equation} 103 \label{eq:6} 104 \exp(A) = \sum_{k=0}^{\infty} \frac {1}{k!} A^k 105\end{equation} 106A trivial solution of \eqref{eq:5} is $R(t) = \exp(t\tilde\Omega) $ since 107\begin{equation} 108 \label{eq:7} 109 \frac {d}{dt}(\exp(At)) = \exp(At) A. 110\end{equation} 111More generally, with the initial condition $R(t_0)= R_0$, we get the solution 112\begin{equation} 113R(t) = R_0 \exp((t-t_0)\tilde\Omega)\label{eq:8} 114\end{equation} 115 116Another interpretation is as follows. From a (incremental) rotation vector, $\Omega$ and its associated matrix $\tilde \Omega$, we obtain a rotation matrix by the exponentation of $\tilde \Omega$: 117\begin{equation} 118 \label{eq:9} 119 R = \exp(\tilde\Omega). 120\end{equation} 121Since we note that $\tilde \Omega^ 3 = - \theta^2 \tilde \Omega$ with $\theta = \|\Omega\|$, it is possible to get a closed form of the matrix exponential of $\tilde \Omega$ 122\begin{equation} 123 \label{eq:10} 124 \begin{array}[lcl]{lcl} 125 \exp(\tilde \Omega) &=& \sum_{k=0}^{\infty} \frac {1}{k!} (\tilde \Omega)^k \\ 126 &=& I_{3\times 3} + \sum_{k=1}^{\infty} \frac {(-1)^{k-1}}{(2k-1)!} \theta ^{2k-1} \tilde \Omega + (\sum_{k=0}^{\infty} \frac {(-1)^{k-1}}{(2k)!} \theta)^{2k-2} \tilde \Omega^2\\[2mm] 127 &=& I_{3\times 3} + \frac{\sin{\theta}} {\theta} \tilde \Omega + \frac{(\cos{\theta}-1)}{\theta^2}\tilde \Omega^2 128 \end{array} 129\end{equation} 130that is 131\begin{equation} 132 \label{eq:11} 133 R = I_{3\times 3} + \frac{\sin{\theta}} {\theta} \tilde \Omega + \frac{(\cos{\theta}-1)}{\theta^2}\tilde \Omega^2 134\end{equation} 135The formula \eqref{eq:11} is the Euler--Rodrigues formula that allows to compute the rotation matrix on closed form. 136 137 138\begin{ndrva} 139 todo : 140 \begin{itemize} 141 \item add the formulation in the inertial frame of the Euler 142 equation with $\omega =R \Omega$. 143 \item Check that \eqref{eq:10} is the Euler-Rodrigues formula and not the Olinde Rodrigues formula. (division by $\theta$) 144\end{itemize} 145 146\end{ndrva} 147 148In the numerical practice, the choice of the rotation matrix is not convenient since it introduces redundant parameters. Since $R$ must belong to $SO^+(3)$, we have also to satisfy $\det(R)=1$ and $R^{-1}=R^\top$. In general, we use a reduced vector of parameters $p\in\RR^{n_p}$ such $R = \Phi(p)$ and $\dot p = \psi(p)\Omega $. We denote by $q$ the vector of coordinates of the position and the orientation of the body, and by $v$ {the body twist}: 149\begin{equation} 150 q \coloneqq \begin{bmatrix} 151 x_{\cg}\\ 152 p 153 \end{bmatrix},\quad 154 v \coloneqq \begin{bmatrix} 155 v_{\cg}\\ 156 \Omega 157 \end{bmatrix}. 158 \end{equation} 159 The relation between $v$ and the time derivative of $q$ is 160\begin{equation} 161 \label{eq:TT} 162 \dot q = 163 \begin{bmatrix} 164 \dot x_{\cg}\\ 165 \psi(p) \dot p 166 \end{bmatrix} 167 = 168 \begin{bmatrix} 169 I & 0 \\ 170 0 & \psi(p) 171 \end{bmatrix} 172 v 173 \coloneqq 174 T(q) v 175\end{equation} 176with $T(q) \in \RR^{{3+n_p}\times 6}$. 177{Note that the twist $v$ is not directly the time derivative of the coordinate vector as a major difference with Lagrangian systems. } 178 179% 180The Newton-Euler equation in compact form may be written as: 181\begin{equation} 182\label{eq:Newton-Euler-compact} 183\boxed{ \left \{ 184 \begin{aligned} 185 &\dot q=T(q)v, \\ 186 & M \dot v = F(t, q, v) 187 \end{aligned} 188 \right.} 189\end{equation} 190where $M\in\RR^{6\times6}$ is the total inertia matrix 191\begin{equation} 192 M:= \begin{pmatrix} 193 m I_{3\times 3} & 0 \\ 194 0 & I 195 \end{pmatrix}, 196\end{equation} 197and $F(t, q, v)\in \RR^6$ collects all the forces and torques applied to the body 198\begin{equation} 199 F(t,q,v):= \begin{pmatrix} 200 f(t,x_{\cg}, v_{\cg}, R, \Omega ) \\ 201 I \Omega \times \Omega + M(t,x_{\cg}, v_{\cg}, R, \Omega ) 202 \end{pmatrix}. 203\end{equation} 204When a collection of bodies is considered, we will use the same notation as in~(\ref{eq:Newton-Euler-compact}) extending the definition of the variables $q,v$ and the operators $M,F$ in a straightforward way. 205 206 207 208 209\input{LieGroupTheory.tex} 210\section{ Lie group $SO(3)$ of finite rotations and Lie algebra $\mathfrak{so}(3)$ of infinitesimal rotations} 211The presentation is this section follows the notation and the developments taken from~\cite{Iserles.ea_AN2000,Munthe-Kaas.BIT1998}. For more details on Lie groups and Lie algebra, we refer to \cite{Varadarajan_book1984} and \cite{Helgason_Book1978}. 212 213 214The Lie group $SO(3)$ is the group of linear proper orthogonal transformations in $\RR^3$ that may be represented by a set of matrices in $\RR^{3\times 3}$ as 215\begin{equation} 216 \label{eq:47} 217 SO(3) = \{R \in \RR^{3\times3}\mid R^TR=I , det(R) = +1 \} 218\end{equation} 219with the group law given by $R_1\glaw R_2 = R_1R_2$ for $R_1,R_2\in SO(3)$. The identity element is $e = I_{3\times 3}$. At any point of $R\in SO(3)$, the tangent space $T_RSO(3)$ is the set of tangent vectors at a point $R$. 220 221\paragraph{Left representation of the tangent space at $R$, $T_RSO(3)$ } Let $S(t)$ be a smooth curve $S(\cdot) : \RR \rightarrow SO(3)$ in $SO(3)$. An element $a$ of the tangent space at $R$ is given by 222\begin{equation} 223 \label{eq:174} 224 a = \left.\frac{d}{dt} S(t)\right|_{t=0} 225\end{equation} 226such that $S(0)= R$. 227Since $S(t)\in SO(3)$, we have $\frac{d}{dt} (S(t)) = \dot S(t)S^T(t) + S(t) \dot S^T(t) =0$. At $t=0$, we get $a R^T + R a^T =0$. 228We conclude that it exists a skew--symmetric matrix $\tilde \Omega = R^T a$ such that $\tilde \Omega^T + \tilde \Omega =0$. Hence, a possible representation of $T_RSO(3)$ is 229\begin{equation} 230 \label{eq:49} 231 T_RSO(3) = \{ a = R \tilde \Omega \in \RR^{3\times 3} \mid \tilde \Omega^T + \tilde \Omega =0 \}. 232\end{equation} 233For $R=I$, the tangent space is directly given by the set of skew--symmetric matrices: 234\begin{equation} 235 \label{eq:50} 236 T_ISO(3) = \{ \tilde \Omega\in \RR^{3\times 3} \mid \tilde \Omega^T + \tilde \Omega =0 \}. 237\end{equation} 238The tangent space $T_ISO(3)$ with the Lie Bracket $[\cdot,\cdot]$ defined by the matrix commutator 239\begin{equation} 240 \label{eq:51} 241 [A,B] = AB-BA 242\end{equation} 243is a Lie algebra that is denoted by 244\begin{equation} 245 \label{eq:53} 246 \mathfrak{so}(3) =\{\Omega\in \RR^{3\times 3} \mid \Omega + \tilde \Omega^T =0\}. 247\end{equation} 248 For skew symmetric matrices, the commutator can be expressed with the cross product in $\RR^3$ 249\begin{equation} 250 \label{eq:52} 251 [\tilde \Omega, \tilde \Gamma] = \tilde \Omega \tilde \Gamma - \tilde \Gamma \tilde \Omega= \widetilde{\Omega \times \Gamma } 252\end{equation} 253We use $T_ISO(3) \cong \mathfrak{so}(3)$ whenever there is no ambiguity. 254 255The notation $\tilde \Omega$ is implied by the fact that the Lie algebra is isomorphic to $\RR^3$ thanks to the operator $\widetilde{(\cdot)} :\RR^3 \rightarrow \mathfrak{so}(3)$ and defined by 256\begin{equation} 257 \label{eq:54} 258 \widetilde{(\cdot)}: \Omega \mapsto \tilde \Omega = 259 \begin{bmatrix} 260 0 & -\Omega_3 & \Omega_2 \\ 261 \Omega_3 & 0 & -\Omega_1 \\ 262 -\Omega_2 & \Omega_1 & 0 263 \end{bmatrix} 264\end{equation} 265Note that $\tilde \Omega x = \Omega \times x$. 266 267\paragraph{ A special (right) action of Lie Group $\mathcal G$ on a manifold $\mathcal M$. } 268 269Let us come back to the representation of $T_RSO(3)$ given in~\eqref{eq:49}. It is clear it can expressed with a representation that relies on $\mathfrak{so}(3)$ 270\begin{equation} 271 \label{eq:58} 272 T_RSO(3) = \{ a = R \tilde \Omega \in \RR^{3\times 3} \mid \tilde \Omega \in \mathfrak{so}(3) \}. 273\end{equation} 274With \eqref{eq:58}, we see that there is a linear map that relates $T_RSO(3)$ to $\mathfrak{so}(3)$. This can be formalize by noting that the left translation map for a point $R \in SO(3)$ 275\begin{equation} 276 \label{eq:59} 277 \begin{array}[lcl]{rcl} 278 L_R& :& SO(3) \rightarrow SO(3)\\ 279 & & S \mapsto L_R(S) = R \glaw S = RS\\ 280 \end{array} 281\end{equation} 282which is diffeomorphism on $SO(3)$ is a group action. In our case, we identify the manifold and the group. Hence, the mapping $L_R$ can be viewed as a left or a right group action. We choose a right action such that $\Lambda^r(R,S) = L_{R}(S) = R \glaw S $. By differentiation, we get a mapping $L'_R: T_I\mathfrak{so(3)} \cong \mathfrak{so(3)} \rightarrow T_R SO(3)$. For a given $\tilde\Omega \in \mathfrak{so(3)}$ and a point $R$, the differential $L'_R$ by computing the tangent vector field $\lambda^r_{*}(a)(R)$ of the group action $\Lambda^r(R,S)$ for a smooth curve $S(t) : \RR \rightarrow S0(3)$ such that $\dot S(0) = \tilde\Omega$: 283\begin{equation} 284 \label{eq:60} 285 \lambda^r_{*}(a)(R) \coloneqq \left. \frac{d}{dt} \Lambda^r(R,S(t)) \right|_{t=0} = \left. \frac{d}{dt} L_{R}(S(t)) \right|_{t=0} = \left. \frac{d}{dt} R \glaw S(t) \right|_{t=0} = R \glaw \dot S(0) = R \tilde\Omega \in X(\mathcal M) 286 \end{equation} 287% 288Therefore, the vector field in \eqref{eq:60} is a tangent vector field that defines a Lie-Type ordinary differential equation 289\begin{equation} 290 \label{eq:61} 291 \dot R(t) = \lambda^r_{*}(a)(R(t)) = R(t) \tilde \Omega 292\end{equation} 293 294 295In~\cite{Bruls.Cardona2010}, the linear operator $\lambda^r_{*}(a)$ is defined as the directional derivative with respect to $S$ an denoted $DL_R(S)$. It defines a diffeomorphism between $T_SSO(3)$ and $T_{RS}SO(3)$. In particular, for $S=I_{3\times3}$, we get 296\begin{equation} 297 \label{eq:62} 298 \begin{array}{rcl} 299 DL_R(I_{3\times3}) : \mathfrak{so}(3) & \rightarrow & T_R SO(3) \\ 300 \tilde \Omega &\mapsto &DL_R(I_{3\times3}). \tilde \Omega = R \tilde \Omega 301 \end{array} 302\end{equation} 303We end up with a possible representation of $T_{R} SO(3)$ as 304\begin{equation} 305 \label{eq:63} 306 T_{R} SO(3) =\{\tilde \Omega_R \mid \tilde \Omega_R = DL_R(I_{3\times3}). \tilde \Omega = R \tilde \Omega, \tilde \Omega \in\mathfrak{so}(3) \}. 307\end{equation} 308In other words, a tangent vector $\tilde \Omega \in \mathfrak{so}(3)$ defines a left invariant vector field on $SO(3)$ at the point $R$ given by $R \tilde \Omega$. 309 310 311 312 313\begin{ndrva} 314 what happens at $S(0)=R$, with $ a =R \tilde \Omega =\dot S(0)$ and then $\dot y(t) = F(y(t)) = R \tilde \Omega y(t) = R\Omega \times y(t)= \dot S(0) y(t) $. What else ? 315\end{ndrva} 316 317 318\paragraph{Exponential map $\expm \mathfrak{so(3)} \rightarrow SO(3)$} 319The relations \eqref{eq:24} and \eqref{eq:25} shows that is possible to define tangent vector field from a group action. We can directly apply Theorem~\ref{Theorem:solutionofLieODE} and we get that the solution of 320\begin{equation} 321 \label{eq:130} 322 \begin{cases} 323 \dot R(t) = \lambda^r_{*}(a)(R(t)) = R(t) \tilde \Omega \\ 324 R(0) = R_0 325\end{cases} 326\end{equation} 327 is 328\begin{equation} 329 \label{eq:138} 330 R(t) = R_0 \expm(t \tilde \Omega) 331\end{equation} 332 333Let us do the computation in this case. Let us assume that the solution can be sought as $R(t) = \Lambda^r(y_o,S(t))$. The initial condition imposes that $R(0) = R_0 = \Lambda(R_0,I) = \Lambda(R_0,S(0))$ that implies $S(0)=I$. Since $\Lambda(R_0,S(t))$ is the flow that is produces by $S(t)$ and let us try to find the relation satisfied by $S(\cdot)$. For a smooth curve $T(s) \in SO(3)$ such that $\dot T(0)= \tilde \Omega$, we have 334\begin{equation} 335 \label{eq:64} 336 \begin{array}[lcl]{lcl} 337 \dot R(t) = \lambda^r_*(\tilde \Omega)(R(t)) &=& \left. \frac{d}{ds}\Lambda^r(R(t),T(s)) \right|_{s=0} \\ 338 &=& \left. \frac{d}{ds} \Lambda^r(\Lambda(R_0, S(t)),T(s)) \right|_{s=0} \\ 339 &=& \left. \frac{d}{ds} (\Lambda^r(R_0, S(t)\glaw T(s)) \right|_{s=0} \\ 340 &=& D_2 \Lambda^r(R_0, \glaw S(t) \glaw \dot T(0) ) \\ 341 &=& D_2 \Lambda^r(R_0, S(t)\glaw \tilde \Omega ) 342 \end{array} 343\end{equation} 344On the other side, the relation $y(t) = \Lambda^r(y_0,S(t))$ gives $\dot y(t) = D_2 \Lambda^r(y_0,S'(t))$ and we conclude that 345\begin{equation} 346 \label{eq:65} 347 \begin{cases} 348 \dot S(t) = S(t)\glaw\tilde\Omega = S(t) \tilde \Omega\\ 349 S(0) = I. 350 \end{cases} 351\end{equation} 352The ordinary differential equation~\eqref{eq:65} is a matrix ODE that admits the following solution 353\begin{equation} 354 \label{eq:66} 355 S(t) = \expm(t\tilde\Omega) 356\end{equation} 357where $\exp : \RR^{3\times 3} \rightarrow \RR^{3\times 3}$ is the matrix exponential defined by 358\begin{equation} 359 \label{eq:67} 360 \begin{array}[lcl]{lcl} 361 \expm(A) &=& \sum_{k=0}^{\infty} \frac {1}{k!} (A)^k. 362 \end{array} 363\end{equation} 364We conclude that $R(t) =\Lambda(R_0,S(t)) = R_0\expm(t\tilde\Omega)$ is the solution of \eqref{eq:35}. 365 366We can use the closed form solution for the matrix exponential of $t \tilde\Omega \in \mathfrak{so}(3)$ as 367\begin{equation} 368 \label{eq:68} 369 \expm(t\tilde\Omega) = I_{3\times 3} + \frac{\sin{t\theta}} {\theta} \tilde\Omega + \frac{(\cos{t \theta}-1)}{\theta^2} \tilde\Omega^2 370\end{equation} 371with $\theta = \|\Omega\|$. 372For given $\tilde \Omega \in\mathfrak{so}(3)$, we have 373\begin{equation} 374 \label{eq:69} 375 \det(\tilde \Omega) = \det(\tilde \Omega^T) = \det (-\tilde \Omega^T) = (-1)^3 \det(\tilde \Omega ) = - \det (\tilde \Omega ) 376\end{equation} 377that implies that $\det(\tilde \Omega ) =0 $. From \eqref{eq:68}, we conclude that 378\begin{equation} 379 \label{eq:70} 380 \det( \expm(t\tilde \Omega)) = 1. 381\end{equation} 382Furthermore, we have $\expm(t\tilde \Omega)\expm( -t\tilde \Omega) = \expm(t(\tilde \Omega-\tilde \Omega)) = I$. We can verify that $\expm(t\tilde \Omega) \in SO(3)$. 383 384\paragraph{Adjoint representation} 385In the case of $SO(3)$, the definition of the operator $\Ad$ gives 386\begin{equation} 387 \label{eq:121} 388 \Ad_R(\tilde\Omega) = R \tilde\Omega R^T 389\end{equation} 390 and then mapping $\ad_{\tilde\Omega}(\tilde \Gamma)$ is defined by 391\begin{equation} 392 \label{eq:56} 393 \ad_{\tilde\Omega}(\tilde\Gamma) = \tilde \Omega \tilde\Gamma - \tilde \Gamma \tilde\Omega = [\tilde \Omega,\tilde \Gamma] = \widetilde{\Omega \times \Gamma}. 394\end{equation} 395Using the isomorphism between $\mathfrak so(3)$ and $\RR^3$, it possible the define the mapping $\ad_{\Omega}(\Gamma) : \RR^3\times\RR^3 \rightarrow \RR^3$ with the realization of the Lie algebra in $\RR^3$ as 396\begin{equation} 397 \label{eq:55} 398 \ad_\Omega(\Gamma) = \tilde\Omega \Gamma = \Omega\times\Gamma 399\end{equation} 400 401\paragraph{Differential of the exponential map $\dexpm$} 402The differential of the exponential mapping, denoted by $\dexpm$ is defined as the 'right trivialized' tangent of the exponential map 403\begin{equation} 404 \label{eq:71} 405 \frac{d}{dt} (\exp(\tilde \Omega(t))) = \dexp_{\tilde\Omega(t)}(\frac{d \tilde{\Omega}(t)}{dt}) \exp(\tilde\Omega(t)) 406\end{equation} 407 408 409 410% \begin{ndrva} 411% explain briefly the notion of left-invariant vector field 412% \end{ndrva} 413%\href{https://en.wikipedia.org/wiki/Lie_group}{https://en.wikipedia.org/wiki/Lie_group} 414%Finally, the straight line $\alpha \tilde \Omega$ for $\Omega$ 415 416The differential of the exponential mapping, denoted by $\dexpm$ is defined as the 'left trivialized' tangent of the exponential map 417\begin{equation} 418 \label{eq:72} 419 \frac{d}{dt} (\exp(\tilde \Omega(t))) = \dexp_{\tilde\Omega(t)}(\frac{d \tilde{\Omega}(t)}{dt}) \exp(\tilde\Omega(t)) 420\end{equation} 421 422Using the formula~\eqref{eq:43} and the fact that $\ad_\Omega(\Gamma) = \Tilde\Omega \Gamma$, we can write the differential as 423\begin{equation} 424 \label{eq:122} 425 \begin{array}{lcl} 426 \dexp_{\tilde\Omega}(\tilde\Gamma) &=& \sum_{k=0}^\infty \frac{1}{(k+1)!} \ad_{\tilde \Omega}^k (\tilde\Gamma) \\ 427 &=& \sum_{k=0}^\infty \frac{1}{(k+1)!} \tilde\Omega^k \tilde \Gamma \\ 428 \end{array} 429\end{equation} 430Using again the fact that $\tilde\Omega^3 = -\theta^2 \tilde\Omega$, we get 431\begin{equation} 432 \label{eq:123} 433 \begin{array}{lcl} 434 \dexp_{\tilde\Omega} &=& \sum_{k=0}^\infty \frac{1}{(k+1)!} \tilde\Omega^k \\ 435 &=& I + \sum_{k=0}^\infty \frac{(-1)^k}{((2(k+1))!} \theta^{2k} \tilde\Omega + \sum_{k=0}^\infty \frac{(-1)^k}{((2(k+1)+1)!} \theta^{2k} \tilde\Omega^2\\ 436 \end{array} 437\end{equation} 438Hence, we get 439\begin{equation} 440 \label{eq:124} 441 \begin{array}{lcl} 442 \dexp_{\tilde\Omega} &=& I + \frac{(1-\cos(\theta))}{\theta^2}\tilde\Omega + \frac{(\theta-\sin(\theta))}{\theta^3}\tilde\Omega^2 443 \end{array} 444\end{equation} 445Since $\dexp_{\tilde\Omega}$ is a linear mapping from $\mathfrak{so(3)}$ to $\mathfrak{so(3)}$, we will use the following notation 446\begin{equation} 447 \label{eq:172} 448 \dexp_{\tilde\Omega}\tilde\Gamma \coloneqq T(\Omega)\tilde\Gamma 449\end{equation} 450with 451\begin{equation} 452 \label{eq:173} 453 T(\Omega) \coloneqq I + \frac{(1-\cos(\theta))}{\theta^2}\tilde\Omega + \frac{(\theta-\sin(\theta))}{\theta^3}\tilde\Omega^2 \in \RR^{3\times 3} 454\end{equation} 455 456 457 458 459\subsection{Newton method and differential of a map $f : \mathcal G \rightarrow \mathfrak g$} 460Finally, let us define the differential of the map $f : SO(3) \rightarrow \mathfrak {so}(3)$ as 461\begin{equation} 462 \label{eq:183} 463 \begin{array}[rcl]{rcl} 464 f'_R : T_RSO(3) &\rightarrow&T_{f(R)}\mathfrak {so}(3) \cong \mathfrak {so}(3)\\ 465 a &\mapsto& \left.\frac{d}{dt} f(R\glaw \expm(t L'_{R^{-1}}(a))) \right|_{t=0} 466 \end{array} 467\end{equation} 468The image of $b$ by $f'_z$ is obtained by first identifying $a$ with an element of $\tilde\Omega \in \mathfrak {so}(3)$ thanks to the left representation of $T_{f(R)}\mathfrak {so}(3)$ view the left translation map $\tilde\Omega= t L'_R(b)$. The exponential mapping transforms $\tilde\Omega$ an element $S$ of the Lie Group $SO(3)$. Then $f'_z$ is obtained by 469\begin{equation} 470 \label{eq:184} 471 f'_R(b) = \lim_{t\rightarrow 0} \frac{f(R\glaw S) - f(R)}{t} 472\end{equation} 473As we have done for the exponential mapping, it is possible to get a left trivialization of 474\begin{equation} 475 \label{eq:185} 476 \dd f_R = (f\circ L_R)' = f'_R \circ L'_R 477\end{equation} 478thus 479\begin{equation} 480 \label{eq:186} 481 \dd f_R (\tilde\Omega) = f'_R \circ L'_R(\tilde\Omega) = f'_R(L'_R(\tilde\Omega)) = \left.\frac{d}{dt} f(R\glaw \expm(t \tilde\Omega )) \right|_{t=0} 482\end{equation} 483 484\begin{ndrva} 485 The computation of this differential is non linear with respect to $\tilde\Omega$. 486 487 488 not clear if we write $\dd f_R (\tilde\Omega)$. Better understand the link with $\dexp_{\tilde \Omega}{\tilde\Gamma}$ 489\end{ndrva} 490Sometimes, it can be formally written as 491\begin{equation} 492 \label{eq:180} 493 \dd f_R (\tilde\Omega) = C(\tilde\Omega)\tilde\Omega 494\end{equation} 495Nevertheless, an explicit expression of $C(\cdot)$ is not necessarily trivial. 496 497Let us consider a first simple example of a mapping $f(R) = \widetilde{R x}$ for a given $x\in\RR^3$. The computation yields 498\begin{equation} 499 \label{eq:181} 500 \begin{array}{rcl} 501 \dd f_R (\tilde\Omega) &=& \widetilde{ \left.\frac{d}{dt} R \exp(t \tilde\Omega) x \right|_{t=0}} \\ 502 &=& \widetilde{R \left.\frac{d}{dt}\exp(t \tilde\Omega)\right|_{t=0} x} \\ 503 &=& \widetilde{R \left. \dexp_{\tilde\Omega}(\tilde\Omega)\exp(t \tilde\Omega) \right|_{t=0} x} \\ 504 &=& \widetilde{R \dexp_{\tilde\Omega}(\tilde\Omega) x} \\ 505 &=& \widetilde{R T(\Omega) \tilde\Omega x} \\ 506 &=& \widetilde{-R T(\Omega) \tilde x \Omega } 507 \end{array} 508\end{equation} 509In that case, it is difficult to find a expression as in \eqref{eq:180}, but considering the function $g(R)$ such that $f(R) = \widetilde g(x)$ we get 510\begin{equation} 511 \label{eq:181} 512 \begin{array}{rcl} 513 \dd g_R (\tilde\Omega) =- R T(\Omega) \tilde x \Omega = C(\Omega) \Omega 514 \end{array} 515\end{equation} 516with 517\begin{equation} 518 \label{eq:182} 519 C(\Omega) = -R T(\Omega) \tilde x 520\end{equation} 521 522 523\section{Lie group of unit quaternions $\HH_1$ and pure imaginary quaternions $\HH_p$.} 524 525 526In Siconos we choose to parametrize the rotation with a unit quaternion $p \in \HH$ such that $R = \Phi(p)$. This parameterization has no singularity and has only one redundant variable that is determined by imposing $\|p\|=1$. 527 528 529\paragraph{Quaternion definition.} There is many ways to define quaternions. The most convenient one is to define a quaternion as 530a $2\times 2$ complex matrix, that is an element of $\CC^{2\times 2}$. For this end, we write for $z \in \CC$, $z=a+ib$ with $a,b \in \RR^2$ and $i^2=-1$ and its conjugate $\bar z= a-ib$. Let ${e, \bf, i, j, k}$ the following matrices in $\CC^{2\times 2}$ 531\begin{equation} 532 \label{eq:127} 533 e = 534 \begin{bmatrix} 535 1 & 0 \\ 536 0 & 1 \\ 537 \end{bmatrix}, 538 \quad \bf{i} = 539 \begin{bmatrix} 540 i & 0 \\ 541 0 & -i \\ 542 \end{bmatrix} 543 \quad \bf{j} = 544 \begin{bmatrix} 545 0 & 1 \\ 546 -1 & 0 \\ 547 \end{bmatrix} 548 \quad \bf{k} = 549 \begin{bmatrix} 550 0 & i \\ 551 i & 0 \\ 552 \end{bmatrix} 553\end{equation} 554 555\begin{definition} 556 Let $\HH$ be the set of all matrices of the form 557 \begin{equation} 558 \label{eq:128} 559 p_0 e + p_1 {\bf i} + p_2 {\bf j} + p_3 {\bf k} 560 \end{equation} 561 where $(p_0,p_1,p_2,p_3) \in \RR^4$. Every Matrix in $\HH$ is of the form 562 \begin{equation} 563 \label{eq:129} 564 \begin{bmatrix} 565 x &y \\ 566 - \bar y & \bar x 567 \end{bmatrix} 568 \end{equation} 569where $x = p_0 + i p_1$ and $y = p_2 + i p_3$. The matrices in $\HH$ are called quaternions. 570\end{definition} 571 572 573\begin{definition} 574 The null quaternion generated by $[0,0,0,0] \in \RR^4$ is denoted by $0$ . Quaternions of the form $p_1 \bf {i} + p_2 \bf{j} + p_3 \bf{k}$ are called pure quaternions. The set of pure quaternions is denoted by $\HH_p$. 575\end{definition} 576 577With the definition of $\HH$ as a set of complex matrices, It can be show that $\HH$ is a real vector space of dimension $4$ with basis ${e, \bf, i, j, k}$. Furthermore, with the matrix product, $\HH$ is a real algebra. 578 579\paragraph{Representation of quaternions} Thanks to the equations~\eqref{eq:128}, ~\eqref{eq:128} and ~\eqref{eq:129}, we see that there are several manner to represent a quaternion $p\in \HH$. It can be represented as a complex matrix as in~\eqref{eq:129}. It can also be represented as a vector in $\RR^4$ , $p= [p_0,p_1,p_2,p_3]$ with the isomorphism~\eqref{eq:128}. In other words, $\HH$ is isomorphic to $\RR^4$. The first element $p_0$ can also be viewed as a scalar and three last ones as a vector in $\RR^3$ denoted by $\vv{p} = [p_1,p_2,p_3]$, and in that case, $\HH$ is viewed as $\RR\times \RR^3$. The quaternion can be written as $p=(p_0,\vv{p})$. 580 581\paragraph{Quaternion product} The quaternion product denoted by $p \glaw q $ for $p,q\in \HH_1$ is naturally defined as the product of complex matrices. With its representation in $\RR\times \RR^3$, the quaternion product is defined by 582\begin{equation} 583 \label{eq:73} 584 p \glaw q = 585 \begin{bmatrix} 586 p_oq_o - \vv{p}\vv{q} \\ 587 p_0\vv{q}+q_o\vv{p} + \vv{p}\times\vv{q} 588 \end{bmatrix}. 589\end{equation} 590Since the product is a matrix product, it is not communicative, but it is associative. The identity element for the quaternion product is 591\begin{equation} 592e= \begin{bmatrix} 593 1 & 0 \\ 594 0 & 1 \\ 595 \end{bmatrix} =(1,\vv{0})\label{eq:57}. 596\end{equation}Let us note that 597\begin{equation} 598 \label{eq:74} 599 (0,\vv{p})\glaw (0,\vv(q)) = - (0,\vv{q})\glaw (0,\vv{p}). 600\end{equation} 601The quaternion multiplication can also be represented as a matrix operation in $\RR^{4\times4}$. Indeed, we have 602\begin{equation} 603 \label{eq:75} 604 p \glaw q = 605 \begin{bmatrix} 606 q_0 p_0 -q_1p_1-q_2p_2-q_3p_3\\ 607 q_0 p_1 +q_1p_0-q_2p_3+q_3p_2\\ 608 q_0 p_2 +q_1p_3+q_2p_0-q_3p_1\\ 609 q_0 p_3 -q_1p_2+q_2p_1+q_3p_0\\ 610 \end{bmatrix} 611\end{equation} 612that can be represented as 613\begin{equation} 614 \label{eq:76} 615 p \glaw q = 616 \begin{bmatrix} 617 p_0 & -p_1 & -p_2 & -p_3 \\ 618 p_1 & p_0 & -p_3 & p_2 \\ 619 p_2 & p_3 & p_0 & -p_1 \\ 620 p_3 & -p_2 & p_1 & p_0 \\ 621 \end{bmatrix} 622 \begin{bmatrix} 623 q_0\\ 624 q_1\\ 625 q_2\\ 626 q_3 627 \end{bmatrix} := [p_\glaw]q 628\end{equation} 629or 630\begin{equation} 631 \label{eq:77} 632 p \glaw q = 633 \begin{bmatrix} 634 q_0 & -q_1 & -q_2 & -q_3 \\ 635 q_1 & q_0 & q_3 & -q_2 \\ 636 q_2 & -q_3 & q_0 & q_1 \\ 637 q_3 & q_2 & -q_1 & q_0 \\ 638 \end{bmatrix} 639 \begin{bmatrix} 640 p_0\\ 641 p_1\\ 642 p_2\\ 643 p_3 644 \end{bmatrix} := [{}_\glaw q] p 645\end{equation} 646 647\paragraph{Adjoint quaternion, inverse and norm} 648The adjoint quaternion of $p$ is denoted by 649\begin{equation} 650 p^\star = \overline{ \begin{bmatrix} 651 x &y \\ 652 - \bar y & \bar x 653 \end{bmatrix}}^T 654 =\begin{bmatrix} 655 \bar x & - y \\ 656 \bar y & x 657 \end{bmatrix} = 658 \begin{bmatrix} 659 p_0, -p_1, -p_2, -p_3 660 \end{bmatrix} = (p_0, - \vv{p}) 661\end{equation} 662We note that 663\begin{equation} 664 \label{eq:131} 665 p \glaw p^\star = 666 \begin{bmatrix} 667 x &y \\ 668 - \bar y & \bar x 669 \end{bmatrix} 670 \begin{bmatrix} 671 \bar x & - y \\ 672 \bar y & x 673 \end{bmatrix} = \det(\begin{bmatrix} 674 x &y \\ 675 - \bar y & \bar x 676 \end{bmatrix}) e = (x\bar x + y \bar y) e = (p^2_0 + p^2_1+ p_2^2 + p_3^2)e 677\end{equation} 678 679 680The norm of a quaternion is given by $|p|^2=p^\top p = p_o^2+p_1^2+p_2^2+p_3^2$. In particular, we have $p \glaw p^\star = p^\star \glaw p = |p|^2 e$. This allows to define the reciprocal of a non zero quaternion by 681\begin{equation} 682 \label{eq:78} 683 p ^{-1} = \frac 1 {|p|^2} p^\star 684\end{equation} 685A quaternion $p$ is said to be unit if $|p| =1$. 686 687\paragraph{Unit quaternion and rotation} 688For two vectors $x\in \RR^3$ and $x'\in \RR^3$, we define the quaternion $p_x = (0,x)\in \HH_p$ and $p_{x'} = (0,x')\in \HH_p$. 689For a given unit quaternion $p$, the transformation 690\begin{equation} 691 \label{eq:79} 692 p_{x'} = p \glaw p_x \glaw p^\star 693\end{equation} 694defines a rotation $R$ such that $x' = R x$ given by 695\begin{equation} 696 \label{eq:80} 697 x' = (p_0^2- p^\top \vv{p}) x +2 p_0(\vv{p}\times x) + 2 (\vv{p}^\top x) p = R x 698\end{equation} 699The rotation matrix may be computed as 700\begin{equation} 701 \label{eq:81} 702 R = \Phi(p) = 703 \begin{bmatrix} 704 1-2 p_2^2- 2 p_3^2 & 2(p_1p_2-p_3p_0) & 2(p_1p_3+p_2p_0)\\ 705 2(p_1p_2+p_3p_0) & 1-2 p_1^2- 2 p_3^2 & 2(p_2p_3-p_1p_0)\\ 706 2(p_1p_3-p_2p_0) & 2(p_2p_3+p_1p_0) & 1-2 p_1^2- 2 p_2^2\\ 707 \end{bmatrix} 708\end{equation} 709 710 711\paragraph{Computation of the time derivative of a unit quaternion associated with a rotation.} 712The derivation with respect to time can obtained as follows. The rotation transformation for a unit quaternion is given by 713\begin{equation} 714 \label{eq:82} 715 p_{x'}(t) = p(t) \glaw p_x \glaw p^\star(t) = p(t) \glaw p_x \glaw p^{-1}(t) 716\end{equation} 717and can be derived as 718\begin{equation} 719 \label{eq:83} 720 \begin{array}{lcl} 721 \dot p_{x'}(t) &=& \dot p(t) \glaw p_x \glaw p^{-1}(t) + p(t) \glaw p_x \glaw \dot p^{-1}(t) \\ 722 &=& \dot p(t) \glaw p^{-1}(t) \glaw p_{x'}(t) + p_{x'}(t) \glaw p(t) \glaw \dot p^{-1}(t) 723 \end{array} 724\end{equation} 725From $p(t) \glaw p^{-1}(t) =e$, we get 726\begin{equation} 727 \label{eq:84} 728 \dot p(t) \glaw p^{-1}(t) + p \glaw \dot p^{-1}(t) = 0 729\end{equation} 730so (\ref{eq:82}) can be rewritten 731\begin{equation} 732 \label{eq:85} 733 \begin{array}{lcl} 734 \dot p_{x'}(t) = \dot p(t) \glaw p^{-1}(t) \glaw p_{x'}(t) - p_{x'}(t) \glaw \dot p(t) \glaw p^{-1}(t) 735 \end{array} 736\end{equation} 737The scalar part of $\dot p(t) \glaw p^{-1}(t)$ is $(\dot p(t) \glaw p^{-1}(t))_0 = p_o \dot p_0 + \vv{p}^T\vv{\dot p}$. Since $p$ is a unit quaternion, we have 738\begin{equation} 739 \label{eq:86} 740 |p|=1 \implies \frac{d}{dt} (p^\top p) = 0 = \dot p^\top p + p^\top \dot p = 2( p_o \dot p_0 + \vv{p}^T\vv{\dot p}). 741\end{equation} 742Therefore, the scalar part $(\dot p(t) \glaw p^{-1}(t))_0 =0$. 743The quaternion product $\dot p(t) \glaw p^{-1}(t)$ and $p_{x'}(t)$ is a product of quaternions with zero scalar part (see~\eqref{eq:74}), so we have 744\begin{equation} 745 \label{eq:87} 746 \begin{array}{lcl} 747 \dot p_{x'}(t) = 2 \dot p(t) \glaw p^{-1}(t) \glaw p_{x'}(t). 748 \end{array} 749\end{equation} 750In terms of vector of $\RR^3$, this corresponds to 751\begin{equation} 752 \label{eq:88} 753 \dot x'(t) = 2 \vv{ \dot p(t) \glaw p^{-1}(t) } \times x'(t). 754\end{equation} 755Since $x'(t) = R(t) x$, we have $\dot x' = \dot R(t) x = \tilde \omega(t) R(t) x = \tilde \omega(t) x'(t) $. Comparing \eqref{eq:87} and \eqref{eq:88}, we get 756\begin{equation} 757 \label{eq:89} 758 \tilde \omega(t) = 2 \vv{ \dot p(t) \glaw p^{-1}(t) } 759\end{equation} 760or equivalently 761\begin{equation} 762 \dot p(t) \glaw p^{-1}(t) = (0, \frac{\omega(t)}{2} ) 763 \label{eq:90} 764\end{equation} 765Finally, we can conclude that 766\begin{equation} 767 \label{eq:91} 768 \dot p(t) = (0, \frac{\omega(t)}2 ) \glaw p(t). 769\end{equation} 770Since $\omega(t)=R(t)\Omega(t)$, we have 771\begin{equation} 772 \label{eq:92} 773 (0, \omega(t) ) = (0, R(t) \Omega(t) ) = p(t) \glaw (0, \Omega(t) ) \glaw \bar p(t) = p(t) \glaw (0, \Omega(t) ) \glaw p^{-1}(t) 774\end{equation} 775and then 776\begin{equation} 777 \label{eq:93} 778 \dot p(t) =\frac 1 2 p(t) \glaw(0, \Omega(t) ) . 779\end{equation} 780 781The time derivation is compactly written 782\begin{equation} 783 \label{eq:94} 784 \dot p = \frac 1 2 p \glaw(0, \frac\Omega 2 ) = [p_\glaw] p_{\frac \Omega 2} = \Psi(p)\frac \Omega 2, 785\end{equation} 786and using the matrix representation of product of quaternion 787we get 788\begin{equation} 789 \label{eq:95} 790 \Psi(p) = \begin{bmatrix} 791 -p_1 & -p_2 & -p_3 \\ 792 p_0 & -p_3 & p_2 \\ 793 p_3 & p_0 & -p_1 \\ 794 -p_2 & p_1 & p_0 \\ 795 \end{bmatrix} 796\end{equation} 797The relation \eqref{eq:93} can be also inverted by writing 798\begin{equation} 799 \label{eq:96} 800 (0, \Omega(t) ) = 2 p^{-1}(t) \glaw \dot p(t) 801\end{equation} 802Using again matrix representation of product of quaternion, we get 803\begin{equation} 804 \label{eq:97} 805 \Omega(t) = 2 \vv{p^{-1}(t) \glaw \dot p(t)} = 2 \begin{bmatrix} 806 -p_1 & p_0 & p_3 & -p_2 \\ 807 -p_2 & -p_3 & p_0 & p_1 \\ 808 -p_3 & p_2 & -p_1 & p_0\\ 809 \end{bmatrix}\dot p(t) = 2 \Psi(p)^\top \dot p(t) 810\end{equation} 811Note that we have $\Psi^\top(p)\Psi(p)= I_{4\times 4 }$ and $\Psi(p)\Psi^\top(p)= I_{3\times 3 }$ 812 813\paragraph{Lie group structure of unit quaternions.} In terms of complex matrices, an unit quaternion $p$ satisfies 814\begin{equation} 815 \label{eq:125} 816 \det\left( \begin{bmatrix} 817 x &y \\ 818 - \bar y & \bar x 819 \end{bmatrix} \right) =1 820\end{equation} 821The set of all unit quaternions that we denote $\HH_1$ is the set of unitary matrices of determinant equal to $1$. From~\eqref{eq:131}, we get that 822\begin{equation} 823 \label{eq:126} 824 p \glaw p^\star = e 825\end{equation} 826It implies that the set $\HH_1$ is the set of special unitary complex matrices. The set is a Lie group usually denoted as $SU(2)$. Since we used multiple representation of a quaternion, we continue to use $\HH_1 \cong SU(2)$ as a notation but with the Lie group structure implied by $SU(2)$. 827 828Let us compute the tangent vector at a point $p \in \HH_1$. Let $q(t)$ be a smooth curve $q(\cdot) : t\in \RR \mapsto q(t)\in H_1$ in $H_1$ such that $q(O)= p$. 829Since $q(t)\in H_1$, we have $|q(t)|=1$ and then $\frac{d}{dt} |q(t)| = 2(q_0(0) \dot q_0(0) + \vec{q}^T(0) \vec{\dot q}(0) ) =0$. At $t=0$, we get 830\begin{equation} 831 \label{eq:48} 832 2(p_0 a_0 + \vec{p}^T \vec{a})= 0. 833\end{equation} 834This relation imposes that the quaternions $2 p^\star \glaw a \in H_1$ and $2 a \glaw p^\star \in H_1$, that is, have to be pure quaternions. Therefore, it exists $\omega \in \RR^3$ and $\Omega \in \RR^3$ such that 835\begin{equation} 836 \label{eq:132} 837 (0, \Omega) = 2 p ^\star \glaw a 838\end{equation} 839and 840\begin{equation} 841 \label{eq:132} 842 (0, \omega) = 2 a\glaw p^\star 843\end{equation} 844In other terms, the tangent vector spaces at $p \in \HH_1$ can be represented as a left representation 845\begin{equation} 846 \label{eq:133} 847 T_p\HH_1 = \{ a \mid a = p \glaw (0, \frac \Omega 2 ), \Omega \in \RR^3\} 848\end{equation} 849or a right representation 850\begin{equation} 851 \label{eq:1330} 852 T_p{\HH_1} = \{ a \mid a = (0, \frac \omega 2 ) \glaw p, \omega \in \RR^3\} 853\end{equation} 854 855At $p=e$, we get the Lie algebra defined by 856\begin{equation} 857 \label{eq:134} 858 \mathfrak h_1 = T_e{\HH_1} = \{ a = (0, \frac \Omega 2 ), \Omega \in \RR^3 \} 859\end{equation} 860equipped with the Lie bracket given by the commutator 861\begin{equation} 862 \label{eq:135} 863 [p,q] = p \glaw q- q\glaw p. 864\end{equation} 865We can easily verify that for $a = (0, \frac \Omega 2 ), \, b = (0, \frac \Gamma 2 ) \in \mathfrak h_1 $, we have 866\begin{equation} 867 \label{eq:136} 868 [a,b] = (0, \frac \Omega 2 ) \glaw (0, \frac \Gamma 2 ) - (0, \frac \Gamma 2 ) \glaw (0, \frac \Omega 2 ) = (0, \frac{\Omega\times \Gamma}{2}) \in \mathfrak h_1 869\end{equation} 870As for $\mathfrak so(3)$, the Lie algebra $\mathfrak h_1$ is isomorphic to $\RR^3$ thanks to the operator $\widehat{(\cdot)} :\RR^3 \rightarrow \mathfrak h_1$ and defined by 871\begin{equation} 872 \label{eq:54} 873 \widehat{(\cdot)}: \Omega \mapsto \widehat \Omega = (0, \frac \Omega 2 ) 874\end{equation} 875With this operator, the Lie Bracket can be written 876\begin{equation} 877 \label{eq:137} 878 [\widehat{\Omega},\widehat{\Gamma}] = \widehat{\Omega \times \Gamma} 879\end{equation} 880 881 882\paragraph{ A special (right) action of Lie Group $\mathcal G$ on a manifold $\mathcal M$. } 883Let us come back to the representation of $T_p\HH_1$ given in~\eqref{eq:133}. It is clear it can expressed with a representation that relies on $\mathfrak h_1$ 884\begin{equation} 885 \label{eq:158} 886 T_RSO(3) = \{ a = p \glaw \widehat \Omega \mid \widehat \Omega \in \mathfrak h_1 \}. 887\end{equation} 888With \eqref{eq:58}, we see that there is a linear map that relates $T_p\HH_1$ to $\mathfrak h_1$. This linear map defines a vector field. 889A special group action is defined by the left translation map for a point $p \in \HH_1$ 890\begin{equation} 891 \label{eq:159} 892 \begin{array}[lcl]{rcl} 893 L_p& :& \HH_1 \rightarrow \HH_1\\ 894 & & q \mapsto L_p(q) = p \glaw q\\ 895 \end{array} 896\end{equation} 897which is diffeomorphism on $\HH_1$. In that case, we identify the manifold and the group. So, $L_p$ can be viewed as a left or a right group action. We choose a right action. For our application where $\mathcal G = \mathcal M = \HH_1$ and $\Lambda^r(p,q) = L_{p}(q) = p \glaw q $, we get 898\begin{equation} 899 \label{eq:160} 900 \lambda^r_{*}(a)(p) = \left. \frac{d}{dt} L_{p}(q(t)) \right|_{t=0} = \left. \frac{d}{dt} p \glaw q(t) \right|_{t=0} = p \glaw \dot q(0) = p \glaw \dot q(0) \in X(\mathcal M) 901 \end{equation} 902 for a smooth curve $q(t)$ in $\HH_1$. 903Since $q(\cdot)$ is a smooth curve in $\HH_1$, $\dot q(0)$ is a tangent vector at the point $q(0)=I$, that is an element $a = \widehat \Omega \in \mathfrak h_1 $ defined by the relation~\eqref{eq:33}. Therefore, the vector field in \eqref{eq:160} is a tangent vector field and we get 904\begin{equation} 905 \label{eq:161} 906 \dot p(t) = \lambda^r_{*}(a)(p(t)) = p(t) \glaw \widehat \Omega 907\end{equation} 908 909\paragraph{Exponential map $\expq : \mathfrak h_1 \rightarrow \HH_1$} 910We can directly apply Theorem~\ref{Theorem:solutionofLieODE} and we get that the solution of 911\begin{equation} 912 \label{eq:130} 913 \begin{cases} 914 \dot p(t) = \lambda^r_{*}(a)(p(t)) = p(t) \glaw \widehat \Omega \\ 915 p(0) = Rp_0 916\end{cases} 917\end{equation} 918 is 919\begin{equation} 920 \label{eq:138} 921 p(t) = p_0 \expq(t \widehat \Omega) 922\end{equation} 923The exponential mapping $\expq : \mathfrak h_1 \rightarrow \HH_1$ can also be defined as $\expq(\widehat \Omega) = q(1)$ where $q (t)$ satisfies the differential equation 924\begin{equation} 925 \label{eq:235} 926 \dot q(t) = q(t) \cdot \widehat \Omega , \quad q (0) = e. 927\end{equation} 928Using the quaternion product, the exponential map can be expressed as 929\begin{equation} 930 \label{eq:232} 931 \expq(t \widehat \Omega ) = \sum_{k=0}^\infty \frac{(t\widehat \Omega)^k}{k!} 932\end{equation} 933since it is a solution of \eqref{eq:130}. A simple computation allows to check this claim: 934\begin{equation} 935 \label{eq:233} 936 \frac{d}{dt}\expq(t \widehat \Omega ) = \sum_{k=1}^\infty k t^{k-1} \frac{ \widehat \Omega ^k}{k!} = \sum_{k=0}^\infty t^{k} \frac{t \widehat \Omega ^k}{k!}\glaw \widehat \Omega = \expq(t \widehat \Omega ) \glaw \widehat \Omega. 937\end{equation} 938 939A closed form relation for the form the quaternion exponential can also be found by noting that 940\begin{equation} 941 \label{eq:140} 942 \widehat \Omega ^2 = - \left(\frac \theta 2 \right)^2 e, \text{ and } \widehat \Omega ^3 = - \left(\frac \theta 2 \right)^2 \widehat \Omega. 943\end{equation} 944A simple expansion of \eqref{eq:232} at $t=1$ equals 945\begin{equation} 946 \label{eq:141} 947 \begin{array}{lcl} 948 \expq(\widehat \Omega ) &=& \sum_{k=0}^\infty \frac{(\widehat \Omega)^k}{k!}\\ 949 &=& \sum_{k=0}^\infty \frac{(-1)^k}{(2k)!}\left(\frac \theta 2 \right)^{2k} e + \sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)!} \left(\frac \theta 2 \right)^{2k+1} \widehat \Omega \\ 950 &=& \cos(\frac \theta 2) e + \frac{\sin(\frac \theta 2)}{\frac \theta 2} \widehat \Omega \\ 951 \end{array} 952\end{equation} 953that is 954\begin{equation} 955 \label{eq:144} 956 \expq(\widehat \Omega ) = (\cos(\frac \theta 2), \sin(\frac \theta 2) \frac{\Omega}{\theta} ). 957\end{equation} 958 959\paragraph{Adjoint representation} 960In the case of $\HH_1$, the definition of the operator $\Ad$ gives 961\begin{equation} 962 \label{eq:121} 963 \Ad_p(\widehat\Omega) = p\glaw \widehat\Omega p^\star 964\end{equation} 965 and then mapping $\ad_{\widehat\Omega}(\widehat \Gamma)$ is defined by 966\begin{equation} 967 \label{eq:56} 968 \ad_{\widehat\Omega}(\widehat\Gamma) = \widehat \Omega \widehat\Gamma - \widehat \Gamma \widehat\Omega = [\widehat \Omega,\widehat \Gamma] = \widehat{\Omega \times \Gamma}. 969\end{equation} 970Using the isomorphism between $\mathfrak h_1$ and $\RR^3$, we can use the the mapping $\ad_{\Omega}(\Gamma) : \RR^3\times\RR^3 \rightarrow \RR^3$ given by \eqref{eq:55} to get 971\begin{equation} 972 \label{eq:145} 973 \ad_{\widehat\Omega}(\widehat\Gamma) = \widehat{\Omega \times \Gamma} = \widehat{\ad_{\Omega}(\Gamma)} = \widehat{\tilde \Omega \Gamma} 974\end{equation} 975 976\paragraph{Differential of the exponential map $\dexpq$} 977The differential of the exponential mapping, denoted by $\dexpq$ is defined as the 'right trivialized' tangent of the exponential map 978\begin{equation} 979 \label{eq:71} 980 \frac{d}{dt} (\expq(\widehat \Omega(t))) = \dexpq_{\widehat\Omega(t)}(\frac{d \widehat{\Omega}(t)}{dt}) \expq(\widehat\Omega(t)) 981\end{equation} 982 983An explicit expression of $\dexp_{\widehat\Omega}(\widehat\Gamma)$ can also be developed either by developing the expansion and~\eqref{eq:137}. 984\begin{equation} 985 \label{eq:168} 986 \dexpq_{\widehat\Omega}(\Gamma) = \sum_{k=0}^\infty \frac{1}{(k+1)!} \ad_{\widehat\Omega}^k (\widehat\Gamma) = \widehat{T(\Omega)\Gamma} 987\end{equation} 988 989\begin{remark} 990Note that the time derivative in $\RR^4$ is not differential mapping. 991The standard time derivative of $\expq$ in the expression \eqref{eq:144} gives 992\begin{equation} 993 \label{eq:171} 994 \frac{d}{dt}\expq(\widehat \Gamma(t)) = (- \frac{\sin(\theta)}{\theta} \Omega^T\Gamma, \frac{\sin(\theta)}{\theta}\Gamma +\frac{\theta \cos(\theta)-\sin(\theta)}{\theta^3}\Omega^T\Omega \Gamma ) 995\end{equation} 996that can be expressed in $\RR^4$ by 997\begin{equation} 998 \label{eq:175} 999 \frac{d}{dt}\expq(\widehat \Gamma(t)) = \nabla \expq(\widehat\Omega) \widehat{\dot\Omega} 1000\end{equation} 1001with 1002\begin{equation} 1003 \label{eq:176} 1004 \nabla \expq(\widehat\Omega) = 1005 \begin{bmatrix} 1006 - \frac{\sin(\theta)}{\theta} \Omega^T \\ 1007 \frac{\sin(\theta)}{\theta}I +\frac{\theta \cos(\theta)-\sin(\theta)}{\theta^3}\Omega^T\Omega 1008 \end{bmatrix} 1009\end{equation} 1010 1011Clearly, we have 1012\begin{equation} 1013 \label{eq:177} 1014 \nabla \expq(\widehat\Omega) \neq \dexpq_{\widehat\Omega} 1015\end{equation} 1016\end{remark} 1017 1018 1019\paragraph{Directional derivative and Jacobians of functions of a quaternion} 1020\begin{ndrva} 1021 experimental 1022\end{ndrva} 1023 1024Let $f : \HH_1 \rightarrow \RR $ be a mapping from the group to $\RR^3$. The directional derivative of $f$ in the direction $\widehat \Omega \in \mathfrak h_1$ at $p\in \HH_1$ is 1025defined by 1026\begin{equation} 1027 \label{eq:139} 1028 df_p(\widehat \Omega) =\left. \frac{d}{dt} f(p\glaw \expq(t\widehat \Omega)) \right|_{t=0} 1029\end{equation} 1030 1031As a first simple example let us choose $f(p) = \vv{p \glaw p_x \glaw p^\star}$ for a given $x \in \RR^3 $, we get 1032\begin{equation} 1033 \label{eq:142} 1034 \begin{array}{lcl} 1035 D Id \cdot \widehat \Omega (p) = (\widehat \Omega^r f )(p) &=& \left. \frac{d}{dt}\vv{p\glaw \expq(t\widehat \Omega) \glaw p_x \glaw (p \glaw \expq(t\widehat \Omega))^\star} \right|_{t=0}\\ 1036 & = & \vv{p\glaw \frac{d}{dt}\left. \expq(t\widehat \Omega) \right|_{t=0} \glaw p_x \glaw p^\star + p \glaw p_x \glaw (p \glaw\frac{d}{dt}\left. \expq(t\widehat \Omega) \right|_{t=0})^\star}\\ 1037 \end{array} 1038\end{equation} 1039We have form the definition of the time derivative of the exponential 1040\begin{equation} 1041 \label{eq:143} 1042 \begin{array}{lcl} 1043 \frac{d}{dt}\left. \expq(t\widehat \Omega) \right|_{t=0} &=& \left. \dexpq_{\widehat\Omega}(\widehat \Omega)\expq(t\widehat \Omega) \right|_{t=0} \\ 1044 &=& \dexpq_{\widehat\Omega}(\widehat \Omega) 1045 \end{array} 1046\end{equation} 1047 1048Then, the directional derivative can be written 1049\begin{equation} 1050 \label{eq:146} 1051 \begin{array}{lcl} 1052 D Id \cdot \widehat \Omega (p) &=& \vv{p\glaw \dexpq_{\widehat\Omega}(\widehat \Omega)\glaw p_x \glaw p^\star + p \glaw p_x \glaw (\dexpq_{\widehat\Omega}(\widehat \Omega))^* \glaw p^\star } \\ 1053 &=& \vv{p\glaw ( \dexpq_{\widehat\Omega}(\widehat \Omega)\glaw p_x + p_x \glaw (\dexpq_{\widehat\Omega}(\widehat \Omega))^*) \glaw p^\star } 1054 \end{array} 1055\end{equation} 1056 1057 1058 1059 1060\section{Newton-Euler equation in quaternion form} 1061 1062\paragraph{Computation of $T$ for unit quaternion} The operator $T(q)$ is directly obtained as 1063\begin{equation} 1064 T(q)=\frac 1 2 \label{eq:98} 1065 \begin{bmatrix} 1066 2 I_{3\times 3} & & 0_{3\times 3} & \\ 1067 & -p_1 & -p_2 & -p_3 \\ 1068 0_{4\times 3} & p_0 & -p_3 & p_2 \\ 1069 & p_3 & p_0 & -p_1 \\ 1070 & -p_2 & p_1 & p_0 1071 \end{bmatrix} 1072\end{equation} 1073 1074\paragraph{} 1075 1076 1077 1078 1079\begin{ndrva} 1080 todo : 1081 \begin{itemize} 1082 \item computation of the directional derivative of $R(\Omega)= exp(\tilde \Omega)$ in the direction $\tilde\Omega$, to get $T(\Omega)$ 1083 \end{itemize} 1084\end{ndrva} 1085 1086\paragraph{Quaternion representation}If the Lie group is described by unit quaternion, we get 1087\begin{equation} 1088 \label{eq:99} 1089 SO(3) = \{p = (p_0,\vv{p}) \in \RR^{4}\mid |p|=1 \} 1090\end{equation} 1091with the composition law $p_1\glaw p_2$ given by the quaternion product. 1092 1093 1094 1095Note that the concept of exponential map for Lie group that are not parameterized by matrices is also possible. 1096 1097 1098\subsection{Mechanical systems with bilateral and unilateral constraints} 1099\label{section22} 1100 1101 1102Let us consider that the system~(\ref{eq:Newton-Euler-compact}) is subjected to $m$ constraints, with $m_{e}$ holonomic bilateral 1103constraints 1104\begin{equation} 1105 \label{eq:bilateral-constraints} 1106 h^\alpha(q)=0, \alpha \in \mathcal{E}\subset\NN, |\mathcal E| = m_e, 1107\end{equation} 1108and $m_{i}$ unilateral constraints 1109\begin{equation} 1110 \label{eq:unilateral-constraints} 1111 g_{\n}^\alpha(q)\geq 0, \alpha \in \mathcal{I}\subset\NN, |\mathcal I| = m_i. 1112\end{equation} 1113% 1114Let us denote as $J^\alpha_h(q) = \nabla^\top_q h^\alpha(q) $ the Jacobian matrix of the bilateral constraint $h^\alpha(q)$ with respect to $q$ and as $J^\alpha_{g_\n}(q)$ respectively for $g_{\n}^\alpha(q)$ . 1115% 1116The bilateral constraints at the velocity level can be obtained as: 1117\begin{equation} 1118 \label{eq:bilateral-constraints-velocity} 1119 0 = \dot h^\alpha(q)= J^\alpha_h(q)\dot q = J^\alpha_h(q) T(q) v \coloneqq H^\alpha(q) v,\quad \alpha \in \mathcal{E}. 1120\end{equation} 1121By duality and introducing a Lagrange multiplier $\lambda^\alpha, \alpha \in \mathcal E$, the constraint generates a force applied to the body equal to $H^{\alpha,\top}(q)\lambda^\alpha$. For the unilateral constraints, a Lagrange multiplier $\lambda_{\n}^\alpha, \alpha \in \mathcal I$ is also associated and the constraints at the velocity level can also be derived as 1122\begin{equation} 1123 \label{eq:unilateral-constraints-velocity} 1124 0 \leq \dot g_\n^\alpha(q)= J^\alpha_{g_\n}(q) \dot q = J^\alpha_{g_\n}(q) T(q) v , \text{ if } g_{\n}^\alpha(q) = 0,\quad \alpha \in \mathcal{I}. 1125\end{equation} 1126Again, the force applied to the body is given by $(J^\alpha_{g_\n}(q) T(q))^\top\lambda^\alpha_\n$. {Nevertheless, there is no reason that $\lambda^\alpha_\n =r^\alpha_\n$ and $u_\n = J^\alpha_{g_\n}(q) T(q) v$ if the $g_n$ is not chosen as the signed distance (the gap function)}. This is the reason why we prefer directly define the normal and the tangential local relative velocity with respect to the {twist vector} as 1127\begin{equation} 1128 \label{eq:unilateral-constraints-velocity-kinematic1} 1129 u^\alpha_\n \coloneqq G_\n^\alpha(q) v, \quad u^\alpha_\t \coloneqq G_\t^\alpha(q) v, \quad \alpha \in \mathcal{I}, 1130\end{equation} 1131and the associated force as $G_\n^{\alpha,\top}(q) r^{\alpha}_\n $ and $G_\t^{\alpha,\top}(q) r^{\alpha}_\t$. For the sake of simplicity, we use the notation $u^\alpha \coloneqq G^\alpha(q) v$ and its associated total force generated by the contact $\alpha$ as $G^{\alpha,\top}(q) r^{\alpha} \coloneqq G_\n^{\alpha,\top}(q) r^{\alpha}_\n + G_\t^{\alpha,\top}(q) r^{\alpha}_\t $. 1132 1133The complete system of equation of motion can finally be written as 1134\begin{numcases}{ } 1135 ~~\dot q = T(q)v ,\nonumber \\[0.5ex] 1136 ~~ M \dot v = F(t,q,v) + H^\top(q) \lambda + G^\top(q) r, \nonumber \\ [0.5ex] 1137 ~~\begin{array}{ll} 1138 H^\alpha(q) v = 0 ,& \alpha \in \mathcal E \\[1ex] 1139 \left. \begin{array}{ll} 1140 r^\alpha= 0 , &\text{ if } g_{\n}^\alpha(q) > 0,\\[1ex] 1141 {K}^{\alpha,*} \ni \widehat u^\alpha \bot~ r^\alpha \in {K}^\alpha, &\text{ if } g_{\n}^\alpha(q) = 0, \\[1ex] 1142 u_{\n}^{\alpha,+} = -e_r^\alpha u_{\n}^{\alpha,-}, &\text{ if } g_{\n}^\alpha(q) = 0 \text{ and } u_{\n}^{\alpha,-} \leq 0, 1143 \end{array}\right\} & \alpha \in \mathcal I \label{eq:NewtonEuler-uni} 1144\end{array} 1145\end{numcases} 1146where the definition of the variables $\lambda\in \RR^{m_e}, r\in \RR^{3m_i}$ and the operators $H,G$ are extended to collect all the variables for each constraints. 1147 1148Note that all the constraints are written at the velocity integrators. {Another strong advantage is the straightforward introduction of the contact dissipation processes that are naturally written at the velocity level such as the Newton impact law and the Coulomb friction. Indeed, in Mechanics, dissipation processes are always given in terms of rates of changes, or if we prefer, in terms of velocities.} 1149 1150\paragraph{Siconos Notation} In the siconos notation, we have for the applied torques on the system the following decomposition 1151\begin{equation} 1152 F(t,q,v):= \begin{pmatrix} 1153 f(t,x_{\cg}, v_{\cg}, R, \Omega ) \\ 1154 I \Omega \times \Omega + M(t,x_{\cg}, v_{\cg}, R, \Omega ) 1155 \end{pmatrix} 1156 := \begin{pmatrix} 1157 f_{ext}(t) - f_{int}(x_{\cg}, v_{\cg}, R, \Omega ) \\ 1158 - M_{gyr}(\Omega) + M_{ext}(t) - M_{int}(x_{\cg}, v_{\cg}, R, \Omega ) 1159 \end{pmatrix}. 1160\end{equation} 1161with 1162\begin{equation} 1163 M_{gyr} := \begin{pmatrix} 1164 \Omega \times I\Omega 1165 \end{pmatrix} 1166\end{equation} 1167 1168 1169 1170In the siconos notation, we have for the relation 1171\begin{equation} 1172 \label{eq:100} 1173 C = J^\alpha(q) \quad CT = J^\alpha(q)T(q) 1174\end{equation} 1175 1176 1177 1178 1179 1180 1181 1182\section{Time integration scheme in scheme} 1183 1184 1185\subsection{Moreau--Jean scheme based on a $\theta$-method} 1186The complete Moreau--Jean scheme based on a $\theta$-method is written as follows 1187 \begin{equation} 1188 \label{eq:Moreau--Jean-theta} 1189 \begin{cases} 1190 ~~\begin{array}{l} 1191 q_{k+1} = q_{k} + h T(q_{k+\theta}) v_{k+\theta} \quad \\[1ex] 1192 M(v_{k+1}-v_k) - h F(t_{k+\theta}, q_{k+\theta},v_{k+\theta}) = H^\top(q_{k+1}) Q_{k+1} + G^\top(q_{k+1}) P_{k+1},\quad\,\\[1ex] 1193 \end{array}\\ 1194 ~~\begin{array}{lcl} 1195 \begin{array}{l} 1196 H^\alpha(q_{k+1}) v_{k+1} = 0\\ 1197 \end{array} & \left. \begin{array}{l} 1198 \vphantom{H^\alpha(q_{k+1}) v_{k+1} = 0}\\[1ex] 1199 \end{array}\right\} &\alpha \in \mathcal E \\[1ex] 1200 ~~~P_{k+1}^\alpha= 0, & 1201 \left. \begin{array}{l} 1202 \vphantom{P_{k+1}^\alpha= 0, \delta^\alpha_{k+1}=0}\\[1ex] 1203 \end{array}\right\} & \alpha \not\in \mathcal I^\nu \\[1ex] 1204 % 1205 % 1206 \begin{array}{l} 1207 {K}^{\alpha,*} \ni \widehat u_{k+1}^\alpha~ \bot~ P_{k+1}^\alpha \in {K}^\alpha \\ 1208 \end{array} & 1209 \left.\begin{array}{l} 1210 \vphantom{{K}^{\alpha,*} \ni \widehat u_{k+1}^\alpha~ \bot~ P_{k+1}^\alpha \in {K}^\alpha} \\ 1211 \end{array}\right\} 1212 &\alpha \in \mathcal I^\nu\\ 1213 \end{array} 1214\end{cases} 1215\end{equation} 1216where $\mathcal I^\nu$ is the set of forecast constraints, that may be evaluated as 1217\begin{equation} 1218 \label{eq:101} 1219 \mathcal I^\nu = \{\alpha \mid \bar g_\n^\alpha \coloneqq g_\n + \frac h 2 u^\alpha_\n \leq 0\}. 1220\end{equation} 1221 1222 1223\subsection{Semi-explicit version Moreau--Jean scheme based on a $\theta$-method} 1224 1225\begin{equation} 1226 \label{eq:Moreau--Jean-explicit} 1227 \begin{cases} 1228 ~~\begin{array}{l} 1229 q_{k+1} = q_{k} + h T(q_{k}) v_{k+\theta} \quad \\[1ex] 1230 M(v_{k+1}-v_k) - h F(t_{k}, q_{k},v_{k}) = H^\top(q_{k}) Q_{k+1}+ G^\top(q_{k}) P_{k+1},\quad\,\\[1ex] 1231 \end{array}\\ 1232 ~~\begin{array}{lcl} 1233 \begin{array}{l} 1234 H^\alpha(q_{k+1}) v_{k+1} = 0\\ 1235 \end{array} & \left. \begin{array}{l} 1236 \vphantom{H^\alpha(q_{k+1}) v_{k+1} = 0}\\[1ex] 1237 \end{array}\right\} &\alpha \in \mathcal E \\[1ex] 1238 ~~P_{k+1}^\alpha= 0, & 1239 \left. \begin{array}{l} 1240 \vphantom{P_{k+1}^\alpha= 0, \delta^\alpha_{k+1}=0}\\[1ex] 1241 \end{array}\right\} & \alpha \not\in \mathcal I^\nu \\[1ex] 1242 % 1243 % 1244 \begin{array}{l} 1245 {K}^{\alpha,*} \ni \widehat u_{k+1}^\alpha~ \bot~ P_{k+1}^\alpha \in {K}^\alpha \\ 1246 \end{array} & 1247 \left.\begin{array}{l} 1248 \vphantom{{K}^{\alpha,*} \ni \widehat u_{k+1}^\alpha~ \bot~ P_{k+1}^\alpha \in {K}^\alpha} \\ 1249 \end{array}\right\} 1250 &\alpha \in \mathcal I^\nu\\ 1251 \end{array} 1252\end{cases} 1253\end{equation} 1254 1255In this version, the new velocity $v_{k+1}$ can be computed explicitly, assuming that the inverse of $M$ is easily written, as 1256 1257\begin{equation} 1258 \label{eq:Moreau--Jean-theta--explicit-v} 1259 v_{k+1} = v_k + M^{-1} h F(t_{k}, q_{k},v_{k}) + M^{-1} (H^\top(q_{k}) Q_{k+1}+ G^\top(q_{k}) P_{k+1}) 1260\end{equation} 1261 1262 1263\subsection{Nearly implicit version Moreau--Jean scheme based on a $\theta$-method implemented in siconos} 1264 1265A first simplification is made considering a given value of $q_{k+1}$ in $T()$, $H()$ and $G()$ denoted by $\bar q_k$. This limits the computation of the Jacobians of this operators with respect to $q$. 1266\begin{equation} 1267 \label{eq:Moreau--Jean-theta-nearly} 1268 \begin{cases} 1269 ~~\begin{array}{l} 1270 q_{k+1} = q_{k} + h T(\bar q_k) v_{k+\theta} \quad \\[1ex] 1271 M(v_{k+1}-v_k) - h \theta F(t_{k+1}, q_{k+1},v_{k+1}) - h (1- \theta) F(t_{k}, q_{k},v_{k}) = H^\top(\bar q_k) Q_{k+1} + G^\top(\bar q_k) P_{k+1},\quad\,\\[1ex] 1272 \end{array}\\ 1273 ~~\begin{array}{lcl} 1274 \begin{array}{l} 1275 H^\alpha(\bar q_k) v_{k+1} = 0\\ 1276 \end{array} & \left. \begin{array}{l} 1277 \vphantom{H^\alpha(q_{k+1}) v_{k+1} = 0}\\[1ex] 1278 \end{array}\right\} &\alpha \in \mathcal E \\[1ex] 1279 ~~P_{k+1}^\alpha= 0, & 1280 \left. \begin{array}{l} 1281 \vphantom{P_{k+1}^\alpha= 0, \delta^\alpha_{k+1}=0}\\[1ex] 1282 \end{array}\right\} & \alpha \not\in \mathcal I^\nu \\[1ex] 1283 % 1284 % 1285 \begin{array}{l} 1286 {K}^{\alpha,*} \ni \widehat u_{k+1}^\alpha~ \bot~ P_{k+1}^\alpha \in {K}^\alpha \\ 1287 \end{array} & 1288 \left.\begin{array}{l} 1289 \vphantom{{K}^{\alpha,*} \ni \widehat u_{k+1}^\alpha~ \bot~ P_{k+1}^\alpha \in {K}^\alpha} \\ 1290 \end{array}\right\} 1291 &\alpha \in \mathcal I^\nu\\ 1292 \end{array} 1293\end{cases} 1294\end{equation} 1295The nonlinear residu is defined as 1296\begin{equation} 1297 \label{eq:Moreau--Jean-theta--nearly-residu} 1298 \mathcal R(v) = M(v-v_k) - h \theta F(t_{k+1}, q(v),v) - h (1- \theta) F(t_{k}, q_{k},v_{k}) - H^\top(\bar q_k) Q_{k+1} - G^\top(\bar q_k) P_{k+1} 1299\end{equation} 1300with 1301\begin{equation} 1302 \label{eq:Moreau--Jean-theta--nearly-residu1} 1303 q(v) = q_{k} + h T(\bar q_k)) ((1-\theta) v_k + \theta v). 1304\end{equation} 1305At each time step, we have to solve 1306\begin{equation} 1307 \label{eq:Moreau--Jean-theta--nearly-residu2} 1308 \mathcal R(v_{k+1}) = 0 1309\end{equation} 1310together with the constraints. 1311 1312Let us write a linearization of the problem to design a Newton procedure: 1313\begin{equation} 1314 \label{eq:Moreau--Jean-theta--nearly-residu3} 1315 \nabla^\top_v \mathcal R(v^{\tau}_{k+1})(v^{\tau+1}_{k+1}-v^{\tau}_{k+1}) = - \mathcal R(v^{\tau}_{k+1}). 1316\end{equation} 1317The computation of $ \nabla^\top_v \mathcal R(v^{\tau}_{k+1})$ is as follows 1318\begin{equation} 1319 \label{eq:102} 1320 \nabla^\top_v \mathcal R(v) = M - h \theta \nabla_v F(t_{k+1}, q(v),v) 1321\end{equation} 1322with 1323\begin{equation} 1324 \label{eq:103} 1325 \begin{array}{lcl} 1326 \nabla_v F(t_{k+1}, q(v),v) &=& D_2 F(t_{k+1}, q(v),v) \nabla_v q(v) + D_3 F(t_{k+1}, q(v),v) \\ 1327 &=& h \theta D_2 F(t_{k+1}, q(v),v) T(\bar q_k) + D_3 F(t_{k+1}, q(v),v) \\ 1328 \end{array} 1329\end{equation} 1330where $D_i$ denotes the derivation with respect the $i^{th}$ variable. The complete Jacobian is then given by 1331\begin{equation} 1332 \label{eq:104} 1333 \nabla^\top_v \mathcal R(v) = M - h \theta D_3 F(t_{k+1}, q(v),v) - h^2 \theta^2 D_2 F(t_{k+1}, q(v),v) T(\bar q_k) 1334\end{equation} 1335In siconos, we ask the user to provide the functions $D_3 F(t_{k+1}, q ,v )$ and $D_2 F(t_{k+1}, q,v)$. 1336 1337Let us denote by $W^{\tau}$ the inverse of Jacobian of the residu, 1338\begin{equation} 1339 \label{eq:105} 1340 W^{\tau} = (M - h \theta D_3 F(t_{k+1}, q(v),v) - h^2 \theta^2 D_2 F(t_{k+1}, q(v),v) T(\bar q_k))^{-1}. 1341\end{equation} 1342and by $\mathcal R_{free}(v)$ the free residu, 1343\begin{equation} 1344 \label{eq:106} 1345 \mathcal R_{free}(v) = M(v-v_k) - h \theta F(t_{k+1}, q(v),v) - h (1- \theta) F(t_{k}, q_{k},v_{k}). 1346\end{equation} 1347 1348The linear equation \ref{eq:Moreau--Jean-theta--nearly-residu3} that we have to solve is equivalent to 1349\begin{equation} 1350 \label{eq:107} 1351 \boxed{v^{\tau+1}_{k+1} = v^{\tau}_{k+1} - W \mathcal R_{free}(v^\tau_{k+1}) + W H^\top(\bar q_k) Q^{\tau+1}_{k+1} + W G^\top(\bar q_k) P^{\tau+1}_{k+1}} 1352\end{equation} 1353We define $v_{free}$ as 1354\begin{equation} 1355 \label{eq:108} 1356 v_{free} = v^{\tau}_{k+1} - W \mathcal R_{free}(v^\tau_{k+1}) 1357\end{equation} 1358 1359The local velocity at contact can be written 1360\begin{equation} 1361 \label{eq:109} 1362 u^{\tau+1}_{\n,k+1} = G(\bar q_k) [ v_{free}^{\tau} + W H^\top(\bar q_k) Q^{\tau+1}_{k+1} + W G^\top(\bar q_k) P^{\tau+1}_{k+1}] 1363\end{equation} 1364and for the equality constraints 1365\begin{equation} 1366 \label{eq:110} 1367 u^{\tau+1}_{k+1} = H(\bar q_k) [ v_{free}^{\tau} + W H^\top(\bar q_k) Q^{\tau+1}_{k+1} + W G^\top(\bar q_k) P^{\tau+1}_{k+1}] 1368\end{equation} 1369Finally, we get a linear relation between $u^{\tau+1}_{\n,k+1}$ and the multiplier 1370\begin{equation} 1371 \label{eq:111} 1372 \boxed{ u^{\tau+1}_{k+1} = 1373 \begin{bmatrix} 1374 H(\bar q_k) \\ 1375 G(\bar q_k) 1376 \end{bmatrix} v_{free}^{\tau} 1377 + 1378 \begin{bmatrix} 1379 H(\bar q_k)W H^\top(\bar q_k) & H(\bar q_k)W G^\top(\bar q_k) \\ 1380 G(\bar q_k)W H^\top(\bar q_k) & G(\bar q_k)W G^\top(\bar q_k) \\ 1381 \end{bmatrix} 1382 \begin{bmatrix} 1383 Q^{\tau+1}_{k+1} \\ 1384 P^{\tau+1}_{k+1} 1385 \end{bmatrix}} 1386\end{equation} 1387 1388 1389 1390 1391 1392 1393\paragraph{choices for $\bar q_k$} Two choices are possible for $\bar q_k$ 1394\begin{enumerate} 1395\item $\bar q_k = q_k$ 1396\item $\bar q_k = q^{\tau}_{k+1}$ 1397\end{enumerate} 1398 1399\begin{ndrva} 1400 1401 todo list: 1402 1403 \begin{itemize} 1404 1405 1406 \item add the projection step for the unit quaternion 1407 1408 \item describe the computation of H and G that can be hybrid 1409 1410 1411\end{itemize} 1412 1413\end{ndrva} 1414 1415 1416\subsection{Computation of the Jacobian in special case} 1417 1418\paragraph{Moment of gyroscopic forces} 1419Let us denote by the basis vector $e_i$ given the $i^{th}$ column of the identity matrix $I_{3\times3}$. The Jacobian of $M_{gyr}$ is given by 1420\begin{equation} 1421 \label{eq:112} 1422 \nabla^\top_\Omega M_{gyr}(\Omega) = \nabla^\top_\Omega (\Omega \times I \Omega) = 1423 \begin{bmatrix} 1424 e_i \times I \Omega + \Omega \times I e_i, i =1,2,3 1425 \end{bmatrix} 1426\end{equation} 1427 1428\paragraph{Linear internal wrench} 1429If the internal wrench is given by 1430\begin{equation} 1431 \label{eq:113} 1432 F_{int}(t,q,v) = 1433 \begin{bmatrix} 1434 f_{int}(t,q,v)\\ 1435 M_{int}(t,q,v) 1436 \end{bmatrix} 1437 = C v + K q, \quad C \in \RR^{6\times 6}, \quad K \in \RR^{6\times 7 } 1438\end{equation} 1439we get 1440\begin{equation} 1441 \label{eq:114} 1442 \begin{array}{lcl} 1443 \nabla_v F(t_{k+1}, q(v),v) &=& h \theta K T(\bar q_k) + C \\ 1444 \nabla^\top_v \mathcal R(v) &=& M - h \theta C - h^2 \theta^2 K T(\bar q_k) 1445 \end{array} 1446\end{equation} 1447 1448\paragraph{External moment given in the inertial frame} 1449 1450If the external moment denoted by $m_{ext} (t)$ is expressed in inertial frame, we have 1451\begin{equation} 1452 \label{eq:115} 1453 M_{ext}(q,t) = R^T m_{ext}(t)= \Phi(p) m_{ext}(t) 1454\end{equation} 1455In that case, $ M_{ext}(q,t)$ appears as a function $q$ and we need to compute its Jacobian w.r.t $q$. This computation needs the computation of 1456\begin{equation} 1457 \label{eq:116} 1458 \nabla_{p} M_{ext}(q,t) = \nabla_{p} \Phi(p) m_{ext}(t) 1459\end{equation} 1460Let us compute first 1461\begin{equation} 1462 \label{eq:117} 1463 \Phi(p) m_{ext}(t) = 1464 \begin{bmatrix} 1465 (1-2 p_2^2- 2 p_3^2)m_{ext,1} + 2(p_1p_2-p_3p_0)m_{ext,2} + 2(p_1p_3+p_2p_0)m_{ext,3}\\ 1466 2(p_1p_2+p_3p_0)m_{ext,1} +(1-2 p_1^2- 2 p_3^2)m_{ext,2} + 2(p_2p_3-p_1p_0)m_{ext,3}\\ 1467 2(p_1p_3-p_2p_0)m_{ext,1} + 2(p_2p_3+p_1p_0)m_{ext,2} + (1-2 p_1^2- 2 p_2^2)m_{ext,3}\\ 1468 \end{bmatrix} 1469\end{equation} 1470Then we get 1471\begin{equation} 1472 \label{eq:118} 1473 \begin{array}{l} 1474 \nabla_{p} \Phi(p) m_{ext}(t) =\\ 1475 \begin{bmatrix} 1476 -2 p_3 m_{ext,2} + 2 p_2 m_{ext,3} & 2p_2 m_{ext,2}+2 p_3 m_{ext,3} & -4 p_2 m_{ext,1} +2p_1 m_{ext,2}+2 p_0 m_{ext,3} & -3 p_3 m_{ext,1} -2p_0 m_{ext,2} +2 p_1m_{ext,3} \\ 1477 2p_3 m_{ext,1} -2p_1m_{ext,3} & 2p_2m_{ext,1} -4p_1 m_{ext,2} -2p_1 m_{ext,3} & & & \\ 1478 \end{bmatrix} 1479 \end{array} 1480\end{equation} 1481 1482 1483 1484 1485 1486\subsection{Siconos implementation} 1487 1488The expression:~$\mathcal R_{free}(v^\tau_{k+1}) = M(v-v_k) - h \theta F(t_{k+1}, q(v^\tau_{k+1}),v^\tau_{k+1}) - h (1- \theta) F(t_{k}, q_{k},v_{k})$ is computed in {\tt MoreauJeanOSI::computeResidu()} and saved in {\tt ds->workspace(DynamicalSystem::freeresidu)} 1489 1490 1491The expression:~$\mathcal R(v^\tau_{k+1}) =\mathcal R_{free}(v^\tau_{k+1}) - h (1- \theta) F(t_{k}, q_{k},v_{k}) - H^\top(\bar q_k) Q_{k+1} - G^\top(\bar q_k) P_{k+1} $ is computed in {\tt MoreauJeanOSI::computeResidu()} and saved in {\tt ds->workspace(DynamicalSystem::free)}. 1492\begin{ndrva} 1493 really a bad name for the buffer {\tt ds->workspace(DynamicalSystem::free)}. Why we are chosing this name ? to save some memory ? 1494\end{ndrva} 1495 1496 1497The expression:~$v_{free} = v^{\tau}_{k+1} - W \mathcal R_{free}(v^\tau_{k+1})$ is compute in {\tt MoreauJeanOSI::computeFreeState()} and saved in {\tt d->workspace(DynamicalSystem::free)}. 1498 1499 1500 1501The computation:~ $v^{\tau+1}_{k+1} = v_{free} + W H^\top(\bar q_k) Q^{\tau+1}_{k+1} + W G^\top(\bar q_k) P^{\tau+1}_{k+1}$ is done in {\tt MoreauJeanOSI::updateState} and stored in {\tt d->twist()}.\\ 1502 1503 1504%%% Local Variables: 1505%%% mode: latex 1506%%% TeX-master: "DevNotes" 1507%%% End: 1508