## 4 Control Design
### Linear Time-Varying Model Predictive Control
\tag{28}\]  
Then as usual in linear MPC, the OCP from Equations (22)-(27) can be transformed into a linear-quadratic optimization problem  
\[\min_{\Delta\mathbf{u}(k)} \left\{\frac{1}{2}\Delta\bar{\mathbf{w}}(k)^{\text{T}}\mathbf{H}(k)\Delta \bar{\mathbf{w}}(k)+\Delta\bar{\mathbf{w}}(k)^{\text{T}}\mathbf{d}(k)\right\},\] (29) s.t. \[\mathbf{F}(k)\Delta\bar{\mathbf{w}}(k)\leq\mathbf{v}(k), \tag{30}\]  
see for example Reference [8] for details and for derivation of the matrices \(\mathbf{H}(k)\in\mathbb{R}^{N\times N}\), \(\mathbf{F}(k)\in\mathbb{R}^{p\times N}\), and the vectors \(\mathbf{d}(k)\in\mathbb{R}^{N}\), \(\mathbf{v}(k)\in\mathbb{R}^{p}\), where \(p\) is the number of constraints following from Equations (26) and (27). Denoting the optimal solution of Equations (29) and (30) by \(\Delta\bar{\mathbf{w}}^{*}(k)\), the implemented control input \(\mathbf{u}(k)\) on the plant follows from \[\mathbf{u}(k)\overset{\eqref{eq:19}}{=}\mathbf{u}_{\text{ff}}(k)+\Delta\mathbf{u}^{*}(k) \overset{\eqref{eq:28}}{=}\mathbf{u}_{\text{ff}}(k)+\Delta\mathbf{u}(k-1)+\Delta\mathbf{z}^{*} (k) \tag{31}\]  
with \(\Delta\mathbf{u}(k-1)\) from Equation (25). Note that only the first piece of the optimal input trajectory is applied whereas the remaining part is discarded. The presented LTV MPC scheme is summarized by Algorithm 1. ```
1: obtain state measurements \(\mathbf{x}(k)\) either from encoders or camera
2: prepare matrices \(\mathbf{H}(k)\), \(\mathbf{F}(k)\), and the vectors \(\mathbf{d}(k)\), \(\mathbf{v}(k)\) for the linear-quadratic optimization problem from Equations (29) and (30) at the current sampling instance \(k\) and the current operating point \((\mathbf{x}_{\text{des}}(k),\mathbf{u}_{\text{ff}}(k))\) based on the measurement \(\mathbf{x}(k)\), the previous input \(\mathbf{u}(k-1)\), the linearized system (23), the desired trajectory \(\mathbf{x}_{\text{des}}(k)\), the state (26), and input constraints (27)
3: compute the optimal input vector \(\Delta\mathbf{\hat{w}}^{*}(k)\) by solving the linear-quadratic optimization problem from Equations (29) and (30)
4: implement \(\mathbf{u}(k)\) due to Equation (31) to the plant
5: shift the prediction horizon and operating point by one time step and continue with step 1
```  
**Algorithm 1** LTV MPC scheme  
By linearizing the nonlinear system (14) around the a priori known desired trajectory and feed-forward controller, several computations of step 2 can be done offline leading to a reduced calculation time and an advantage of the presented LTV MPC scheme over the corresponding complete online approach. Figure 7 shows and summarizes the generalized topology of the closed control loop. It is remarked that the proposed LTV MPC scheme does not necessarily guarantee stability of the closed control loop, which follows directly from considering a finite prediction horizon, see Reference [35]. In the literature, see for example Reference [36], stability is usually achieved by introducing terminal costs and terminal inequality constraints. Moreover, for LTV MPC the interested reader can find a formal stability proof in Reference [19] under some reasonable assumptions. However,  
Figure 7: Topologic structure of the control loop with model predictive control (MPC) and encoder- or vision-based feedback. for applicability, the feasibility of the OCP, and real-time capability, in this conceptual investigation stability is achieved by choosing the prediction horizon sufficiently long as usual in MPC application.