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