IDM Robot RR Lagrange Method
IDM Robot RR Lagrange Method
1 Introduction
This document presents the calculation of the Inverse Dynamic Model (IDM) of the
2R robot. For a quick presentation of the features of the robot that are pertinent
to the calculation of the IDM and for all notations, the reader if referred to [2]. Not
all notations are recalled in the present document, so reference to [2] is necessary.
For additional information about the robot, a complete technical documentation
is available in [4].
For the reader's convenience, we recall here the sketch of the robot in gure 1
1
2 Inverse Dynamic Model
The Inverse Dynamic Model (IDM) expresses the vector of joint torques Γ as a
function of the joint position vector q, speed q̇ , acceleration q̈ and of the forces
exerted by the robot on its environment Fe :
The Direct Dynamic Model (DDM) expresses the joint acceleration vector q̈ as
a function of the other above-mentionned variables:
The names f () and g() are classical for these functions. We will stick to those
names, in spite of the fact that g is also the acceleration of gravity, since there is
no risk of confusion.
Both these equations incorporate the robot parameters dened in [2]: lengths,
masses, positions of centers of mass, plus inertia parameters, and possibly friction
parameters. We recall the parameter vector here for convenience:
T
χ= zz1 mx1 m1 Ia1 zz2 mx2 m2 Ia2 (3)
t t
d ∂L ∂L
Γ= − (4)
dt ∂ q̇ ∂q
In the Lagrange equation, the Lagrangian L is dened as L = E − U, where
E is the total kinetic energy of the robot and U its total potential energy with
respect to gravity. The word total means that it is the sum of the energy of all
links.
Conventionally, the potential energy U is zero when the arm is fully extended
horizontally, i.e. when θ1 = θ2 = 0.
2
Figure 2: Height of the centers of mass
To calculate the potential energy of the arm, we need the height above the zero
potential energy datum of G1 and G2 , which are given by (see gure 2):
zG1 = c1 sin θ1
zG2 = l1 sin θ1 + c2 sin(θ1 +θ2 )
The potential energy is the sum of the potential energies of each link:
We now take into account the fact that m1 c1 = mx1 and m2 c2 = mx2
The kinetic energy of the whole robot is the sum of the kinetic energies of each
link of the robot. Each link is a rigid body, so the kinetic energy Ej of link j can
be calculated as:
Ej = 21 ωjT IGj ωj + 12 mj vG
T
j
vGj (7)
Ej = 21 ωjT Jj ωj + 12 mj vO
T
vOj + msTj vOj × ωj
(8)
j
3
This general expression can be found in [3], in chapter 9.3.3. In this equation,
Jj is the inertia matrix of link j expressed in Rj , vOj is the velocity vector of Oj
T
and msj = mxj myj mzj , is a vector formed of the rst moments of the
link.
Now to use equation (8), we need to choose a frame in which to express the
terms. Frame Rj is the logical choice. Indeed, with that particular choice, the
inertial parameters in Jj and in msj are the ones we have dened as standard
parameters in [2], and the expression of Jj is:
xxj −xyj −xzj
j
Jj = −xyj yyj −yzj (9)
−xzj −yzj zzj
As pointed out in [2], in the case of the 2R robot we can write:
0 0 0
j
Jj = 0 0 0 (10)
0 0 zzj
Of course, starting from equation (7) would ultimately lead to the same result.
ω1T J1 ω1 = zz1 θ̇12 . And since O1 is motionless, vO1 is the null vector, so:
We can now add the inuence of the inertia Ia1 of the rotor of motor 1, taking
into account the fact that the rotation speed of the rotor is n1 θ̇1 , where n1 is the
gear ratio. Combining all terms:
1
zz1 + n21 Ia1 θ̇12
E1 = 2
(12)
It is important not to neglect the eect of motor inertia due to the squaring of
2
the gear ratio n1 . In the case of large values of n1 , n1 Ia1 may be the dominant
part of the inertia.
T
ω2 = 0 0 θ̇1 + θ̇2
And:
4
1
2
ω2T J2 ω2 = 12 zz2 (θ̇1 + θ̇2 )2
We now need the velocity vector of point O2 . We rst evaluate vO2 in frame
1
R1 vO2 , where it is simpler.
1
T
vO2 = 0 l1 θ̇1 0
1
This expression is convenient to evaluate
2
T
m2 vO v = 21 l12 m2 θ̇12 .
2 O2
2
We get vO2 by:
cos θ2 sin θ2 0 0 l1 sin(θ2 ) θ̇1
2
vO2 = 2 Rot1 1 vO2 = − sin θ2 cos θ2 0 l1 θ̇1 = l1 cos(θ2 ) θ̇1
0 0 1 0 0
2
Where Rot1 is the matrix of the rotation of angle −θ2 around z. Now, still in
frame R2 we get:
l1 sin(θ2 ) θ̇1 0 l1 cos(θ2 ) θ̇1 (θ̇1 + θ̇2 )
vO2 × ω2 = l1 cos(θ2 ) θ̇1 × 0 = −l1 sin(θ2 ) θ̇1 (θ̇1 + θ̇2 )
0 θ̇1 + θ̇2 0
And:
l1 cos(θ2 ) θ̇ 1 (θ̇1 + θ̇2 )
msT2 (vO2 ×ω2 ) = mx2
0 0 −l1 sin(θ2 ) θ̇1 (θ̇1 + θ̇2 ) = l1 mx2 cos(θ2 ) θ̇1 (θ̇1+θ̇2 )
0
E2 = 21 zz2 (θ̇1 + θ̇2 )2 + l1 mx2 cos(θ2 ) θ̇1 (θ̇1 + θ̇2 ) + 12 l12 m2 θ̇12 (13)
Let us now take into account the kinetic energy of the rotor of motor 2 (its
stator has already been taken into account as part of link 1). Taking the rotation
1 1 2
speed of rotor 2 as n2 θ̇2 , its contribution to the kinetic energy is n Ia2 θ̇22
2 2
Ec2 = 21 zz2 (θ̇1 + θ̇2 )2 + l1 cos(θ2 ) mx2 θ̇1 (θ̇1 + θ̇2 ) + 12 l12 m2 θ̇12 + 21 n22 Ia2 θ̇22 (14)
1 This is in fact an approximation but it does not change anything. For more details, see the
appendix in section 4.
5
2.3.3 Total kinetic energy
1
zz1 + n21 Ia1 + zz2 + 2 l1 mx2 cos(θ2 ) + l12 m2 θ̇12
E= 2
(15)
2
1
2
+ 2
zz 2 + n 2 Ia2 θ̇2 + [zz2 + l1 mx2 cos(θ2 )] θ̇1 θ̇2
With:
H11 (θ2 ) = zz1 + n21 Ia1 + zz2 + 2 l1 mx2 cos(θ2 ) + l12 m2
H12 (θ2 ) = zz2 + l1 mx2 cos(θ2 ) (17)
H22 = zz2 + n22 Ia2
Now recalling that the Lagrangian is L = E −U and using equations (15) and (6),
we get the expression of the Lagrangian:
H (θ ) H (θ ) θ̇
1 11 2 12 2 1
L= 2
θ̇1 , θ̇2
H12 (θ2 ) H22 θ̇2 (18)
∂L
= −g (mx1 + l1 m2 ) cos θ1 − g mx2 cos(θ1 +θ2 ) (19)
∂θ1
The kinetic energy of the other hand is a function of θ2 , so we have to take the
derivatives of terms H11 (θ2 ) and H12 (θ2 ). We have
6
∂L
= −l1 mx2 sin(θ2 ) θ̇1 θ̇1 + θ̇2 − g mx2 cos(θ1 +θ2 ) (20)
∂θ2
∂L
= H11 (θ2 ) θ̇1 + H12 (θ2 ) θ̇2
∂ θ̇1
∂L
= H12 (θ2 ) θ̇1 + H22 θ̇2
∂ θ̇2
So:
d ∂L dH11 (θ2 ) dH12 (θ2 )
= H11 (θ2 ) θ̈1 + θ̇1 + H12 (θ2 ) θ̈2 + θ̇2
dt ∂ θ̇1 dt dt
(21)
= H11 (θ2 ) θ̈1 − 2 l1 mx2 sin(θ2 ) θ̇1 θ̇2 + H12 (θ2 ) θ̈2
− l1 mx2 sin(θ2 ) θ̇22
d ∂L dH12 (θ2 )
= H22 θ̈2 + H12 (θ2 ) θ̈1 + θ̇1
dt ∂ θ̇2 dt (22)
We now have all the formula we need to write the equations of the torque from
equation (4).
Γ1 = H11 (θ2 ) θ̈1 + H12 (θ2 ) θ̈2 − l1 mx2 sin(θ2 ) θ̇22 − 2 l1 mx2 sin(θ2 ) θ̇1 θ̇2
+ g (mx1 + l1 m2 ) cos θ1 + g mx2 cos(θ1 +θ2 )
(23)
Γ2 = H22 θ̈2 + H12 (θ2 ) θ̈1 + l1 mx2 sin(θ2 ) θ̇12
+ g mx2 cos(θ1 +θ2 )
Now we can add friction to the model. Friction is a complex phenomenon which
is decomposed into two physically distinct components, viscous friction, which is
proportional to speed, and Coulomb friction, which depends only on the direction
of motion. i can be written as F vi q̇i . In the case of
Viscous friction for joint
Coulomb friction, the standard form is F si sgn(q̇i ), which corresponds to symmet-
rical Coulomb friction, as in gure 2.7, case (a). When Coulomb friction is not
symmetrical, the friction force is greater in one direction than the other, as in
7
Figure 3: Symmetrical and non-symmetrical Coulomb friction
gure 2.7, case (b). So in general, we write the friction force as F si sgn(q̇i ) + oi ,
where oi is an oset with respect to the symmetrical case.
The equations of the torque then become:
Γ1 = H11 (θ2 ) θ̈1 + H12 (θ2 ) θ̈2 − l1 mx2 sin(θ2 ) θ̇22 − 2 l1 mx2 sin(θ2 ) θ̇1 θ̇2
+ g (mx1 + l1 m2 ) cos θ1 + g mx2 cos(θ1 +θ2 )
+ F s1 sgn(θ̇1 ) + o1 + F v1 θ̇1 (24)
3.1 Introduction
8
When the robot moves in the horizontal plane, and friction is assumed neg-
ligible.
When the robot moves in the horizontal plane, with friction taken into ac-
count.
When the robot moves in the vertical plane, and friction is taken into account.
We will see that the list of identiable parameters is not the same in each case
and we will check that the list of regrouped parameters that we obtain by hand
is indeed minimal.
In this section, remember that l1 is not part of the parameter vector χ. In
practice, l1 is either considered known from mechanical design and manufacturing
data or is the result of a prior geometric calibration of the robot, as described in
[1].
Let us take equation (24), and set friction and gravity to zero. We get:
Γ1 = H11 (θ2 ) θ̈1 + H12 (θ2 ) θ̈2 − l1 mx2 sin(θ2 ) θ̇22 − 2 l1 mx2 sin(θ2 ) θ̇1 θ̇2
Γ = H θ̈ + H (θ ) θ̈ + l mx sin(θ ) θ̇2
2 22 2 12 2 1 1 2 2 1
(25)
Now what we need to do is express the torques under the form:
Ja
θ̈1 θ̈1 + θ̈2 w13 (θ2 ) 0 zz2
Γh = mx2 = W × K (26)
2
0 θ̈1 + θ̈2 w23 (θ2 ) n2 θ̈2
Ia2
With:
w13 (θ2 ) = l1 2 cos(θ2 ) θ̈1 + cos(θ2 ) θ̈2 − sin(θ2 ) θ̇22 − 2 sin(θ2 ) θ̇1 θ̇2
(27)
w23 (θ2 ) = l1 cos(θ2 ) θ̈1 + sin(θ2 ) θ̇12
9
And:
It is easy to check that parameters Ja , zz2 , mx2 and Ia2 are independent. To
clarify the meaning of this, we can say that, for a given set of values of q , q̇ and
q̈ , Γ is a linear function of four Ki parameters, and that there is no way it can be
written as a function of only three parameters. Should we take n sets of q (i) , q̇ (i)
(i)
and q̈ values, we can build a linear system of the form:
(1)
Γ1
...
(n)
Γ1
= Wall × K (29)
(1)
Γ2
...
(n)
Γ2
In this equation, Wall contains all the W matrices corresponding to each set of
q , q̇ and q̈ values. Here we chose to put rst all lines corresponding to torque Γ1 and
then all those corresponding to torque Γ2 . The reason for this will become apparent
when we cover the identication process. The exponent between parentheses is the
(i) (i) (i)
index of the q , q̇ and q̈ values. It appears between parentheses to remind of
the fact that it is an index, not an exponent.
We need to take n≥2 for Wall to have at least four lines. If the rank of the
matrix is four, it means that our four Ki parameters (in this case Ja . . . Jb ) are
indeed independent. Otherwise, it means that they are not, and at least one of
those parameters can be written as a linear combination of the others. How to
proceed in that case will be covered in the identication process.
Should the reader not be convinced that the parameters are indeed indepen-
(i) (i)
dent, they can generate an instance of Wall using random values of q , q̇ and
(i)
q̈ (with n ≥ 2) and check the numerical rank of the matrix, which will be equal
to four. Beware of not using an unnecessarily large value of n, which may result
in numerical diculties in the determination of the rank.
10
Ja
zz2
mx2
Ia2
θ̈1 θ̈1 + θ̈2 w13 (θ2 ) 0 sgn(θ̇1 ) 1 θ̇1 0 0 0 F s1
Γh = 2
0 θ̈1 + θ̈2 w23 (θ2 ) n2 θ̈2 0 0 0 sgn(θ̇2 ) 1 θ̇2
o1
F v1
F s2
o2
F v2
(30)
For convenience, we recall that:
This model will be the rst we will use in the identication process, as the
robot is currently operating in the horizontal plane.
With respect to the expression of the torque in the previous case, the additional
terms to take into account are:
G1 = g (mx1 + l1 m2 ) cos θ1 + g mx2 cos(θ1 +θ2 )
(32)
G2 = g mx2 cos(θ1 +θ2 )
Which can be written as:
G1 = M Xa g cos θ1 + mx2 g cos(θ1 +θ2 )
(33)
G2 = mx2 g cos(θ1 +θ2 )
M Xa = mx1 + l1 m2 (34)
11
Ja
zz2
mx2
M Xa
0
Ia2
θ̈ θ̈ + θ̈2 w13 (θ2 ) g cos θ1 0 sgn(θ̇1 ) 1 θ̇1 0 0 0
Γvf = 1 1
0 F s 1
0 θ̈1 + θ̈2 w23 (θ2 ) 0 n22 θ̈2 0 0 0 sgn(θ̇2 ) 1 θ̇2
o1
F v1
F s2
o2
F v2
(35)
With:
Ja = zz1 + n21 Ia1 + l12 m2
M Xa = mx1+ l1 m2
0 2
w13 (θ2 ) = l1 2 cos(θ2 ) θ̈1 +cos(θ2 ) θ̈2 − sin(θ2 ) θ̇2 −2 sin(θ2 ) θ̇1 θ̇2 +g cos (θ1+θ2 )
w0 (θ2 ) = l1 cos(θ2 ) θ̈1 +sin(θ2 ) θ̇2 +g cos (θ1+θ2 )
23 1
(36)
regrouped
From equations 35 and 36, it is simple to obtain the form linear with respect to the
standard parameters without any parameter regrouping. It's a simple matter of
developing the equations. The non regrouped model can be useful to experiment
with the numerical methods of nding the regrouped parameters. So for com-
pleteness, we give here the equation with the full vector of standard parameters,
including m1 which in fact does not have any eect as such on the torque.
12
zz1
mx1
m
1
Ia1
zz2
mx2
θ̈1 g cos θ1 0 n21 θ̇1 θ̈1 + θ̈2 w16 (θ2 ) w17 (θ1 ) 0 sgn(θ̇1 ) 1 θ̇1 0 0 0 m2
Γ=
0 0 0 0 θ̈1 + θ̈2 w26 (θ2 ) 0 n22 θ̈2 0 0 0 sgn(θ̇2 ) 1 θ̇2 Ia2
F s1
o1
F v1
F s2
o
2
F v2
(37)
With:
2
w
16 2
(θ ) = l1 2 cos(θ 2 ) θ̈1 +cos(θ2 ) θ̈2 − sin(θ2 ) θ̇2 −2 sin(θ2 ) θ̇1 2 +g cos (θ1+θ2 )
θ̇
w17 (θ1 ) = l12θ̈1 + l1 g cos θ1
w26 (θ2 ) = l1 cos(θ2 ) θ̈1 +sin(θ2 ) θ̇2 +g cos (θ1+θ2 )
1
(38)
4 Appendix
In this section we go into a little more detail about how to take into account the
rotors of the motors in the kinetic energy. In practice, we can analyze the problem
as involving four solids:
Actually, there more solids than that when the motors have gearboxes, but the
rotation speed relative of all the solids that constitute a gearbox (relative to the
stator) is proportional to that of the rotor, and so the analysis presented below
holds for all those solids.
Now let us rewrite the expression of the total kinetic energy of equation (15),
but involving only links 1 and 2. The general expression keeps the same form:
13
E = 21 H11 (θ2 ) θ̇12 + 12 H22 θ̇22 + H12 (θ2 ) θ̇1 θ̇2
H11 (θ2 ) H12 (θ2 ) θ̇1 (39)
1
= 2 θ̇1 θ̇2
H12 (θ2 ) H22 θ̇2
But the expressions of the terms Hij no longer contain Ia1 and Ia2 :
H11 (θ2 ) = zz1 + zz2 + 2 l1 mx2 cos(θ2 ) + l12 m2
H12 (θ2 ) = zz2 + l1 mx2 cos(θ2 ) (40)
H22 = zz2
Now let us explicitly calculate the contribution of the rotors. For rotor 1, the
center of mass coincides with z1 and so it has zero speed. Hence, the contribution
is exactly as stated above:
We can calculate the contribution of rotor 2 to the kinetic energy using equa-
tion (7). The rotor of motor 2 does not coincide with z1 : it is at a distance r1
along axis x1 . So the speed of its center of mass is r1 θ̇1 . As stated above, its
absolute rotation speed is θ̇1+n2 θ̇2 , so its kinetic energy can be expressed as (with
mr1 themassof therotor):
We now regroup terms in θ̇12 , θ̇22 and θ̇1 θ̇2 , and add them respectively to H11 ,
H22 and H12 , we get the corrected values of those terms as:
0
H11 (θ2 ) = (zz1 + mr1 r12 + Ia2 ) + n21 Ia1 + zz2 + 2 l1 mx2 cos(θ2 ) + l12 m2
H 0 (θ2 ) = (zz2 + Ia2 ) + l1 mx2 cos(θ2 )
120
H22 = zz2 + n22 Ia2 = (zz2 + Ia2 ) + (n22 − 1) Ia2
(43)
Which can be written as:
0
H11 (θ2 ) = zz10 + n21 Ia1 + zz2 + 2 l1 mx2 cos(θ2 ) + l12 m2
H 0 (θ2 ) = zz20 + l1 mx2 cos(θ2 ) (44)
120
H22 = zz20 + n22 Ia02
With:
0
zz1 = zz1 + mr1 r12 + Ia2
zz20 = zz2 + Ia2 (45)
0
Ia2 = (n2 − 1) Ia2
So the equations of the total kinetic energy (16) and (17) are indeed correct,
though the physical interpretation of the terms is slightly dierent.
14
References
[2] G. Garcia and M. Stein. General description and parameters of the 2R robot.
Technical report, Ecole Centrale de Nantes, 2022.
[4] M. Stein. 2R robot model technical report. Technical report, Ecole Centrale
de Nantes, 2022.
15