# Exploiting Lunar Navigation Constellation for GNC Enhancement in Landing Missions
## 3 GNC Algorithms
### Guidance and Control  
The guidance and control strategy employed for this paper is to provide an offline optimised landing trajectory that is interpolated on board and then fed to a reference tracking controller, based on a PID regulator. Such a strategy is not completely autonomous, since the guidance optimisation is performed on the ground and uploaded to the lander just before starting this critical phase. It is, however, performed completely autonomously during the actual thrusting period.  
The trajectory used for the guidance is generated offline through an optimisation similar to the one presented in [33; 34], with the goal of minimising fuel consumption. The procedure considers an indirect optimisation step to solve a two-point boundary value problem with prescribed initial and final conditions in a simplified 2D dynamics on the polar orbital plane. A constant thrust value is considered, and the minimisation of propellant is obtained by constructing a cost function considering the integral of the control acceleration, thus including the evolving mass state variable. The solution to the indirect optimisation consists of finding the unknown initial conditions of the adjoint states by exploiting a shooting method. The result of this process is a history of the control action and the associated 2D dynamics, which can be remapped to a 3D trajectory by knowing the mission scenario geometry.  
Such a trajectory is imported only as a sequence of six states, discretised in the sampling times output of the optimisation. To exploit this sequence, the on-board guidance uses the offline optimised six states as grid points to perform the interpolation and to retrieve the target states at any given query point. In such a way, the controller is fed at any instant with a control error computed between the obtained reference trajectory and the estimated current state, coming from the navigation. The control action of the optimal guidance is instead not exploited, since such an action is recomputed using the PID controller described in Figure 3.  
Figure 3: Details of the PID scheme used to follow the offline optimised guidance, employing an anti-windup logic.  
The input of this block, \(\mathbf{\Delta\hat{x}_{k}}\), is computed as the error between the set-point trajectory state at time \(t_{k}\) and the current estimation of the state, \(\mathbf{\hat{x}_{k}}\). This state error is decomposed into its position and velocity parts, \(\mathbf{\Delta\hat{r}_{k}}\) and \(\mathbf{\Delta\hat{v}_{k}}\). The former is used for the proportional and the integral parts of the control, while the latter is used for the derivative one. The sum of the three components then passes through a saturation block, in order to impose the maximum thrust constraints. To prevent uncontrollability due to the actuator saturation caused by the integral term, a simple _anti-windup_ logic [35] is introduced. The computed control action before passing the saturation step is compared in absolute value to the output of the limiter. A non-null difference means that the saturation is active, so to avoid controllability issues, the input to the integral term is driven to zero. In such a way, the regulator is able to avoid the windup condition, for which a saturated control action would continue increasing the integral of the error. The anti-windup logic remains active as long as the control acts to reduce the error and consequently re-enter the saturation limit.  
The only available tuning parameters for such a controller are the three PID coefficients, \(k_{P}\), \(k_{I}\), and \(k_{D}\), representing proportional, integral, and derivative coefficients.  
The control action computed by the controller is perturbed before entering the lander dynamics, in order to simulate both pointing and magnitude zero mean additive Gaussian errors. The former presents a standard deviation of \(1^{\circ}\) on each of the two angles defining the thrusting direction, while the latter is defined with standard deviation equal to 0.1% of the maximum thrust.