Synthesis of Data-Driven LightGBM Controller for Spacecraft Attitude Control

The attitude dynamics of spacecraft are highly nonlinear, which makes it challenging to design control algorithms that can handle these nonlinearities. This study presents a novel data-driven synthesis method for spacecraft attitude control using the LightGBM controller. The LightGBM controller is designed by using supervised machine learning methodologies. The training and testing datasets for the LightGBM controller are generated from the input-output data of a closed-loop system of spacecraft attitude dynamics under an exact feedback linearization-based controller. We show that under some realistic conditions, even though we can not guarantee asymptotic stability for the closed-loop system under the LightGBM controller, but we can have a kind of practical stability, i.e., we can have a smaller bounded ball by designing a LightGBM controller with a smaller bound of error. Furthermore, the simulation results show an additional interesting phenomenon that the LightGBM controller still produces good closed-loop performance even though there is uncertainty in satellite parameters and disturbance.


I. INTRODUCTION
Spacecraft attitude control is one of the most important research topics in the practical aerospace industry, which refers to an essential basis for various advanced aerospace tasks. The topic of attitude control for spacecraft has attracted significant attention and has yielded notable achievements in recent research. Numerous key findings and advancements have been made in this area, reflecting its significance in the field of spacecraft control [1], [2], [3]. Therefore, the development of reliable and efficient attitude control methods is a crucial research area in the field of spacecraft engineering. Hence, it has attracted the interest of researchers, leading to the development of multiple control strategies aimed at achieving optimal attitude performance. For instance, Adaptive control [3], [4], model-free prescribed performance control [5], sliding mode control [6], and PD control [1], [7] have been proposed for spacecraft attitude control.
Since there are so many disturbances in the spacecraft's position, tracking control of the spacecraft's attitude becomes The associate editor coordinating the review of this manuscript and approving it for publication was Zhong Wu . very important. External disturbances, such as solar radiation, gravitational effects, and atmospheric drag, can affect the spacecraft's attitude and introduce uncertainty in the control system. Moreover, parameter uncertainty, such as variations in mass, inertia, and aerodynamic coefficients, can further impact the accuracy of the attitude control. In addition, sensor errors, such as measurement noise and bias, can degrade the quality of the feedback signals used in the control system. Moreover, uncertainty in the system model can significantly impact the performance and stability of the spacecraft's attitude control [8]. Managing this uncertainty and disturbance is crucial to ensure accurate and reliable spacecraft attitude control, as they can lead to degraded performance, instability, and even mission failure. Therefore, developing robust and adaptive control strategies that can handle these uncertainty and disturbance is of utmost importance in spacecraft attitude control applications. This problem has been extensively studied under various scenarios [9], [10].
Many control methods which are usually used for synthesizing spacecraft attitude control have limitations and disadvantages [11], [12], [13]. LQR (Linear Quadratic Regulator)/ LQG (Linear Quadratic Gaussian) methods and other linear approximation-based methods, for example, are usually ineffective under large attitude angles while its nonlinearity effect occurs. Optimal control methods which use nonlinear attitude dynamics usually require solving nonlinear differential equations which resulted from Bellman's dynamics programming or Pontryagin's maximum principle which do not have a closed-form solution.
Other nonlinear design methodology such that Lyapunov's physical approach which generates PD stabilizing controller or non-linear adaptive controller have difficulties in choosing the controller's parameters that result in good performance [11].
To overcome the limitations of those traditional control methods, data-driven control has emerged as a promising approach in various fields, including spacecraft attitude control. By utilizing data-driven techniques, controllers can be designed to adapt to uncertainty and noise in spacecraft dynamics, allowing for improved performance and robustness. One of the key advantages of data-driven control is its ability to leverage large datasets to learn complex system dynamics and generate control actions based on realtime data. This allows for more adaptive and flexible control strategies that can better handle system uncertainty and noise.
In recent years, the use of machine learning has shown promise in enhancing spacecraft attitude control through data-driven techniques. The application of machine learning algorithms for addressing spacecraft attitude problems has been extensively explored in previous researches [14], [15]. Many studies have used machine learning,i.e. neural networks, to handle spacecraft attitude control. A study has used neural networks to predict spacecraft movements and control them [16]. This research intends not only to produce nonlinear control but also to make it adaptive. Another recent study used a neural network to handle space-craft attitude control and showed that this method is more fuel-efficient than a sliding mode control approach [17]. On the other hand, we've observed that LightGBM has gained popularity among many researchers in the machine learning field as having amazing trainability and learning capabilities. The LightGBM model is introduced by Microsoft and became open source in 2017, its operation speed is much faster than XGBoost, and it takes up less memory than XGBoost and has higher accuracy [18]. LightGBM is preferred if higher predictive accuracy is required while comparing the dimensionality reduction effect between the Light GBM and XGBoost [19]. Comparison in using multiple machine learning models also shows that LightGBM produces higher prediction accuracy with much easier hyper-parameter optimization and a simpler architecture than neural networks [20]. We hope for better performance of the closed loop dynamics also due to the higher accuracy of the LightGBM controller.
In this study, we propose the use of LightGBM in synthesizing a data-driven spacecraft attitude control. The data used to train LightGBM was generated using the exact feedback linearization approach. The LightGBM algorithm is well-suited for this task due to its ability to handle large datasets and high-dimensional features.
Further, spacecraft attitude control poses significant challenges due to uncertainty and noise in the system. This paper presents a novel methodology for designing data-driven control systems for spacecraft attitude control, leveraging the LightGBM algorithm. The proposed approach aims to synthesize a robust and reliable spacecraft attitude control system which also effective although there are some uncertainty and disturbance. Inspired by recent advancements in datadriven control, the proposed methodology contributes to the field of spacecraft attitude control by providing an innovative approach that enhances the robustness and reliability of the control system. It will be shown in the following sections that our proposed method produces stable closed-loop system performance despite uncertainty and disturbance, and the simulation results show the good transient response of closed-loop systems in the presence of such uncertainty and disturbance.
The proposed data-driven control system is expected to perform well based only on feedback from the measured spacecraft attitude data during its mission. The major contributions of this study are listed below: • We have proposed a supervised learning algorithm utilizing the LightGBM algorithm for spacecraft attitude control, which is based on a decision-tree algorithm. This approach eliminates the reliance on model-based controllers and instead employs data-driven techniques to overcome some of the limitations of traditional control methods.
• The proposed LightGBM controller learns from spacecraft attitude control data generated using a feedback linearization approach. The learning process covers various conditions and varying data sizes, allowing for robust and scalable control performance.
• The proposed LightGBM controller undergoes validation through extensive testing using a wide range of test scenarios and simulations with uncertainty and noise. This ensures its robustness, effectiveness, and reliability in handling different operational scenarios and system dynamics.
• We propose a practical stability concept for the datadriven LightGBM controller. The stability of the controller is analyzed in detail to ensure its robustness and reliability in spacecraft attitude control. This research is organized as follows. In the next section, the spacecraft attitude dynamic model is given. Further, section III presents a brief review of feedback linearization and introduces the proposed LightGBM controller, ends with a stability analysis of the proposed LightGBM controller. Numerical simulations and conclusions are presented in Sections IV and V, respectively.

II. MATHEMATICAL MODEL OF SPACECRAFT ATTITUDE
The spacecraft model studied here is a small spacecraft with three reaction wheels. There are two common ways VOLUME 11, 2023 to describe the spacecraft attitude of a rigid body, Euler angle and quaternion, which can inter transformed. The representation of spacecraft attitude is mathematically expressed by kinematic equations relating the angular position with the angular velocity, and dynamic equations describing the evolution of angular velocity or, equivalently, angular momentum. Following Dwyer [21], [22], [23], [24], the spacecraft attitude control can be represented by a sixth-order nonlinear system which can be written as follows: where ω is the 3 × 1 angular velocity vector resolved along the principal axes in a body-fixed frame with respect to the orbit frame, ζ is the Gibbs vector of the Cayley-Rodrigues attitude parameters [24], [25], [26], defined as follows: describing the result of a virtual rotation by φ radians about a 3 × 1 virtual unit axes vector q (Euler axes), with the same components q 1 , q 2 , and q 3 along either the preselected inertial reference axes or the body axes, so that q T q = 1; τ denotes the 3 × 1 torques generated to drive the reaction wheels; H stands the 3 × 3 positive definite inertia matrix of the spacecraft; p symbolizes the 3 × 1 angular momentum vector of the spacecraft relative to the inertial axes. Furthermore, Z (ζ ) is the 3 × 3 fully invertible kinematical Jacobian matrix for the Cayley-Rodrigues parameters [12], [25], [27], defined by: where I is the 3×3 identity matrix. This definition is valid for −π < φ < π Using this description, the momentum p can be represented as a function of ζ defined by this formula [12]: where p 0 denotes the total angular momentum, and the matrix M (ζ ) shows the coordinate transformation from the inertial frame to the body frame [12], expressed by: with [ζ ×] is the 3 × 3 skew symmetric matrix operator given by the following representation [25], [27]:

III. CONTROLLER SYNTHESIS A. CONSTRUCTION OF FEEDBACK LINEARIZATION CONTROLLER
Consider the model of the spacecraft attitude represented by (1), and as options for the state variables in the feedback linearization, the vector components ζ andζ are selected.
Since the matrix H is invertible, our objective is to show that by choosing ζ andζ as state variables, and by differentiating the expression ofζ the dynamics of a flexible spacecraft in (1) can be represented by the following equation [12]. We choose the torque applied to the system in the form of: which is obtained based on (1) as follows: where f : If we choose the control law in the form of (7), where v is the new control input, we will have the new system dynamics as followsζ If we choose the new state variable as follows then, we haveẋ where Therefore, it is clear that (7) is the feedback Linearization controller of (1). Then, we can choose the control law in the new coordinate v in the form of: by using standard linear control design methodology as LQR or pole placement. Under this control law (18) in the new coordinate system, we will have the control law in the old coordinate system as (7), which is a nonlinear feedback control law. In this paper, without loss of generality, we use the pole placement techniques. We choose the control law (18) which satisfies: where ϑ n,i denotes ith natural frequency, ξ i denotes ith damping ratio and i = 1, 2, 3.

B. CONSTRUCTION OF LightGBM CONTROLLER
LightGBM regressor is a powerful gradient boosting tree (GBT) regressor that has the ability to synthesize data-driven controllers based on a large amount of spacecraft attitude data. LightGBM has the advantage of being highly scalable and able to handle large amounts of data efficiently. This makes it a valuable tool for spacecraft attitude control, where large amounts of data must be processed in real-time to make decisions. Overall, the use of LightGBM in spacecraft attitude control has the potential to improve the performance and accuracy of the system. The input and output data used to train the LightGBM regressor are generated by the closed-loop system without uncertainty and disturbance. The system is controlled by using the exact feedback linearization control law. The training dataset consists of various initial conditions of the system. This is done in order to obtain a reliable training dataset for the LightGBM regressor. The same dataset is also used as a testing dataset to evaluate the performance of the trained LightGBM regressor. In other words, the LightGBM regressor is trained using a simulation of the exact feedback linearization control law and then tested on the same simulation to compare its performance with the exact feedback linearization method as a baseline. By using this approach, it is possible to evaluate the effectiveness of the LightGBM regressor in handling uncertainty and disturbance that are present in the actual spacecraft attitude control system.
In LightGBM, the input features are represented by a vector of input variables denoted as ζ andζ , and the output variable is labeled as τ , which is the torque in this case, that is based on the exact controller. This notation is exactly the same as defined before. The relationship between the input and output variables is modeled using some probabilistic distribution. The goal is to find a function τ M (ζ,ζ ) that maps the input features to the output variable with minimal error. This is formalized by introducing some loss function L(τ, f (ζ,ζ ) and minimizing it in expectation: The model is designed to handle high-dimensional data and can perform feature selection and dimensionality reduction. It works by dividing the data into small subsets and then building a tree-based model on each subset. The model then combines the results of all the trees to make the final prediction. The algorithm also uses a technique called histogram-based gradient boosting, which reduces the computational cost and memory usage.
Overall, the LightGBM controller provides a powerful tool for spacecraft attitude control as it can handle highdimensional data and produce accurate predictions with the help of a combination of loss functions, gradient boosting, and evaluation metrics.
where v is defined as follows: 3: Prepare dataset generated by the closed-loop system of a system without uncertainty and disturbance which is controlled by using exact feedback linearization control law 4: Split data into training and testing sets (80 : 20). 5

C. STABILITY ANALYSIS FOR LightGBM CONTROLLER
The LightGBM controller is basically a statistical machine learning algorithm. We note that the statistical learning process is performed in the training stage. When we apply  the result of the training as the spacecraft attitude controller, it is not statistical anymore. Therefore, we will use stability analysis for a deterministic dynamical system to analyze the stability (property) of spacecraft attitude closed loop dynamics under the LightGBM controller. The controller resulting from the LightGBM machine learning algorithm can be chosen very close enough with the exact controller τ (x) = τ (ζ,ζ ). This can be easily understood from the discussion in the previous section. Let the controller result from LightGBM machine learning as: and let, expresses the LightGBM controller error. The closed-loop dynamics of the spacecraft attitude control under the LightGBM controller will be in the form of: where A and B are given by (17) and v is given by (18). we can then write (23) as follows: where Proof: It is obvious by the fact that (A + BK ) is a strictly stable matrix. Moreover, by observing the linearity of (24), as long as we choose τ M (x) which gives smaller M , then, we can have smaller N. Thus, even though we can not guarantee asymptotic stability for the closed-loop system under the LightGBM controller, we can have a kind of practical stability ''ball of boundedness'' by designing a LightGBM controller with a smaller bound of error. Further, we assume that there is uncertainty in spacecraft inertia of the form where H is the uncertainty and disturbance in the torque of the form where τ d (t) is the disturbance. Next, we will show that the closed-loop system will have a total stability property. We use (20), (7), (18) as the control law. It is not difficult to show that the dynamics of the closed-loop system in the presence of LightGBM controller error (22), uncertainty in the inertia (27), and disturbance in the torque (28) will have the forṁ where g : R 6 × R + → R 6 expresses the effect of LightGBM controller regressor error, uncertainty, and disturbance, and A CL is a strictly stable matrix.
Following [11], we can see (29) as a systemẋ = A CL x with perturbation term g(x, t). Here, following [11], we will use the total stability concept.
Further, we will restate an important result from [11] as Theorem 1.
Theorem 1 (Theorem 4.14 [11], Page 150) If the equilibrium point x = 0 of the unperturbed systemẋ = A CL x is uniformly asymptotically stable, then it is totally stable.
We are in a position to state the main theorem which guarantees the total stability property of the spacecraft attitude origin point x = 0 under uncertainty and disturbance.
Theorem 2 The origin point x = 0 of (29) is totally stable. Proof: Note that, the origin point x = 0 of (29) is the equilibrium point of the unperturbed systeṁ The unperturbed system (30) is a time-invariant system or an autonomous system. Therefore, since A CL is a strictly stable matrix, the equilibrium point x = 0 of (30) will be asymptotically stable. Further, because (30) is timeinvariant or autonomous, asymptotic stability will be identical with uniform asymptotic stability. Further, the total stability property of the origin point x = 0 of (29) follows directly as a direct implication of Theorem 1. Theorem 2 guarantees that the closed-loop system of spacecraft attitude dynamics under the LightGBM controller is totally stable despite uncertainty in inertia and torque disturbance.
70242 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.

IV. SIMULATION AND DISCUSSION
Digital simulations were performed using Python programming language (version 3.11) to compare the performance of the three controllers. In order to show the performance of the proposed controller, a large initial maneuvering deviation is given, i.e., the rotation angle of 132.3436 • with the deviation axis (2, 1, 1) T . The parameter values utilized for the simulation of the spacecraft's attitude are: For this example, we choose the same damping ratio ξ i = 0.707, and the natural frequency ϑ i is chosen as follows:

A. SYNTHESIZING LightGBM CONTROLLER: TRAINING AND TESTING
The synthesis of the LightGBM controller is presented in this section. The LightGBM training and testing dataset is generated from a closed-loop system without disturbance controlled by an exact feedback linearization controller. The controller's performance was evaluated based on the accuracy of the prediction of the spacecraft attitude control system, with evaluation metrics such as R-squared, RMSE, and MAE. The trained model was then used to predict the attitude response of the spacecraft under various operating conditions. The simulation results showed that the LightGBM controller provided accurate predictions with a high degree of precision. all of the model training, testing, and simulations were carried out using Python v3.11 and Python package LightGBM v3.2.1. The dataset was generated based on 32,768 combinations of initial conditions (32 for each ζ , and 1 for allζ ), and 1001 timesteps, which yield 32,800,768 data points, or data size. LightGBM training and simulations were carried out with various data sizes to show the importance of data size in LightGBM training, ranging from 1,000 to 32,800,768 in data size. The smaller datasets were generated with fewer combinations of initial conditions, as well as timesteps. For each model, LightGBM training was done taking hyperparameters tuned as follows: ('max depth': 6, 'learning rate': 0.1, 'num tree': 100), while the other hyperparameters are left at their default values.
In evaluating the performance of the LightGBM controller, various evaluation metrics such as R-squared, root mean squared error (RMSE), and mean absolute error (MAE) were utilized. These metrics were used to measure the accuracy of the predicted values compared to the actual values. R-squared is a statistical measure that indicates how well the predicted values match the actual values. RMSE is the square root of the mean of the squared differences between predicted and actual values. MAE is the mean of the absolute differences between predicted and actual values. A higher R-squared value and lower RMSE and MAE values indicate higher accuracy and a better fit of the data-driven controller to the actual data.
The analysis of the experimental results reveals interesting trends in the R-squared values with varying data sizes. It is observed that as the data size increases, the R-squared value, which measures the goodness of fit of the LightGBM controller, improves significantly. This signifies that a larger dataset allows for better accuracy and predictive performance of the controller. Starting from 10,000 data size, a notable enhancement is observed in the R-squared value, surpassing the threshold of 0.90. This indicates that the model explains more than 90% of the variance in the spacecraft attitude control data. This high R-squared value suggests that the LightGBM algorithm is effective in capturing the underlying patterns in the data and predicting spacecraft attitudes with a high degree of accuracy.  On the other hand, the Root Mean Squared Error (RMSE) and Maximum Absolute Error (MAE) values tend to decrease as the sample size increases. This observation suggests that the performance of the model may increase slightly with larger sample sizes, as indicated by the smaller difference in train-test performance. However, it is important to note that the increase in RMSE and MAE values may still be within acceptable bounds, depending on the specific application and tolerance for errors. From Section III-C, it is proven that we can generate a smaller M, which is equivalent to MAE, with increasing data size.
Overall, the high R-squared value and the trends observed in RMSE and MAE values indicate promising results for our proposed LightGBM algorithm for spacecraft attitude control. However, further analysis and validation are warranted to fully understand the model's performance and potential limitations and to ensure its suitability for realworld applications.
These results suggest that the LightGBM controller is capable of accurately predicting the torque output based on the input variables with a high degree of confidence, as evidenced by the high R-squared values and low RMSE values. The model became more capable as the data size increased. These results demonstrate the effectiveness of the LightGBM controller in predicting the behavior of the spacecraft attitude control system.

B. SIMULATION OF LightGBM CONTROLLER
The simulation using the LightGBM controller shows that the closed-loop system is stable as we have shown in the previous section. The simulation was conducted with different data sizes, ranging from 1 thousand to 32 Million data points. In addition to that, we also evaluate the transient property of the closed-loop dynamics in this simulation. Evaluation metrics use two parameters for the transient property. First, maximum overshoot which is defined as the percentage of the largest overshoot value with respect to the initial condition of the respective attitude, namely 70244 VOLUME 11, 2023 Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply. where |ζ i,peak | is the maximum absolute value sof the i-th attitude. Second, we use 2% settling time for another evaluation metric for transient performance, t s , which defined as follows where t s,i is 2% settling time for attitude i, i.e. if for all t ≥ t s,i imply |ζ i (t)| ≤ 2%|ζ i (0)|. The analysis of the simulation results with various data sizes, ranging from 1,000 to 32 million, reveals interesting trends in the maximum overshoot and settling time with varying data sizes, as shown in Table 3. It is observed that as the data size increases, the performance of the LightGBM controller improves in terms of maximum overshoot and settling time. This indicates that a larger dataset allows for better learning and generalization of the controller.
Specifically, At a data size of 10,000, there is a noticeable improvement in both maximum overshoot and settling time as the dataset grows larger. The controller adapts more effectively to the system dynamics and achieves better control performance.
However, after reaching a data size of 10,000, the performance improvement becomes less significant. The overshoot values consistently fall within the range of 4.727 to 6.238%, and the settling time values range from 26.6 to 29.0 seconds. The controller has already learned the underlying patterns and dynamics of the spacecraft attitude system from the available data. As a result, increasing the data size further does not lead to a significant reduction in maximum overshoot and settling time.
This analysis highlights the diminishing effects of increasing the data size beyond a certain threshold, in terms of maximum overshoot and settling time. Therefore, it is crucial to strike a balance between the amount of data collected and the desired control performance.
These results highlight the importance of having an adequate amount of data for training and validating the controller. However, it is also important to consider the tradeoffs between data size and computational resources, as larger data sizes may require more computational power and storage. Further analysis could also explore the optimal data size for achieving the best performance in terms of overshoot, settling time, and other relevant metrics, as well as investigate the potential impact of data quality, data preprocessing techniques, and other factors on the controller's performance.

C. SIMULATION OF LightGBM CONTROLLER WITH UNCERTAINTY AND DISTURBANCE
The ability of the LightGBM controller to handle disturbance and increased inertia is crucial in real-world applications where spacecraft may encounter uncertainty and disturbance. The robustness of the controller's performance, as demonstrated by its ability to maintain effective control even in the presence of uncertainty and disturbance, underscores its reliability and suitability for practical implementation in spacecraft attitude control systems. The spacecraft attitude system using LightGBM controller with uncertainty and disturbance is presented in Fig. 4, and is defined in section III-C.
This section investigates the robustness of the proposed LightGBM Controller approach. In order to show controller robustness, the simulation of the LightGBM controller is carried out under conditions of a 50% increase in inertia, with the torque disturbance simulated using white noise by a normal Gaussian distribution with a mean value of zero and a standard deviation of 10%, using a data size of 32,800,768 data points. The simulation result is presented in Fig. 5.
The result reveals that the controller is capable of handling uncertainty and noise effectively, exhibiting robust performance. 50% increase in inertia and 10% Gaussian white noise result in slower settling time and higher overshoot by 24.3%, and 22.2%, respectively, as compared to spacecraft attitudes without uncertainty and disturbance. Even though, it is evident from Fig. 5 that the system with uncertainty and disturbance still achieves stability. The analysis results provide valuable insights into the controller's performance and its resilience to perturbance, validating its effectiveness in mitigating the adverse effects of uncertainty and disturbance. Further investigations could be conducted to explore the controller's performance under different types and levels of uncertainty and disturbance, as well as evaluate its performance in comparison to other control methods in similar conditions.
Overall, the findings highlight the promising potential of the LightGBM controller as a data-driven approach for spacecraft attitude control in the presence of perturbances such as inertial uncertainty and torque disturbance.

V. CONCLUSION
Based on the points discussed in our paper, we can conclude that our proposed data-driven LightGBM controller for spacecraft attitude control offers a promising approach that overcomes the limitations of traditional model-based controllers. The synthesis process from spacecraft attitude control data using feedback linearization allows for robust and scalable control performance. The extensive validation through diverse test scenarios and simulations confirm the effectiveness and reliability of the proposed LightGBM controller in handling different operational scenarios and system dynamics. Moreover, the practical stability concept and total stability concept proposed ensures the robustness and reliability of the data-driven LightGBM controller despite the existence of uncertainty in spacecraft inertia and disturbance in spacecraft attitude control.
Furthermore, the results obtained from using the proposed LightGBM controller with 32,800,678 data points demonstrate its effectiveness in handling challenging conditions of uncertainty and disturbance. The controller shows robust performance, indicating its capability to handle uncertainty and disturbance in spacecraft attitude control applications.
To elaborate further, the results suggest that utilizing a data-driven approach like LightGBM can provide a more flexible and adaptable control strategy for spacecraft attitude control compared to traditional methods. The ability to effectively handle uncertainty and disturbance in the system can improve the spacecraft's performance and reliability. Additionally, the use of a large amount of data in training the controller can enhance its performance, as it can capture a wider range of scenarios and variations in the system. Future research is to explore the impact of hyperparameter tuning and optimization techniques on the performance of the controller. This can further improve the controller's performance and robustness.