Lecture 5: Basic Dynamical Systems CS 344R: Robotics Benjamin Kuipers Dynamical Systems • A dynamical system changes continuously (almost always) according to xÝ F(x) where x n • A controller is defined to change the coupled robot and environment into a desired dynamical system. xÝ F(x,u) y G(x) u H i (y) xÝ F(x,Hi (G(x))) In One Dimension • Simple linear system xÝ kx xÝ • Fixed point x 0 xÝ 0 • Solution x(t) x 0 e kt – Stable if k < 0 – Unstable if k > 0 x In Two Dimensions • Often, position and velocity: T x (x,v) where v xÝ • If actions are forces, causing acceleration: xÝ xÝ v xÝ Ý Ý v xÝ forces The Damped Spring • The spring is defined by Hooke’s Law: F ma mx k1 x • Include damping friction mx k1 x k2 x • Rearrange and redefine constants x bx cx 0 xÝ xÝ v xÝ Ý Ý v xÝ bxÝ cx The Linear Spring Model Ý c0 xÝ bxÝ cx 0 • Solutions are: x(t) Ae Be • Where r1, r2 are roots of the characteristic 2 equation b c 0 r1 t r2 t b b 4c r1,r2 2 2 Qualitative Behaviors b b 2 4c r1,r2 2 • Re(r1), Re(r2) < 0 means stable. • Re(r1), Re(r2) > 0 means unstable. • b2-4c < 0 means complex roots, means oscillations. unstable c stable spiral nodal nodal unstable b Generalize to Higher Dimensions Ý Ax • The characteristic equation for x generalizes to det( A I) 0 – This means that there is a vector v such that Av v • The solutions are called eigenvalues. • The related vectors v are eigenvectors. Qualitative Behavior, Again • For a dynamical system to be stable: – The real parts of all eigenvalues must be negative. – All eigenvalues lie in the left half complex plane. • Terminology: – Underdamped = spiral (some complex eigenvalue) – Overdamped = nodal (all eigenvalues real) – Critically damped = the boundary between. Node Behavior Focus Behavior Saddle Behavior Spiral Behavior (stable attractor) Center Behavior (undamped oscillator) The Wall Follower (x,y) The Wall Follower • Our robot model: xÝ v cos xÝ yÝ F (x,u) v sin Ý u = (v )T y=(y )T 0. • We set the control law u = (v )T = Hi(y) Ý yÝ Ý e y yset so eÝ yÝ and eÝ The Wall Follower • Assume constant forward velocity v = v0 – approximately parallel to the wall: 0. • Desired distance from wall defines error: e y yset so eÝ yÝ and Ý eÝ Ý yÝ • We set the control law u = (v )T = Hi(y) – We want e to act like a “damped spring” Ý k1 eÝ k2 e 0 eÝ The Wall Follower Ý Ý k1 eÝ k2 e 0 • We want e • For small values of eÝ yÝ v sin v Ý v Ý yÝ Ý v cos eÝ • Assume v=v0 is constant. Solve for v 0 v u k k 2 e H i (e, ) 1 v 0 – This makes the wall-follower a PD controller. Tuning the Wall Follower eÝ k1 eÝ k2 e 0 • The system is Ý 2 k • Critically damped is 1 4k 2 0 k1 4k 2 • Slightly underdamped performs better. – Set k2 by experience. – Set k1 a bit less than 4k2 An Observer for Distance to Wall • Short sonar returns are reliable. – They are likely to be perpendicular reflections. Experiment with Alternatives • The wall follower is a PD control law. • A target seeker should probably be a PI control law, to adapt to motion. • Try different tuning values for parameters. – This is a simple model. – Unmodeled effects might be significant. Ziegler-Nichols Tuning • Open-loop response to a step increase. d T K Ziegler-Nichols Parameters • K is the process gain. • T is the process time constant. • d is the deadtime. Tuning the PID Controller • We have described it as: u(t) kP e(t) kI t e dt k D eÝ(t) 0 • Another standard form is: t u(t) P e(t) TI e dt TD eÝ(t) 0 • Ziegler-Nichols says: 1.5 T P TI 2.5 d TD 0.4 d Kd Ziegler-Nichols Closed Loop 1. Disable D and I action (pure P control). 2. Make a step change to the setpoint. 3. Repeat, adjusting controller gain until achieving a stable oscillation. • • This gain is the “ultimate gain” Ku. The period is the “ultimate period” Pu. Closed-Loop Z-N PID Tuning • A standard form of PID is: u(t) P e(t) TI • For a PI controller: P 0.45 K u e dt TDeÝ(t) 0 t Pu TI 1.2 • For a PID controller: Pu P 0.6 K u TI 2 Pu TD 8