Multibody simulation Dynamics of a multibody system (Newton-Euler formulation) Dimitar Dimitrov Örebro University June 8, 2012 Main points covered Newton-Euler formulation forward dynamics inverse dynamics 1/17
Euler-Lagrange formulation We derived the equations of motion for a multibody system by treating the multibody system as a whole and performing analysis using the Lagrangian (the difference between the kinetic and potential energy) of the system. Newton-Euler formulation In this lecture, we describe an alternative formulation which treats each link in turn by forming the equations that govern its linear and angular motion. The forces f and torques t acting on a particular link are computed by analyzing its interaction with its neighboring links. Our starting point are the Newton-Euler equations for a single rigid body f = m v c t = I C ω +ω I C ω 2/17
Let us express the equations of motion for link i as [ fi ] = t i [ ][ ] [ mi I 0 vi + 0 I i ω i ] 0 ω i I i ω i v i denotes the linear velocity of the center of mass (CoM) of link i ω i denotes the angular velocity of link i I i denotes the 3 3 inertia matrix of link i, calculated about its CoM and expressed in the world frame. all vectors are expressed with respect to the world frame We can write the above equations as where u e i = [ fi t i ], M i = u e i = M i ξ i +u n i, [ ] [ ] [ mi I 0 vi, ξ 0 I i =, u n i ω i = i ] 0 ω i I i ω i 3/17
For a system of n bodies (without constraints) we have or in short u e 1 u e 2.. u e n }{{} u e M 1 0... 0 0 M 2... 0 =......... } 0 0... M n {{ } M ξ 1 ξ 2. ξ n }{{} ξ + u n 1 u n 2.. u n n }{{} u n u e = M ξ +u n (1) The fact that M is a block-diagonal matrix implies that there is no coupling between the rigid bodies in the system. Or in other words, the motion of body i is independent of all other bodies. 4/17
Constraints due to joints When the bodies are interconnected using joints, we have to introduce constraints on their motion. There are alternative ways to do so form the constraint equations of each pair of bodies, and impose them explicitly since we are dealing only with open-loop systems, we could use the joint variables q as generalized coordinates, and impose the constraints implicitly by expressing ξ in (1) as a function of the generalized coordinates and their derivatives We adopt the second approach Recall that when using the Euler-Lagrange formulation, we expressed the Lagrangian of the system as a function of the generalized coordinates, and then substituted it in the Euler-Lagrange equations. Because of that, no constraints appeared explicitly in the equations of motion. 5/17
Implicit constraints The relation between the velocity of link i and q can be expressed as [ ] Jvi ξ i = q = J J ci q. ωi By using J c = J c1 J c2. J cn R6n n the velocities of all links can be expressed as ξ = J c q ξ = J c q + J c q (2) Substitute (2) in u e = M ξ +u n u e = M(J c q + J c q)+u n = MJ c q +u c, (3) where u c = M J c q+u n is the sum of all velocity dependent inertial forces (and torques) acting on the CoM of the links. Multiply (3) by J T c from the left J T c MJ c q +J T c }{{} uc = J T c }{{} ue. }{{} H c τ e τ e are the generalized forces/torques acting on the generalized coordinates as a result of u e. Recall that τ e = J T c ue is the static relation. 6/17
Computing c c = J T c M J c q +J T c un The only term of the above equation that we have not computed yet is J c. Forming it explicitly is not usually done because we can compute directly the product J c q as follows. If we set q = 0 in ξ = J c q + J c q, we obtain J c q = ξ 0. We use ξ 0 to denote the Cartesian accelerations of the links computed with zero joint accelerations q. Hence, c can be computed using c = J T c (M ξ 0 +u n ) }{{}. (4) u c Computing the vector ξ 0 R 6n can be done in a recursive fashion (as we show next). 7/17
Link velocity ξ ξ can be computed using ξ = J c q, which corresponds to the following recursion for i = 1,...,n (we will assume fixed base v 0 = 0, ω 0 = 0). All vectors are expressed in the world frame. Revolute joint ω i = ω i 1 +k i q i k i v i = v i 1 +ω i 1 h i +ω i d i = v i 1 +ω i 1 (r i r i 1 )+k i d i q i q i d i v i h i ω i Prismatic joint v i 1 ω i = ω i 1 v i = v i 1 +ω i 1 h i +ω i ˆd i +k i q i ω i 1 r i = v i 1 +ω i 1 (h i + ˆd i )+k i q i r i 1 = v i 1 +ω i 1 (r i r i 1 )+k i q i where ˆd i = d i +k i q i 8/17
Link acceleration ξ The following computation for i = 1,...,n is called forward recursion. A fixed base is assumed, i.e., v 0 = 0, v 0 = 0, ω 0 = 0, ω 0 = 0. revolute joint ω i = ω i 1 +k i q i ω i = ω i 1 +ω i 1 k i q i +k i q i v i = v i 1 +ω i 1 (r i r i 1 )+k i d i q i v i = v i 1 + ω i 1 (r i r i 1 )+ω i 1 (v i v i 1 )+ω i (k i d i ) q i +k i d i q i prismatic joint ω i = ω i 1 ω i = ω i 1 v i = v i 1 +ω i 1 (r i r i 1 )+k i q i v i = v i 1 + ω i 1 (r i r i 1 )+ω i 1 (v i v i 1 +k i q i )+k i q i 9/17
Some notes d dt k i = ω i k i = (ω i 1 +k i q i ) k i = ω i 1 k i. d dt (k i d i ) = (ω i 1 k i ) d i +k i (ω i d i ) = (ω i 1 k i ) d i +k i [(ω i 1 +k i q i ) d i ] = (ω i 1 k i ) d i +k i (ω i 1 d i )+k i (k i d i ) q i = ω i (k i d i ). The last equality is obtained by adding the following term to the equation ω i 1 (k i d i )+k i (d i ω i 1 )+d i (ω i 1 k i ) = 0. Note that any three vectors a,b,c R 3 satisfy the Jacobi identity a (b c)+b (c a)+c (a b) = 0. 10/17
Summary (Newton-Euler formulation - batch version) Given (q, q) - state of the system at time t u e - external forces acting on the system (including gravity) τ - torque delivered by joint motors Do form M, J c, u n form the manipulator inertia matrix H = J T c MJ c compute link accelerations ξ 0 (forward recursion using q = 0) form u c = M ξ 0 +u n compute c = J T c uc (backward recursion) compute τ e = J T c u e (backward recursion) The above steps lead to the following equation of motion H q +c = τ e +τ 11/17
Recursive computation of J T c(u e u c ) Define [ f ec i t ec i ] = u ec i = u e i uc i f ec i R 3 is a force acting at the CoM of link i t ec i R 3 is a torque acting on link i. see figure on next slide The following computation for i = n,...,1 is called backward recursion. It is computationally more efficient compared to using J T c (ue u c ). f Ji = f ec i +f Ji+1 t Ji = t ec i +t Ji+1 +d i f ec i +(d i +h i+1 ) f Ji+1 f Ji+1, t Ji+1 - forces and torques acting on link i through joint i+1 f Ji, t Ji - forces and torques acting on link i 1 through joint i f Jn+1 = 0, t Jn+1 = 0 is assumed 12/17
Figure (backward recursion) joint i+1 f ec i f Ji+1 t Ji+1 t ec i h i+1 d i f Ji t Ji joint i link i backward recursion (i = n...,1) f Ji = f ec i +f Ji+1 t Ji = t ec i +t Ji+1 +d i f ec i +(d i +h i+1 ) f Ji+1 13/17
Project (f Ji,t Ji ) on the i th axis of rotation/translation Define τ ec = τ e c = J T c (ue u c ). τ ec is the generalized force/torque acting on the generalized coordinates q as a result of u c and u e. The final step of the backward recursion is to determine the torque τ ec i around the axis of rotation k i, if joint i is revolute the force τ ec i along the axis of translation k i, if joint i is prismatic { τi ec ki t = Ji if joint i is revolute k i f Ji if joint i is prismatic 14/17
Newton-Euler formulation (the big picture) velocities and accelerations (forward forces and torques (backward recursion) recursion) the two recursions forward recursion (1,...,n) for computing Cartesian velocities and accelerations of the links backward recursion (n,...,1) for computing the generalized forces τ ec as a result of the external and inertial forces acting on the links 15/17
Forward dynamics inverse dynamics Forward dynamics Solve the equations of motion for the accelerations q resulting from given generalized forces/torques q = H 1 (τ e +τ c). After solving for q, one can obtain q and q by using numerical integration. Forward dynamics is useful for the purpose of simulation. Inverse dynamics Find joint forces/torques τ that should be applied by the joint motors, in order to generate system motion specified by q, q, q, (possibly in the presence of external forces). Solving the inverse dynamics problem is equivalent to performing forward and backward recursions. It is useful for forming the equations of motion manipulator trajectory planning control algorithm implementation 16/17
Recursive computation of the manipulator inertia matrix We already know how to compute the manipulator inertia matrix H, however, here we discuss an alternative (and more efficient) approach. Step 0 set all external forces (including gravity) equal to zero set q = 0. This results in the following equation of motion (satisfied only by q = 0) H q = 0. Recursive computation of H for i = 1,...,n set q i = 1, and q j = 0 for all j i perform a forward and backward recursion At the i th iteration, the result from the backward recursion would be a vector of torques/forces that is equivalent to the i th column of H. See file bmsd/examples/example_id.m. 17/17