Trajectory Optimization

MIT 6.821: Underactuated Robotics

Spring 2024, Lecture 10

Follow live at https://slides.com/d/QGK95tc/live

(or later at https://slides.com/russtedrake/spring24-lec10)

Image credit: Boston Dynamics

Explicit LQR + input constraints for the double integrator

99 regions for horizon N=8.

def optimize_double_integrator(N):
  # Discrete-time approximation of the double integrator.
  dt = 0.01
  A = np.eye(2) + dt * np.mat("0 1; 0 0")
  B = dt * np.mat("0; 1")

  prog = MathematicalProgram()

  # Create decision variables
  u = prog.NewContinuousVariables(1, N-1, "u")
  x = prog.NewContinuousVariables(2, N, "x")

  # Add constraints
  x0 = [-2, 0]
  prog.AddBoundingBoxConstraint(x0, x0, x[:, 0])
  for n in range(N - 1):
    prog.AddConstraint(eq(x[:, n + 1], A.dot(x[:, n]) + B.dot(u[:, n])))
    prog.AddBoundingBoxConstraint(-1, 1, u[:, n])
    prog.AddQuadraticCost(u[0,n]**2, True)
  xf = [0, 0]
  prog.AddBoundingBoxConstraint(xf, xf, x[:, N - 1])

  result = Solve(prog)

Lecture 10: Trajectory Optimization

By russtedrake

Lecture 10: Trajectory Optimization

MIT Underactuated Robotics Spring 2024 http://underactuated.csail.mit.edu

  • 710