Lecture 10 Reprise and generalized forces
The Lagrangian
Holonomic constraints
Generalized coordinates
Nonholonomic constraints we haven’t done this, so let’s start with it Generalized forces
Euler‐Lagrange equa ons
Hamilton’s equa ons
1 Generalized forces are based on the principle of virtual work
i δW = F ⋅δr + τ ⋅δΦ = Qiδq convert to me deriva ves € δW δW = δt ⇒ W˙ δt, Qδqi ⇒ Q q˙ iδt δt i i
˙ i ˙ i Wδ t = Qiq˙ δt ⇒ W = Qiq˙
€ ∂W˙ Q = i ∂q˙ i €
€ so what we need is W˙
2 € We need to look at the forces and torques applied to each link
W˙ = F ⋅ r˙ + τ ⋅ Φ˙
The transla onal part is obvious: F ⋅ r˙ = F ⋅ v € The rota onal part € δΦ = δφk + δθI1 + δψK 3
˙ ˙ ˙ δΦ = φδ tk + θδ tI1 +ψ δtK 3 = ωδt = Ωδt € Φ˙ = ω € W˙ = F ⋅ v + τ ⋅ ω €
€ 3 So my total rate of work will be
K ˙ W = ∑(Fi ⋅ vi + τ i ⋅ ω i ) i=1
The veloci es and rota ons must be consistent with the constraints and everything must be expressed in iner al coordinates €
I can believe that this looks mysterious, but it is actually simple, which we can see by looking at some examples
REMEMBER THAT THESE FORCES AND TORQUES DO NOT INCLUDE THE POTENTIAL FORCES AND TORQUES
4 This is the three link robot that we have seen before
It will have torques from the ground to link 1 from link 1 to link 2 from link 2 to link 3
5 The torque from the ground to link 1 τ 01k
€ The torque from link 1 to link 2 τ12I1
€ The torque from link 2 to link 3 τ 23I2
€ There is a force from the ground that balances the weight of the robot but it does no work because link 1 does not move up and down
6 The torque on link 1 τ 01k − τ12I1
€ The torque on link 2 τ12I1 − τ 23I2
€ The torque on link 3 τ 23I2
These will give us the generalized forces as we’ll see shortly €
7 There are a bunch of constraints affec ng the rota on rates
φ1 = 0 = θ1
φ2 =ψ1 = φ3 € ψ2 = 0 =ψ3 € There are also enough connec vity constraints to reduce the system to three degrees of freedom € we’ll look at these shortly
8 All three I vectors are equal to
cos ψ 1 sinψ1 0
The rota on rates are €
˙ ˙ 0 cosψ1θ 2 cosψ1θ 3 ˙ ˙ ω1 = 0 , ω 2 = sinψ1θ 2 , ω 3 = sinψ1θ 3 ˙ ˙ ˙ ψ 1 ψ1 ψ1
€
9 Build the work terms for each link
˙ ω1 ⋅ (τ 01k − τ12I1) = τ 01ψ1
˙ ω2 ⋅ (τ12I1 − τ 23I2 ) = (τ12 − τ 23 )θ 2 € ˙ ω3 ⋅ τ 23I2 = τ 23θ 3 € so we have € ˙ ˙ ˙ ˙ W = τ 01ψ1 + (τ12 − τ 23)θ 2 + τ 23θ 3
€
10 The three generalized coordinates
ψ 1 ˙ q = θ 2 ⇒ W = τ 01q˙1 + (τ12 − τ 23)q˙ 2 + τ 23q˙ 3 θ 3
Differen ate to get the generalized forces €
Q1 = τ 01, Q2 = (τ12 − τ 23), Q3 = τ 23
€
11 We get a be er idea of the compa bility issues by looking further
Apply a horizontal force to the end of link 3 Let it be directed in the –I direc on
12 We have to take the connec vity constraints in to account to handle this
We see intui vely that the only work is can do is to rotate the en re robot about k.
It will contribute a torque to Q1; can we get that using the rubric?
We have a force applied to link 3, and it is not at the center of mass, so there is an accompanying torque
1 1 1 τ = r K × F = r K × I F = r sinθ Fψ˙ 3 2 3 3 2 3 3 1 2 3 3 1
€ 13 The connec vity constraint
1 1 p = p + r K + r K ⇒ v = r K˙ + r K˙ 3 1 2 2 2 3 3 3 2 2 2 3 3
The force piece of the work term is € 1 1 W˙ = F ⋅ v = FI ⋅ r K˙ + r K˙ = r sinθ + r sinθ Fψ˙ F 3 1 2 2 2 3 3 2 2 2 3 3 1
combine that with the torque term and we have
€ ˙ ˙ W = (r2 sinθ2 + r3 sinθ3 )Fψ1
for an addi onal term in accord with intui on € Q1 = (r2 sinθ2 + r3 sinθ3 )F
14 € ??
We’ll look at this in general once again
15 The Lagrangian in physical variables
K
L = ∑Ti −Vi i=1
1 1 2 T = m x˙ 2 + y˙ 2 + z˙ 2 + A θ˙ cosψ + φ˙ sinθ sinψ 2 ( ) 2 ( ) € 1 2 1 2 + B −θ˙ sinψ + φ˙ sinθ cosψ + C ψ˙ + φ˙ cosθ 2 ( ) 2 ( )
€ We’ve mostly been doing gravity poten als
16 Simple holonomic constraints
Nonsimple holonomic constraints
These remove some number of variables from the problem
At this point you can assign the remaining variables to a set of generalized coordinates
17 Nonholonomic constraints: linear in the deriva ves of q
Write them in matrix form
i j C jq˙ = 0 ⇔ Cq˙ = 0
C is an M x N matrix — number of constraints € x number of generalized coordinates
18 Generalized forces
Iden fy the outside forces and torques on each link
Form W˙
∂W˙ Then Qi = € ∂q˙ i
€ Choose between Euler‐Lagrange and Hamilton
19 Euler‐Lagrange
d ∂L ∂L j i = i + Qi + λ jCi dt ∂q˙ ∂q
Convert to first order system € the first set of equa ons is really simple q˙ i = ui
We need to develop the symbolic representa on of the second set €
20 Here’s the Lagrangian we want its contribu on to the le and right hand sides 1 L = q˙ i M q˙ j −V qk 2 ij ( )
∂L 1 ∂M ∂V right hand side = q˙ m mn q˙ n − € ∂qi 2 ∂qi ∂qi subs tute q˙ m = um, q˙ n = un € right hand side ∂L 1 ∂M ∂V = um mn un − € ∂qi 2 ∂qi ∂qi
€ 21 le hand side
∂L j j d ∂L j dMij j i = Mijq˙ = Mij u ⇒ i = Mij u˙ + u ∂q˙ dt ∂q˙ dt
dMij ∂Mij € M u˙ j + u j = M u˙ j + u j uk ij dt ij ∂qk
and we can combine the two and add back € the constraint contribu on and the generalized forces
22 ∂Mij ∂L M u˙ j + u j uk = + λ C j + Q ij ∂qk ∂qi j 1 i
∂L 1 m ∂Mmn n ∂V i = u i u − i € ∂q 2 ∂q ∂q
€ ∂Mij 1 ∂M ∂V M u˙ j + u j uk = um mn un − + λ C j + Q ij ∂qk 2 ∂qi ∂qi j 1 i
€
23 ∂Mij 1 ∂M ∂V M u˙ j + u j uk = um mn un − + λ C j + Q ij ∂qk 2 ∂qi ∂qi j 1 i
1 ∂M ∂Mij ∂V M u˙ j = um mn un − u j uk − + λ C j + Q € ij 2 ∂qi ∂qk ∂qi j 1 i
€ q˙ i = ui
and we can (in principle) solve for the individual components of u € j ki 1 m ∂Mmn n ∂Mij j k ∂V j u˙ = M u i u − k u u − i + λ jC1 + Qi 2 ∂q ∂q ∂q
€ 24 We did Hamilton the last me
I have the pair of sets of odes
j ji q˙ = M pi
∂L j p˙ i = + λ jC1 + Qi € ∂qi where all the q dots in the second set have been replaced by their expressions in terms of p €
25 We can write this out in detail, although it looks pre y awful
1 L = q˙ i M q˙ j −V qk 2 ij ( )
∂L 1 ∂M ∂V right hand side = q˙ m mn q˙ n − € ∂qi 2 ∂qi ∂qi subs tute m mr n ns q˙ = M pr, q˙ = M ps €
∂L 1 ∂M ∂V right hand side = M mr p mn M ns p − € ∂qi 2 r ∂qi s ∂qi
€
26 ∂L p˙ = + λ C j + Q i ∂qi j 1 i
∂L 1 ∂M ∂V = M mr p mn M ns p − ∂qi 2 r ∂qi s ∂qi €
€ 1 ∂M ∂V p˙ = M mr p mn M ns p − + λ C j + Q i 2 r ∂qi s ∂qi j 1 i
€
i ij q˙ = M p j
27 € Both of these are of the same general form a form that we will see in the other methods we will address
i ij q˙ = M p j
1 ∂M ∂V p˙ = M mr p mn M ns p − + λ C j + Q i 2 r ∂qi s ∂qi j 1 i Euler‐Lagrange €
€ Hamilton q˙ i = ui
j ki 1 m ∂Mmn n ∂Mij j k ∂V j u˙ = M u i u − k u u − i + λ jC1 + Qi 2 ∂q ∂q ∂q €
€ 28 What you have to do in general — whether you use Euler‐Lagrange or Hamilton
Set up the physical Lagrangian
Put in the simple holonomic constraints
Put in the nonsimple holonomic constraints
Define the generalized coordinates
Find the nonholonomic constraints and the constraint matrix
Define the Lagrange mul pliers
Find the rate of work and the generalized forces
29 For Hamilton’s equa ons
i ij Define the momentum and use it to eliminate q˙ = M p j
(These are half the differen al equa ons) € The other half are the momentum equa ons 1 ∂M ∂V p˙ = M mr p mn M ns p − + λ C j + Q i 2 r ∂qi s ∂qi j 1 i
€
30 Solve some of the momentum equa ons for the Lagrange mul pliers
Combine the remaining momentum equa ons with the differen ated constraints
These are the new momentum equa ons
i ij Solve the new momentum equa ons simultaneously with q˙ = M p j
€
31 An example
link 1, the frame link 2, the fork link 2 link 3, the rear wheel link 4, the front wheel
link 1 link 4
link 3
32 The (physical) Lagrangian
There are four iden cal Lagrangians — we’ve seen them before I’m not going to write them out
I am going to hold this system erect, so that gravity does nothing I can set g = 0
33 Simple holonomic constraints
I want the system to be erect Let the frame and fork rotate only about the ver cal
φ1 = 0 = φ2, θ1 = 0 = θ 2 minus 4
Define the difference between their k = K rota ons €
ψ2 =ψ1 + α no change
€
34 Simple holonomic constraints
The heights of all the links are fixed
z1 = h1, z2 = h2, z3 = rW = z4 minus 4
€
35 Simple holonomic constraints
I want the wheels to be upright
π θ = − = θ minus 2 3 2 4
The rear wheel points in the same direc on as the frame the front wheel in the same direc on as the fork €
φ3 =ψ1, φ4 =ψ1 + α minus 2
The horizontal loca ons of the centers of mass are connected the front connec on is simple €
x4 = x3, y4 = y3 minus 2
36 € Nonsimple holonomic constraints
The other horizontal loca ons of the centers of mass are also connected
x3 = −l1 cosψ1, y3 = −l1 sinψ1 minus 4 x2 = l2 cosψ1, y2 = l2 sinψ2
At this point we have introduced eighteen constraints, leaving six variables €
37 Assign the generalized coordinates
x1 y 1 ψ q = 1 α ψ 3 ψ 4
€ We s ll have rolling constraints
38 Nonholonomic constraints
rolling constraints
v3 = ω 3 × r3, v4 = ω 4 × r4
r3 = k = r4
ver cal components are already in place, so there are but four of these €
x˙ 3 −€r Wψ˙ 3 cosφ3 = 0 = y˙ 3 − rWψ˙ 3 sinφ3
x˙ 4 − rWψ˙ 4 cosφ4 = 0 = y˙ 4 − rWψ˙ 4 sinφ4
constraint matrix
€ 3 3 1 0 l2 sinq 0 −rW cosq 0 3 3 0 1 −l2 cosq 0 −rW sinq 0 C = 3 3 4 1 0 −l1 sinq 0 0 −rW cos(q + q ) 3 3 4 0 1 l1 cosq 0 0 −rW sin(q + q )
39
€ Nonholonomic constraints
in physical coordinates
1 0 l2 sinψ1 0 −rW cosψ1 0 0 1 −l cosψ 0 −r sinψ 0 C = 2 1 W 1 1 0 −l1 sinψ1 0 0 −rW cos(ψ1 + α) 0 1 l1 cosψ1 0 0 −rW sin(ψ1 + α)
There will be four Lagrange mul pliers €
j We’ll add λ jCi to the momentum equa ons
€
40 Generalized forces
There is torque from the frame to the fork τ12k
and from the frame to the rear wheel τ13K 3 €
The rate of work will be € ˙ W = ω1 ⋅ (−τ12k − τ13K 3) + ω 2 ⋅ τ12k + ω 3 ⋅ τ13K 3
from which we can find €
Q = {0 0 0 τ12 τ13 0}
€ 41 At this point we have the structure of the problem
It’s me to go to Mathema ca to see how to do this in prac ce
And to see how to convert this to numerical form for integra on
And some simple examples
42