# Safety Control for Satellite Formation Flying via High-Order Control Barrier Functions
## 3 Safety Control Design
### High-Order Control Barrier Function Design  
Before discussing how to design the control barrier function, System (4) is rewritten as the state space form. Defining \(x_{1}=x\), \(x_{2}=\dot{x}\), \(x_{3}=y\), \(x_{4}=\dot{y}\), \(x_{5}=z\), and \(x_{6}=\dot{z}\), one can rewrite System (4) as  
\[\dot{x}_{1} = x_{2},\] \[\dot{x}_{2} = 2\omega x_{4}+\omega^{2}x_{1}-\frac{\mu}{d^{3}}x_{1}+u_{1},\] \[\dot{x}_{3} = x_{4},\] \[\dot{x}_{4} = \omega^{2}x_{3}-2\omega x_{2}+r\omega^{2}-\frac{\mu}{d^{3}}(x_{3} +r)+u_{3},\] \[\dot{x}_{5} = x_{6},\] \[\dot{x}_{6} = -\frac{\mu}{d^{3}}x_{5}+u_{5}, \tag{8}\]  
where \(x_{i}\in\mathcal{D}\subset\mathcal{R}\), \((i=1,2,3,4,5,6)\), and \(\mathcal{D}\) is the set of safety positions of the accompanying satellite. To facilitate the following description, a compact form of (8) is described as  
\[\dot{x}_{i} = x_{i+1},\] \[\dot{x}_{i+1} = f_{i}(x)+u_{i},i=1,2,3,4,5, \tag{9}\]  
where \(x_{i}\in\mathcal{D}\subset\mathcal{R}\), and \(f_{i}(x)\) is determined based on (8). To guarantee the safety of the satellite formation flying system, and considering the sizes of both the reference satellite and the accompanying satellite, the position variables must satisfy \(x_{1}\geq\iota_{1}\), \(x_{3}\geq\iota_{2}\), and \(x_{5}\geq\iota_{3}\) simultaneously, where \(\iota_{j}\)\((j=1,2,3)\) are the safety distances of the reference satellite and the accompanying satellite. Then, the following control barrier functions are defined for System (9). \[h_{1}(x) = x_{1}-\iota_{1},\] \[h_{3}(x) = x_{3}-\iota_{2},\] \[\dot{x}_{2} = 2\omega x_{4}+\omega^{2}x_{1}-\frac{\mu}{d^{3}}x_{1}+u_{1},\]0  
According to the above description and the results in [18], the safety set \(\mathcal{C}\) can be defined as \(\mathcal{C}=\mathcal{C}_{1}\bigcup\mathcal{C}_{3}\bigcup\mathcal{C}_{5}\), where \(\mathcal{C}_{i}\)\((i=1,3,5)\), respectively, represents the superset of the control barrier functions \(h_{l}(x)\). Furthermore, \(\mathcal{C}_{l}\) is defined as  
\[\dot{x}_{2} = 2\omega x_{4}+\omega^{2}x_{1}-\frac{\mu}{d^{3}}x_{1}+u_{1},\]1 \[\dot{x}_{2} = 2\omega x_{4}+\omega^{2}x_{1}-\frac{\mu}{d^{3}}x_{1}+u_{1},\]2 \[\dot{x}_{2} = 2\omega x_{4}+\omega^{2}x_{1}-\frac{\mu}{d^{3}}x_{1}+u_{1},\]3  
where \(\partial\mathcal{C}_{i}\) denotes the boundary of the set \(\mathcal{C}_{i}\), and \(\mathrm{Int}(\mathcal{C}_{i})\) is the inner of the set \(\mathcal{C}_{i}\). According to Definition 1, for the initial position of the satellite formation \(x_{i}(0)\in\mathcal{C}_{i}\), if one can design a safety controller \(u\) such that \(x_{i}(t)\in\mathcal{C}_{i}\) holds for \(\forall t>0\), the safety set \(\mathcal{C}\) is forward invariant. In this case, the safety constraint of the satellite formation flying can be guaranteed. To preserve the forward invariant property of the safety set \(\mathcal{C}\), calculate the Lie derivative of the control barrier function \(h_{i}(x)\) along System (9). The Lie derivative of the control barrier function \(h_{i}(x)\) is required to satisfy the following inequality. \[\dot{x}_{2} = 2\omega x_{4}+\omega^{2}x_{1}-\frac{\mu}{d^{3}}x_{1}+u_{1},\]4  
where \(\alpha(\cdot)\) is a \(\mathcal{K}\) class function. By directly computing the Lie derivative of the control barrier function, it is clear that \(L_{S}h_{i}(x)u_{i}=0\), which means the control input \(u_{i}\) does not exist in the expression of the Lie derivative of the control barrier function \(h_{i}(x)\). Accordingly, the Lie derivative of the first-order control barrier function cannot be directly utilized as constraints to calculate the safety controller. A high-order control barrier function needs to be constructed to ensure that the safety set is forward invariant. As seen from System (9), if one calculates the Lie derivative twice for the control barrier function \(h_{l}(x)\) along the trajectory of System (9), \(L_{S}h_{i}(x)u_{i}\
eq 0\) holds. Namely, the relative degree of the control barrier function \(h_{i}(x)\) with regard to System (9) is 2.