CDS 110b: Lectre 1-2 Introdction to Optimal Control Richard M. Mrray 4 Janary 2006 Goals: Introdce the problem of optimal control as method of trajectory generation State the maimm principle and give eamples of its sage Reading: Lewis and Syrmos Section 3.1-3.2 available on web page RMM corse notes available on web page Homework #1 Apply the maimm principle to some simple problems De Wed 11 Jan by 5 pm in bo otside 109 Steele 4 Jan 06 R. M. Mrray Caltech 1
Trajectory Generation Trajectory Generation Controller Process Estimator System Dynamics: Trajectory Generation: r d d Tracking Controller: = d + K - d Approach: optimal control Find trajectory that minimies desired cost fnction and satisfies the nonlinear dynamics Use linear state feedback K that minimies qadratic criteria Modern variation: receding horion control Resolve trajectory generation in real-time based on crrent state 4 Jan 06 R. M. Mrray Caltech 2
Review: Optimiation * Optimiation of fnctions: given F:R n R find * R n sch that F * F for all R n Necessary conditions: Remarks: Basic idea: if gradient is non-ero move in that direction to increase cost Conditions are not sfficient conditions: all marked points satisfy conditions only one is global maimm To find the minimm of a fnction F find the maimm of the fnction -F conditions are nchanged so we will switch back and forth MATLAB: X = FMINSEARCHFUNX0 starts at X0 and attempts to find a local minimier X of the fnction FUN 4 Jan 06 R. M. Mrray Caltech 3
Constrained Optimiation * G i = 0 F Optimiation with constraints: given cost fnction F:R n R and constraints G i :R n R i = 1 k find * R n sch that G i * = 0 satisfies constraints and F * F for all sch that G i = 0. Necessary conditions Lagrange mltipliers: i Geometric interpretation: free variables that cancel the gradient of F in directions normal to the constraint Algebraic interpretation: minimie the fnction with respect to leaving free. Variables can take any vale need to choose sch that G = 0 otherwise we can choose to generate a large cost MATLAB: se Optimiation Toolbo 4 Jan 06 R. M. Mrray Caltech 4
Optimal Control Problem Statement: Given nonlinear system Find trajectory * * that satisfies the dynamics and minimies cost Integrated cost Terminal cost Remarks Usally assme we are trying to take system to the origin = 0; easy to generalie by rewriting dynamics in terms of write e = - r Integrated cost L is sed to tradeoff state error from inpt cost Typical cost fnction: qadratic cost 4 Jan 06 R. M. Mrray Caltech 5
Pontryagin s Maimm Principle System: Cost: Hamiltonian: Terminal constraint optional Theorem Pontryagin: If * * is optimal then there eists * t and * sch that and Bondary conditions 2n total Remark: this is a very general and sefl set of conditions 4 Jan 06 R. M. Mrray Caltech 6
Using the Maimm Principle 1. Formlate problem in standard form: 2. Constrct Hamiltonian: 3. Compte necessary conditions: 4. Find the optimal inpt 5. Solve for the optimal trajectory: Sbstitte optimal inpt into necessary conditions and solved bondary vale problem. In general this is hard to do in closed form Good news: can convert this to a comptational problem 4 Jan 06 R. M. Mrray Caltech 7
Eample: Bang-Bang Control 1. Problem formlation: move to origin in minimm amont of time Linear dynamics bonded inpt Minimm time make T small 0 Terminal constraint 2. Constrct Hamiltonian: 3 4. Compte necessary conditions and optimal inpt: Retrns a copy of the dynamics Evoltion of Lagrange mltipliers costates Optimal inpt Remarks: Form of the soltion is easy: apply ma or min inpt at all times Finding actal trajectory is hard: need to search over switching times 4 Jan 06 R. M. Mrray Caltech 8
Application: Dcted Fan flight control Nonlinear design global nonlinearities inpt satration state space constraints Local design ref Trajectory Generation d d noise Plant P Local Control otpt Op Maps NTG MPC+CLF Use real-time trajectory generation to constrct sboptimal feasible trajectories Use model predictive control for reconfigrable tracking & robst performance Etension to mlti-vehicle systems performing cooperative tasks 4 Jan 06 R. M. Mrray Caltech 9
Approach: Receding Horion Optimiation T T t+ T tt+ T = arg min L d + V t+ T [ ] = t = t+ T 0 t f & = f g 0 d Online control cstomiation System: f Constraints/environment: g Mission: L Update in real-time to achieve reconfigrable operation 4 Jan 06 R. M. Mrray Caltech 10
4 Jan 06 R. M. Mrray Caltech 11 Dcted Fan Terrain Avoidance Real-Time Trajectory Generation / Optimiation Collocation Flatness Qasi-collocation f = & i i i i i t t f t t = = & = = = = t i i q q p K & K & K & 0 p q y y y y y y h y K & K & = = =
Eperimental Reslts: Caltech Dcted Fan NTG + MPC + CLF Pitch Control dspace RTOS 4 Jan 06 R. M. Mrray Caltech 12
Eperiments: Caltech Dcted Fan Milam Fran Haser 2002 ACC Dnbar Milam Mrray 2002 IFAC Real-Time MPC on Caltech Dcted Fan Ag 01 NTG with qasi-flat otpts + Lyapnov CLF Average comptation time of ~100 msec Inner pitch loop closed sing local control law; MPC for position variables Inner/oter tradeoff: how mch can be pshed into optimiation 4 Jan 06 R. M. Mrray Caltech 13
Smmary Trajectory Generation Controller Process Estimator Optimal Control for Trajectory Generation Find feasible optimal trajectories for a nonlinear control system Necessary conditions: Pontryagin Maimm Principle Homework Work throgh several eamples of maimm principle Net week: application of optimal control to design state feedback Note: NO CLASS MONDAY - net reglar class on Wed 11 Jan 1:30 pm Corse Project information meeting: Friday 2-3 pm 125 Steele 4 Jan 06 R. M. Mrray Caltech 14