Tuesday, February 11, 2025

MPC basics

 an MPC (Model Predictive Control) problem formulation, where the goal is to drive the center of mass (CoM) of a robot to a desired reference position while ensuring it stays within a support polygon and satisfies various constraints (such as position, velocity, and acceleration). Let's break down the terms and the optimization problem.

Objective Function:

The optimization problem minimizes an objective function that includes:

  1. State tracking error:

    • k=0N1(xkrk)TQ(xkrk)\sum_{k=0}^{N-1} (x_k - r_k)^T Q (x_k - r_k): This term minimizes the difference between the current state xkx_k and the reference rkr_k, weighted by the matrix QQ.
    • (xNrN)TQN(xNrN)(x_N - r_N)^T Q_N (x_N - r_N): Similar to the previous term but for the final state at k=Nk = N, with a different weighting matrix QNQ_N.
  2. Control effort:

    • k=0N1ukTRuk\sum_{k=0}^{N-1} u_k^T R u_k: This term minimizes the control effort (the control inputs uku_k at each time step kk), weighted by the matrix RR.
  3. Slack variables (epsilon terms):

    • k=1NϵkTPϵk\sum_{k=1}^{N} \epsilon_k^T P \epsilon_k: This term adds penalties for slack variables ϵk\epsilon_k, which are used to handle possible constraint violations. The matrix PP determines the weight of the penalty for violating constraints.

Constraints:

The problem is subject to several constraints:

  1. State dynamics:

    • xk+1=Axk+Bukx_{k+1} = A x_k + B u_k (Equation 2b): This constraint represents the system dynamics, where xkx_k is the state at time step kk, AA is the system matrix, BB is the input matrix, and uku_k is the control input at time step kk.
  2. State constraints:

    • FxkfF x_k \leq f (Equation 2c): These are constraints on the state xkx_k (position, velocity, etc.). The matrix FF and vector ff define upper and lower bounds on the state variables at each time step.
  3. Input constraints:

    • MukmM u_k \leq m (Equation 2d): These are constraints on the control inputs uku_k (e.g., motor torques or forces). The matrix MM and vector mm define the allowable limits for the control inputs.
  4. Support polygon and slack variable constraints:

    • Skxksk+ϵkS_k x_k \leq s_k + \epsilon_k (Equation 2e): These constraints ensure that the CoM stays within the support polygon. The matrix SkS_k defines the boundary of the support polygon, and ϵk\epsilon_k is a slack variable that allows some flexibility if necessary.
  5. Non-negativity of slack variables:

    • ϵk0\epsilon_k \geq 0 (Equation 2f): This constraint ensures that the slack variables ϵk\epsilon_k are non-negative, meaning that any violation of constraints is penalized and cannot be negative.

No comments:

Post a Comment