# CMU 16-745: Optimal Control

# Continuous-Time Dynamics

  • Most general/generic for smooth systems:

    x˙=f(x,u)\dot{x} = f(x, u)

    • xRnx \in \mathbb{R}^n is the state
    • uRmu \in \mathbb{R}^m is the input
    • ff represents the dynamics
  • For a mechanical system:
    x=[qv]x = \begin{bmatrix} q \\ v \end{bmatrix}

    • qq: configuration (not always a vector)
    • vv: velocity

# Example: Pendulum

  • Equation of Motion: ml2θ¨+mglsinθ=τml^2 \ddot{\theta} + mgl \sin\theta = \tau (where τ=u\tau = u)
  • State variables: q=θq = \theta, v=θ˙v = \dot{\theta}
  • State vector: x=[θθ˙]x˙=[θ˙]=[θ˙glsinθ+1ml2u]f(x,u)x = \begin{bmatrix} \theta \\ \dot{\theta} \end{bmatrix} \Rightarrow \dot{x} = \begin{bmatrix} \dot{\theta} \\ \dots \end{bmatrix} = \underbrace{\begin{bmatrix} \dot{\theta} \\ -\frac{g}{l} \sin\theta + \frac{1}{ml^2} u \end{bmatrix}}_{f(x, u)}
  • Manifold: qS1q \in S^1 (circle), xS1×Rx \in S^1 \times \mathbb{R} (cylinder)

# Control-Affine Systems

x˙=f0(x)+B(x)u\dot{x} = f_0(x) + B(x)u

  • f0(x)f_0(x): "drift"
  • B(x)B(x): "input Jacobian"
  • Most systems can be put in this form.
  • Pendulum Example:
    f0(x)=[θ˙glsinθ],B(x)=[01ml2]f_0(x) = \begin{bmatrix} \dot{\theta} \\ -\frac{g}{l} \sin\theta \end{bmatrix}, \quad B(x) = \begin{bmatrix} 0 \\ \frac{1}{ml^2} \end{bmatrix}

# Manipulator Dynamics

M(q)v˙+C(q,v)=B(q)u+FM(q)\dot{v} + C(q, v) = B(q)u + F

  • M(q)M(q): "Mass matrix" or "Inertia tensor"
  • C(q,v)C(q, v): "Dynamic Bias" (Coriolis + gravity)
  • B(q)B(q): "Input Jacobian"
  • FF: "External forces"

Velocity Kinematics: q˙=G(q)v\dot{q} = G(q)v

State-Space Form:

x˙=f(x,u)=[G(q)vM(q)1(B(q)uC)]\dot{x} = f(x, u) = \begin{bmatrix} G(q)v \\ M(q)^{-1}(B(q)u - C) \end{bmatrix}

  • Pendulum Example: M(q)=ml2,C(q,v)=mglsinθ,B=1,G=IM(q) = ml^2, \quad C(q, v) = mgl \sin\theta, \quad B=1, \quad G=I
  • All mechanical systems can be written like this.
  • Just rewriting Euler-Lagrange equations: L=12vTM(q)vU(q)L = \frac{1}{2} v^T M(q) v - U(q)

# Linear Systems

x˙=A(t)x+B(t)u\dot{x} = A(t)x + B(t)u

  • Called "time-invariant" if A(t)=AA(t) = A and B(t)=BB(t) = B.
  • Called "time-variant" otherwise.
  • We often approximate non-linear systems with linear ones:

    x˙=f(x,u)A=fx,B=fu\dot{x} = f(x, u) \Rightarrow A = \frac{\partial f}{\partial x}, \quad B = \frac{\partial f}{\partial u}


# Equilibria

  • A point where the system will "remain at rest": x˙=f(x,u)=0\dot{x} = f(x, u) = 0.
  • Algebraically, these are the roots of the dynamics.
  • Pendulum Example:
    x˙=[θ˙glsinθ]=[00]θ˙=0,θ=0,π\dot{x} = \begin{bmatrix} \dot{\theta} \\ -\frac{g}{l} \sin\theta \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix} \Rightarrow \dot{\theta} = 0, \quad \theta = 0, \pi

# First Control Problem:

  • Can I move the equilibria?
    Example: Hold pendulum at θ=π/2\theta = \pi/2
    x˙=[θ˙glsin(π/2)+1ml2u]=[00]\dot{x} = \begin{bmatrix} \dot{\theta} \\ -\frac{g}{l} \sin(\pi/2) + \frac{1}{ml^2} u \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}
    1ml2u=glsin(π/2)u=mgl\frac{1}{ml^2} u = \frac{g}{l} \sin(\pi/2) \Rightarrow u = mgl

# Stability of Equilibrium

  • When will we stay "near" an equilibrium point under perturbations?

  • Look at 1D system (xRx \in \mathbb{R}):
    * fx<0\frac{\partial f}{\partial x} < 0 \Rightarrow stable

    • fx>0\frac{\partial f}{\partial x} > 0 \Rightarrow unstable
  • In higher dimensions:

    • fx\frac{\partial f}{\partial x} is a Jacobian matrix.
    • Take an eigen decomposition \Rightarrow decouple into n×1Dn \times 1D systems.
    • Re[eig(fx)]<0Re[eig(\frac{\partial f}{\partial x})] < 0 \Rightarrow stable
    • Otherwise \rightarrow unstable

# Example: Pendulum

f(x)=[θ˙glsinθ]fx=[01glcosθ0]f(x) = \begin{bmatrix} \dot{\theta} \\ -\frac{g}{l} \sin\theta \end{bmatrix} \Rightarrow \frac{\partial f}{\partial x} = \begin{bmatrix} 0 & 1 \\ -\frac{g}{l} \cos\theta & 0 \end{bmatrix}

  • At θ=π\theta = \pi (Upward):
    fxθ=π=[01g/l0]eig(fx)=±gl\frac{\partial f}{\partial x}\big|_{\theta=\pi} = \begin{bmatrix} 0 & 1 \\ g/l & 0 \end{bmatrix} \Rightarrow eig(\frac{\partial f}{\partial x}) = \pm \sqrt{\frac{g}{l}} \Rightarrow unstable

  • At θ=0\theta = 0 (Downward):
    fxθ=0=[01g/l0]eig(fx)=±igl\frac{\partial f}{\partial x}\big|_{\theta=0} = \begin{bmatrix} 0 & 1 \\ -g/l & 0 \end{bmatrix} \Rightarrow eig(\frac{\partial f}{\partial x}) = \pm i \sqrt{\frac{g}{l}} \Rightarrow marginally stable (undamped oscillations)

  • Marginally Stable: The pure imaginary case results in undamped oscillations.

  • Adding Damping: (e.g., u=kdθ˙u = -k_d \dot{\theta}) results in a strictly negative real part.