Some Applications of Automatic Differentiation to Rigid, Flexible, and Constrained Multibody Dynamics D. T. Griffith Sandia National Laboratories J. D.

Slides:



Advertisements
Similar presentations
PLANAR KINETICS OF A RIGID BODY: CONSERVATION OF ENERGY
Advertisements

Automatic Generation and Integration of Equations of Motion for Linked Mechanical Systems D. Todd Griffith, John L. Junkins, James D. Turner Department.
© 2011 Autodesk Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the.
LINCS: A Linear Constraint Solver for Molecular Simulations Berk Hess, Hemk Bekker, Herman J.C.Berendsen, Johannes G.E.M.Fraaije Journal of Computational.
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Physics 430: Lecture 16 Lagrange’s Equations with Constraints
The structure and evolution of stars
LECTURE SERIES on STRUCTURAL OPTIMIZATION Thanh X. Nguyen Structural Mechanics Division National University of Civil Engineering
Dynamics of Articulated Robots Kris Hauser CS B659: Principles of Intelligent Robot Motion Spring 2013.
ME 4135 Fall 2011 R. R. Lindeke, Ph. D. Robot Dynamics – The Action of a Manipulator When Forced.
Lagrangian and Hamiltonian Dynamics
Ch. 4: Velocity Kinematics
Mechanics.
Forward Kinematics.
Dr. Y.P. Daniel Chang Weidong Zhang Velocity Transformation Based Multi-Body Approach for Vehicle Dynamics Abstract: An automobile is a complex close loop.
ME Robotics DIFFERENTIAL KINEMATICS Purpose: The purpose of this chapter is to introduce you to robot motion. Differential forms of the homogeneous.
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Introduction to ROBOTICS
III Solution of pde’s using variational principles
© 2011 Autodesk Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the.
Velocities and Static Force
ME751 Advanced Computational Multibody Dynamics Introduction January 21, 2010 Dan Negrut University of Wisconsin, Madison © Dan Negrut, 2010 ME751, UW-Madison.
Definition of an Industrial Robot
Spring Topic Outline for Physics 1 Spring 2011.
ME451 Kinematics and Dynamics of Machine Systems
Dr. Wang Xingbo Fall , 2005 Mathematical & Mechanical Method in Mechanical Engineering.
ME451 Kinematics and Dynamics of Machine Systems Numerical Solution of DAE IVP Newmark Method November 1, 2013 Radu Serban University of Wisconsin-Madison.
Robot Dynamics – Slide Set 10 ME 4135 R. R. Lindeke, Ph. D.
A PPLIED M ECHANICS Lecture 02 Slovak University of Technology Faculty of Material Science and Technology in Trnava.
Dynamics.  relationship between the joint actuator torques and the motion of the structure  Derivation of dynamic model of a manipulator  Simulation.
Sect 5.4: Eigenvalues of I & Principal Axis Transformation
ME451 Kinematics and Dynamics of Machine Systems Dynamics of Planar Systems December 1, 2011 Solving Index 3 DAEs using Newmark Method © Dan Negrut, 2011.
Sect. 3.4: The Virial Theorem Skim discussion. Read details on your own! Many particle system. Positions r i, momenta p i. Bounded. Define G  ∑ i r i.
ME451 Kinematics and Dynamics of Machine Systems
Scientific Computing Numerical Solution Of Ordinary Differential Equations - Euler’s Method.
Lecture Fall 2001 Physically Based Animation Ordinary Differential Equations Particle Dynamics Rigid-Body Dynamics Collisions.
ME451 Kinematics and Dynamics of Machine Systems Basic Concepts in Planar Kinematics 3.1, 3.2 September 18, 2013 Radu Serban University of Wisconsin-Madison.
In the Hamiltonian Formulation, the generalized coordinate q k & the generalized momentum p k are called Canonically Conjugate quantities. Hamilton’s.
Illustration of FE algorithm on the example of 1D problem Problem: Stress and displacement analysis of a one-dimensional bar, loaded only by its own weight,
Ch. 8: Hamilton Equations of Motion Sect. 8.1: Legendre Transformations Lagrange Eqtns of motion: n degrees of freedom (d/dt)[(∂L/∂q i )] - (∂L/∂q i )
ME451 Kinematics and Dynamics of Machine Systems Introduction to Dynamics 6.1 October 09, 2013 Radu Serban University of Wisconsin-Madison.
ME451 Kinematics and Dynamics of Machine Systems Driving Constraints 3.5 September 30, 2013 Radu Serban University of Wisconsin-Madison.
ME451 Kinematics and Dynamics of Machine Systems Review of Differential Calculus 2.5, 2.6 September 11, 2013 Radu Serban University of Wisconsin-Madison.
Texas A&M University, Department of Aerospace Engineering AN EMBEDDED FUNCTION TOOL FOR MODELING AND SIMULATING ESTIMATION PROBLEMS IN AEROSPACE ENGINEERING.
1 Dynamics Differential equation relating input torques and forces to the positions (angles) and their derivatives. Like force = mass times acceleration.
Lagrangian Mechanics A short overview. Introduction Previously studied Kinematics and differential motions of robots Now Dynamic analysis Inertias, masses,
ME451 Kinematics and Dynamics of Machine Systems
Phy 303: Classical Mechanics (2) Chapter 3 Lagrangian and Hamiltonian Mechanics.
Robotics II Copyright Martin P. Aalund, Ph.D.
The Hamiltonian method
Canonical Equations of Motion -- Hamiltonian Dynamics
Ch. 8: Summary So Far We’re doing the “2 body”, conservative central force problem! 2 bodies (m 1 & m 2 ) with a central force directed along the line.
Chapter 4 Dynamic Analysis and Forces 4.1 INTRODUCTION In this chapters …….  The dynamics, related with accelerations, loads, masses and inertias. In.
Texas A&M University, Department of Aerospace Engineering AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER- LOADING TECHNIQUES.
Velocity Propagation Between Robot Links 3/4 Instructor: Jacob Rosen Advanced Robotic - MAE 263D - Department of Mechanical & Aerospace Engineering - UCLA.
MESB 374 System Modeling and Analysis Translational Mechanical System
Character Animation Forward and Inverse Kinematics
Mathematical & Mechanical Method in Mechanical Engineering
Manipulator Dynamics 1 Instructor: Jacob Rosen
MANE 4240 & CIVL 4240 Introduction to Finite Elements
Manipulator Dynamics 4 Instructor: Jacob Rosen
Department of Aerospace Engineering
Special English for Industrial Robot
Manipulator Dynamics 2 Instructor: Jacob Rosen
© Sharif University of Technology - CEDRA By: Professor Ali Meghdari
Special English for Industrial Robot
Chapter 4 . Trajectory planning and Inverse kinematics
CHAPTER 3-2. Planar Cartesian Kinematics
The structure and evolution of stars
Presentation transcript:

Some Applications of Automatic Differentiation to Rigid, Flexible, and Constrained Multibody Dynamics D. T. Griffith Sandia National Laboratories J. D. Turner Dynacs J. L. Junkins Texas A&M University ASME 2005 International Design Engineering Technical Conferences September 24, 2005

2 Folk theorem The Chain Rule, when applied by hand recursively to even moderately dimensioned nonlinear systems, for more than two orders of differentiation, stops being fun around age 45. Empirical Evidence: The master differentiator, James Turner tried to automate the process completely during his late forties.

3 Presentation Outline Introduction to Automatic Differentiation Modeling Rigid and flexible multibody systems Constrained multibody systems Automatic generation of exact PDE/ODEs and BCs for hybrid systems validation of approximate solutions Numerical Examples

4 Comparison of Computerized Differentiation Approaches Symbolic Differentiation –Very useful and popular –Matlab, Maple, Mathcad, Macsyma –Pros: Can view expressions & control simplification/ approximation on screen –Cons: Result in lengthy expressions and require code generation/porting/de-bugging Automatic Differentiation (AD) –Generally, not as well-known as Symbolic Differentiation –Recursive, automated use of Chain Rule … –Begins with FORTRAN, C or …code that computes the functions to be differentiated –ADIFOR, AD01, ADOL-C, AUTODERIVE, OCEA –Pro: Derivatives computed & possibly coded without (*much*) user intervention –Historical Cons: Limited order of differentiation and also, usually requires code generation OCEA is a novel AD approach that enables 1 st - through 4 th -order derivatives, with zero code generation required. There are very important implications in many fields, including multi-body dynamics.

5 Overview of automatic differentiation by OCEA (1) –OCEA (Object Oriented Coordinate Embedding Method) –Define new data structure (OCEA second-order method), for example for the function scalar f : –All intrinsic operators ( +, -, *, /, = ) are overloaded to enable, for example, addition and multiplication of OCEA variables. Examples: You code: OCEA computes: –Composite Functions (chain rule, use recursively, numerically!): You code: OCEA computes: –Let’s take a look at an illustrative example….

6 Overview of automatic differentiation by OCEA (2) A second-order OCEA example Suppose: OCEA-FORTRAN ! X(1) = x, X(2) = y Type(EB):: X(2) Type(EB):: F1, F2, F3 Real(DP):: S_F3, JAC_F3(2), HES_F3(2,2) ! Code Functions F1 = X(1)**3 + X(2) F2 = (X(2)**2)*sin( X(1) ) F3 = F1 + F2 S_F3 = F3 ! Extract function JAC_F3 = F3 ! Extract Jacobian (2x1) HES_F3 = F3 ! Extract Hessian (2x2) Declare OCEA independent variables, type EB Declare OCEA dependent variables, type EB Declare function and partial derivative arrays, type DP Code functions Extract partial derivative information function Jacobian Hessian We desire to compute f 3 and most importantly its partials: You never had to derive, code, or debug:

7 Equation of motion formulation using automatic differentiation Lagrange’s equations: subject to Lagrangian: T, V: kinetic and potential energy q: generalized coordinates Q: generalized force C(q): constraint Jacobian matrix : Lagrange multipliers Of course, many choices for equation of motion formulation exist. The OCEA approach is broadly applicable, however, the utility of automatic differentiation can be immediately seen and appreciated for implementing Lagrange’s Equations…

8 Implementation of Lagrange’s Equations: A Direct Approach (1) Automatic Differentiation (AD) Specified & coded AD or specified & coded Many numerical methods AD or specified & coded Mass matrix and its time derivative extracted as second-order Automatic Differentiation of T …

9 Implementation of Lagrange’s Equations: A Direct Approach (2) Can also compute constraint matrix, C, automatically for holonomic type constraint. Now forming the equations: Accelerations computed after generating or prescribing all terms here. Now, can proceed with numerical integration…….

10 Illustrative Example: Spring Pendulum (1) r Lagranges Eqs: Directly invoke ODE solver in OCEA to get solution W/O hand derivation, coding, or checkout … only derive & code T, V

11 Spring Pendulum (2) SUBROUTINE SPRING_PEND_EQNS( PASS, TIME, X, DXDT, FLAG ) USE EB_HANDLING IMPLICIT NONE **************************************** !.....LOCAL VARIABLES TYPE(EB)::L, T, V! LAGRANGIAN, KINETIC, POTENTIAL REAL(DP):: M, K! MASS AND STIFFNESS VALUES REAL(DP), DIMENSION(NV):: JAC_L REAL(DP), DIMENSION(NV,NV):: HES_L **************************************** ! X(1) = Q(1) = R, X(2) = Q(2) = THETA, X(3) = dR/dt, X(4) = dTHETA/dt R0 = 0.55D0 GRAV = 9.81D0 T = 0.5D0*M*(X(3)**2 + X(1)**2*X(4)**2) ! DEFINE KE V = 0.5D0*K*(X(1)-R0)**2 + M*GRAV*(R0-X(1)*COS(X(2))) ! DEFINE PE L = T – V! DEFINE LAGRANGIAN FUNCTION JAC_L = L! EXTRACT dL/(dq,dqdot) JAC_L_Q = JAC_L(1:NV/2)! EXTRACT dL/dq HES_L = L ! EXTRACT 2nd ORDER PARTIALS OF LAGRANGIAN MASS = HES_L(NV/2+1:NV,NV/2+1:NV)! EXTRACT MASS MATRIX MASSDOT = HES_L(NV/2+1:NV,1:NV/2)! EXTRACT MDOT ! QDOTDOT = INV(MASS)*(- MASSDOT*Q + JAC_L_Q ) ! SEE PAPER … **************************************** DXDT(1)%E = X(3)%E! RDOT DXDT(2)%E = X(4)%E! THETADOT DXDT(3)%E = QDOTDOT(1)! RDOTDOT DXDT(4)%E = QDOTDOT(2)! THETADOTDOT END SUBROUTINE SPRING_PEND_EQNS

12 Geometry of Multiple Flexible Link Configuration Note from the figure of a series of deformed links that the local coordinate frames attached to the links are defined such that the elastic deformation vanishes at the endpoints. This choice greatly simplifies the “downstream” velocity expressions.

13 Kinetic Energy Generalization for Flexible Links Assumed Modes Method used to transform the kinetic energy expression into a form which can be tamed by Lagrange’s Equations. The details can be found in the paper. Along with the potential energy expression, we can define the Lagrangian and proceed to generate the equations of motion…………..

14 Example: Closed-chain 5-link Manipulator (1) The Lagrangian expressions are developed for each link and summed to form the total system Lagrangian. Additionally, we specify two holonomic constraints of the form: And, we specify damping at all joints with the exception of the base end of link 5. OCEA automatically generates the equations of motion for the constrained system 5 link manipulator g D

15 Example: Closed-chain 5-link Manipulator (2)

16 Example: 4-link Planar Truss (1) The Lagrangian expressions are developed for each link and summed to form the total system Lagrangian. Now, we consider translation as well. Additionally, we specify two holonomic constraints of the form: OCEA automatically generates the equations of motion for the constrained system 4-link planar truss with “springs” across diagonal

17 Example: 4-link Planar Truss (2) Starting with zero flexible energy initially, we can assess the suitability of rigid body modeling. Question: How much flexibility exists in the system?

18 Satisfaction of Constraint Equations for Planar Truss: Position level constraints

19 Satisfaction of Constraint Equations for Planar Truss: Velocity level constraints

20 Accuracy of Solutions: Comparison with Hard-coded Equations of Motion for Flexible Double Pendulum(1) Angular coordinates and angular velocities

21 Accuracy of Solutions: Comparison with Hard- coded Equations of Motion for Double Pendulum(2 ) Flexible coordinates for link one

22 Methods for Validating Solution Accuracy 1) Testing special cases that have exact analytical solutions 2) Evaluation of error in exact motion integrals 3) The method of manufactured solutions 4) The method of “nearby problems” Method #1 is a standard approach to validating solution accuracy. Here we look at a simple system which has an exact analytical solution. Methods #3 and #4 rely upon computing analytical source terms (fictitious generalized forces) by inverse dynamics which define a benchmark problem for validation studies. The difference is that with method #3 a benchmark solution is chosen a priori and may have no important physical meaning. With method #4, a benchmark solution is constructed as a neighbor of a candidate approximate solution for the motion being studied and thus has physical meaning.

23 Methods for Validating Solution Accuracy: Computing fictitious generalized forces ODEs: PDEs: where As can be seen, we need exact dynamical relationships for the system ODE/PDEs and boundary conditions (not shown here) in order to compute these error terms. We address this issue in the following slides……….

24

25

26

27 Addendum to JLJ Folk Theorem Generating the exact ODE/PDE and boundary conditions for a distributed parameter system by hand or symbolic manipulation stops being fun at age 29 !

28 Generating Exact PDE/ODEs and BCs for Many Body Distributed Parameter Systems Lagrangian: Discrete/ODE: Flexible/PDE: BCs: You code this. OCEA/AD computes these.

29 Generating Exact ODEs Lagrangian: You code this. OCEA/AD computes these.

30 Generating Exact PDEs Lagrangian: You code this. OCEA/AD computes these.

31 Generating Exact PDE/ODEs: Double Pendulum We can hard-code the exact equations of motion for the double pendulum and compare the difference with between these and the OCEA derived numerically evaluated equations.

32 Errors in ODEs: Double Pendulum

33 Errors in PDEs: Double Pendulum Link one Link two

34 Summary and Conclusions Automatic Differentiation has broad potential in Dynamics and Control Automating differentiation by operator overloading is a beautiful idea whose time has come – the applications are endless! Ideal for implementing Lagrange’s Equations – this presentation provides some simple illustrations – a few important first steps along the path. No hand derivation effort beyond code specifying the building of the Lagrangian, constraints and external forces is required. OCEA also gives rise to new methods for solving differential equations – the time derivative computations can be automated, so that formal analytical continuation is easily done in lieu of traditional Runge-Kutta methods, for example. Can automatically derive systems of PDEs and BCs for use in validating the accuracy of approximate solutions of flexible systems corresponding to the same modeling assumptions?