Chapter 3 Numerical Methods

Similar documents
Chapter 3 Numerical Methods

Video 3.1 Vijay Kumar and Ani Hsieh

Nonholonomic Constraints Examples

Advanced Dynamics. - Lecture 4 Lagrange Equations. Paolo Tiso Spring Semester 2017 ETH Zürich

(W: 12:05-1:50, 50-N202)

EN Nonlinear Control and Planning in Robotics Lecture 2: System Models January 28, 2015

Lecture Schedule Week Date Lecture (M: 2:05p-3:50, 50-N202)

Control of Mobile Robots

Physics 6010, Fall 2016 Constraints and Lagrange Multipliers. Relevant Sections in Text:

Numerical Methods for Inverse Kinematics

Chapter 7 Control. Part State Space Control. Mobile Robotics - Prof Alonzo Kelly, CMU RI

5 Handling Constraints

Lagrange Multipliers

Video 1.1 Vijay Kumar and Ani Hsieh

Numerical Methods for Rigid Multibody Dynamics

DYNAMICS OF PARALLEL MANIPULATOR

The Jacobian. Jesse van den Kieboom

Part of the advantage : Constraint forces do no virtual. work under a set of virtual displacements compatible

Euler-Lagrange's equations in several variables

Robot Dynamics II: Trajectories & Motion

Introduction MEAM 535. What is MEAM 535? Audience. Advanced topics in dynamics

In most robotic applications the goal is to find a multi-body dynamics description formulated

Analytical Dynamics: Lagrange s Equation and its Application A Brief Introduction

Multibody simulation

Robotics, Geometry and Control - A Preview

= U / x. That is, U d = m x x dt FRIDAY'S QUIZ QUESTION AN EXAMPLE IN THE CALCULUS OF VARIATIONS

Lecture IV: Time Discretization

Planar Multi-body Dynamics of a Tracked Vehicle using Imaginary Wheel Model for Tracks

Trajectory Planning from Multibody System Dynamics

Video 2.1a Vijay Kumar and Ani Hsieh

CONTROL OF THE NONHOLONOMIC INTEGRATOR

Lecture 2: Controllability of nonlinear systems

5. Nonholonomic constraint Mechanics of Manipulation

Lecture Notes Multibody Dynamics B, wb1413

AN INTRODUCTION TO LAGRANGE EQUATIONS. Professor J. Kim Vandiver October 28, 2016

Modeling and Solving Constraints. Erin Catto Blizzard Entertainment

Answer Key for Exam #2

Physics 6010, Fall Relevant Sections in Text: Introduction

Robotics. Dynamics. University of Stuttgart Winter 2018/19

Lagrangian Mechanics I

1 Computing with constraints

A motion planner for nonholonomic mobile robots

Dynamics. describe the relationship between the joint actuator torques and the motion of the structure important role for

Review for Exam 2 Ben Wang and Mark Styczynski

the EL equation for the x coordinate is easily seen to be (exercise)

How to Simulate a Trebuchet Part 1: Lagrange s Equations

Modelling and Control of Mechanical Systems: A Geometric Approach

Dynamics. Basilio Bona. Semester 1, DAUIN Politecnico di Torino. B. Bona (DAUIN) Dynamics Semester 1, / 18

Torque and Rotation Lecture 7

Chapter 2 Math Fundamentals

In this section of notes, we look at the calculation of forces and torques for a manipulator in two settings:

Lecture V: The game-engine loop & Time Integration

FINAL EXAM GROUND RULES

Robust Control of Cooperative Underactuated Manipulators

Physics 106a, Caltech 16 October, Lecture 5: Hamilton s Principle with Constraints. Examples

Inverse differential kinematics Statics and force transformations

Trajectory-tracking control of a planar 3-RRR parallel manipulator

Robotics. Dynamics. Marc Toussaint U Stuttgart

Robot Control Basics CS 685

THEODORE VORONOV DIFFERENTIAL GEOMETRY. Spring 2009

Numerical method for approximating the solution of an IVP. Euler Algorithm (the simplest approximation method)

Robotics & Automation. Lecture 25. Dynamics of Constrained Systems, Dynamic Control. John T. Wen. April 26, 2007

Ordinary Differential Equations (ODEs)

Robotics 2 Robot Interaction with the Environment

Bindel, Spring 2017 Numerical Analysis (CS 4220) Notes for So far, we have considered unconstrained optimization problems.

Chapter 4 Statics and dynamics of rigid bodies

Basic Math for

CHAPTER 10: Numerical Methods for DAEs

Numerical Optimization

Upon successful completion of MATH 220, the student will be able to:

1 Trajectory Generation

Kinematics. Chapter Multi-Body Systems

Chapter 7 Control. Part Classical Control. Mobile Robotics - Prof Alonzo Kelly, CMU RI

A MULTI-BODY ALGORITHM FOR WAVE ENERGY CONVERTERS EMPLOYING NONLINEAR JOINT REPRESENTATION

AM 205: lecture 18. Last time: optimization methods Today: conditions for optimality

Trajectory-based optimization

8 Velocity Kinematics

In the presence of viscous damping, a more generalized form of the Lagrange s equation of motion can be written as

Reduced-order Forward Dynamics of Multi-Closed-Loop Systems

Artificial Intelligence & Neuro Cognitive Systems Fakultät für Informatik. Robot Dynamics. Dr.-Ing. John Nassour J.

Analytical Mechanics for Relativity and Quantum Mechanics

Numerical Algorithms as Dynamical Systems

ANALYTICAL MECHANICS. LOUIS N. HAND and JANET D. FINCH CAMBRIDGE UNIVERSITY PRESS

Robotics 1 Inverse kinematics

Circular motion. Aug. 22, 2017

DYNAMICS OF SERIAL ROBOTIC MANIPULATORS

MULTIVARIABLE CALCULUS, LINEAR ALGEBRA, AND DIFFERENTIAL EQUATIONS

Lecture 9 - Rotational Dynamics

Game Physics. Game and Media Technology Master Program - Utrecht University. Dr. Nicolas Pronost

Trajectory Planning of Planar Tracked Vehicles

GENERAL FORMULATION OF AN EFFICIENT RECURSIVE ALGORITHM BASED ON CANONICAL MOMENTA FOR FORWARD DYNAMICS OF CLOSED-LOOP MULTIBODY SYSTEMS

Physics 106a, Caltech 4 December, Lecture 18: Examples on Rigid Body Dynamics. Rotating rectangle. Heavy symmetric top

LINEAR AND NONLINEAR PROGRAMMING

Geometric Mechanics and Global Nonlinear Control for Multi-Body Dynamics

Segment Prismatic 1 DoF Physics

Introduction to Robotics

Optimal control problems with PDE constraints

Generalized Forces. Hamilton Principle. Lagrange s Equations

Robotics I Kinematics, Dynamics and Control of Robotic Manipulators. Velocity Kinematics

Coordinates, phase space, constraints

Transcription:

Chapter 3 Numerical Methods Part 3 3.4 Differential Algebraic Systems 3.5 Integration of Differential Equations 1

Outline 3.4 Differential Algebraic Systems 3.4.1 Constrained Dynamics 3.4.2 First and Second Order Constrained Kinematic Systems 3.4.3 Lagrangian Dynamics 3.4.4 Constraints Summary 3.5 Integration of Differential Equations 2

Outline 3.4 Differential Algebraic Systems 3.4.1 Constrained Dynamics 3.4.2 First and Second Order Constrained Kinematic Systems 3.4.3 Lagrangian Dynamics 3.4.4 Constraints Summary 3.5 Integration of Differential Equations 3

3.4.1.1. Augmented Systems Consider a differential equation with n states subject to m constraints: x = fxu (, ) cx ( ) = 0 Linear equations could be substituted into the DE. Nonlinear is the case that matters to us. What does it mean? Both equations cannot be correct It means the DE applies in the subspace of R n that satisfies the constraints. The subspace is known as the constraint manifold. 4 4

3.4.1.3 Sequential Approach First Approach: Integrate the unconstrained DE one time step. x k+ 1 = x k + x k = x k + fxu (, ) t Use result as initial conditions for a rootfinding problem that enforces constraints cx ( ) Should work but = 0 What if rootfinding step reverses the DE step? Did it move by t or < t or > t? The two equations can disagree with each other. They need to be decoupled. Idea: Make the DE step satisfy the constraints to first order. 5

3.4.1.4 Projection Approach Second Approach: Remove the component of the state derivative out of the constraint tangent plane. Equivalently, project it into the tangent plane. Write step in terms of feasible and infeasible component: x = x + x Remove the component out of the tangent plane: x T T c x [ cx c x ] 1 c x x The matrix P C ( M) = MM [ T M ] 1 projection on the column space of M. = M T performs a Here we project onto colspace of cc xx TT - which is the rowspace of cc xx (the Constraint Jacobian). So this is the component that violates the constraints to first order. 6

Outline 3.4 Differential Algebraic Systems 3.4.1 Constrained Dynamics 3.4.2 First and Second Order Constrained Kinematic Systems 3.4.3 Lagrangian Dynamics 3.4.4 Constraints Summary 3.5 Integration of Differential Equations 7

3.4.2.1 Augmented First Order Systems Third approach: Remove the infeasible component right in the differential equation. For a feasible perturbation: The infeasible part is some unknown combination of the T constraint gradients. Let it be of the form: x = c x λ t Remove the infeasible component with: x c x x = 0 T = fxu (, ) t x = fxu (, ) t c x λ t Divide both equations by t and pass to the limit: T x + c x λ = fxu (, ) c x x = 0 8

3.4.2.2 Solving The Eqns of Motion This can be written in matrix form: T x + c x λ = fxu (, ) c x x = 0 I c x T c x 0 x λ = f ( x, u) 0 We will see this Again in Lagrangian Dynamics c x To solve, multiply 1 st by : T c x x + c x c x λ = cx fxu (, ) By 2 nd equation c x x = 0 so solve for λ: λ = T ( c x c x ) 1 c x fxu (, ) Right Pseudo Inverse 9

3.4.2.2 Solving The Eqns of Motion Substitute for λ in first equation: c x T T x = [ I c x ( cx c x ) 1 ]fxu (, ) The matrix: c x T T T T P N ( c x ) = I P C ( c x ) = I c x ( cx c x ) 1 Projects the state derivative directly into the nullspace of the constraints i.e. directly into the tangent plane. By simply removing the component normal to the tangent plane (i.e. a weighted sum of the gradients). 10

3.4.2.3 Holonomic Constraints These are of the form: It is useful to differentiate constraints sometimes. Differentiating wrt time gives our standard form for a velocity constraint: If the DE has a holonomic constraint on xx, this implies that the derivative (xx,) must be constrained too: In fact it must be orthogonal to the constraint gradient. 11

3.4.2.4 Nonholonomic Constraints Consider a form that depends on the state derivative: Differentiate to get: In general, all higher state derivatives are constrained too. A special form that is relevant to us is: This does not need to be differentiated to use. 12

Outline 3.4 Differential Algebraic Systems 3.4.1 Constrained Dynamics 3.4.2 First and Second Order Constrained Kinematic Systems 3.4.3 Lagrangian Dynamics 3.4.4 Constraints Summary 3.5 Integration of Differential Equations 13

Compte Joseph-Louis Lagrange Greatest mathematician of 18 century? Advised by Leonhard Euler (who was advised by Bernoulli) Notable students Joseph Fourier Simeon Poisson Reformulated Newtonian Mechanics Mécanique Analytique (Analytical Mechanics) (1788). Invented: Theory of Differential Equations Calculus of variations 1736-1813 Italian-French 14

Vehicle on Terrain Video 15

3.4.3.1 Equations of Motion Embedded Form: Eliminates constraint forces Fewest dof, fewest equations Nonlinear, complex equations Popular for manipulators Augmented Form: Redundant coordinates Explicit constraint forces Simpler equations Suitable for automation Real wheels do slip. Hence nonholonomic constraints are not really no slip constraints, they are slip like this constraints. 16

3.4.3.1 Equations of Motion One Body Equations of motion are simple when the generalized coordinates (q) are absolute (inertial). Coordinates for one body: Equation of motion: Unknowns Eqn A mass external force constraint force Segment forces into those known and those unknown 17

3.4.3.1 Applied and Constraint Forces Constraint forces are generated to oppose motion in the disallowed directions. The net force (parallel to acceleration) is therefore not in the direction of the applied force. QQ eeeeee qq QQ cccccc QQ cccccc 18

Center of Mass Reference Choose Center of mass as the body reference point. Then: 2x2 identity Polar moment of inertia 19

Underdetermined System n bodies # of equations: 3 n: one for each element of xx # of unknowns: 3 n generalized accelerations xx 3 c constraint forces 3 n generalized velocities xx 3 n generalized coordinates xx Where do the other 3c constraints come from? The constraints Where do the velocities and positions come from? Integration 20

3.4.3.2 Differentiated Constraints - Holonomic The 2 nd derivative of a holonomic constraint is: Define: Then we have: This makes the differentiated constraint look like Newton s 2 nd law. 21

3.4.3.2 Differentiated Constraints-Nonholonomic Also, for a nonholonomic constraint: Define: Then the constraint becomes: Once again, this makes the differentiated constraint look like Newton s 2 nd law. 22

3.4.3.2 Differentiated Constraints-General Both earlier forms are of the form: Eqn B holonomic nonholonomic 23

3.4.3.3 Principle of Virtual Work Credited to Aristotle(!) and/or Bernoulli. Work: The product of a force and a displacement in the direction of the force. Virtual Work: As above but either force or displacement is not real. 24

3.4.3.3 Lagrange Multipliers We will require the virtual work performed by constraint forces to vanish. This is accomplished by writing: Why? 25 Columns of C T (rows of C) are prohibited directions. Constraint forces are confined above to those prohibited directions. Dot product of constraint forces with any feasible displacement will be zero. Constraint Jacobian Eqn C Displacements parallel to the the rows of J are infeasible.

3.4.3.4 Augmented System Recall the original equations of motion: Substitute from Eqn C: Forces in Infeasible Directions Combine this with Eqn B: Eqn A Eqn A1 Feasible Accelerations Eqn B 26

Augmented System We now have c extra equations and have replaced the constraint forces with the Lagrange Multipliers as unknowns. Augmented Mass Matrix Augmented Force Vector unknowns Solve and then integrate acceleration twice. 27

Outline 3.4 Differential Algebraic Systems 3.4.1 Constrained Dynamics 3.4.2 First and Second Order Constrained Kinematic Systems 3.4.3 Lagrangian Dynamics 3.4.4 Constraints Summary 3.5 Integration of Differential Equations 28

3.4.4.1 Constraint Trim Due to inevitable numerical error, enforcing differentiated constraints does not enforce the original constraints. Lt f(t) be the state derivative computed by integrating the second order system: The first order system is subject to the original constraints: xx generated by integration will likely not satisfy these constraints, so fix it with the following before integration: 29

3.4.4.2 Drift Control Constraints will drift over time since only derivatives are enforced. Elegant solution is to add compensation pseudoforces in PID loops Gains relate to time constants: tt ττ 30

3.4.4.4 Initial Conditions Differentiated constraints will hold the constraints constant rather than at zero. So they must start at zero to stay at zero. Two approaches. 1) Start from zero velocity state which automatically satisfies constraints. Then activate system with forces. 2) Start from moving state but guarantee constraints are satisfied by solving the rootfinding problem. 31

Overconstraint Typical of wheeled vehicles. Leads to collapse of nullspace. No motion possible. or constraints do work. Few approaches: 1) Use any two independent constraints. 2) Compute and equivalent bicycle model of constraints for each cycle. 3) Use an equation solver that tolerates the situation It may or may not be appropriate to let the overconstrained system slow down. 32

Redundant Constraints Example: two rear wheels of car generate the same constraint equation. Leads to singularity of the system. Good approach is avoid inversion. Compute least residual norm: Conjugate gradient algorithm 33

3.4.4.5 Basic Rigid Body Constraint Two bodies have poses known with respect to the world frame. If there is a rotary constraint, frame p is at the pivot point. p i j ρρ ii w ρρ jj 34

Rigidity Constraint Express this in terms of pose composition as follows: Holonomic of the form: Equivalent to: 35

Rigidity Constraint Gradient contains two elements: The first is a right pose Jacobian: 36

Rigidity Constraint The second is more complicated. By the chain rule: This is: Left Pose Jacobian Inverse Pose Jacobian 37

Rigidity Constraint Total Constraint Jacobian: Where Time Derivative: Where 38

Rotary Joint Constraint Let p denote a reference frame attached to the point of rotation. The constraints for the rotary joint at the front wheel can be expressed as the first two elements of the equation: p means axis of rotation Rewritten in terms of generalized coordinates. Unknowns Knowns 39

This gives: Rotary Joint Constraint Minus sign Hence, total constraint Jacobian is: w w x i = ( x p xi ) w w y i = ( y p yi ) w w x j = ( x p xj ) w w y j = ( y p yj ) 40

Time Derivative: Rotary Joint Constraint ω i ω j ω i w = = ω j w = = θ i w w θ j Fd vector is: F d 41

Outline 3.4 Differential Algebraic Systems 3.4.1 Constrained Dynamics 3.4.2 First and Second Order Constrained Kinematic Systems 3.4.3 Lagrangian Dynamics 3.4.4 Constraints Summary 3.5 Integration of Differential Equations 42

Summary - DAEs Simplest formulation for some problems. Only practical formulation for some problems. Can be really fast for mobile robots. Can be written in completely general way to simulate anything. 43

Outline 3.4 Differential Algebraic Systems 3.5 Integration of Differential Equations 3.5.1 Dynamic Models in State Space 3.5.2 Integration of State Space Models 44

3.5.1 State Space State space = a minimal set of variables which can be used to predict future state given inputs: Number of initial conditions in a differential equation. 45

3.5.1 Dynamic Models in State Space Predicting the future involves predicting trajectories caused by motion commands. General case: x () t = fxt ( ()ut, ()t, ) Known as the State Space representation of the system The inputs u are a new addition. Known as a forced system although the inputs need not be forces. 46

Constraints The dynamics of wheeled mobile robots are constrained dynamics in 3D of systems of rigid bodies. Often must consider: Actuator kinematics Lateral and longitudinal wheel slip (or nonslip). Terrain following. 47

Outline 3.4 Differential Algebraic Systems 3.5 Integration of Differential Equations 3.5.1 Dynamic Models in State Space 3.5.2 Integration of State Space Models Summary 48

3.5.2.1 Euler s Method For the nonlinear differential equation: Seems reasonable to use the definition of integration: In discrete time: x () t = f ( x, t) xt ( + t) = xt () + f ( x, t) t x k 1 + = x k + f ( x k, t k ) t k Works well if f() is nearly linear. Errors are 2nd order. 49

3.5.2.2 Midpoint Method Let s try for a 2nd order approximation. A 2nd order Taylor series is: h= t xt ( + h) xt () + f ( x, t)h + dt df x, t ( ) 2 h ---- 2 Which can be written as (factor out an h): df ( x, t) h xt ( + h) xt () f ( x, t) + dt 2 -- + h Now, the part in brackets is the first degree Taylor series for the first time derivative evaluated at the midpoint of the step because: f ( x( t + h 2), t + h 2) f ( x, t) + df ( x, t) h -- dt 2 Eqn A 50

3.5.2.2 Midpoint Method The derivative df ( x, t ) dt is typically expensive computationally. Instead, invert the last formula to produce a finite difference approximation: df ( x, t) h -- f ( x( t + h 2), t+ h 2) f ( x, t) dt 2 Substituting into Eqn A produces: And, the value of x at the midpoint can be approximated: This gives finally: xt ( + h) xt () + hf ( x( t + h 2), t+ h 2) xt ( + h 2) xt () + f ( x, t) ( h 2) xt ( + h) xt () + hf [ x() t + f ( x, t) ( h 2), t + h 2] 51

3.5.2.2 Midpoint Method For future reference, this is best written as: k= xt () + f ( x, t) ( h 2) xt ( + h) xt () + hf ( k, t + h 2) x Euler Step Midpoint Step 52 t t+h/2 t+h

Example Example, integrate a general curve with respect to distance: xs () ys () θ() s = x0 ( ) y0 ( ) θ( 0) + s 0 cos θ() s sinθ() s κ() s ds In discrete time: x y θ k+ 1 = x y θ k + cosθ sinθ κ k s Specific curvature profile is constant (arc): κ() s = κ 0 = 1 53

Example Midpoint Algorithm Reduces Error By a Factor Of 20 54

3.5.2.3 (4th Order) Runge Kutta Closest thing to a definitive algorithm for integration. This can be 1000 times more accurate than Euler s method. 55

Outline 3.4 Differential Algebraic Systems 3.5 Integration of Differential Equations 3.5.1 Dynamic Models in State Space 3.5.2 Integration of State Space Models Summary 56

Summary This is worth knowing about. A few lines of code can be the difference between: 100 mm of error after moving 10 meters 0.1 mm of error after moving 10 meters 57