<<

If the aim of is to “describe” the body , the aim of dynamics is to “explain” it; the history of shows that the passage from description to explanation requires the introduction of a new physical entity, that of or, in alternative, that of . The fundamental law of mechanics, due to Newton, is analytically expressed as a vectorial equation between force, mass and of a translating rigid mass     fx ax     f = ma or else fy = m ay fz az [ ] T where the linear acceleration a = ax ay az is a kinematic quantity, obtained ad the derivative of the body linear . This law is true in principle only for a single point-mass particle with mass m, where the applied force f and the acceleration a can exchange the role of cause and effect: if a force f is applied to the particle, the particle accelerates with a linear acceleration equal to a, and conversely, if a particle has a linear acceleration a, the particle is subject to a force f proportional to its mass. [ ] [ ] T T If we jointly know the two vectors f = fx fy fz and a = ax ay az , we can compute the mass from one or any of the following scalar relations as f f f m = x = y = z ax ay az Though, in this last case, we are applying a circular argument, since no definitions of “acceleration” or “force” exist that are independent from the measurement of a mass; we are therefore compelled to use some trick, as clearly illustrated in [?]. If a single point mass is connected to others to form a rigid body, the Newton law is still valid, given that we observe some precautions. Every point-mass shall be isolated and we must consider and deduce the applied on it by the other ; that is, we must introduce the constraint forces in addition to the external forces applied on the body. It is important to notice that the vector equations are dependent on the representa- tion used to characterize its components, and change changing the reference frame

1 2

used to represent the force and acceleration vectors, although the masses, at least in a non-relativistic motion state, do not vary changing the reference frame. In this textbook we will use an analytical approach, as defined in [?], instead of the vectorial one due to Newton. We consider the as a system in which the dynamical equations derive from a unifying principle that implicitly includes and generates these equations. This principle is based on the fact that, in order to describe the motion of a multi- body system is sufficient to consider and use in a proper way some suitable scalar quantities; these were in origin called by Leibnitz vis viva and function, nowa- days take the name of kinetic and . They are an example of the so-called state functions, since to each value of the state vector1 This general principle takes the name of principle of least action; it can be roughly described in the following way. Let us consider the Q of the q ∈ Q, as sketched in Figure 8 for a two-dimensional space Q; let us assume that a particle starts its motion at time t1 in the state Q1 = q(t1) and ends it motion at time t2 having reached the state Q2 = q(t2). Let us further assume that the motion keeps constant the sum E = C + P of the C and the potential energy P that the particle has at time t1.

Given the continuity of motion, the two points Q1 and Q2 are connected by a continuous path (or trajectory), as the one represented by a continuous line in Figure 8; this trajectory is called the true trajectory, and at least in principle, it is unknown, since it is exactly what we want to compute as the result of the dynamical equation analysis. If we had chosen at random a different trajectory, with the only condition that the two boundary point remain fixed, and called this trajectory a perturbed trajectory, the chance to obtain exactly the true trajectory would have been minimal. Now we ask what is that characterize the true trajectory with respect to all possible other perturbed trajectories. Euler was the first mathematician to contribute to the solution of this problem, but it was Lagrange that developed a complete theory, that was later extended by Hamilton: the true trajectory is the one that minimizes the integral of the so-called vis-viva (i.e., two the kinetic energy) of the entire motion between Q1 and Q2. This integral is called action and has a constant and well defined value for each perturbed trajectory at constant E. The least action principle states that the nature “chooses”, among the infinite number of trajectories starting in q(t1) and ending in q(t2), the trajectory that

1The concept of state will be defined in Section XXX; for the we simply consider that the state corresponds to the two vectors q(t) and q˙ (t). 3

Figure 1: True and perturbed trajectories in the configuration space Q.

minimizes the definite integral S of a particular state function C∗(q(t), q˙ (t))2 that depends on the generalized coordinates q(t) and the generalized , where q˙ (t) ∫ t2 S = C∗(q(t), q˙ (t))dt (1) t1

In order to apply this principle it is therefore necessary to compute the trajectory in the space Q that minimizes S. The integral in (1) is computed between the initial time t1 and the final time t2 and must obey to the boundary constraints active at these two times. The minimization of a functional3 is based on a particular mathematical technique, called , whose illustration goes beyond the scope of the present text. The interested reader can find additional treatment in [?], Appendix D. FARE APPENDICE? The conditions that assure the attainment of the minimum of S provide a set of differential equations that contain the first and second time derivatives of the qi(t); this set completely describes the system motion dynamics. As a final comment, we can say that the least action principle makes use of a concept - the action - that overturns the usual representation of the physical system dynamics

2We will see later what this state function C∗ is. 3A functional is a mapping between a function and a real number; the function shall be con- sidered as a whole, i.e., not a single particular value; in this sense a functional is often the integral of the function, as in the above equation for S. 4

by means of a set of differential equations. With some approximation we can say that the differential equations specify the evolution of a physical quantity as the result of infinitesimal increments of time or position; summing up this infinitesimal variations we obtain the physical variables at every instant, knowing only their initial value and possibly some initial derivative: we can say that the motion has a local representation. On the contrary, the action characterizes the motion dynamics requiring only the knowledge of the states at the initial and final times; every intermediate value of the variables can be determined by the minimization of the action, that is a global, rather than local, measure. In any case the implementation of the principle of least action produces as a result a set of differential equations, different from these obtained with the local representation. In the following Sections we will illustrate how to obtain these equations.

0.1 Point Mass System

Yo introduce the Lagrangian approach and compare it with the Newtonian approach we must define some general physical entities

Let us start to consider a sate of N point masses mi, with i = 1, ··· ,N), as schemat- ically represented inn Figure 2. These systems are called multi-point systems.

Figure 2: A system of N point masses mi. The position r i and the velocity v i are represented in a generic reference frame Rb.

Now we consider a pure motion around a point O, that, for simplicity, is the origin of the reference frame Rb; all vectors will be represented in this frame. If b necessary we indicate the vectors as r i , otherwise with r i. [ ] T The position of the generic mass mi is defined by the vector r i = xi yi zi . If the rotation velocity of the system is given by the vector ω, every mass will acquire 0.1. POINT MASS SYSTEM 5

a linear velocity v i, as the result of the rotation, whose value is

v i(t) = ω(t) × r i(t) = S(ω(t))r i(t) (2)

4 We define the linear pi(t) as the product between the mass mi and the velocity v i(t) pi(t) = miv i(t) In this Chapter, the symbol p indicates the linear momentum an not the cartesian pose of a body or the position of a point, as in the preceding Chapters.

0.1.1 Moment of a Force

We briefly recall that, given a point mass located in a point P represented by the vector r in the reference frame R, and a force f applied to it, the moment of the force with respect to a point O is given by the dv dp r × f = r × m = r × (3) dt dt where the terms on the right side arise from the Newton equation. It is important to recall that the term “moment” indicates the cross product, while the term “momentum” indicates the vector p = mv. Applying the derivative rules in (??) to the right end side of (3), we obtain dp d dr r × f = r × = (r × p) − × p dt dt dt d = (r × p) − v × p dt | {z } 0 dh = dt where the last term is always zero, since the moment p and the linear velocity of the point mass v are always collinear, and where the vector h = r × p is called angular moment or moment of the momentum. Since the moment r × f is often referred as the applied by the force with respect to the point O, we can write d τ = h dt Note the analogy d f = p = p˙ dt d τ = h = h˙ dt 4In Italian quantit`adi moto (lineare). 6

that shows the relations between the generalized force/torque and the generalized momentum.

Figure 3: A point mass m with the applied force f and it linear moment p.

0.1.2 and

Given a point O in space and a point mass mi with position r i, belonging to a set of point masses, we have define the angular momentum, or moment of 5 momentum h i, as × × h i(t) = r i(t) pi(t) = r i(t) (miv i(t))

Replacing (2) in the above relation and omitting for simplicity the time dependency, we obtain h i = mi(r i × (ω × r i)) Summing up all the N point masses contributions, we have the total angular mo- mentum ∑N ∑ h = h i = mi(r i × (ω × r i)) (4) i=1 i Recalling from (??) that the triple cross product enjoys of the following property

a × (b × c) = (a Tc)b − (a Tb)c,

where a Tc and a Tb are scalar products, it follows that the momentum can be written as ∑ ( ) T − T h = mi (r i r i)ω (r i ω)r i i

5In Italian momento della quantit`adi moto or quantit`adi moto angolare. 0.1. POINT MASS SYSTEM 7

2 ∥ ∥2 T 2 2 2 Replacing with ri the square norm r i = r i r i = (xi + yi + zi ) and writing T explicitely r i ω = (xiωx + yiωy + ziωz) we obtain      ∑ ωx xi  2   −   h = mi ri ωy (xiωx + yiωy + ziωz) yi i ωz zi or     2 − 2 − − mi(ri xi )ωx mixiyiωy mixiziωz hx ∑     − 2 − 2 − h = hy =  mixiyiωx + mi(ri yi )ωy miyiziωz (5) hz i − − 2 − 2 mixiziωx miyiziωy + mi(ri zi )ωz

This relation can be written in matrix form as     ∑ Γxx,i Γxy,i Γxz,i ωx ∑     h = Γyx,i Γyy,i Γyz,i ωy = Γ iω (6) i Γzx,i Γzy,i Γzz,i ωz i where

2 − 2 2 2 Γxx,i = mi(ri xi ) = mi(yi + zi ) 2 − 2 2 2 Γyy,i = mi(ri yi ) = mi(xi + zi ) 2 − 2 2 2 Γzz,i = mi(ri zi ) = mi(xi + yi )

and

Γxy,i = Γyx,i = −mixiyi

Γxz,i = Γzx,i = −mixizi

Γyz,i = Γzy,i = −miyizi

If we now introduce a new matrix defined as     Γxx Γxy Γxz Γxx,i Γxy,i Γxz,i   ∑   ∑ Γ = Γyx Γyy Γyz = Γyx,i Γyy,i Γyz,i = Γ i i i Γzx Γzy Γzz Γzx,i Γzy,i Γzz,i

from (6) we have     Γxx Γxy Γxz ωx     h = Γyx Γyy Γyz ωy = Γω (7) Γzx Γzy Γzz ωz or better, restating the time dependency

h(t) = Γ(t)ω(t) 8

The matrix Γ is called inertia matrix or inertia tensor and has on the main diagonal the inertia moments ∑ ∑ ∑ 2 − 2 2 2 2 Γxx = mi(ri xi ) = mi(yi + zi ) = midx ∑i ∑i ∑i 2 − 2 2 2 2 Γyy = mi(ri yi ) = mi(xi + zi ) = midy (8) ∑i ∑i ∑i 2 − 2 2 2 2 Γzz = mi(ri zi ) = mi(xi + yi ) = midz i i i and outside the diagonal the inertia products ∑ Γxy = Γyx = − mixiyi ∑i Γxz = Γzx = − mixizi (9) ∑i Γyz = Γzy = − miyizi i

Inertia moments As one can notice, the inertia moments are obtained summing the contribu- 2 2 2 tions of the products of each mass by the square euclidean distance dx, dy, dz from the three axes x, y and z.

Prodotti d’inerzia When the inertia products are zero, the inertia matrix becomes diagonal   Γxx 0 0   Γ = 0 Γyy 0 0 0 Γzz

In this case the reference frame axes are aligned along what are called the principal inertia axes of the body, and the matrix is the so called principal inertia matrix.

Another possible representation of h and Γ can be obtained using (4) and the properties of the skew-symmetric matrices: ∑ ∑ h = mi(r i × (ω × r i)) = miS(r i)S(ω)r i (10) i i

Recalling that S(ω)r i = −S(r i)ω, one obtains: ∑ ∑ h = miS(r i)S(ω)r i = −miS(r i)S(r i)ω (11) i i 0.1. POINT MASS SYSTEM 9 and being ω a common term, at the end one has ( ) ∑ h = − miS(r i)S(r i) ω = Γω (12) i with ∑ Γ = − miS(r i)S(r i) (13) i

The inertia matrix Γ depends on the r i vectors that characterize the positions of the masses mi in a given reference frame, with respect to a given point; this point can be fixed, as the origin O of the frame, or mobile (i.e., local) as the C of the body; in the first case the inertia matrix will be indicated as Γ o, in the second case as Γ c. Considering two reference frames with a common origin, but one rotated with respect to the other, the inertia matrices will be different; the rule to transform one into the other will be detailed later on. The inertia matrix Γ represents the inertial properties of a rigid body subject to a rotation, in the same way as the mass represents the inertia properties of a body subject to a translation. Equation (7) is qualitatively similar to the expression of the total linear momentum p(t) = mv(t). Since we can write it as p(t) = M v(t), where M = mI , the two momentum are

p(t) = M v(t) h(t) = Γ(t)ω(t) with the difference that usually the mass matrix M does not depend on time, while Γ(t) does.

Example 0.1.1

Let us consider a simple body system composed by two equal masses as in Figure 4; we want to compute the angular momenta and the inertia matrices with respect to the points O and C. Assume also that R is fixed, while R is on the barycenter (or center of mass) of a b −−→ the body having the axis i aligned with the segment CB. Assume           1 2 3 −1 1           r 1 = 2 ; r c = 2 ; r 2 = 2 ; c1 = 0 ; c2 = 0 0 0 0 0 0 10

Figure 4: The two equal masses system considered in Example 0.1.1.

and m1 = m2 = 1. R R a Since a e b are parallel, the Rb = I and we can neglect it.

We start computing Γ o as   8 −8 0   Γ o = −m1S(r 1)S(r 1) − m2S(r 2)S(r 2) = −8 10 0 0 0 18 and then Γ c as   0 0 0   Γ c = −m1S(c1)S(c1) − m2S(c2)S(c2) = 0 2 0 0 0 2 Recalling the parallel axes theorem, that we will introduce in Paragraph 0.3.3, and assuming also (23) and (24), we obtain   8 −8 0   Γ o − Γ c = −8 8 0 = −(m1 + m2)S(r c)S(r c) 0 0 16 Now assuming that the of the system is   0 a b   ωab = ωab = 0 1 we can compute the momenta as follows             8 −8 0 0 0 0 0 0 0 0             h o = −8 10 0 0 = 0 ; h c = 0 2 0 0 = 0 0 0 18 1 18 0 0 2 1 2

 0.2. DISTRIBUTED MASS SYSTEMS 11 0.2 Distributed Mass Systems

We make a further step assuming that the body whose angular moment we want to compute is composed by a continuous distribution of infinitesimal point masses dm, having point density ρ(r) = ρ(x, y, z), depending on the position (x, y, z), and where the infinitesimal mass is dm = ρ(x, y, z)dV . The coordinate r takes its values in V, where∫ V is a finite space region∫ that in- ∫cludes the body, with a total volume V = V dV and total mass mtot = V dm = V ρ(x, y, z)dV . We can apply the same arguments used above for N point masses to a system of distributed masses, replacing in (8) and (9) the summation operator with the integral operator in the volume V. We can now write in compact form the inertia matrix as:   ∫ y2 + z2 −xy −xz Γ = ρ(x, y, z)  −xy x2 + z2 −yz  dV (14) V −xz −yz x2 + y2 obtaining the inertia moments ∫ 2 2 Γxx = ρ(r)(y + z ) dV ∫V 2 2 Γyy = ρ(r)(x + z ) dV (15) ∫V 2 2 Γzz = ρ(r)(x + y ) dV V and the inertia products ∫

Γxy = Γyx = − ρ(r)xy dV ∫V

Γxz = Γzx = − ρ(r)xz dV (16) ∫V

Γyz = Γzy = − ρ(r)yz dV V

Notice that ρ(r)dV is equivalent to an infinitesimal mass dm(r), therefore we can also write relation (14) as   ∫ y2 + z2 −xy −xz Γ =  −xy x2 + z2 −yz  dm(r) (17) V −xz −yz x2 + y2

0.2.1 Some Observations

The inertia matrix is implicitly defined when we define the angular momentum h as in (10); this one in turn is defined introducing a rotation around a point O, 12

characterized by the angular velocity ω. The cartesian components of h are represented in the chosen reference frame, that often, but not always, coincides with a reference frame with its origin in O; the inertia matrix (or inertia tensor) describes the way the mass is distributed with respect to the axes of R0(O; x, y, z). If the frame is rigidly attached to the body, the inertia matrix is time independent, otherwise it changes with time. This is the reason why it is common to read in textbooks “inertia moment with respect to a point” and/or “inertia matrix with respect to the axes”. This difference shall not generate confusion since it is an example of a casual use of mathematical concepts, that, once understood, does not represents a problem anymore. A reference frame attached to the body is called a body-frame and any inertia matrix with respect to this frame is always constant. If one chooses a different reference frame attached to the body, with the same ori- gin O, but different axes, the components of h do change and therefore also the components of Γ, but they remain time-invariant. If the frame is translated, Γ changes according to the parallel axes theorem (see Section 0.3.3) If the body rotates with respect to the reference frame (and therefore this one is not a body-frame), the components of Γ vary with time. To conclude, we recall that what has been presented here is valid only for rigid bodies.

0.3 Mathematical Formulation

We have seen that a inertia matrix or tensor6 of a rigid body specifies and summarize the inertial characteristics of the body with respect to the variations of the angular velocity associated to the body rotation. The matrix is always defined specifying explicitly or implicitly a point with respect to which it is computed; usually this point is the center of mass of the body, but this choice it is not strictly necessary. In order to define correctly the inertia matrix of a rigid body it is proper to introduce a number of subscripts and superscripts that make clear the meaning with respect to the reference frames defined by the user.

Given a rigid body B, identified by the subscript b, and a reference system Rb, called

6The term tensor is used to indicate an abstract mathematical entity that generalizes the vectors, while we use the term matrix to indicate its representation in some defined reference frame. We prefer to use “matrix” instead of “tensor” because it is more common in modelling and control literature 0.3. MATHEMATICAL FORMULATION 13

local frame, the position of the center of mass C of the body is defined by the vector r b, computed as follows: c ∫ ∫ b b b b r c dm = r c mtot = r dm (18) B B b R where r represents the position∫ in b of the generic point mass dm belonging to B b B the body ; moreover mtot = B dm is the total mass of the body . b ∈ R3×3 The inertia matrix Γ c around the center of mass C is defined, as seen in Section 0.1.2, resorting to the angular momentum definition, that we write again here, with the addition of the introduced subscripts and superscripts:

b b b h c = Γ cω0 (19) b b ≡ b where h c is the momentum of the rigid body with respect to C and ω0 ω0b is the total angular velocity of the rigid body; both are 3D vectors represented in Rb. b R Take care not to confuse the total angular velocity ω0b represented in b and the R 0 same velocity represented in 0, that we shall indicate with the symbol ω0b. b The use of various subscripts and superscript in Γ c is non a useless pedantry; on b the contrary it highlights the fundamental points of its definition: Γ c is the inertia matrix of the rigid body B with respect to its center of mass C, represented in the reference frame Rb, that in general can be placed everywhere one likes, but usually attached to the body. The inertia matrix changes changing the reference frame, as we will see later.

If now we attach Rb to the rigid body with its origin in C we have from (18) ∫ b → b r c = 0 r dm = 0 (20) B and the inertia matrix Γ b will be defined as: ∫ c ∫ [ ] b − b b b 2 − b b T Γ c = S(r )S(r )dm = r I r (r ) dm B B  Γxx Γxy Γxz (21)   = Γyx Γyy Γyz Γzx Γzy Γzz where we notice that r b(r b)T is a rank one dyadic product (see Appendix ??), and that S(x) is a skew-symmetric matrix (see Appendix ??). Observe the analogy of the second term in (21) with the second term in (13).

0.3.1 Rotation of the Reference Frame

If now we consider another reference frame Rk, rotated around the common origin R k (in this case C) with respect to b, and the rotation matrix given by Rb , then the 14

inertia matrix is computed according the following relation

k k b b k b k T Γ c = Rb Γ cRk = Rb Γ c(Rb ) (22)

or k k k b Γ c Rb = Rb Γ c. a b T using the usual notation Rb = (Ra) .

When the generic reference frame Rb is attached at the body B and moving with it, i.e., it is a body-frame, the inertia matrix relative to Rb is time invariant; in the other case it is time variant.

0.3.2 Principal Inertia Matrix

Often it is appropriate to refer to a “privileged” reference frame R∗, implicitly defined as that frame having its origin in the body center of mass and with respect to which the inertia matrix is diagonal, i.e.,   Γx 0 0 ∗   Γ c = 0 Γy 0 ; 0 0 Γz

This frame has the three unit vectors i ∗, j ∗ andk ∗, aligned along the so-called ∗ allineati principal inertia axes; the matrix Γ c is called prende il nome di prin- cipal inertia matrix.

0.3.3 Parallel Axes Theorem

Assume that we know the inertia matrix with respect to a reference frame with origin in the center of mass C, and we want to compute it with respect to another frame, with different origin O, but parallel axes. To do so we must express the relation between the infinitesimal mass ρ dV = dm with respect to the two points O e C is (vedi Fig. 6) It is straightforward to see that:

b b b ∀ r i = r c + ci , i = 1,...,N [ ] b T where r c = tx ty tz represents the translation of the reference frame from O to C. − b As we already know, the inverse translation, from C to O, is given by r c. This relation is valid for any vector represented in a of translated reference frames. 0.3. MATHEMATICAL FORMULATION 15

Figure 5: An example of parallel axes inertia computation.

b b The point mass element dmi that was in the position ci , is now in position r i . b It is now possible to compute the new inertia matrix Γ o, taking into account (21), as [ ] b b − b b b b 2 − b b T Γ o = Γ c mtotS(r c)S(r c) = Γ c + mtot r c I r c(r c) (23)

Simplifying the notation as follows     ′ ′ ′ Γxx Γxy Γxz Γxx Γxy Γxz b ≡   b ≡ ′  ′ ′ ′  Γ c Γ = Γyx Γyy Γyz e Γ o Γ = Γyx Γyy Γyz ′ ′ ′ Γzx Γzy Γzz Γzx Γzy Γzz

≡ b ≡ with t r c and with m mtot, we will obtain

′ − Γ = Γ mS[ (t)S(t) ] (24) = Γ + m ∥t∥2 I − tt T   2 2 − − (ty + tz) txty txtz  − 2 2 −  = Γ + m txty (tx + tz) tytz − − 2 2 txtz tytz (tx + ty)

that gives ( ) ′ 2 2 Γxx = Γxx + m ty + tz Γ ′ = Γ + m (t2 + t2) (25) yy yy ( x z ) ′ 2 2 Γzz = Γzz + m tx + ty . 16

Figure 6: Parallel axes theorem: relation between the infinitesimal mass position in the two cases.

The inertia products can be written as ′ − Γxy = Γxy m txty ′ − Γxz = Γxz m txtz (26) ′ − Γyz = Γyz m tytz

The two relations (22) and (23) allow to compute the inertia matrix with respect to any other point O of choice, knowing the inertia matrix with respect to the point C. The relation introduced above are valid both for discrete point-mass systems and for distribute mass systems.

0.4 Angular Momentum and Euler Equation

The expression of the angular momentum has been introduced in (19) without any additional explanation; here we justify it in a more formal way. We can assume that a rigid body B is composed by a continuum of point-mass particles with mass dm located at r k, with velocity v k = r˙ k and acceleration a k = k v˙ ; the superscript k identifies the generic reference frame Rk with respect to which the vectors are represented. Since B is a rigid body, there will be a number of constraint relations linking positions, velocities and , as detailed in Section ??. To simplify the mathematical treatment of the rigid body dynamics, we can reduce the action of the forces and acting on the body B to two equivalent effects: 0.4. ANGULAR MOMENTUM AND EULER EQUATION 17

• k an equivalent linear force f c , with its line of action across the body center of mass C, and with a module equal to the module of the vector sum of the applied forces;

• k an equivalent torque τ c , equal to the total moment of produced by the forces acting on B, relative to C.

The second Newton Law states that the resulting inertial force is equal to the time derivative of the linear momentum ( ) ( ) k d k d k k f c = mv c = m v c = ma c dt 0 dt 0

k where v c is the instantaneous velocity of C, m is the total mass of the body and k k a c = v˙ c is the total acceleration of the center of mass; the relation is valid for any choice of the reference frame Rk used to describe the vectors. The Euler equation states that the inertial torque is equal to the time derivative of the angular momentum ( ) k d k τ c = h c dt 0 where in both cases we have pointed out that the total derivative must be performed 7 with respect to an inertial (or pseudo-inertial) reference frame R0; It is not neces- sary that Rk is an inertial frame, but only that the derivative, seen as the limit of the difference quotient between vectors, is computed in the inertial frame (see also Section ??). k The vector h c is the angular momentum with respect to the mass center C and is defined, in analogy to what has been introduce in Section 0.1.2, as follows: ∫ k k × k h c = (c v )dm (27) B

where ck indicates the position of an element of infinitesimal mass dm with respect to the center of mass C of the body (see also Figure 7). Since the position of an element dm with respect to the origin O of the reference frame Rk can be decomposed into the sum

k k k r = c + r c

it results k k − k c = r r c k k where we have indicated with r c the position of the center of mass C and with r the position of dm with respect to O.

7We recall that an inertial reference frame must be fixed or in linear uniform motion, i.e., 18

Figure 7: The position r k of on infinitesimal mass element dm is decomposed into k k R the sum r c + c . The reference frame k is assumed to be inertial and all vectors are represented in it.

Corretto fin qua Therefore, the velocity v k = r˙ k of the generic elementary mass can be expressed in k relation to the velocity of the center of mass v c as follows k ≡ k k k k k × k v r˙ = c˙ + r˙ c = v c + ωkb c (28) The second term of the right hand side is obtained considering the relation (??), rewritten here for convenience comodit`a

0 0 × 0 0 1 ˙ 0 r˙ (t) = ω01(t) ρ (t) + R1r˙ (t) + d 1(t) (29)

˙ 0 ≡ k k ≡ 0 where r˙ 1(t) = d 1(t) = 0, ρ0(t) c and ωkb ω01(t) k B As usual, the angular velocity ωkb, is the total angular velocity of with respect to Rk and is represented in Rk itself. Replacing (28) in the (27), we obtain ∫ ∫ k k × k k × k × k h c = c dm v c + c (ωkb c )dm = B B ∫ k the term B c dm goes to zero since, in accordance with the definition of the mass center in (18), one can write: ∫ ∫ ∫ k k − k k − k c dm = (r r c )dm = r dm mr c = 0 B B B

one in which the accelerations acting on it are zero or negligible; in this last case the reference frame is pseudo-inertial. For example, a reference frame on your study table experiences only the accelerations due to the Earth rotation around its axis and around the Sun, to neglect other more complex of the Sun in the local galaxy, etc. In this textbook we call “inertial” any pseudo-inertial reference frame. 0.4. ANGULAR MOMENTUM AND EULER EQUATION 19 ∫ k k being r dm = mr c In conclusion, we have ∫ ∫ k k × k × k − k × k × k h c = c (ωkb c )dm = c (c ωkb)dm = B∫ B∫ − k k k − k k k = S(c )S(c )ωkbdm = S(c )S(c )dm ωkb = (30) B B = definition (21) = k k = Γ c ωkb

If we represent the vectors and the inertia matrix in a different reference frame Rℓ we write ℓ ℓ ℓ h c = Γ cωkb. with the relation between the inertia matrices

ℓ ℓ k k Γ c = RkΓ c Rℓ (31) and the angular velocities ℓ ℓ k ωkb = Rkωkb therefore we can observe that

ℓ ℓ ℓ ℓ k k ℓ k ℓ k k ℓ k h c = Γ cωkb = RkΓ c |R{zℓ R}k ωkb = RkΓ c ωkb = Rkh c I

To complete the Euler equation, we should define the time derivative of the angular momentum. Recalling the expression (??), we can write ( ) ( ) k d d ˙ k k k k k × k k h c = (Γ c ωkb) = (Γ c ωkb) + ωcb (Γ c ωcb) dt 0 dt k

k R Since Γ c is a constant in k, it follows that

˙ k k k k × k k h b = Γ b α0b + ω0b (Γ b ω0b) (32)

k ≡ k R where α0b ω˙ 0b is the total of the body b represented in k. In conclusion, the time derivative of the angular momentum, i.e., the inertial torques that appears in the Euler equation, can be simply written as:

h˙ = Γω˙ + ω × (Γω) (33) where the simplified symbols are to be correctly interpreted. 20

Alternative Formulation

Another way to obtain (33) is the following: we assume that the body b rotates with a total angular velocity ω0 with respect to an inertial reference frame R0, whose origin is now located at the center-of-mass of the body. The Euler equation, that describes the dynamics of a rotating body, states that the variation of the angular momentum h 0 is equal to the vector τ 0, that is the sum of all torques applied to the body: d h˙ ≡ (Γ ω ) = τ (34) 0 dt 0 0 0

Both Γ 0 and ω0 are time functions, so we have ˙ ˙ h 0 = Γ 0ω0 + Γ 0ω˙ 0 (35) ˙ In order to easily compute Γ 0 it is convenient to change the reference frame; if Rℓ is the local frame attached to the body, i.e., the body-frame, having its origin in the ≡ 0 R R center-of-mass, if R Rℓ is the rotation matrix representing ℓ in 0, and if Γ ℓ is the inertia tensor expressed in Rℓ, then we have seen from (22) that T Γ 0 = RΓ ℓR (36)

Calling ωℓ the total angular velocity of the body represented in the frame Rℓ, i.e., ≡ ℓ R 0 ≡ ωℓ ω0b, and calling ω0 the same velocity represented in 0, i.e., ω0b ω0, we can write ω0 = Rωℓ and consequently T h 0 = Γ 0ω0 = RΓ ℓR Rωℓ = RΓ ℓωℓ = Rh ℓ (37)

where we have introduced the new vector h ℓ = Γ ℓωℓ that is the angular momen- tum represented in Rℓ. We can see that the angular momentum is a vector that transforms from one reference frame to another with the same rule of other vectors.

Replacing h 0 in (37) and computing the derivative, we obtain: d h˙ = (RΓ ω ) = RΓ˙ ω + RΓ˙ ω + RΓ ω˙ (38) 0 dt ℓ ℓ ℓ ℓ ℓ ℓ ℓ ℓ

The inertia tensor Γ ℓ is time invariant, since it is relative to a body-frame and the ˙ body does not change its shape, therefore Γ ℓ = O, and (38) simplifies as follwos ˙ h 0 = S(ω0)RΓ ℓωℓ + RΓ ℓω˙ ℓ = ω0 × (RΓ ℓωℓ) + RΓ ℓω˙ ℓ (39)

This vector is represented in R0 but includes both ωℓ and ω0; if we want to represent T everything in Rℓ we should pre-multiply by R . Recalling the properties of the skew-symmetric matrices, we obtain ˙ T ˙ T T h ℓ = R h 0 = R S(ω0)RΓ ℓωℓ + R RΓ ℓω˙ ℓ T = S(R ω0)Γ ℓωℓ + Γ ℓω˙ ℓ (40) = S(ωℓ)Γ ℓωℓ + Γ ℓω˙ ℓ

= ωℓ × Γ ℓωℓ + Γ ℓω˙ ℓ 0.5. NEWTON-EULER EQUATIONS 21

˙ Poich´e h ℓ = τ ℓ, segue: τ ℓ = ωℓ × Γ ℓωℓ + Γ ℓω˙ ℓ (41) T where τ ℓ = R τ 0 is the sum of the applied torques, represented in Rℓ.

If we prefer to represent the torque in R0, we use (39), replacing Γ 0R instead of RΓ ℓ, obtained from (36); in this way we obtain

τ 0 = ω0 × Γ 0ω0 + Γ 0ω˙ 0 (42)

The equations (33), (41) and (42) are identical, provided that all vectors and tensor matrices are expressed in the same reference frame.

0.5 Newton-Euler Equations

The Newton-Euler equations are vector equilibrium equations that state that all forces and torques acting on the body B, including the inertial ones due to the motion, the external ones and those due to the constraint, are in (dynamical) equi- librium. There are two vector equations, the first, due to Newton, describes the equilibrium of the linear forces, while the second, due mainly to Euler, describes the equilibrium of the linear momenta. Assuming that the rigid body is connected with other rigid bodies, we must consider also the reaction forces and torques that the other bodies transmit to the considered body. For simplicity, from now on, all vectors will be represented in a common reference frame Rk, but omitting the subscript k. The motion of the rigid body B is decomposed into two distinct motions

1. A translation motion of the center-of-mass C, described by the Newton equilibrium vector equation − f aC + f vC + mg C ma C = 0 (43)

where a C = v˙ C = r¨C is the total acceleration, with respect to an inertial R reference frame 0, of the center-of-mass C, g C is the acceleration due to the gravitational field, applied to C, f aC is the resultant of all the external forces acting on the body applied in C, and f vC is the resultant of the constraint forces, with the application point brought in C. 2. A rotation motion around a generic point P , described by the Euler equi- librium vector equation f f − − × τ aP + τ vP + τ aP + τ vP + τ gP + τ iP Γ b/P α0 ω0 Γ b/P ω0 = 0 (44) 22

where τ aP is the resultant of the active applied external torques, τ vP is the f resultant of the constraint torques, τ aP is is the resultant of the torques due to f the applied external forces, τ vP is the resultant of torques due to the constraint forces, τ gP is the torque due to the gravitational field, and τ iP is the torque − ≡ 0 due to the inertial force ma P , ω0 is the total( ) angular velocity ω0 ω0b, and d 0 α0 is the total angular acceleration α0 = ω0b. dt 0 Equation (44) is simplified if the point P coincides with the center-of-mass C; indeed in this case we have τ gP = τ iP = 0 and (44)reduces to f f − − × τ aC + τ vC + τ aC + τ vC Γ bα0 ω0 Γ bω0 = 0 (45)

Notice that equations (43) and (45) are functions of a C , the linear acceleration of the center-of-mass, of the total angular acceleration α0 and of the total angular velocity ω0. If the acceleration due to the gravitational field is negligible, then g ≈ 0. The Newton-Euler equations can be also written in a more compact form, introduc- ing suitable matrices, as follows [ ][ ] [ ] [ ] mI 0 a 0 f C + = totC (46) 0 Γ b α0 S(ω0)Γ b τ totC where f f f totC = f aC + f vC + mg C τ totC = τ aC + τ vC + τ aC + τ vC

Recalling that a C = v˙ C + ω0 × v C , where v C is the total linear velocity of the center-of-mass, a second form of the equation is possible [ ][ ] [ ][ ] [ ] mI 0 v˙ mS(ω ) 0 v f C + 0 C = totC (47) 0 Γ b α0 0 S(ω0)Γ b ω0 τ totC

If instead of the center-of-mass C we want to express the equation with respect to another point P , the resulting equation become [ ][ ] [ ] [ ] mI mS(r )T a mS(ω )S(ω )r f pc p + 0 0 pc = totP (48) mS(r pc) Γ bω0 α0 S(ω0)Γ b/pω0 τ totP

where r pc is the oriented segment from P to C, and a p = r¨p is the total acceleration of P . In conclusion, we want again point out that the difficulties arising with the use of these equations is due to the necessity to include the constraint forces and torques; these do not contribute to characterize the body motion, but have the only function to replace the geometrical constraints with vector quantities to be included in the equations However, if one is interested in numerical computation of the body dynamics the Newton-Euler equations, suitably organized in a recursive form, are an efficient way to do so, as we will see in Section 0.8. 0.6. PRINCIPLE 23 0.6 Virtual Work Principle

Virtual displacements, as seen in Section ??, give the degrees-of-freedom of a rigid body and are used to define the virtual work. Given a system composed by N point masses, each located in a position defined by the vector r i, and N forces (possibly having zero magnitude) acting on them from the external world, the virtual work δW is defined as in relation (??), reported here for completeness ∑N W · δ = f i δr i i=1 If the system is a continuous rigid body, on which both forces and torques act, we can write a more complete expression, as in (??)

∑Nf ∑Nτ W · · δ = f i δr i + τ i δαi = 0 (49) i=1 i=1

where τ i are the applied torques and δαi the respective angular virtual displace- ments. The virtual work principle can be applied also to dynamic equilibrium; indeed, if we introduce the inertia forces −mia i, and if we define with the name of effective forces the sum of the applied and inertia forces − F i = f i mia i acting on each mass particle, the D’Alembert principle [?] states that the total virtual work of the effective forces is zero for all invertible variations that satisfy the kinematic conditions given by : ∑ ∑ · − · F iδ r i = (f i mia i) δr i = 0 (50) i i

0.7 Lagrange Equations in Mechanical Systems

We have already seen in Section 0.5 how the Newton-Euler approach determines the dynamical equations of the system. We will see now how the Lagrange approach can produce an equivalent set of equations, starting from a very different viewpoint. The Lagrange approach is based on the definition of two scalar quantities, namely the total kinetic co-energy 8 and the total potential energy associated with the body. In general the Lagrange method allows to define a set of Lagrange equations, that have some advantages with respect to the vector equations provided by the Newton-Euler approach. 8The reason of using the term co-energy instead of the term energy, will be clarified later. 24

• The approach provides n second order scalar differential equations, directly ex- press in the generalized coordinatesq ˙i(t) e qi(t), that provide an easier starting point for writing the state variable equations than the Newton-Euler equations.

• If holonomic constraint are present, in the equations the constraint force do not appear: This is very convenient when the equations are used for control design or simulation problems, but may be annoying when we want to explicitly compute constraint forces. We will discuss this topic in Section 0.7.5.

• The kinetic co- and the potential energies are independent of the ref- erence frame used to represent the body motion.

• The kinetic co-energies and the potential energies are additive scalars: in a multi-body system the total energies/co-energies is the sum of each component energy/co-energy.

We will now formally define these two quantities.

0.7.1 Kinetic Energy and Co-energy

First we will define these energies for a point mass and then for a rigid extended body.

Point-mass

The kinetic energy associated to a point-mass m is defined as the work necessary to increase the linear or angular momentum from 0 to h, i.e., ∫ h C(h) = dW (51) 0 The infinitesimal work associated to the mass is given by

dW = f · dr where f is the resultant of the applied forces on the mass and dr is the infinitesimal position increment. The infinitesimal increment dr differs from the virtual displace- ment δr since the former is consistent with the laws of dynamics, i.e., dr = vdt, while the latter if free or restricted only by the geometry of the constraints. In order to have as integrand in (51) only a quantity that depends on the integration limits, we recall that dh f = dt 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 25

that relates the force to the variation of the linear momentum; the resulting in- finitesimal work is therefore dh dh dW = f · dr = · dr = · vdt = v · dh dt dt

and so we can write ∫ h C(h) = v · dh (52) 0 The kinetic energy is a scalar state function associated to the particle, that de- pends only of the state variables v and h associated to the point mass. It is possible to define another state function associated to the point-mass, that we will call kinetic co-energy, defined as ∫ v C∗(v) = h · dv (53) 0

As shown in Figure 8, between the energy and the co-energy, a relation exists, namely C∗(v) = h · v − C(h) (54) This relation is an example of the Legendre transform. In Section ?? we will present a detailed discussion of this topic.

Figure 8: The relation existing between the linear momentum h and the linear velocity v; in this particular case the two quantities are scalars and the relation assumes a constant mass.

In particular, if the mass particle is moving at a velocity significantly smaller that the light c, i.e., it is not a relativistic mass, we can write h = mv and the two 26

“energies” become ∫ h 1 1 1 C(h) = h · dh = h · h = ∥h∥2 0 m 2m 2m ∫ (55) v 1 1 C∗(v) = mv · dv = mv · v = m ∥v∥2 0 2 2 As one can see, in this case the kinetic energy and co-energy are the same; this does not happens for relativistic particles. We conclude this Section pointing out that in many textbooks the kinetic energy is indicated by the symbol T , but we prefer to use this not-so-common symbol C or C∗, and since these are functions of the generalized coordinates and velocities, often we write C(q, q˙ ) or C∗(q, q˙ )

Multiple Point-masses Bodies

Now we take into consideration an extended body composed by N masses mi. The kinetic co-energy will be the sum of the kinetic co-energy of each mass,

1 ∑N C∗(v) = m v · v (56) 2 i i i i=1

In Figure 9 we have an inertial reference frame R0, with origin in a fixed point O and a body-frame Rb; if we consider the velocity v i = r˙ i with respect to R0, we consider first the linear velocity and then the angular velocity.

The velocities in R0 can be computed from the general relation (??), rewritten here for convenience 0 0 × 0 0 1 ˙ 0 r˙ (t) = ω01(t) ρ (t) + R1r˙ (t) + d 1(t) 0 where the second term Rb r˙ i(t) at the right hand side is zero, since the point-masses are fixed with respect to the body-frame. Now we consider a a purely translatory motion and then a purely rotational motion.

Translational Motion

If the motion is purely translational, (??) gives 0 ˙ 0 ≡ r˙ i (t) = d b (t) v 0(t) where v 0 is the total linear velocity with respect to R0; therefore each mass mi will have the same velocity v 0 and the relation (56) will reduce to

1 ∑N 1 1 1 C∗ = v · v m = m v · v = m ∥v ∥2 = v T(m I )v (57) 2 0 0 i 2 tot 0 0 2 tot 0 2 0 tot 0 i=1 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 27

Figure 9: A rigid system composed by N point masses, and the various position vectors. C is the body center-of-mass.

where the mass mtot is the total body mass. So this equation states that the kinetic (co)energy of a purely translational motion is equivalent to that of one single particle with mass mtot having the total translational velocity v 0.

We recall that the total mass mtot can be ideally concentrated in the body center- of-mass C del corpo, that obeys to the relation ∑ ∑ m r m = r m → r = i r c tot i i c m i i i tot

Since the velocity is equal for all points of the body, v 0 is also the velocity of the center-of-mass C; if we use the symbol v 0c ≡ v 0 for this velocity, we can write 1 1 1 C∗ = m v · v = m ∥v ∥2 = v T (m I )v 2 tot 0c 0c 2 tot 0c 2 0c tot 0c that gives the usual rule: “the kinetic energy is half the product of the total mass for total velocity squared”.

Rotational Motion

If the motion is purely rotational, (??) reduces to 0 0 × b r˙ i (t) = ω01(t) r i 0 ≡ where ω01 ω0 is the total angular velocity; therefore, using a simpler notation, the velocity of each mass follows the relation

v i = ω0 × r i 28

where r i is the position of the i-th mass in R0. Replacing this expression in (56) we obtain 1 ∑N C∗ = m (ω × r ) · (ω × r ) (58) 2 i 0 i 0 i i=1 Recalling that, given three generic vectors a, b, c, we can write

a · (b × c) = b · (c × a) and calling

a ≡ (ω0 × r i), b ≡ ω0, c ≡ r i we obtain ( ) 1 ∑N 1 ∑N C∗ = m ω · r × (ω × r ) = ω · m r × (ω × r ) 2 i 0 i 0 i 2 0 i i 0 i i=1 i=1

Now, recalling (4), we obtain ( ) 1 ∑N 1 C∗ = ω · h = ω · h 2 0 i 2 0 0 i=1 where h 0 is the total angular momentum with respect to O.

Since h 0 = Γ 0ω0, we can conclude writing this expression 1 C∗ = ωTΓ ω (59) 2 0 0 0 So we interpret this equation stating that the kinetic (co)energy of purely rotating body is dependent on the total angular velocity and the inertia matrix with respect to the point O. Notice the similarity between (57) and (59):

1 1 C∗ = v T (m I )v C∗ = ωTΓ ω 2 0c tot 0c 2 0 0 0 In both cases the energy is proportional to the “weighted” scalar product of the velocities, where the weighing matrix is the fixed mass diagonal matrix, or the variable inertia symmetric matrix.

Alternative Formulation

An alternative formulation is obtained considering the center-of-mass C, whose po- sition in R0 is given by r c, and representing the position of each point-mass as r i = r c + ci, where ci is the oriented segment from C to the i-th mass, as in Figure 9. 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 29

We compute the velocity v i = ω0 × r i as

v i = ω0 × (r c + ci) = ω0 × r c + ω0 × ci = v c + ω0 × ci and, from (56), we have

1 ∑ 1 ∑ C∗ = m v · v = m (v + ω × c ) · (v + ω × c ) 2 i i i 2 i c 0 i c 0 i i { i } 1 ∑ ∑ = m v · v + m (ω × c ) · (ω × c ) + ... (60) 2 i c c i 0 i 0 i i i

In this case v c is the (tangential) velocity of the center-of-mass due to the angular motion; considering (58), where now in place of r i we have ci, we can rewrite the above equation as 1 { } C∗ = v T(m I )v + ωTΓ ω (61) 2 c tot c 0 c 0 where Γ c is the inertia matrix with respect to the body center-of-mass.

Natural Systems

In general, one can extend the arguments used above to the case in which each mass has a position that depends, in addition to the coordinates qi, also explicitly from the time t; therefore a system consisting of N point-mass particles defined by a position r i(q(t), t) and by the velocity ∑n ∂r i ∂r i v i(q(t), t) ≡ r˙ i(q(t), t) = q˙k + , ∂qk ∂t k=1 have a kinetic (co)energy that is defined as [ ] ∑N ∑N ∑n ∑n ∑n ∗ 1 1 ∂r i ∂r i ∂r i ∂r i ∂r i ∂r i C = mir˙ i · r˙ i = · q˙jq˙k + 2 · q˙j + · 2 2 ∂qj ∂qk ∂t ∂qj ∂t ∂t i=1 i=1 j=i k=1 j=i (62) If we introduce the following coefficients

∑N ∂r ∂r α = m i · i jk i ∂q ∂q i=1 j k ∑N ∂r ∂r β = m i · i j i ∂t ∂q i=1 j 1 ∑N ∂r ∂r γ = m i · i 2 i ∂t ∂t i=1 30 we can write (62) as C∗ C∗ C∗ C∗ = 2 + 1 + 0 (63) where 1 ∑n ∑n C∗ = α q˙ q˙ 2 2 jk j k j=1 k=1 ∑n C∗ 1 = βjq˙j j=1 C∗ 0 = γ Therefore, in general, the kinetic (co)energy is the sum of three terms: a quadratic, a linear and a constant one. If there is no direct time dependence the linear and the constant terms disappear, and the energy is a purely quadratic function. A system where

• the vectors r i are not explicitly depending on time, but depend on time only through the generalized coordinates q(t),

• the field of external forces is conservative,

• no constraints are present, has a kinetic (co)energy that is quadratic, as

1 ∑n ∑n C = C = α q˙ q˙ 2 2 jk j k j=1 k=1

These systems are a called natural systems; the others are called non natural systems. C∗ In a non natural system we observe that the term 0 behaves as a sort of potential energy and is naturally connected to the centrifugal forces9, that are proportional ∂r ∂r to the square of the angular velocity i · i , while the term C produces the so ∂t ∂t 1 called Coriolis forces, that are proportional to the product of two velocities

Extended Rigid Body

In analogy with the derivation used to compute the kinetic (co)energy of a multiple point-masses body, it is possible to compute the kinetic (co)energy of an extended

9Consider, as an example, a satellite orbiting the Earth, where the gravitational (conservative) field forces are kept in equilibrium by the due to the angular velocity of the satellite around the Earth. 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 31

rigid body, as that represented in Figure 10. The relation is ∫ ∫ 1 1 C∗(v) = v · v dm = ρ(r) v · v dV 2 B 2 B

where v is the total velocity of every element with mass dm; the integral is com- puted considering the entire body volume V ; ρ(r) is the local density, function of the position r of the elements; the density is assumed to be uniform in time, but generally not in position.

Figure 10: da definire

Again we have an inertial reference frame R0, with origin in a fixed point O and a body-frame Rb; with arguments that are similar to those used to derive relation (61), we have now

1 1 1 [ ] C∗(v, ω) = mv · v + ωTΓ ω = v T(mI )v + ωTΓ ω (64) 2 c c 2 0 c 0 2 c c 0 c 0 ∫ ∫ where m = B dm = B ρ(r)dV is the total body mass, Γ c is the inertia moment with respect to the center-of-mass C, v c is the total velocity of the center of mass and ω0 is the total angular velocity of the body. From (64) we can state the well known law for computing the kinetic (co)energy of a rigid body The kinetic (co)energy of an extended rigid body is the sum of two terms: a transla- tional part, equal to the kinetic energy equivalent to the entire mass concentrated in the body center-of-mass, and an rotational part, equal to the kinetic energy due to the rotational inertia of the body with respect to its center-of-mass.

The reference system with respect to which the inertia matrix Γ c is computed must be considered as a body-frame, with its origin in C; in this way the inertia matrix 32

is constant in time. However this frame may be rotate with respect to the frame where ω0 is represented; in this case, as given by (31) and (36), the Γ c value must be expressed in the common frame.

Example 0.7.1

Let us consider a prismatic rigid body B (as a rod); we want to compute the kinetic energy. As shown in Figure 11 we have two possible reference frames, Ra e Rb.

Figure 11: Computation of the inertia matrix for a rigid body and two reference frames. [ ] The first one is inertial and the total angular velocity of the body is ωa = 0 0 θ˙ ; the second is a body-frame with origin in the center-of-mass C. At a given time t the two systems are related by the following rotation matrix   1 0 0 a ◦  −  Rb = Rot(i, 90 ) = 0 0 1 0 1 0 The axes of R are aligned with the principal inertia axes, and the inertia matrix is b   Γx 0 0 b   Γ = 0 Γy 0 0 0 Γz Since the kinetic (co)energy is independent of the reference frame, provided that we use the total angular velocity, we can compute it in two different ways.

a 1. We can represent Γ in Ra and use the total angular velocity ω represented in that frame 1 C∗ = (ωa)TΓ aωa 2 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 33

b 2. We can represent Γ in Rb and use the total angular velocity ω represented in that frame 1 C∗ = (ωb)TΓ bωb 2

In the first case we have         1 0 0 Γx 0 0 1 0 0 Γx 0 0 a a b b  −        Γ = Rb Γ Ra = 0 0 1 0 Γy 0 0 0 1 = 0 Γz 0 0 1 0 0 0 Γz 0 −1 0 0 0 Γy and consequently     Γ 0 0 0 1 1 [ ] x 1 C∗ = (ωa)TΓ aωa = 0 0 θ˙  0 Γ 0  0 = Γ θ˙2 2 2 z 2 y 0 0 Γy θ˙

In the second case we have       1 0 0 0 0 b b a      ˙ ω = Raω = 0 0 1 0 = θ 0 −1 0 θ˙ 0 and consequently     Γ 0 0 0 1 1 [ ] x 1 C∗ = (ωb)TΓ bωb = 0 θ˙ 0  0 Γ 0  θ˙ = Γ θ˙2 2 2 y 2 y 0 0 Γz 0

In both cases, as expected, the kinetic (co)energy is the same. 

Generalized Coordinates

If we want to write the kinetic (co)energy as a function of the generalized velocities q˙i(t), we shall recall the direct kinematic velocity function, that requires to know the linear Jacobian and the geometrical angular Jacobian:

v c = J ℓ(q)q˙ or ω = J ω(q)q˙ (65)

Here we will use the geometrical Jacobian, since we are interested in ω0 and not in ∗ α˙ 0 to express C (v, ω) in (64) as a function of q and q˙ . Using the linear (??) and the angular geometrical jacobians we obtain 1 [ ] C∗(q˙ , q) = q˙ TJ T(mI )J q˙ + q˙ TJ TΓ J q˙ (66) 2 ℓ ℓ ω c ω 34

and finally 1 [ ] 1 C∗(q˙ , q) = q˙ T J T(mI )J + J TΓ J q˙ = q˙ TΓ q˙ (67) 2 ℓ ℓ ω c ω 2 tot This relation shows that the kinetic (co)energy is a quadratic function of the overall inertial mass of the body; since the kinetic energy of a body with a non-zero mass is always positive, the matrix Γ tot is always positive definite and hence invertible.

0.7.2 Potential Energy

Gravitational Energy

A force f is said to be conservative or potential when it the negative gradient of P a potential function[ (r);] the potential function is a scalar function and depends on the position r = x y z T, defined as: [ ] ∂P(r) ∂P(r) ∂P(r) T f (r) = −∇P(r) = − (68) ∂x ∂y ∂z The symbol ∇ indicates the gradient operator that transforms a scalar function into a vector10. If a potential function exists, it is conventionally called potential energy of the system; it must be observed that, if it exists, it is unique apart from an additive constant. This implies, as we will see later, that the effects on the body dynamics depend only from the potential energy variation, and not on its absolute value. The dynamical systems in which all the forces doing work are due to a potential function, are called conservative systems. In a field the potential energy P is obtained integrating the con- servative forces, i.e., ∫ ∫ r r P(r) = − f (r) · dr = ∇P(r) · dr (69) r 0 r 0

where r 0 represents a generic initial position of the mass, and the minus sign estab- lish that the potential energy decreases if the force field perform the work on the body. A typical example of conservative force filed is the gravitational field around Earth, or in general any mass. The potential field produces the so-called weight forces. The potential energy due to a gravitational field and associated to a generic mass m is given by the following relation:

Pg = −mg · r c0 (70)

10Often the gradient is interpreted as a row vector, but we prefer to follow the usual column representation rule, so we introduce the transpose symbol T. 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 35

where g is the local gravitational acceleration vector and r c0 is the body center-of- mass position vector with respect to an orthogonal plane to g that has the conven- tional zero value of potential energy (zero energy plane); it is the variation of energy with respect to this plane that is considered.

Elastic Energy

Moreover there is another force field related to potential energy; it is that due to elastic elements, as the ideal springs: these elements are the abstract model of a proportional relation between elongation and force, so that force is proportional to the of the ideal spring element. If we assume a one-dimensional linear spring we can write

f = kee (71) while if we assume a one-dimensional torsional or torsion spring we write ′ τ = keδ (72) where e and δ are, respectively, the linear elongation, and the angular defor- ′ mation from the rest position of the spring; ke and ke are the so-called elastic constants of the springs. The elongation and the deformation physically represent a difference in position or angle between a rest state of the elastic element and the deformed state of the same element. In one dimensional linear springs the force and the deformation are co-linear, while in one dimensional torsion spring the torque and the rotation axis are co-linear as well. Figure 13 depicts a one dimensional linear spring, where the force and the deforma- tion are co-linear. It is also possible to find elastic elements where the elastic constant depends on the deformation itself, as in ′ f = ke(e)e τ = ke(δ)δ (73)

Figure 12: The scheme of a one dimensional linear spring.

The potential energy is the integral of the virtual work performed by the spring ∫ deformation e P(e) = f · de (74) 0 36

Figure 13: The scheme of a one dimensional torsion spring. or ∫ δ P(δ) = τ · dδ (75) 0 We can also in this case define the potential co-energies, that are ∫ f P∗(f ) = e · df 0 or ∫ τ P∗(τ ) = δ · dτ 0 The relation between P∗(f ) and P(e) is similar to the co-energy Legendre transfor- mation given in (54) P∗(f ) = f · e − P(e) (76) as illustrated in Figure 14

Figure 14: da definire

When the elastic elements are linear with constant ke, the potential energy and co-energy are as follows

1 1 P(e) = eT(k I )e = k ∥e∥2 (77) 2 e 2 e 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 37

and ∗ 1 T −1 1 2 P (f ) = f (keI ) f = ∥f ∥ (78) 2 2ke If ′ When torsion springs are considered with constant ke, the potential energy and co-energy are as 1 1 P(δ) = δT(k′ I )δ = k ∥δ∥2 (79) 2 e 2 e and 1 1 P∗ T ′ −1 ∥ ∥2 (τ ) = τ (keI ) τ = ′ τ (80) 2 2ke When the linear relations (71) and (72) are valid, the energies and co-energies are equal P(e) = P∗(f ) and P(δ) = P∗(τ )

If the elastic constants are different along the three directions, as, for example, in the case of the rubber-band ball of Figure 15, we have the following, more general, relations: 1 1 P(e) = eTK e; P∗(f ) = f TK −1f 2 e 2 e and 1 1 P(δ) = δTK ′ δ; P∗(τ ) = τ T(K ′ )−1τ 2 e 2 e ′ ′ ′ ′ where K e = diag(ke1, ke2, ke3) e K e = diag(ke1, ke2, ke3) are the elastic constant matrices along the three dimensional components.

Figure 15: A rubber-band sphere, an example of a three dimensional elastic element.

We observe that, in general, the potential energy is function of the position coordi- nates alone, so we will write P(q)11. Nevertheless, there are some cases where the potential energy is also dependent on the velocity coordinates q˙ ; in this case it will be designated as generalized potential energy: the most notable example is that involving the motion of a charged particle in an electromagnetic field, where we can write ( ) 1 P(q, q˙ ) = e ϕ(r) − v(r, r˙ ) · A c where e is the electric charge of the particle, ϕ is the scalar electric potential, A is the vector potential of the electromagnetic field, v is the particle speed and c is the light velocity. 11Many textbooks write the symbol V (q) for potential energy, but we prefer to use the symbol P. 38

0.7.3 in Holonomic Systems

Let us assume that we have a system composed by N point-masses, subject only to

holonomic, ideal, frictionless constraints. The forces f i acting on the i-th mass can be classified according to three groups:

• ′′′ c N forces f i due to constraint reactions.

• ′′ c N forces f i due to a conservative field.

• ′ nc N non conservative forces f i .

i.e., ∑N ′ ∑N ′′ ∑N ′′′ nc c c f i = f i + f i + f i i=1 i=1 i=1

Constraint Forces

The allowed virtual displacements δr i are always tangent to the constraints, while v the constraint forces f i are always orthogonal to te constraints, as illustrated in Figure 16; from this assumption it follows that

c · c · f i dr i = 0 and f i δr i = 0

Therefore the work done by the constraint forces is zero (the forces “do not work”)

∑N ′′′ Wv c · δ = f i δr i = 0. i=1

Figure 16: Vincoli geometrici, spostamenti virtuali e forze vincolari. 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 39

Conservative Forces

The N ′′ conservative forces do a work that, considering (68), results to be

∑N ′′ ∑N ′′ Wc c · − ∇P · δ = f i δr i = i δr i = i=1 i=1 ′′ [ ] [ ′′ ] ∑N ∑n ∂r ∑n ∑N ∂r − ∇P · i δq = −∇P · i δq (81) i ∂q j i ∂q j i=1 j=1 j j=1 | i=1 {z j } F c j

F c This last expression highlights the so called generalized conservative forces j and allows to transform the virtual work from a function of the positions r to a function of the generalized coordinates qj:

∑N ′′ ∑n Wc c · F c F c · δ = f i δr i = j δqj = δq (82) i=1 j=1

Non Conservative Forces

′ nc The N non conservative forces f i do a work equal to

′ ′ [ ] [ ′ ] ∑N ∑N ∑n ∂r ∑n ∑N ∂r δWnc = f nc · δr = f nc · i δq = f nc · i δq (83) i i i ∂q j i ∂q j i=1 i=1 j=1 j j=1 | i=1 {z j } F nc j

F nc This last expression highlights the so called generalized non conservative forces j and allows to transform the virtual work from a function of the positions r to a function of the generalized coordinates qj:

∑N ′′ ∑n Wnc nc · F nc F nc · δ = f i δr i = j δqj = δq (84) i=1 j=1

In conclusion, only two types of forces will do work in a system subject to homoge- neous constraint

• the j-th generalized conservative force:

′′ ∑N ∂r F c(q) = − ∇P · i j i ∂q i=1 j 40

• the j-th generalized non conservative force:

′ ∑N ∂r F nc(q) = f nc · i j i ∂q i=1 j

The generalized force, being the result of a scalar product, will be itself a scalar quantity. In case of torques acting on the system, the generalized forces due to them will give origin to the following generalized torques

′′ ′ ∑N ∂α ∑N ∂α T c = −∇P · i ; T nc = τ nc · i (85) j i ∂q j i ∂q i=1 j i=1 j In the following, the symbol used to identify both the generalized forces and the generalized torques will be identical, namely F.

0.7.4 Lagrange Equations with Holonomic Constraints

In a multi-body system subject to holonomic constraints, the formulation of the Lagrange equations may take different forms, from the most general one to that describing particular cases; we will see them all briefly in the following Sections We start with the knowledge of the total co-energy of the system, that is the sum of the co-energies of the N composing parts, as a function of the generalized coordinates and velocities ∑N C∗ C∗ (q, q˙ ) = k(q, q˙ ) k=1 The Lagrange equations are a set of n equations (one for each generalized coordinates qi) defined as ( ) d ∂C∗ ∂C∗ − = Fi i = 1, . . . , n (86) dt ∂q˙i ∂qi F F c F nc where i = i + i is the i-th generalized force, with a positive sign if applied by the environment to the body, with a negative sign if applied by the body to the environment. Indeed we have seen in the previous Sections that the generalized forces are determined by the virtual work principle: the work can be done by the external environment on the body, or from the body on the external environment; in the two cases the sign will be opposite. It is a convention that the positive sign is that of the work done on the body. Considering relation (81), we can write equations (86) in a slightly different way, F F c F nc F c decomposing i into the two terms i and i , and bringing portiamo i on the left hand side ( ) d ∂C∗ ∂C∗ − − F c F nc i = i dt ∂q˙i ∂qi 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 41

Since (81) is valid, we can write [ ] ( ) ′ d ∂C∗ ∂C∗ ∑N ∂r − ∇P · k F nc + k = i dt ∂q˙i ∂qi ∂qi k=1 we notice that the term inside the square bracket is equal to the partial derivative ∂P ; therefore we can write ∂qi ( ) ( ) d ∂C∗ ∂C∗ ∂P − − F nc = i dt ∂q˙i ∂qi ∂qi

Again we notice that ∂P = 0 ∂q˙i so we can write ( ) ( ) d ∂C∗ ∂P ∂C∗ ∂P − − − F nc = i i = 1, . . . , n (87) dt ∂q˙i ∂q˙i ∂qi ∂qi

The Lagrange state function (or simply the Lagrange function) is defined as the difference between the kinetic co-energy C∗ of the system and its potential energy P: L(q, q˙ ) = C∗(q, q˙ ) − P(q) (88) Considering (89), we can therefore write n differential equations ( ) d ∂L(q, q˙ ) ∂L(q, q˙ ) − F nc = i (q) i = 1, . . . , n (89) dt ∂q˙i ∂qi each one relative to the i-th generalized coordinate. ∂L The term is called generalized momentum and is usually indicated by the ∂q˙i symbol µi; the vector of generalized momenta is therefore indicated by µ(q(t)).

Dissipative and Forces

fric If we prefer to keep the friction or other dissipative forces fi separate from the other non conservative forces, considering that the friction represents an energy dissipated by the body in the form of heat, and therefore appears with the minus sign, the Lagrange equation becomes: ( ) d ∂L ∂L − F − fric = i fi (90) dt ∂q˙i ∂qi 42

In general the friction forces are due to complex physical phenomena involving the interaction between solid/solid or solid/fluid surfaces; tribology is the science that studies in details the friction forces. fric To keep the discussion simple, we can schematically describe the friction force fi as a nonlinear function of the v between the two contact surfaces of the involved bodies. This nonlinear function is approximately due to three distinct phenomena that takes place at different velocity regimes: when the velocity is zero or very low, the friction is highly nonlinear and is called stiction or Stribeck friction or Stribeck effect, from the name of the German engineer that studied it at the beginning of the XX century. When the velocity increases, the friction is essentially proportional to the velocity; it is the so-called viscous regime. Moreover there is also a constant component that is independent of the velocity, called Coulomb friction from the name of the French scientist that studied friction phenomena at the end of XVIII century. At nonzero velocities friction introduces a effect on the system motion. In conclusion, we can model the total friction force as in Figure 17, and write

fric fric fric fric ftotal = fstiction + fcoulomb + fviscous (91)

Figure 17: The three components of the non-conservative friction forces

While stiction and Coulomb friction must be explicitly introduced as non-conservative forces, it is a common assumption, as suggested by the English physicist Rayleigh, 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 43

to express the viscous dissipative phenomenon as the derivative of a dissipation function, also called Rayleigh function, given by: 1 1 D (q˙ ) = q˙ T(β I )q˙ = β ∥q˙ ∥2 (92) i 2 i 2 i

where the coefficient βi is the viscous friction coefficient, and ∥q˙ ∥ is the norm of the relative velocity between the moving body and the surface responsible of the viscous friction effect. Care should be taken not to call this quadratic expression dissipation “energy” since it is only a conventional way to introduce it in the Lagrange, reformulating (90) as follows ( ) d ∂L ∂L ∂Di − + = Fi (93) dt ∂q˙i ∂qi ∂q˙i

Now the term Fi includes only the non conservative forces, with the exclusion of the forces modelled by the dissipation function, that now are given by

∂Di = βi ∥q˙ ∥ ∂q˙i

In particular the forces Fi include the motion forces/torques applied by the actuators and the interaction forces exchanged with the environment. The n equations (93) can be written in matrix form, with a slight abuse of notation, as ( ) d ∂L ∂L ∂D − + = F (94) dt ∂q˙ ∂q ∂q˙

To conclude this paragraph, we point out that in the scientific literature the holo- nomic systems in which the forces are solely due to generalized potential functions P(q, q˙ ), are called Lagrangian or Lagrangean systems; when the kinetic co- energy and the potential energy explicitly depend on time, i.e., C∗ = C∗(q, q˙ , t) and P = P(q, q˙ , t), the systems are called Hamiltonian systems.

0.7.5 Lagrange Equations with Non Holonomic Constraints

The Lagrangian approach has the advantage to produce the dynamical equations as function only of the generalized coordinates. In this way only the minimum number of differential equations, namely n equations, is generated, and this is due to the fact that the constraint forces do not generate work in correspondence to the virtual displacements compatible with the geometrical constraints. The constraint forces never appear in the equations: the holonomic systems are described by a set of independent generalized coordinates, with no constraints. Conversely, systems where non holonomic constraints are present, cannot be com- pletely described by the independent generalized coordinates alone. The equations 44 must be augmented including also the constraint characterization; as a result we observe the appearance of the constraint forces. If the problem requires it, we can make appear the constraint forces also in holonomic systems; to do this, we consider that:

1. the geometric constraints are representable as hyper-surfaces in the χj config- uration space; 2. the geometric constraints are enforced by suitable forces/torques called, as already known, constraint forces; 3. at every instant the constraint forces are orthogonal to the hyper-surfaces described by the constraints.

The holonomic constraints are “translated” into generalized constraint forces, that are added to the non-constraint forces already included into the equations. Un- fortunately these constraint forces cannot be a-priori computed, since they depend on the actual motion and, in order to obtain them, we must in advance solve the differential equations. However we can use a simple method to obtain them, that consists in introducing new artificial coordinates, that represent the constraint violation: they are zero when the constraints are satisfied, otherwise they are positive or negative, according to a suitable sign convention related to how the constraints are violated. These coordinates are called superfluous coordinates and the generalized forces associated with them are exactly the constraint forces. If the set of the generalized coordinates together with the superfluous coordinates is independent, then the resulting dynamical equations will contain the constraint forces; these will appear only in the equations related to the superfluous coordinates. The constraint forces can be computed solving the motion equations and setting to a constant value the superfluous coordinates. Conversely, when non-holonomic constraints are involved, the solution require to introduce the so called Lagrange multipliers.

Lagrange Multipliers

Let us assume a system, defined by n generalized coordinates qi, constrained by m non-holonomic constraints, where the k-th constraint is written in pfaffian form as

a1kdq1 + a2kdq2 + ··· + ankdqn + a0k, k = 1, . . . , m The constraint equation expressed in virtual displacements, recalling that δt = 0, becomes a1kδq1 + a2kδq2 + ··· + ankδqn = 0 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 45

written in vector form as a k · δq = 0 (95) [ ] T where a k = a1k a2k ··· ank . This relation states that the virtual displace- ments are orthogonal to the vector a k, that is therefore aligned with the constraint forces, also orthogonal to the constraints, as in point 3) above. Therefore the con- c straint forces f k and the vector a k are proportional, as in c f k = λk(t)a k and we call the proportionality coefficient the k-th Lagrange multiplier. Since ∑N ∑N ∑N ∑N ∑m F F nc F c F nc δW = iδqi = ( i + ) δqi = i δqi + λiδqi i=1 i=1 i=1 i=1 k=1

the total generalized force relative to the coordinate qi will be now obtained as the sum of the external generalized and constraint forces: ∑m F nc i + λiaik k=1

The i-th Lagrange equation will then become ( ) d ∂L ∂L ∑m − F nc = i + λiaik (96) dt ∂q˙i ∂qi k=1 Equation (95) together with (96), gives origin to n+m equations in n+m unknowns, among which there are the m Lagrange multipliers λk(t). When these equations are solved and the λk are obtained, one use

c f k = λka k to compute the constraint forces. The matrix form of the Lagrange equation becomes ( ) d ∂L ∂L − = F nc + Aλ (97) dt ∂q˙ ∂q or else, separating friction effects from other non-constraint forces, ( ) d ∂L ∂L ∂D − + = F + Aλ (98) dt ∂q˙ ∂q ∂q˙ where   λ [ ]  1  ··· ··· n×m . m×1 A = a 1 a k a m ∈ R ; λ =  .  ∈ R λm 46

This equation, together with the non-holonomic constraint equations

T A q˙ + a 0 = 0 (99) form a system of n + m equations in n + m unknowns (q, λ), that must be solved si- multaneously to get the n generalized coordinates q and the m Lagrange multipliers λ. After that, it will be possible to compute the m constraint forces as

F c = Aλ.

Notice thta this method can still be used to find, if necessary or advisable, the constraint forces associate to the mh holonomic constraints, expressed as

ϕk(q, t) = 0, k = 1, . . . , mh building the matrix A and the vector a 0 in (99) as follows:   ∂ϕ ∂ϕ   1 ... mh ∂ϕ1  ∂q ∂q     1 1   ∂t   . . .   .  A =  . . .  and a 0 =  .  ∂ϕ ∂ϕ  ∂ϕ 1 ... mh mh ∂qn ∂qn ∂t

Example 0.7.2

A small sphere with mass m is constrained to move without friction along an ideal wire that rotates with at a constant velocity θ˙ around the z axis of a given reference frame; the sphere does not rotate. The wire has a parabolic shape, given by the relation z = kx2 (see Figure 18).

Figure 18: Example of a mobile constraint. 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 47

12 Using the cartesian coordinates , we define two reference frames, one fixed R0 and one mobile with the wire R1, related by the rotation matrix   cθ −sθ 0 0   R1 = Rot(k, θ) = sθ cθ 0 0 0 1 The constraint are given by the relation   constraint 1: z(t) = kx2(t) in frame R    1 0   0   constraint 2: ω(t) = in both frames θ˙ = cost Both are holonomic and this implies we can write the virtual displacements as { δz − 2kxδx = 0 δθ = ωδt = 0

The two constraints imply two Lagrange multipliers, λ1 and λ2; the generalized forces associated to the constraints are:

1. a force f c that keeps the sphere on the wire,

c 2. a torque τ , aligned along the axis k 0, that keeps the constant rotation of the wire.

There are two degrees of freedom and two generalized coordinates: we can choose q = (x, θ) or q ′ = (z, θ)

c c Since we want to compute f and τ in R0, and we know that they are aligned as the columns of a k, as in (95), it is more convenient to write the constraint in matrix form as functions of the cartesian coordinates ξ = (x, y, z, α1, α2, θ) and not of the generalized coordinates q; with αi we have denoted two generic orientation angles that are not relevant to the problem, since the only orientation we are interested in is θ, i.e., that relative to the rotation around k 0. In forma matriciale abbiamo perci`o:   δx    δy  [ ] [ ]   T −   a 1 2kx 0 1 0 0 0 δz ATδξ = δξ = 0 ⇒   = 0 (100) T   a 0 0 0 0 0 1 δα1 2   δα2 δθ

12In this case the use of the cylindrical coordinates would have been more appropriate, but, in order to make the development straightforward, we have use the cartesian ones. 48

We write the Lagrange equations (97), functions of q, after having computed the different quantities necessary to build L:

• mass coordinates in R1:     x(t) x(t) p1(t) =  0  =  0  z(t) kx2(t)

• mass coordinates in R0:     x(t)cθ x(t)cθ 0 0 1     p (t) = R1p (t) = x(t)sθ = x(t)sθ  z(t) kx2(t)

• mass velocity in R0, expressed in the generalized coordinates q:     ˙ [ ] x˙(t)cθ − x(t)sθθ cθ −x(t)sθ 0     x˙(t) p˙ (t) = x˙(t)s + x(t)c θ˙ =  sθ x(t)cθ  = J (q(t))q˙ (t) θ θ θ˙ 2kx(t)x ˙(t) 2kx(t) 0

• kinetic co-energy of the mass

1 C∗(q, q˙ ) = m p˙ 0 2 2 1 = m q˙ T(t)J TJ q˙ (t) 2 [ ] (101) 1 1 + 4k2x2(t) 0 = m q˙ T(t) q˙ (t) 2 0 x2(t) [ ] 1 = m x˙ 2(t)(1 + 4k2x2(t)) + x2(t)θ˙2(t) 2

• Potential energy of the mass

P(q) = −mgz(t) = −mgkx2(t)

• Lagrange function ( ) 1 L = C∗ − P = m 4k2x2(t)x ˙ 2(t) + x2(t)θ˙2(t) + mgkx2(t) 2

• generalized forces: no generalized forces are applied, but only constraint forces, that will be computed once the Lagrange equations (97) are solved 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 49

• constraint forces: there are two constraints and two generalized constraint forces, see (100) [ ] c − T f 1 = λ1a 1 = λ1 2kx 0 1 0 0 0 [ ] c T f 2 = λ2a 2 = λ2 0 0 0 0 0 1

Equazione 1) relative to q1 = x(t): ( ) L L ∑ d ∂ − ∂ F 6 = 1 + k=1 λ1a1k dt (∂q˙1) ∂q1 d ∂L ∂L − = −2kxλ1 dt [ ∂x˙ ∂x ] [ ] d 1 1 m(2x ˙ + 8k2x2x˙) − m(8k2xx˙ 2 + 2xθ˙2) − 2mgkx = −2kxλ dt 2 2 1

hence 2 2 2 2 ˙2 mx¨(1 + 4k x ) + 4mk xx˙ − xθ = 2kx(mg − λ1) (102)

Equazione 2) relative to q2 = θ(t): ( ) L L ∑ d ∂ − ∂ F 6 = 2 + k=1 λ2a2k dt ∂(q˙2 ∂q)2 d 1 2 ˙ (103) 2mx θ = λ2 d(t 2 ) 2 ¨ ˙ m x θ + 2xx˙θ = λ2

since θ˙ = cost, it follows that θ¨ = 0, and hence

˙ 2mxx˙θ = λ2

Solving these two nonlinear differential equations we obtain also the values for λi; as a matter of fact λ2 can be directly obtained from the last equation. 

0.7.6 Characterization of the Resulting Equations

Having defined the set of generalized coordinates q(t) ∈ Rn and of the generalized velocities q˙ (t) ∈ Rn, assuming all holonomic constraints, we have seen that the Lagrange approach generates n differential equations ( ) d ∂L ∂L − = Fi i = 1, . . . , n dt ∂q˙i ∂qi 50 ( ) d ∂L The term will generate in the equations terms that are proportional to dt ∂q˙i the second time derivatives q¨(t), and similarly there will be terms proportional to the first time derivatives q˙ (t) and to the generalized coordinates q(t). In conclusion, collecting the n equations in one vector equation ( ) d ∂L ∂L ∂D − + = F (104) dt ∂q˙ ∂q ∂q˙ this can be linear or non linear: if the equations are linear or if we consider small perturbations around some equilibrium point, we will have a linear formulation that in the general case can be expressed as a second order differential vector equation

A1q¨(t) + A2q˙ (t) + A3q(t) = F (105) where F is the generalized force vector. n×n The three matrices Ai ∈ R can have different physical interpretations in relation to the treated problem; some problems will produce matrices whose elements are function of the generalized coordinates or velocities, in other cases the matrices will be constant. Gravitational terms, when present, will appear on the left hand side as a column vector g(q(t)) added to A3q(t). In alternative, we can include these terms in the generalized forces F. Recalling from (??) that a generic A ∈ Rn×n may be factored as

A = As + Aa T where As is a symmetric matrix As = As and Aa is a skew-symmetric matrix − T Aa = Aa . Therefore equation (105) can be rewritten as M q¨(t) + (D + G)q˙ (t) + (K + H )q(t) = F (106) where M = M T mass or inertia matrix, positive definite symmetric D = D T viscous damping matrix, symmetric G = −GT gyroscopic matrix, skew-symmetric K = K T stiffness () matrix, symmetric H = −H T circulatory matrix (due to constrained damping), skew-symmetric (107) Some of these matrices can be function of the generalized coordinates or velocities, as in the industrial robot kinematic chains, where we have configuration-dependent mass matrices M = M (q(t)). Not all the above terms are always present in the dynamical equations of multibody systems; the most common cases are: 0.7. LAGRANGE EQUATIONS IN MECHANICAL SYSTEMS 51

1. Systems where the structure of (106) is

M q¨(t) + K q(t) = F (108)

whre M e K are symmetrical and positive definite, are called conservative systems. They are called “conservative” despite the fact that not all the forces F are due to conservative phenomena; indeed in the left hand side of the equation there are no forces associated to dissipating energy elements, and consequently the total energy is conserved inside the system.

2. Systems where M q¨(t) + Gq˙ (t) + K q(t) = F (109) They are still conservative, in the sense explained above (the internal energy is conserved), but they are properly called gyroscopic conservative sys- tems or undamped gyroscopic systems. This type of dynamical behavior is associated to systems where there is an important rotation motion, as in or satellites.

3. Systems where M q¨(t) + Dq˙ (t) + K q(t) = F (110) where M , D and K are, other than symmetric are also positive definite, are called damped non gyroscopic systems and sometimes damped con- servative systems, also if the internal energy is not conserved, since it is dissipated through the viscous friction. Systems with symmetric positive def- inite matrices are sometimes called passive systems; we will see in Section ?? a more detailed definition of this class of systems.

4. Systems where M q¨(t) + (K + H )q(t) = F (111) are called circulatory systems. The circulatory forces modeled by the cir- culatory matrix H are not easily described; they appear in the dynamics of rotating mechanical or electrical (rotodynamics). The circulatory matrix contains non conservative terms linked with the internal damping of rotating elements and with the damping of the fluid surrounding the rotor [?], and can cause instability.

5. Systems with the general form

M q¨(t) + Dq˙ (t) + (K + H )q(t) = F

are often the result of modeling rotating shafts and structures, where, beside the usual dissipative phenomena, an additional constraint damping func- tion exists. 52

In kinematics chains composed by n rigid links, as for example the industrial robots, the nonlinear Lagrange equation takes the following form: M (q(t))q¨(t) + C (q(t), q˙ (t))q˙ (t) + g(q(t)) = F (112) where M (q(t)) is the mass or inertia matrix of the robot, depending on the instantaneous configuration q(t), C (q(t), q˙ (t))q˙ (t) represents the Coriolis torques and g(q(t)) represents the gravitational torques.

0.8 Numerical Algorithms for Direct and

The Newton-Euler equations, presented in Section 0.5, are vector equations that must include the constraint forces/torques between the rigid bodies of the multi- body system; when the number of these bodies increases, the equations become more and more hard to solve by hand. Conversely, the Lagrange equations are simpler to write, since they require only the knowledge of the positions and velocities of the bodies, and furthermore, they emphasize some energy aspects that are useful for the design of a special class of controllers, the so-called passive controllers, i.e., those that preserve the passivity property of the controlled system (see Section ??). However, from a numerical point of view, the Newton-Euler equations, when written in a recursive form, are the basis for numerical algorithms with a computational complexity that is lower than that of the algorithms based on the Lagrange approach. To show an example of this recursive formulation, we refer to a robotic structure, that will be discussed without presenting the details that allow to write its final equation. The model consists of n equations; for each i-th robot arm we write the following differential equation, whose general form was already presented in (112)) ∑n ∑n ∑n Mij(q)¨qj+ cijk(q)q ˙jq˙k + gi(q) = τi i = 1, . . . , n (113) j=1 j=1 k=1 where

• qi(t),q ˙i(t) andq ¨i(t) are the generalized coordinates, velocities and accelera- tions;

• τi are the motor torques applied to the joints;

• the terms Mij, cijk and gi model the inertial, centrifugal and Coriolis torques, as well the gravitational ones. These terms depend on the configuration given by q. 0.8. NUMERICAL ALGORITHMS FOR DIRECT AND INVERSE DYNAMICS53

Given the input torques τi(t) it is possible to integrate the differential equations (113) and find a solution for the generalized coordinates qi(t); this problem is the so-called direct dynamics problem.

The inverse dynamics problem is that of finding the torques τi(t) from the generalized coordinates qi(t) and their derivativesq ˙i(t) andq ¨i(t). The direct dynamics is useful to simulate the behavior of the system given the input torques, while the inverse dynamics allows to compute the control torques to achieve the desired qi(t),q ˙i(t) andq ¨i(t). The number of operations required to compute these quantities increase rapidly with n. It is possible to show that the number of products is proportional to n4, that is, the complexity is O(n4). For a particular robot where n = 6, the Lagrange approach requires at every step the computation of 66.271 multiplications. There exists a number of algorithms that reduce the computational complexity of the problem; the most cited is due to Luh, Walker and Paul, that is detailed in [?]. It consists in a two-steps recursive procedure, where, using the kinematics equations, the positions, linear and angular velocities and accelerations of the center-of-mass of every joint are computed, starting from the base to the most external one. At this point, taking into consideration also the generalized forces applied by the environment to the various parts of the structure and the gravitational effects, a backward recursion in implemented, that allows to compute the joint torques. In particular, indicating the following quantities

• ℓ ℓ ℓ ωk the angular velocity, αk the angular acceleration and a k the linear acceler- ation of the center-of-mass of the k-th arm in the reference frame Rℓ attached to the ℓ-th arm;

• k R R Rk−1 is the rotation matrix from k−1 to k;

• ℓ R R d k−1,k is the translation from the origin of k−1 to the origin of k, represented in Rℓ;

ℓ • R − d k−1,kc is the translation from the origin of k 1 to the center-of-mass of the k-t arm, represented in Rℓ;

• ℓ − f k−1,k are the constraint forces applied from the (k 1)-th arm to the k-th arm, represented in Rℓ;

• ℓ − τ k−1,k are the constraint torques applied from the (k 1)-th arm to the k-th arm, represented in Rℓ;

• ℓ F k,c is the total equivalent force applied to the k-th arm, having its line of action across the center-of-mass of the k-th arm, represented in Rℓ; 54

• ℓ n kc is the total torque on the k-th arm, that is equal to the momentum with respect to the center-of-mass of the k-th arm, represented in Rℓ; • ℓ Γ k/c is the inertia matrix of the k-th arm with respect to the center-of-mass of the k-th arm, represented in Rℓ;

• mk is the total mass of the k-th arm; [ ] • k = 0 0 1 T;

Recalling that k k − k d k,kc = d k−1,kc d k−1,k k k k R and that d k,kc , d k−1,kc , d k−1,k are constant in k, we have this recursive algorithm, valid for a robot with all rotating joint:

Initialization 0 0 0 − 0 0 We set ω0 = 0, α0 = 0 e a 0 = g , where g is the gravitational acceleration. Forward recursion (k = 1,..., 6)

k k k−1 ˙ ωk = Rk−1(ωk−1 + θkk) (114) k k k−1 k−1 ˙ ¨ αk = Rk−1(αk−1 + S(ωk−1)θkk + θkk) (115) k k k−1 k k k k k a k = Rk−1a k−1 + S(αk)d k−1,k + S(ωk)S(ωk)d k−1,k (116)

Motion equations relative to the center-of-mass (k = 1,..., 6)

k k k k k k k F kc = mk[a k + S(αk)d k,kc S(ωk)S(ωk)d k,kc ] (117) k k k k k k n kc = Γ k/cαk + S(ωk)Γ k/cωk (118)

Backward recursion (k = 5,..., 0)

k k+1 k+1 k f k−1,k = Rk f k,k+1 + F kc (119) k k+1 k+1 k k+1 k+1 τ k−1,k = Rk τ k,k+1 + S(d k−1,k)Rk f k,k+1 (120) k k k + S(d k−1,kc )F kc + n kc (121)

Motor torque computation

T k−1 k τk = k Rk τ k−1,k

This algorithm requires 117n − 24 products and 103n − 21 sums; for a robot with n = 6 arms the total is 678 products and 597 sums, largely smaller than those required with the Lagrangian approach. Bibliography

[1] S.H. Crandall, D.C.Karnopp, jr. E.F Kurtz, and D.C. Pridmore-Brown. Dynam- ics of mechanical and Electromechanical Systems. McGraw-Hill, 1968.

[2] J. Meisel. Principles of Electromechanical-Energy Conversion. Robert E. Krieger Publishing Company, 1984.

55