3.4 Exact Contact Dynamics
3.4.2 Discrete Constrained Equations of Motion
range(N(q)) = null(G(q)) =TqC, (3.61)
and that the resulting equations of motion represent a D’Alembert type system since the premulti- plication with a null space matrix is closely related to D’Alembert’s principle that internal forces do no work [50].
tk
Ld(qk,qk+1, h) =h 1
2h2(qk+1−qk)TM(qk+1−qk)−V
(qk+1+qk) 2
.
(3.62)
To form the augmented discrete Lagrangian, the constraint term is discretized via h
2gT(qk)λk+h
2gT(qk+1)λk+1≈ Z tk+1
tk
gT(q)λdt. (3.63)
Ld(qk,qk+1,λk,λk+1, h) =Ld(qk,qk+1, h)−h
2gT(qk)λk−h
2gT(qk+1)λk+1. (3.64) Note that in the preceding equations, an explicit dependence on the time step h = tk+1 −tk is allowed, in contrast to the basic development in Section 3.2. To derive the discrete Euler-Lagrange equations from an action sum, the time step is allowed to vary in the interval containing the actual contact time and configuration. That is, restrictingα∈(0,1), and the discrete action sum is given by
Id=
c−−1
X
k=0
Ld(qk,qk+1,λk,λk+1, h)
+Ld(qc−,qc,λc−,λc, αh) +Ld(qc,qc+,λc,λc+,(1−α)h) +
K−1
X
k=c+
Ld(qk,qk+1,λk,λk+1, h).
(3.65)
Taking variations of (3.65) with respect to qk,λk,andα using δq0 = δqK = 0, and enforcing stationarity gives
δId=
c−−1
X
k=1
D2Ld(qk−1,qk) +D1Ld(qk,qk+1)−hGT(qk)λk
·δqk
+
K−1
X
k=c++1
D2Ld(qk−1,qk) +D1Ld(qk,qk+1)−hGT(qk)λk
·δqk
+
D2Ld(qc−−1,qc−) +D1Ld(qc−,qc, αh)−(1 +α)h
2 GT(qc−)λc−
·δqc−
+
D2Ld(qc−,qc, αh) +D1Ld(qc,qc+,(1−α)h)−h
2GT(qc)λc
·δqc
+
D2Ld(qc,qc+,(1−α)h) +D1Ld(qc+,qc++1)−(2−α)h
2 GT(qc+)λc+
·δqc+
+ (D3Ld(qc−,qc, αh)−D3Ld(qc,qc+,(1−α)h))hδα +
K−1
X
k=0
g(qk)·δλk
= 0,
(3.66)
where again, the notationDiLd denotes the derivative of the discrete Lagrangian with respect to its ithargument.
Pre- and post-collision. Away from the contact configuration, the discrete Euler-Lagrange equa- tions for the augmented Lagrangian are given by
D1Ld(qk,qk+1, h) +D2Ld(qk−1,qk, h)−hGT(qk)λk =0, (3.67a) g(qk+1) =0, (3.67b)
which can be solved as a system of equations for q2, . . .qc− andλ1, . . . ,λc−−1 in the pre-collision configurations, and then qc++1, . . . ,qK and λc+, . . . ,λK−1 in in the post collision configurations, assuming that the simulation is started so that no collision takes place in the first time step as described in Section 3.2.
Collision. In the interval surrounding the collision configuration,qc, a different set of equations must be solved. First, the equations are advanced according to (3.8) to ˜qc+attc+. If it is determined that ˜qc+ ∈ A/ , then this inadmissible configuration is discarded, and Equations (3.68) are solved instead forα,qc, and λc−.
With the collision configuration and time in hand, the simulation can the be advanced toqc+, also solving forµc according to
D2Ld(qc−,qc, αh) +D1Ld(qc,qc+,(1−α)h)−h 2
GT(qc)∇g(qc)
µc=0 (3.69a) g(qc+) =0 (3.69b) D3Ld(qc−,qc, αh)−D3Ld(qc,qc+,(1−α)h) = 0 (3.69c)
where, in the analog to the continuous formulation, µc = [λcµc]T. That is, an additional La- grange multiplier, µc, has been introduced to enforce the constraint that variations of the collision configuration are restricted to the tangent space of the admissible setA, i.e., that
D2Ld(qc−,qc, αh) +D1Ld(qc,qc+,(1−α)h)−h
2GT(qc)λc
·δqc= 0∀δqc∈T ∂A.
Note that Equation (3.69c) is a statement of conservation ofdiscrete energy
Ed(qk,qk+1, h) = 1 2
qk+1−qk
h T
M
qk+1−qk
h
+V
qk+1+qk
2
=KEq+V
qk+1+qk
2
so that (3.69c) can be written succinctly as
Ed(qc−,qc, αh)−Ed(qc,qc+,(1−α)h) = 0
=Ed−−Ed+.
(3.70)
Finally, care must also be taken that the appropriate time step is used to find theqc++1 andλc+ according to
D2Ld(qc,qc+,(1−α)h) +D1Ld(qc+,qc++1, h)−(2−α)h
2 GT(qc+)λc+=0. (3.71)
Hamiltonian Jump Conditions. In the continuous formulation, the energy jump condition (see Equation (3.59a)) was transformed via the continuous Legendre transform without mentioning to a jump condition on the Hamiltonian of the system. In the discrete setting, the Hamiltonian can be approximated byHd defined as
Hd(qk,pk) =1
2pTkM−1pk+V(qk)
=KEp+V(qk).
This energy approximates the continuous HamiltonianH(q,p) = 12pTM−1p+V(q), which is the energy of the continuous system. In fact, it is shown in [50] that in the absence of a potential, Hd
exactly preserves the energyH(q0,p0), in which the continuous state (q0,p0) is used to start the discrete timestepping scheme, and that oscillations inHd tend to be on a smaller magnitude than oscillations inEd, even though both energies converge toH as the time step goes to 0.
Although it does not precisely conform to the discrete variational framework, the energy jump condition can be written on the momentum level using the projected Hamiltonian
QHd(qk,pk) = 1 2
QpTkM−1Qpk+V(qk)
=QKEp+V(qk)
(3.72)
as
QHd(qc,p+c|αh)−QHd(qc,p−c |(1−α)h) = 0
=QHd+−QHd−
=
QKEp+c|αh−QKEp− c|(1−α)h
(3.73)
Ed with one in terms ofQHd yields identical results in the pressence or absence of a potiential, and furthermore that computations usingQHd are marginally faster than those usingEd.
It can be readily verified that (3.73) is equivalent to
P Hd(qc,Pp+c|αh)−PHd(qc,P p−c|(1−α)h) = 0
=PHd+−P Hd−
=
PKEp+c|αh−P KEp− c|(1−α)h
(3.74)
in which the reduced mass matrix,Mred=PT(qc)M P(qc), should be used as the mass matrix in the final expression.
Discrete Null Space Approach and Reparametrization. The discrete constrained Euler- Lagrange equations (Equations 3.67, 3.68, and 3.69) can be reduced to a minimal set of equations by premultiplication of a discrete null space matrix and determining the update via a local nodal reparametrization in terms of the minimal set of configuration variables, u∈ U, withU associated to Rn−m. The resulting scheme is given by Equation (3.13) for pre-and post-collision intervals, and
PT(qc−) [D2Ld(qc−−1,qc−) +D1Ld(qc−,Fd(uc,qc−), αh)] =0 (3.75a) g(Fd(uc,qc−)) = 0. (3.75b)
to be solved foruc (andqc via the parametrization) andαalong with
PT(qc)
D2Ld(qc−,qc, αh) +D1Ld(qc,Fd(uc+,qc),(1−α)h)−h
2∇g(qc)µc
=0 (3.76a) Ed(qc−,qc, αh)−Ed(qc,qc+,(1−α)h) = 0, (3.76b)
or the equivalent statement in terms ofQHd to be solved for µc andu+c (and by extensionq+c) for the contact intervals.
Constrained Discrete Legendre Transform. The constrained discrete Legendre transforms defined in Equations 3.16 and 3.17, modified only slightly to account for the explicit dependence on the time step in the intervals near the contact node, can be used to formulate an alternative time-stepping scheme. Away from the contact configuration, we are left with
P p+k−P p−k =0.
Near the contact configuration,
P p+k−P p−k|αh=0 g(qc) = 0,
and
P p+k|αh−Pp−k|(1−α)h= h
2 P∇gµc PHd−−PHd+= 0.
in which it is assumed that the parametrization qk =Fd(uk,qk−1) is used, and the notation p|γ implies that the momenta being considered is only associated with a portion of the interval h.
Furthermore, the notation has been slightly abused on the right hand side of the expression so that
P∇gµc =PT(qc)∇gµc.
Multiple Collisions. If more than one pair of bodies are overlapping at the end of a non-contact step, two cases are considered. The first case, in which there are only pairwise collisions (see Figure 3.37) and no potentials which depend on the relative orientation of the bodies is easier to deal with.
In this case,αis treated as a vector in Equation 3.75, with one entry for each independent collision.
Having solved forα∈Rκ, Equation 3.76 can be solved as-is, forµc∈Randqc+=Fd(uc+,qc) with the vectored nature ofαtaken into account.
Figure 3.37: Two cases of multiple collisions. In the first case, only two bodies are involved in each collision event. In the second case, the order of collisions needs to be determined.
In the second case, as illustrated in Figure 3.37b, in which groups of overlapping bodies are detected or a potential is present which depends on the relative configuration of the bodies, a different method must be used because resolving the order of collisions becomes important to resolving the trajectory.
Again, α becomes a vector, but the equations are now coupled so that Equations 3.75 and 3.76 reflect the coupled nature of the collisions, i.e. terms like (1−(α1+α2)) appear, linking the update for the set of bodies involved in the multiple collision, and Equation 3.76 must be resolved in each sub-interval. Unfortunately, this formulation requiresa priori knowledge of the oder of collisions, i.e., referring to Figure 3.38, one must know in advance which collision corresponds to the time tc−+α1h, and which to tc−+ (α1+α2)hon order to accurately solve Equation 3.75.
t=tc−+α1h
t=tc−+ (α1+α2)h
t=tc−+α1h t=tc−+ (α1+α2)h
˜
qc+ vs.
Figure 3.38: A priori knowledge of the order of collisions is needed to accurately solve Equation 3.75 for non-pairwise collisions.
A final complication comes from the fact that, in particular for the polygonal bodies under con- sideration, collisions cause relative rotation between the bodies, which in turn can lead to a series of collisions in quick succession between the same pair of bodies. That is, even for one pair-wise collision, advancing the configuration toqc+ mightnot lead to an admissible configuration.
As a practical consideration to overcome the challenges associate with multiple collisions, if multiple collisions are detected, or if only pairwise collisions are detected but qc+ ∈ A/ , the time step h is repeatedly subdivided in the interval under consideration until there are only pairwise collisions
within each interval, and the configurations at the interval end points are admissible.