-
Notifications
You must be signed in to change notification settings - Fork 0
/
app1-dynamics.tex
812 lines (774 loc) · 25.9 KB
/
app1-dynamics.tex
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
%-------------------------------------------------------------------------------
\chapter{Dynamics of a multibody system}
\label{app.dynamics}
\acresetall
%-------------------------------------------------------------------------------
In this appendix we derive equation of dynamics of a floating base multibody
system with unilateral constraints. The presentation is based on
\cite{Wieber2006fastmotions}, and likewise aims at exposing the structure of
this equation, rather than at fast computation of its components. In addition
to that, we demonstrate how momenta of the whole system are computed.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Preliminaries}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Notation}
We consider a system of $n + 1$ interconnected rigid bodies. We associate the
following variables with each body $k \in \{1, ..., n+1\}$
%
\begin{longtable}[l]{@{\extracolsep{0pt}}l @{\extracolsep{3pt}}l p{9.5cm}}
$m_k$ & $\in \RR_{>0}$ & mass of $k$-th body\\
$\V{c}_k$ & $\in \RR^3$ & position of \ac{CoM} of $k$-th body in the global frame\\
$\ddotV{x}_k = (\ddotV{c}_k, \dotV{\omega}_k)$ & $\in \RR^6$ & constrained spatial acceleration of $k$-th body in frame $\FRAME{k}$\\
$\ddotV{x}_{k,u}$ & $\in \RR^6$ & unconstrained spatial acceleration of $k$-th body in frame $\FRAME{k}$\\
$\INERTIA_k$ & $\in \RR^{3 \CROSS 3}$ & inertia matrix of $k$-th body in frame $\FRAME{k}$\\
$\M{H}_k = \begin{bmatrix}
m_k \V{I}_3 & \V{0} \\
\V{0} & \INERTIA_k
\end{bmatrix}$ & $\in \RR^{6 \CROSS 6}$ & spatial inertia matrix of $k$-th body in frame $\FRAME{k}$\\
$(\V{f}_k, \moment_k)$ & $\in \RR^{6 \CROSS 6}$ & wrench acting on $k$-th body in frame $\FRAME{k}$\\
$\M{J}_k = (\M{J}_{\TRAN,k}, \M{J}_{\ROT,k})$ & $\in \RR^{6 \CROSS (n+6)}$ & Jacobian of $k$-th body\\
\end{longtable}
%
\noindent and fix frame $\FRAME{k}$ to the \ac{CoM} of $k$-th body. All frames
$\FRAME{k}$, as well as frame $\FRAME{r}$ fixed to the base have the same
orientation as the global frame. Also, we reuse some of the variables defined
in \cref{sec.complementarity_system}
%
\begin{longtable}[l]{@{\extracolsep{0pt}}l @{\extracolsep{3pt}}l p{9.5cm}}
$\q = (\qn, \V{r}, \V{\EULER})$ & $\in \RR^{n+6}$ & vector of generalized coordinates\\
$\M{H}(\q)$ & $\in \RR^{(n+6) \CROSS (n+6)}$ & inertia matrix of the whole system\\
$\V{h}(\q, \dq)$ & $\in \RR^{n+6}$ & vector of Coriolis and centrifugal terms of the whole system\\
$\Jcom$ & $\in \RR^{3 \CROSS (n+6)}$ & Jacobian of the \ac{CoM}\\
$\Itorques$ & $\in \RR^{(n+6) \CROSS n}$ & torque selection matrix\\
$\V{g}$ & $\in \RR^3$ & vector of gravitational acceleration\\
$m$ & $\in \RR_{>0}$ & total mass of the system\\
\end{longtable}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Structure of Jacobians}\label{sec.jacobians}
Vector of generalized coordinates $\V{q}$ contains three parts corresponding to
joint angles, position, and orientation of the base. Consequently, the Jacobians,
which map generalized velocities to the twist of the $k$-th body
%
\begin{equation}
\begin{bmatrix}
\dotV{c}_k \\
\V{\omega}_k
\end{bmatrix}
=
\begin{bmatrix}
\M{J}_{\TRAN,k}\\
\M{J}_{\ROT,k}\\
\end{bmatrix}
\dq
=
\M{J}_k
\dq
,
\end{equation}
%
have corresponding structure:
%
\begin{equation}
\M{J}_k
=
\begin{bmatrix}
\M{J}_{\TRAN,k}\\
\M{J}_{\ROT,k}\\
\end{bmatrix}
=
\begin{bmatrix}
\M{J}_{\TRAN,k,1} & \M{J}_{\TRAN,k,2} & \M{J}_{\TRAN,k,3}\\
\M{J}_{\ROT,k,1} & \M{J}_{\ROT,k,2} & \M{J}_{\ROT,k,3}\\
\end{bmatrix}
=
\begin{bmatrix}
\M{J}_{\TRAN,k,1} & \M{I}_3 & - \CROSS[(\V{c}_k - \V{r})] \\
\M{J}_{\ROT,k,1} & \M{0}_{3,3} & \M{I}_3\\
\end{bmatrix}
\end{equation}
%
In situations when orientation of the base is represented by Euler angles
$\V{\EULER} \in \RR^3$ and its angular velocity and acceleration are replaced
with $\dotV{\EULER}$ and $\ddotV{\EULER}$, it is necessary to introduce matrix
$\Teuler$, which transforms derivatives of the Euler angles to angular
velocities:
%
\begin{equation}
\M{J}_k
=
\begin{bmatrix}
\M{J}_{\TRAN,k,1} & \M{I}_3 & - \CROSS[(\V{c}_k - \V{r})] \Teuler\\
\M{J}_{\ROT,k,1} & \M{0}_{3,3} & \Teuler\\
\end{bmatrix}
=
\begin{bmatrix}
\M{J}_{\TRAN,k,1} & \M{I}_3 & \T{(\CROSS[(\V{c}_k - \V{r})])} \Teuler\\
\M{J}_{\ROT,k,1} & \M{0}_{3,3} & \Teuler\\
\end{bmatrix}
\end{equation}
%
Henceforth, we use this version of the Jacobian, since we represent
orientation, angular velocity and acceleration of the base using Euler angles
in our simulations.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Gauss' principle}
The Gauss' principle states that constrained motions of rigid bodies in a
system are as close as possible to the unconstrained motions in least-squares
sense \cite{Wieber2006fastmotions, Moreau1966siamjc}. Based on this principle
we define the following optimization problem:
%
\begin{equation}
\begin{aligned}
\MINIMIZE{\ddotV{x}_1, \dots, \ddotV{x}_n, \ddot{q}}
& \frac{1}{2} \sum_{k=1}^{n+1}
\T{(\ddotV{x}_k - \ddotV{x}_{k,u})}
\M{H}_k
(\ddotV{x}_k - \ddotV{x}_{k,u}) \\
\SUBJECTTO & \ddotV{x}_k =
\begin{bmatrix}
\ddotV{c}_k\\
\dotV{\omega}_k\\
\end{bmatrix}
=
\begin{bmatrix}
\M{J}_{\TRAN,k}\\
\M{J}_{\ROT,k}\\
\end{bmatrix}
\ddotV{q}
+
\begin{bmatrix}
\dotM{J}_{\TRAN,k}\\
\dotM{J}_{\ROT,k}\\
\end{bmatrix}
\dotV{q}
=
\M{J}_k \ddotV{q} + \dotM{J}_k \dotV{q} \\
& \M{H}_k \ddotV{x}_{k,u} =
\begin{bmatrix}
\V{f}_k\\
\moment_k - \V{\omega}_k \CROSS \INERTIA_k \V{\omega}_k \\
\end{bmatrix}\\
& \ddotV{c}_j =
\M{J}_{\TRAN,j}
\ddotV{q}
+
\dotM{J}_{\TRAN,j}
\dotV{q}
\ge
\V{b}_j,
\end{aligned}
\end{equation}
%
where inequality constraint on $\ddotV{c}_j$ with $j \in \{1, ..., n+1\}$ is
added for illustration. Handling of this constraint is easily generalized to
arbitrary inequalities, such as contact constraints in
\cref{sec.whole_body_model}.
First, we expand multiplication in the objective function and eliminate
constant terms to obtain:
%
\begin{equation}
\begin{aligned}
\MINIMIZE{\ddotV{x}_1, \dots, \ddotV{x}_n, \ddot{q}}
& \frac{1}{2} \sum_{k=1}^{n+1}
\left(
\T{\ddotV{x}_k} \M{H}_k \ddotV{x}_k
-
2 \T{\ddotV{x}_k} \M{H}_k \ddotV{x}_{k,u}
\right)\\
\SUBJECTTO & \ddotV{x}_k =
\M{J}_k \ddotV{q} + \dotM{J}_k \dotV{q} \\
& \M{H}_k \ddotV{x}_{k,u} =
\begin{bmatrix}
\V{f}_k\\
\moment_k - \V{\omega}_k \CROSS \INERTIA_k \V{\omega}_k \\
\end{bmatrix}\\
& \M{J}_{\TRAN,j}
\ddotV{q}
+
\dotM{J}_{\TRAN,j}
\dotV{q}
\ge
\V{b}_j.
\end{aligned}
\end{equation}
%
Then we eliminate all equality constraints
%
\begin{equation}
\begin{aligned}
\MINIMIZE{\ddot{q}}
& \frac{1}{2} \sum_{k=1}^{n+1}
\Bigg(
\T{(\M{J}_k \ddotV{q})} \M{H}_k \M{J}_k \ddotV{q}
+
2 \T{(\M{J}_k \ddotV{q})} \M{H}_k \dotM{J}_k \dotV{q}
+
\T{(\dotM{J}_k \dotV{q})} \M{H}_k \dotM{J}_k \dotV{q}\\
&
-
2 \T{(\M{J}_k \ddotV{q} + \dotM{J}_k \dotV{q})}
\begin{bmatrix}
\V{f}_k\\
\moment_k - \V{\omega}_k \CROSS \INERTIA_k \V{\omega}_k \\
\end{bmatrix} \Bigg)\\
\SUBJECTTO & \M{J}_{\TRAN,j}
\ddotV{q}
+
\dotM{J}_{\TRAN,j}
\dotV{q}
\ge
\V{b}_j,
\end{aligned}
\end{equation}
%
and drop the constant terms
%
\begin{equation}
\begin{aligned}
\MINIMIZE{\ddot{q}}
& \sum_{k=1}^{n+1}
\left(
\frac{1}{2} \T{(\M{J}_k \ddotV{q})} \M{H}_k \M{J}_k \ddotV{q}
+
\T{(\M{J}_k \ddotV{q})} \M{H}_k \dotM{J}_k \dotV{q}
-
\T{(\M{J}_k \ddotV{q})}
\begin{bmatrix}
\V{f}_k\\
\moment_k - \V{\omega}_k \CROSS \INERTIA_k \V{\omega}_k \\
\end{bmatrix}
\right)\\
\SUBJECTTO & \M{J}_{\TRAN,j}
\ddotV{q}
+
\dotM{J}_{\TRAN,j}
\dotV{q}
\ge
\V{b}
\end{aligned}
\end{equation}
%
\ac{KKT} optimality conditions for the considered problem are stated as a
complementarity system \cite{Nocedal2006numopt}
\begin{subequations}\label{eq.kkt_dynamics}
\begin{empheq}[left=\empheqlbrace]{align}
& \sum_{k=1}^{n+1}
\left(
\T{\M{J}_k} \M{H}_k \M{J}_k \ddotV{q}
+
\T{\M{J}_k} \M{H}_k \dotM{J}_k \dotV{q}
-
\T{\M{J}_k}
\begin{bmatrix}
\V{f}_k\\
\moment_k - \V{\omega}_k \CROSS \INERTIA_k \V{\omega}_k \\
\end{bmatrix}
\right)
-
\T{\M{J}_{\TRAN,j}}
\V{\Lambda}
= 0, \label{eq.kkt_dynamics.dynamics}\\
& \M{J}_{\TRAN,j}
\ddotV{q}
+
\dotM{J}_{\TRAN,j}
\dotV{q}
\ge
\V{b},\\
& \V{\Lambda} \ge \V{0},\\
& \T{\V{\Lambda}}
\left(
\M{J}_{\TRAN,j}
\ddotV{q}
+
\dotM{J}_{\TRAN,j}
\dotV{q}
-
\V{b}
\right)
=
\V{0},
\end{empheq}
\end{subequations}
where $\V{\Lambda}$ is the vector of Lagrange multipliers.
System~\cref{eq.kkt_dynamics} corresponds to the complementarity system
presented in \cref{sec.whole_body_model}: the first line is the equation of
dynamics of the whole system and $\V{\Lambda}$ correspond to the contact
forces.
We further modify \cref{eq.kkt_dynamics.dynamics} by substituting
$\V{\omega}_k = \M{J}_{\ROT,k} \dotV{q}$ and moving all forces to the right
side:
%
\begin{equation}\label{eq.lagrangian_dynamics}
\underbrace{
\sum_{k=1}^{n+1}
\left(
\T{\M{J}_k} \M{H}_k \M{J}_k
\right)
}_{\M{H}}
\ddotV{q}
+
\underbrace{
\sum_{k=1}^{n+1}
\left(
\T{\M{J}_k} \M{H}_k \dotM{J}_k \dotV{q}\\
+
\T{\M{J}_{\ROT,k}}
((\M{J}_{\ROT,k} \dotV{q}) \CROSS \INERTIA_k \M{J}_{\ROT,k} \dotV{q})
\right)
}_{\V{h}}
=
\sum_{k=1}^{n+1}
\T{\M{J}_k}
\begin{bmatrix}
\V{f}_k\\
\moment_k\\
\end{bmatrix}
+
\T{\M{J}_{\TRAN,j}}
\V{\Lambda}.
\end{equation}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Structure of the equation of dynamics}
In this section we employ our knowledge of the structure of Jacobians to
explore the structure of components of Equation~\cref{eq.lagrangian_dynamics}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Inertia matrix}
Expansion of the Jacobians exposes the structure of inertia matrix as shown
below
%
\begin{subequations}
\begin{align}
\M{H}
& =
\sum_{k=1}^{n+1}
\T{\M{J}_k} \M{H}_k \M{J}_k \\
& =
\sum_{k=1}^{n+1}
m_k \T{\M{J}_{\TRAN,k}} \M{J}_{\TRAN,k}
+
\sum_{k=1}^{n+1}
\T{\M{J}_{\ROT,k}} \INERTIA_k \M{J}_{\ROT,k} \\
& =
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\T{\M{J}_{\TRAN,k,1}} \M{J}_{\TRAN,k}\\
\T{\M{J}_{\TRAN,k,2}} \M{J}_{\TRAN,k}\\
\T{\M{J}_{\TRAN,k,3}} \M{J}_{\TRAN,k}\\
\end{bmatrix}
+
\begin{bmatrix}
\T{\M{J}_{\ROT,k,1}} \INERTIA_k \M{J}_{\ROT,k}\\
\T{\M{J}_{\ROT,k,2}} \INERTIA_k \M{J}_{\ROT,k}\\
\T{\M{J}_{\ROT,k,3}} \INERTIA_k \M{J}_{\ROT,k}\\
\end{bmatrix}
\right)\\
\begin{split}
&
=
\sum_{k=1}^{n+1}
\Bigg(
m_k
\begin{bmatrix}
\T{\M{J}_{\TRAN,k,1}} \M{J}_{\TRAN,k,1} & \T{\M{J}_{\TRAN,k,1}} & - \T{\M{J}_{\TRAN,k,1}} \CROSS[(\V{c}_k - \V{r})] \Teuler\\
\M{J}_{\TRAN,k,1} & \V{I}_3 & - \CROSS[(\V{c}_k - \V{r})] \Teuler\\
\T{\Teuler} \CROSS[(\V{c}_k - \V{r})] \M{J}_{\TRAN,k,1} & \T{\Teuler} \CROSS[(\V{c}_k - \V{r})] & - \T{\Teuler} \CROSS[(\V{c}_k - \V{r})] \CROSS[(\V{c}_k - \V{r})] \Teuler\\
\end{bmatrix}\\
& \quad \quad \quad \quad +
\begin{bmatrix}
\T{\M{J}_{\ROT,k,1}} \INERTIA_k \M{J}_{\ROT,k,1} & \M{0}_{n,3} & \T{\M{J}_{\ROT,k,1}} \INERTIA_k \Teuler\\
\M{0}_{3,n} & \M{0}_{3,3} & \M{0}_{3,3}\\
\T{\Teuler} \INERTIA_k \M{J}_{\ROT,k,1} & \M{0}_{3,3} & \T{\Teuler} \INERTIA_k \Teuler\\
\end{bmatrix}
\Bigg)
\end{split}
\label{eq.inertia_structure.long_line}
\\
& =
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\T{\M{J}_{\TRAN,k,1}} \M{J}_{\TRAN,k}\\
\M{J}_{\TRAN,k} \\
\T{\Teuler} \CROSS[(\V{c}_k - \V{r})] \M{J}_{\TRAN,k}\\
\end{bmatrix}
+
\begin{bmatrix}
\T{\M{J}_{\ROT,k,1}} \INERTIA_k \M{J}_{\ROT,k}\\
\M{0}_{n+6,3} \\
\T{\Teuler} \INERTIA_k \M{J}_{\ROT,k}\\
\end{bmatrix}
\right)
=
\begin{bmatrix}
\M{H}_{1} \\
\M{H}_{2} \\
\M{H}_{3} \\
\end{bmatrix}
\end{align}
\end{subequations}
%
It is worth noting that the structure of the inertia matrix simplifies when the
base $\V{r}$ is chosen to coincide with the \ac{CoM} $\V{c}$. In this case some
of the components of $\M{H}$ are equal to zero due to
%
\begin{equation}
\sum_{k=1}^{n+1}
m_k \CROSS[(\V{c}_k - \V{r})]
=
\sum_{k=1}^{n+1}
\CROSS[(m_k \V{c}_k - m_k \V{c})]
=
\CROSS[\left(m \V{c} - \sum_{k=1}^{n+1} (m_k \V{c})\right)]
=
\CROSS[(\M{0}_{3,1})]
=
\M{0}_{3,3}.
\end{equation}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Nonlinear term}
%
\begin{equation}
\begin{aligned}
&\V{h}
=
\sum_{k=1}^{n+1}
\left(
\M{J}_k^T \M{H}_k \dotM{J}_k \dotV{q}
+
\M{J}_{\ROT,k}^T
((\M{J}_{\ROT,k} \dotV{q}) \CROSS \INERTIA_k \M{J}_{\ROT,k} \dotV{q})
\right)\\
& =
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\M{J}_{\TRAN,k,1}^T \dotM{J}_{\TRAN,k} \dotV{q}\\
\dotM{J}_{\TRAN,k} \dotV{q} \\
\T{\Teuler} \CROSS[(\V{c}_k - \V{r})] \dotM{J}_{\TRAN,k} \dotV{q}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{J}_{\ROT,k,1}^T \INERTIA_k \dotM{J}_{\ROT,k} \dotV{q} + \M{J}_{\ROT,k,1}^T ((\M{J}_{\ROT,k} \dotV{q}) \CROSS \INERTIA_k \M{J}_{\ROT,k} \dotV{q})\\
\M{0}_{3,1} \\
\T{\Teuler} \INERTIA_k \dotM{J}_{\ROT,k} \dotV{q} + \T{\Teuler} ((\M{J}_{\ROT,k} \dotV{q}) \CROSS \INERTIA_k \M{J}_{\ROT,k} \dotV{q})\\
\end{bmatrix}
\right)
\\
& =
\begin{bmatrix}
\M{h}_{1} \\
\M{h}_{2} \\
\M{h}_{3} \\
\end{bmatrix}
\end{aligned}
\end{equation}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Forces}
Assuming that the wrenches $(\V{f}_k, \moment_k)$ are the result of gravity
field and joint torques we obtain
%
\begin{equation}
\sum_{k=1}^{n+1}
\T{\M{J}_k}
\begin{bmatrix}
\V{f}_k\\
\moment_k\\
\end{bmatrix}
+
\T{\M{J}_{\TRAN,j}}
\V{\Lambda}
=
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\M{J}_{\TRAN,k,1}^T\\
\M{I}_3 \\
\T{\Teuler} \CROSS[(\V{c}_k - \V{r})]\\
\end{bmatrix}
\right)
\V{g}
+
\Itorques
\torques
+
\begin{bmatrix}
\M{J}_{\TRAN,j,1}^T\\
\M{I}_3 \\
\T{\Teuler} \CROSS[(\V{c}_j - \V{r})]\\
\end{bmatrix}
\V{\Lambda}.
\end{equation}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Momenta of the system}\label{sec.momenta_structure}
Consider the lower $6$ lines of the equation of dynamics:
%
\begin{equation}
\begin{aligned}
&
\begin{bmatrix}
\M{I}_3 & \M{0}_{3,3} \\
\M{0}_{3,3} & \T{\Teuler}\\
\end{bmatrix}
\Bigg(
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\M{J}_{\TRAN,k} \\
\CROSS[(\V{c}_k - \V{r})] \M{J}_{\TRAN,k}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{0}_{3,n+6} \\
\INERTIA_k \M{J}_{\ROT,k}\\
\end{bmatrix}
\right)
\ddotV{q}
\\
&+
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\dotM{J}_{\TRAN,k} \dotV{q} \\
\CROSS[(\V{c}_k - \V{r})] \dotM{J}_{\TRAN,k} \dotV{q}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{0}_{3,1} \\
\INERTIA_k \dotM{J}_{\ROT,k} \dotV{q}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{0}_{3,1} \\
((\M{J}_{\ROT,k} \dotV{q}) \CROSS \INERTIA_k \M{J}_{\ROT,k} \dotV{q})\\
\end{bmatrix}
\right)
\Bigg)
\\
& =
\begin{bmatrix}
\M{I}_3 & \M{0}_{3,3} \\
\M{0}_{3,3} & \T{\Teuler}\\
\end{bmatrix}
\Bigg(
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\M{I}_3 \\
\CROSS[(\V{c}_k - \V{r})]\\
\end{bmatrix}
\right)
\V{g}
+
\begin{bmatrix}
\M{I}_3 \\
\CROSS[(\V{c}_j - \V{r})]\\
\end{bmatrix}
\V{\Lambda}
\Bigg)
.
\end{aligned}
\end{equation}
%
%
This is the Newton-Euler equation of the whole system multiplied by the
constant matrix $\diag{}{\M{I}_3, \T{\Teuler}}$ \cite{Wieber2006fastmotions}.
The right hand side of the equation gives the total wrench acting at the
reference point $\V{r}$ of the system, hence
%
\begin{equation}
\begin{aligned}
&\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\M{J}_{\TRAN,k} \\
\CROSS[(\V{c}_k - \V{r})] \M{J}_{\TRAN,k}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{0}_{3,n+6} \\
\INERTIA_k \M{J}_{\ROT,k}\\
\end{bmatrix}
\right)
\ddotV{q}
\\
&+
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\dotM{J}_{\TRAN,k} \dotV{q} \\
\CROSS[(\V{c}_k - \V{r})] \dotM{J}_{\TRAN,k} \dotV{q}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{0}_{3,1} \\
\INERTIA_k \dotM{J}_{\ROT,k} \dotV{q}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{0}_{3,1} \\
((\M{J}_{\ROT,k} \dotV{q}) \CROSS \INERTIA_k \M{J}_{\ROT,k} \dotV{q})\\
\end{bmatrix}
\right)
\\
&=
\begin{bmatrix}
\M{I}_3 & \M{0}_{3,3} \\
\M{0}_{3,3} & \TI{\Teuler}\\
\end{bmatrix}
\left(
\begin{bmatrix}
\M{H}_2\\
\M{H}_3\\
\end{bmatrix}
\ddotV{q}
+
\begin{bmatrix}
\M{h}_2\\
\M{h}_3\\
\end{bmatrix}
\right)
=
\begin{bmatrix}
\dotV[r]{\LM}\\
\dotV[r]{\AM}
\end{bmatrix},
\end{aligned}
\end{equation}
%
where $\dotV[r]{\LM}$ and $\dotV[r]{\AM}$ are the rates of linear and angular
momenta of the system expressed in frame $\FRAME{r}$. Integration of this
equation allows to compute the momenta as
%
\begin{equation}
\sum_{k=1}^{n+1}
\left(
m_k
\begin{bmatrix}
\M{J}_{\TRAN,k} \\
\CROSS[(\V{c}_k - \V{r})] \M{J}_{\TRAN,k}\\
\end{bmatrix}
+
\begin{bmatrix}
\M{0}_{3,n+6} \\
\INERTIA_k \M{J}_{\ROT,k}\\
\end{bmatrix}
\right)
\dotV{q}
=
\begin{bmatrix}
\M{I}_3 & \M{0}_{3,3} \\
\M{0}_{3,3} & \TI{\Teuler}\\
\end{bmatrix}
\begin{bmatrix}
\M{H}_2\\
\M{H}_3\\
\end{bmatrix}
\dotV{q}
=
\begin{bmatrix}
\V[r]{\LM}\\
\V[r]{\AM}
\end{bmatrix}.
\end{equation}
%
Then, assuming that frame $\FRAME{r}$ has the same orientation as the global
frame
%
\begin{equation}
\V[r]{\LM} = \V{\LM} = m \dotV{c} =
\sum_{k=1}^{n+1}
\left(
m_k \M{J}_{\TRAN,k}
\right)
\dotV{q},
\quad
\dotV{c}
=
\left(
\frac{1}{m}
\sum_{k=1}^{n+1}
m_k \M{J}_{\TRAN,k}
\right)
\dotV{q}
=
\Jcom
\dotV{q},
\end{equation}
%
where $\Jcom$ is Jacobian of the \ac{CoM} in accordance with
\cite{Sugihara2002iros, Espiau1998report}.
Often, it is more convenient to work with momenta $\V{\LM}$ and $\V{\AM}$
expressed in a frame $\FRAME{c}$ fixed to the \ac{CoM} of the system
\cite{Orin2013auro}. If this frame has the same orientation as frame
$\FRAME{r}$ transformation of the linear momentum is not needed $\V[c]{\LM} =
\V[r]{\LM}$. In order to transform angular momentum we use $\V[r]{\AM} =
\V[c]{\AM} + m \V[r]{c} \CROSS \dotV[r]{c}$, where $\V[r]{c} = \V{c} - \V{r}$
is the vector from the base to the \ac{CoM}:
%
\begin{equation}\label{eq.angular_momentum_com}
\V[c]{\AM}
=
\V[r]{\AM} - m \V[r]{c} \CROSS \dotV[r]{c}
=
\V[r]{\AM}
-
m
\V[r]{c}
\CROSS
(
\Jcom
\dotV{q}
)
=
\V[r]{\AM}
-
\V[r]{c}
\CROSS
\V[r]{\LM}.
\end{equation}
%
Rate of the angular momentum $\dotV[c]{\AM}$ is computed by differentiating
\cref{eq.angular_momentum_com}:
%
\begin{equation}
\dotV[c]{\AM}
=
\dotV[r]{\AM}
-
\dotV{c}
\CROSS
\V[r]{\LM}
-
\V[r]{c}
\CROSS
\dotV[r]{\LM}.
\end{equation}
%
Note, that computation of momenta with respect to the \ac{CoM} as suggested in
\cite{Orin2013auro} is equivalent to computation of the equation of dynamics
with $\V{r} = \V{c}$, and it is unnecessary if equation of dynamics with $\V{r}
\neq \V{c}$ is already constructed.