Discrete Variational Mechanics Benjamin Stephens J.E. Marsden and M. West, “Discrete mechanics and variational integrators,” Acta Numerica, No.

Download Report

Transcript Discrete Variational Mechanics Benjamin Stephens J.E. Marsden and M. West, “Discrete mechanics and variational integrators,” Acta Numerica, No.

Discrete Variational Mechanics
Benjamin Stephens
J.E. Marsden and M. West, “Discrete mechanics and variational
integrators,” Acta Numerica, No. 10, pp. 357-514, 2001
M. West “Variational Integrators,” PhD Thesis, Caltech, 2004
1
About My Research
• Humanoid balance using
simple models
• Compliant floating body
force control
• Dynamic push recovery
planning by trajectory
optimization
C
C(t )
Fˆ
PL
PL (t )
PR
http://www.cs.cmu.edu/~bstephe1
2
http://www.cs.cmu.edu/~bstephe1
3
But this talk is not about that…

The Principle of Least Action
The spectacle of the universe seems all the more grand and
beautiful and worthy of its Author, when one considers that it is
all derived from a small number of laws laid down most wisely.
-Maupertuis, 1746
5
The Main Idea
• Equations of motion are derived from a
variational principle
• Traditional integrators discretize the equations
of motion
• Variational integrators discretize the
variational principle
6
Motivation
• Physically meaningful dynamics simulation
Stein A., Desbrun M. “Discrete geometric mechanics for variational time integrators” in
7
Discrete Differential Geometry. ACM SIGGRAPH Course Notes, 2006
Goals for the Talk
• Fundamentals (and a little History)
• Simple Examples/Comparisons
• Related Work and Applications
• Discussion
8
The Continuous Lagrangian
• Q – configuration space
• TQ – tangent (velocity) space
• L:TQ→R
L(q, q )  T (q, q )  U (q)
Lagrangian
Kinetic Energy
Potential Energy
9
Variation of the Lagrangian
• Principle of Least Action = the function, q*(t),
minimizes the integral of the Lagrangian
T
T
0
0
 L(q * (t ), q * (t ))dt   L(q * (t )  q(t ), q * (t )  q (t ))dt
“Calculus of Variations” ~ Lagrange, 1760
T
Variation of trajectory
with endpoints fixed
  L( q (t ), q (t )) dt  0
0
“Hamilton’s Principle” ~1835
10
Continuous Lagrangian
L d  L 
     0
q dt  q 
“Euler-Lagrange Equations”
11
Continuous Mechanics
L(q(t ), q (t ))  T (q, q )  U (q)
L d L   d  

 
(T  U )

q dt q  q dt q 
T U d T



q q dt q
T U  2T
 2T



q 
q
q q qq
qq
 M (q)q  C (q, q )  G(q)  0
12
The Discrete Lagrangian
T h
• L:QxQ→R
 Lq(t ), q(t )dt  L q , q
d
k
k 1
, h
T
 qk 1  qk 
Ld qk , qk 1 , h   L qk ,
h
h


L
qk h qk 1
13
Variation of Discrete Lagrangian
 D2 Ld qk 1, qk , t   D1Ld qk , qk 1 , t   0
“Discrete Euler-Lagrange Equations”
14
Variational Integrator
• Solve for qk 1:
D2 Ld qk 1, qk , h  D1Ld qk , qk 1, h  0

qk
 
qk  qk 1   
h  
 L qk 1 ,
h
  qk
 
  qk 1  qk
 L qk ,
h
 
qk  qk 1  L 
qk  qk 1  L  qk 1  qk
L 
q
,
h

q
,
 k 1

 k 1
   qk ,
q 
h
q 
h
h

 q 
 
h   0
 
 L  qk 1  qk
h   qk ,
h
 q 

0

15
Solution: Nonlinear Root Finder
f (qk 1 )  D2 Ld qk 1, qk , h  D1Ld qk , qk 1 , h  0
i 1
k 1
q
q
i
k 1
i
k 1
i
k 1
f (q )

Df (q )
16
Simple Example: Spring-Mass
1 2 1 2
Lq, q   mx  kx
2
2
• Continuous Lagrangian:
• Euler-Lagrange Equations: L  d L  kx  mx  0
q
dt q
• Simple Integration Scheme:
1 2 k
xk 1  xk  hx k  h
xk
2 m
k
xk 1  x k  h xk
m
17
Simple Example: Spring-Mass
• Discrete Lagrangian:
1  xk 1  xk  1 2
Ld xk , xk 1 , h  m
  kxk
2 
h
 2
2
• Discrete Euler-Lagrange Equations:
D2 Ld xk 1, xk , h  D1Ld xk , xk 1 , h  0
m
 2 xk 1  2 xk  xk 1   kx k  0
h
• Integration:
2

h k
 xk  xk 1
xk 1   2 
m 

18
Comparison: 3 Types of Integrators
• Euler – easiest, least accurate
• Runge-Kutta – more complicated, more
accurate
• Variational – EASY & ACCURATE!
19
Euler h=0.001
Runge-Kutta (ode45)
Variational h=0.001
0.04
0.02
velocity
0
-0.02
-0.04
-0.06
-0.08
0.97
0.98
0.99
1
1.01
1.02
position
1.03
1.04
1.05
1.06
20
0.51
Euler h=0.001
Runge-Kutta (ode45)
Variational h=0.001
0.508
Energy
0.506
0.504
0.502
0.5
0.498
Notice:
0
10
20
30
40
50
time (s)
60
70
80
90
100
•Energy does not dissipate over time
•Energy error is bounded
21
Variational Integrators are
“Symplectic”
• Simple explanation: area of the cat head
remains constant over time
Stein A., Desbrun M. “Discrete geometric mechanics for variational time integrators” in
22
Discrete Differential Geometry. ACM SIGGRAPH Course Notes, 2006
Forcing Functions
• Discretization of Lagrange–d’Alembert
principle
23
Constraints
 D2 Ld qk 1 , qk , h   D1Ld qk , qk 1 , h   g (qk )T k 
f ( zk 1 )  
0
g (qk 1 )


z k 1
z
i 1
k 1
z
 qk 1 



 k 
i
k 1
i
k 1
i
k 1
f (z )

Df ( z )
24
Example: Constrained Double
Pendulum w/ Damping
2
 x
g ( q)     0
 y
x
y
q 
1 
 
 2 
1
 0 
 0 

F (q)  
  K1 



  K 2 
( x, y )
25
Example: Constrained Double
Pendulum w/ Damping
• Constraints strictly enforced, h=0.1
No stabilization heuristics required!
26
Complex Examples From Literature
E. Johnson, T. Murphey, “Scalable Variational Integrators for
Constrained Mechanical Systems in Generalized Coordinates,”
IEEE Transactions on Robotics, 2009
a.k.a “Beware of ODE”
27
Complex Examples From Literature
Variational Integrator
ODE
28
Complex Examples From Literature
29
log
Complex Examples From Literature
Timestep was decreased until error was
below threshold, leading to longer runtimes.
30
Applications
• Marionette Robots
E. Johnson and T. Murphey, “Discrete and Continuous Mechanics for Tree
Represenatations of Mechanical Systems,” ICRA 2008
31
Applications
• Hand modeling
E. Johnson, K. Morris and T. Murphey, “A Variational Approach to Stand-Based Modeling
32
of the Human Hand,” Algorithmic Foundations of Robotics VII, 2009
Applications
• Non-smooth dynamics
Fetecau, R. C. and Marsden, J. E. and Ortiz, M. and West, M. (2003)
Nonsmooth Lagrangian mechanics and variational collision integrators. SIAM
Journal on Applied Dynamical Systems
33
Applications
• Structural Mechanics
Kedar G. Kale and Adrian J. Lew, “Parallel asynchronous variational integrators,”
International Journal for Numerical Methods in Engineering, 2007
34
Applications
• Trajectory optimization
O. Junge, J.E. Marsden, S. Ober-Blöbaum, “Discrete Mechanics and Optimal
Control”, in Proccedings of the 16th IFAC World Congress, 2005
35
Summary
• Discretization of the variational principle
results in symplectic discrete equations of
motion
• Variational integrators perform better than
almost all other integrators.
• This work is being applied to the analysis of
robotic systems
36
Discussion
• What else can this idea be applied to?
– Optimal Control is also derived from a variational
principle (“Pontryagin’s Minimum Principle”).
• This idea should be taught in calculus and/or
dynamics courses.
• We don’t need accurate simulation because
real systems never agree.
37