Optimal Control Techniques for Dynamic Walking

Similar documents
CasADi tutorial Introduction

Real-Time Optimization for Fast Nonlinear MPC: Algorithms, Theory, and Applications

Introduction to Optimization

Introduction to Optimization Problems and Methods

Fast Direct Multiple Shooting Algorithms for Optimal Robot Control

Contents. I Basics 1. Copyright by SIAM. Unauthorized reproduction of this article is prohibited.

Inverse KKT Motion Optimization: A Newton Method to Efficiently Extract Task Spaces and Cost Parameters from Demonstrations

Optimization III: Constrained Optimization

Programming, numerics and optimization

LECTURE 13: SOLUTION METHODS FOR CONSTRAINED OPTIMIZATION. 1. Primal approach 2. Penalty and barrier methods 3. Dual approach 4. Primal-dual approach

Department of Mathematics Oleg Burdakov of 30 October Consider the following linear programming problem (LP):

Trajectory Optimization

Theoretical Concepts of Machine Learning

Introduction to Optimization

APPLIED OPTIMIZATION WITH MATLAB PROGRAMMING

Constrained Optimization COS 323

Chapter 3 Numerical Methods

Unconstrained Optimization Principles of Unconstrained Optimization Search Methods

Chapter II. Linear Programming

DIRECT SEQUENTIAL DYNAMIC OPTIMIZATION WITH AUTOMATIC SWITCHING STRUCTURE DETECTION. Martin Schlegel, Wolfgang Marquardt 1

Nonlinear Programming

Maximizing an interpolating quadratic

qpoases - Online Active Set Strategy for Fast Linear MPC

Nonlinear Model Predictive Control Using Multiple Shooting Combined with Collocation on Finite Elements

Modern Methods of Data Analysis - WS 07/08

Preface. and Its Applications 81, ISBN , doi: / , Springer Science+Business Media New York, 2013.

Solving Optimal Control Problems with ACADO Toolkit

arxiv: v1 [math.oc] 2 Jul 2017

Animation Lecture 10 Slide Fall 2003

25. NLP algorithms. ˆ Overview. ˆ Local methods. ˆ Constrained optimization. ˆ Global methods. ˆ Black-box methods.

Applied Lagrange Duality for Constrained Optimization

Computational Optimization. Constrained Optimization Algorithms

Constrained and Unconstrained Optimization

Computational Methods. Constrained Optimization

Linear methods for supervised learning

Local and Global Minimum

A Short SVM (Support Vector Machine) Tutorial

Data Mining Chapter 8: Search and Optimization Methods Fall 2011 Ming Li Department of Computer Science and Technology Nanjing University

Programs. Introduction

Ellipsoid Algorithm :Algorithms in the Real World. Ellipsoid Algorithm. Reduction from general case

Introduction to Linear Programming. Algorithmic and Geometric Foundations of Optimization

Module 1 Lecture Notes 2. Optimization Problem and Model Formulation

Convex Optimization. Lijun Zhang Modification of

Lagrange multipliers. Contents. Introduction. From Wikipedia, the free encyclopedia

Problem characteristics. Dynamic Optimization. Examples. Policies vs. Trajectories. Planning using dynamic optimization. Dynamic Optimization Issues

Today. Golden section, discussion of error Newton s method. Newton s method, steepest descent, conjugate gradient

Lecture VI: Constraints and Controllers. Parts Based on Erin Catto s Box2D Tutorial

A Brief Look at Optimization

Panagiotis Tsiotras. Dynamics and Control Systems Laboratory Daniel Guggenheim School of Aerospace Engineering Georgia Institute of Technology

5 Machine Learning Abstractions and Numerical Optimization

CS 395T Lecture 12: Feature Matching and Bundle Adjustment. Qixing Huang October 10 st 2018

Problem Set #3 (With Corrections)

David G. Luenberger Yinyu Ye. Linear and Nonlinear. Programming. Fourth Edition. ö Springer

Trajectory Optimization for. Robots

OPTIMIZATION METHODS

A FACTOR GRAPH APPROACH TO CONSTRAINED OPTIMIZATION. A Thesis Presented to The Academic Faculty. Ivan Dario Jimenez

Jane Li. Assistant Professor Mechanical Engineering Department, Robotic Engineering Program Worcester Polytechnic Institute

Introduction to Multi-body Dynamics

Convex Programs. COMPSCI 371D Machine Learning. COMPSCI 371D Machine Learning Convex Programs 1 / 21

In other words, we want to find the domain points that yield the maximum or minimum values (extrema) of the function.

A coupling of discrete and continuous optimization to solve kinodynamic motion planning problems 1

Augmented Lagrangian Methods

From Theory to Application (Optimization and Optimal Control in Space Applications)

Virtual Manikin Controller Calculating the movement of a human model Master s thesis in Complex Adaptive Systems DANIEL GLEESON

USING OPTIMIZATION TECHNIQUES FOR THE DESIGN AND CONTROL OF FAST BIPEDS

Chapter Multidimensional Gradient Method

Kinematics. Why inverse? The study of motion without regard to the forces that cause it. Forward kinematics. Inverse kinematics

Demo 1: KKT conditions with inequality constraints

Trajectory Optimization

Numerical Method in Optimization as a Multi-stage Decision Control System

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Lecture Notes: Constraint Optimization

Sequential Coordinate-wise Algorithm for Non-negative Least Squares Problem

Characterizing Improving Directions Unconstrained Optimization

PRIMAL-DUAL INTERIOR POINT METHOD FOR LINEAR PROGRAMMING. 1. Introduction

New features in dynamic optimization with EcosimPro

A convex, smooth and invertible contact model for trajectory optimization

Parameter Estimation in Differential Equations: A Numerical Study of Shooting Methods

Sensitivity computation based on CasADi for dynamic optimization problems

Augmented Lagrangian Methods

Convex Optimization and Machine Learning

Introduction to optimization methods and line search

Recent developments in simulation, optimization and control of flexible multibody systems

Structure and Synthesis of Robot Motion

Dynamic Optimization in JModelica.org

CS205b/CME306. Lecture 9

SIMULTANEOUS PERTURBATION STOCHASTIC APPROXIMATION FOR REAL-TIME OPTIMIZATION OF MODEL PREDICTIVE CONTROL

VIBRATION ISOLATION USING A MULTI-AXIS ROBOTIC PLATFORM G.

Lecture VI: Constraints and Controllers

Introduction to Constrained Optimization

Can we quantify the hardness of learning manipulation? Kris Hauser Department of Electrical and Computer Engineering Duke University

15.082J and 6.855J. Lagrangian Relaxation 2 Algorithms Application to LPs

Convex Optimization CMU-10725

Interior Point I. Lab 21. Introduction

Robot Mapping. TORO Gradient Descent for SLAM. Cyrill Stachniss

ACADO TOOLKIT - AUTOMATIC CONTROL AND DYNAMIC OPTIMIZATION

Parallel Robots. Mechanics and Control H AMID D. TAG HI RAD. CRC Press. Taylor & Francis Group. Taylor & Francis Croup, Boca Raton London NewYoric

Lagrangian Relaxation: An overview

CS321 Introduction To Numerical Methods

arxiv: v2 [math.oc] 12 Feb 2019

Transcription:

Optimal Control Techniques for Dynamic Walking Optimization in Robotics & Biomechanics IWR, University of Heidelberg Presentation partly based on slides by Sebastian Sager, Moritz Diehl and Peter Riede Dynamic Walking 2011 Jena

Why do we do this tutorial? There are a lot of optimal control problems in walking robots There are often statements like We use SNOPT (fmincon,... etc.) to optimize robot motions There is a lot more to optimal control than to nonlinear optimization!!

Introduction Katja Mombaur

Nonlinear Optimization Problem Famous nonlinear example function Rosenbrock function Fletcher Banana valley function

Important property of nonlinear optimization problems The optimization is performed in finite dimensional space The result is a point in finite dimensional space This will change for the next problem class

Optimal control problems Optimal control = Optimal choice of inputs for a dynamic system

Optimal control problems Optimization problems including dynamics e.g. optimal control problems State and control variables are functions in time (infinite-dimensional variables)

Optimal control methods Transformation from optimal control to nonlinear optimization problem Optimal control method Nonlinear Optimization Methods

MUSCOD an efficient tool for optimal control problems Developed by Bock and co-workers (IWR, University of Heidelberg) Original version Muscod I 1981 (Fortran 77) MUSCOD II developed in 1995 ( C ) Since then continuous extensions and updates (e.g. Mixed integer optimal control, NMPC,...) also contains efficient integrators with sensitivity generation Unfortunately not yet publicly available, but maybe in the near future If you are interested, contact us

Optimal Control

Optimal control problem (simplifed) Lagrange type Mayer type Objective function Process dynamics Initial and final constrainte

Optimal control problem (more complex) e.g. for the optimization of dynamic robot gaits: Multiphase problems with many additional constraints But we will stay with the simple problems for now

3 different approaches for optimal control problems Reminder Key problem: How to handle infinite dimensionality of states x(t) and controls u(t)? Dynamic Programming / Hamilton-Jacobi-Bellman equation Indirect Methods/ calculus of variations/ Pontryagin Maximum Principle Direct Methods (discretization of controls) Only approach treated in this talk

Direct methods for optimal control problems Common idea: replace control functions u by a discretization (= a finite-dimensional parameter vector) Are also called First-dicretize-then-optimize methods Infinite dimensionality of controls resolved But what about states x(t)?

Three different methods for state discretization Direct Collocation Direct Single Shooting Direct Multiple Shooting

Direct Single Shooting

NLP in Direct Single Shooting

Numerical example

Single shooting optimization for x 0 = 0.05

Single shooting iteration Solution

Direct Single Shooting: Pros and Cons + Concept easy to understand + Can use state-of-the art ODE or DAE integrators + (comparatively) Few optimization variables even for large ODE/DAE systems + Need only initial guess for controls q - Can not use knowledge of x in initialization (e.g. in tracking problems) - Often does not work when initial guesses for controls are far off trajectory explodes - Unstable systes are difficult/impossible to treat These drawbacks are adressed by Multiple Shooting Often used in enigineering applications, e.g. in packages gopt (PSE), ADOPT (Marquardt),...

Direct Multiple Shooting Bock, Plitt, 1981 Discretize controls piecewise on a coarse grid Use functions which have only local support, e.g. piecewise constant or piecewise linear functions

Direct Multiple Shooting Bock, Plitt, 1981 Split long integration interval into many shorter ones Use initial values of all integration intervals as free variables and shoot a new integration from each initial value

Direct Multiple Shooting Bock, Plitt, 1981 Introduce constraints to close gaps ( continuity conditions ) Also use integators to compute objective function

Discretized Optimal Control Problem

How to solve the NLP

The Lagrangian Function for NLP Lagrangian function of the constrained NLP equality multipliers λ i may have both signs in a solution inequality multipliers µ i cannot be negative (cf. shadow prices) for inactive constraints, multipliers µ i are zero

First order optimality conditions Karush-Kuhn-Tucker necessary conditions (KKT-conditions): x * feasible there exist λ *, µ * such that and it holds the complementary condition i.e. µ i* = 0 or h i (x * )= 0 for all i

Newton s method for unconstrained NLP Idea: calculate zeros of the equation to satisfy first order optimality constraints Taylor series: Newton Iteration: Inverse of Hessian Gradient of Lagrangian function

SQP - applying Newton s method to KKT Newton s method finds zeros of nonlinear equations

SQP sequential quadratic programming This is equivalent to solving the following quadratic programming problem (QP) in each step of the SQP Hessian of Lagrangian function use active-set-strategy to determine active inequality constraints Practical SQP: use update formula for Hessian use step size adaption

Example - Newton s method Behavior for banana valley function

Example - comparison between methods Newton s method much faster than steepest descent method convergence roughly linear for first 15-20 iterations since step length α k <1 convergence roughly quadratic for last iterations with step length α k 1

Essential steps in NLP solution Sequential quadratic programming (SQP) methods are very efficient methods to solve nonlinear programming problems Use a QP approximation to the NLP at every iteration SQP = Newton s method applied to KKT conditions Reduction of computation times by computation of Hessians via update formula Globalization of convergence by using damped Newton steps Important to note: iterates can be infeasible, only solution must be feasible

Back to the optimal control problem

Direct multiple shooting Bock, Plitt, 1981 Simultanuous optimization and simulation Discretized optimal control problem (NLP) Variables: discretized states s i, discretized controls u i, parameters p, Phase durations h i s i, u i, p, h x e,i + sens. Initial value problem solution (Integration + derivatives) on each multiple shooting interval s i x e,i Solution by efficient SQP Solution by efficient integrators

Trajectory sensitivity generation: black box - a bad idea

Trajectory sensitivity generation: IND a good idea! IND = internal numerical differentiation (Bock, 1981)

Direct Multiple Shooting Result of discretization: Large-scale nonlinear programming problem (NLP) Special structure originating from discretization (in KKT matrix) Bock, Plitt, 1981 Hessian of Lagrange Fct Constraint Jacobians MUSCOD Solution with structure-exploiting, tailored sequential quadratic programming (SQP) method, special condensing techniques

Direct Multiple Shooting example Same example as before; same initialization : u = 0 3 iterations compared to 7 for single shooting

Direct Multiple Shooting: Pros and Cons

Demonstration of example optimal control problem solution with MUSCOD-II A simple example

A simple optimal control problem A car is supposed to travel 300 m in 32 seconds Its initial and final velocity are zero The acceleration can vary between -2 m/s 2 and 1m/s 2 The maximum velocity is 30 m/s Optimization goal: minimize energy in terms of accelrations squared

A simple optimal control problem Mathematical formulation: subject to the constraints: Objective function (Lagrange type) lfcn Dynamic process model ffcn Initial and final constraints rdfcn Bounds (data file)

MUSCOD-II Model file Macros 1 0 0 0 2 0 1 0 2 2 2 2 # of model stages # of global parameters # coupled constraints among them, # of equaliy cnstraints # of differential state variables # of algebraic state variables # of controls # of local parameters # of start point constraints among them, # of equality constraints # of end point constraints among them, # of equality constraints

MUSCOD II source file Objective function: Integral term, Lagrange type Dynamical equations (right hand side)

MUSCOD II source file Constraint equations

MUSCOD-II source file // Define optimal control problem //Define model dimensions // Define model stage with index, dimensions of // state and control variables, pointers to // right hand side and objective fnctions,... etc.

MUSCOD-II source file // Define multipoint constraints (at start point, interior points or end point (of last phase)

MUSCOD-II data file Define number of multiple shooting intervals (also equals number of control intervals) Define start values, min and max values, and scaling factors for phase time flag to fix variable

MUSCOD-II data file Define type of state initialization: s_spec= 0: every point 1: start value generation by linear interpolation 2: start value generation by forward integration Define start values, scaling factors, min and max values for states

MUSCOD-II data file Type of control discretization u_ Control variable start values, scaling, min and max

MUSCOD-II data file Scaling of constraints: Scaling, min and max of objective function

Results

Same problem with different objective function Mathematical formulation: subject to the constraints: Objective function (Mayer type) mfcn Dynamic process model ffcn Initial and final constraints rdfcn Bounds (data file)

Results for time minimization

Demonstration of example optimal control problem solution with MUSCOD-II: A bipedal running robot

A bipedal running robot Running motion: alternation between single leg contact phases and flight phases Touch -down Leg1 Phase 1: Contact Takeoff Phase 2: Flight Touch -down Leg2 + Leg shift

A bipedal running robot 5 DOF in flight 4 DOF in contact 4 actuators : trunk Upper legs lower legs (massless) Only active in contact phase

Model of bipedal running robot Flight phase

Contact phase Spring damper forces Coupling between state variables

Model of bipedal running robot Contact phase

Form of model equations required for optimal control code MUSCOD. x = ffcn where a is the solution of see previous slides also satisfying

Switching functions Switching function for lift-off: Must also satisfy condition: Leg spring at rest length Positive vertical velocity (moving up) Switching function for take-off: Must also satisfy condition: Height of contact point = zero Negative vertical velocity at contact point

Touchdown discontinuity & Periodicity Inelastic impact: there is a jump in all model velocities at touchdown compute velocity after touchdown: Periodicity constraints on all positions (except forward direction) and velocities

The same robot performing summersaults... Mombaur et al. 2005 Only requires modification of periodicity constraints: + 360 in torso and leg angles per step

... and even open-loop stable flip-flops Requires another modification of periodicity constraints: + 180 in torso and leg angles per step

Literature

Thank you for your attention! www.orb.uni-hd.de Katja Mombaur Pictures taken at the Musée de l Automate, Souillac