## 2 Materials and Methods
### Networked Model Predictive Formation Control
The admissible control set \(\mathbb{U}\) is defined as \(\{\mathbf{u}\in\mathbb{R}^{3}\mid||\mathbf{u}||_{2}\leq u_{max}\}\) and describes a ball of radius \(u_{max}\) around the origin. Solving the MPC formulation in Equation (8) not only provides a corresponding optimal control input sequence \(\mathbf{u}_{0;N}^{*}\) as input to a specific actuator but also the estimated future state trajectory \(\tilde{\mathbf{x}}_{0;N}\) of the associated satellite for the next \(N\) time steps. The final missing component for the networked MPC problem described in Equation (8) is a discrete-time Lyapunov stable controller \(\mathbf{h}(\mathbf{x}_{k})\) and its corresponding Lyapunov function \(V(\mathbf{x}_{k})\). There are several ways to get such a stabilizing controller given a LTI system. We reformulated the discrete MPC problem as discrete infinite horizon OCP with a constant gain feedback control law \(\mathbf{h}(\mathbf{x}_{k})=\mathbf{K}\,\mathbf{x}_{k}\). The gain \(\mathbf{K}\) is then derived by solving the resulting Discrete-Time Algebraic Riccati Equation (DARE) and relaxing the control constraint set \(\mathbb{U}\). Given a stabilizing control law \(\mathbf{h}\) the corresponding Lyapunov function \(V(\mathbf{x})=\mathbf{x}^{T}\mathbf{P}\mathbf{x}\) can be obtained by solving the Discrete Lyapunov Equation \(\mathbf{A}_{cl}^{T}\mathbf{P}\mathbf{A}_{cl}-\mathbf{P}+\mathbf{W}=0\) for \(\mathbf{P}\) and \(\mathbf{W}\) using a DARE again. The closed loop system matrix \(\mathbf{A}_{cl}\) is given by \(\mathbf{A}_{cl}=\mathbf{A}_{d}+\mathbf{B}_{d}\,\mathbf{K}\) and describes a stable closed loop system by design of the constant gain controller \(\mathbf{h}\). Therefore both \(\mathbf{P}\) and \(\mathbf{W}\) are positive definite and \(V(\mathbf{x}_{k})\) is a valid Lyapunov function for the controller \(\mathbf{h}\)[46]. To incorporate the control limits \(\mathbf{h}\) is changed to \(\mathbf{h}(\mathbf{x}_{k})=\alpha\mathbf{K}\mathbf{x}_{k}\) with \(\alpha\in\mathbb{R}^{+}\). Using \(\alpha\) the gain \(\mathbf{K}\) is scaled depending on the initial state \(\mathbf{x}_{0}\), so that a decreasing \(V(\mathbf{x}_{k})\) over time step \(k\) ensures that \(||\mathbf{h}||_{2}\) never exceeds \(u_{max}\). To generate an online solution to the MPC problem described in Equation (8) we integrated the non-linear gradient-based MPC solver GRAMPC as a task in the RODOS middleware running on the computing nodes. GRAMPC is a free software framework written in the C language capable of solving the MPC problem for parameterized linear or non-linear MPC problems with native support for linear inequality constraints. Due to its self contained nature it needs no external support libraries and has a small code size which makes it very suited for embedded applications. In addition online solution generation allows us to update required MPC parameters like the control horizon length \(N_{c}\) or the Lyapunov constraint during run time. Further advantages like fast speed or even real-time capability are further described in [44]. The algorithmic side of GRAMPC is well documented in [47; 48]. Now all required components necessary to facilitate predictive formation control that compensates for the effect of a distributed closed-loop network are realized. An overview of the wireless closed-loop system and the interaction of the nodes is shown in Figure 6. The MPC task running on the controller node generates a control input trajectory and sends it to the actuator, where a command execution task takes care to realize the control inputs according to their execution time by processing the received buffer one-by-one until new data arrives. In addition the actuator feeds back the current buffer state, e.g., the number of executed commands since the last update to the controller. This information is then used on the controller side to adapt the control horizon to compensate for the current network condition. The control performance and the network effects on the control horizon length over time are further discussed in Section 3.2.