**1. Introduction**

Satellite attitude control plays a significant role in most space missions. Therefore, the development of an accurate and stable controller is an essential part of conducting a space mission [1–8]. The most advanced satellite attitude control techniques use the concept of quaternion feedback [9–12]. However, various linear and nonlinear attitude control strategies based on quaternion feedback have been investigated [13,14]. The quaternion feedback approach is also used to stabilize the attitude of microsatellites [15].

In recent years, many control techniques have been proposed for satellite attitude control in the presence of uncertainty and disturbance [16,17]. Li et al. [18] proposed a robust finite time control algorithm for controlling satellite attitude in the presence of uncertainty; and Xiao et al. [19] developed a control approach with a simple structure to perform an attitude tracking maneuver for rigid satellites in the case of disturbances and uncertain inertia parameters. In another study, Vatankhahghadim and Damaren [20]

**Citation:** Wang, X.; Abtahi, S.M.; Chahari, M.; Zhao, T. An Adaptive Neuro-Fuzzy Model for Attitude Estimation and Control of a 3 DOF System. *Mathematics* **2022**, *10*, 976. https://doi.org/10.3390/ math10060976

Academic Editors: Xiang Li, Shuo Zhang and Wei Zhang

Received: 18 February 2022 Accepted: 16 March 2022 Published: 18 March 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

proposed a linear passivity-based controller design for hybrid attitude control of spacecraft using magnetic torques and thrusters.

Several different types of optimal controllers have been used to enhance the performance of the satellite attitude control system. In order to enhance the pointing accuracy of a small satellite, an attempt was made to optimize the attitude control model based on the optimal control algorithm [21]. In another study, the optimal magnetic attitude control for small satellites was studied [22]. Moreover, Arantes et al. [23] tried to analyze and design a reaction thruster attitude controller and then improve the performance of the control subsystem. All these optimal control design algorithms inevitably led to a specific mathematical model, leading to inappropriate behavior compared to external pulses in the comparison simulation state. It is noteworthy to mention that an optimal controller may not guarantee the stability of the closed-loop system in the presence of uncertainties.

The adaptive control method is one of the most powerful approaches that can deal with the problem of system uncertainty. In this regard, Wen et al. [24] proposed a novel adaptive control method for the spacecraft's attitude tracking control problem with inertia uncertainties. Moreover, Lee and Singh [25] proposed an adaptive controller in order to control the satellite attitude by solar radiation pressure. In another research, they presented a novel adaptive controller for attitude control of satellites with large uncertainties in the system parameters utilizing solar radiation pressure [26]. All of these adaptive control algorithms are model-based, and although they are able to deal accurately with uncertainties, they are incapable of dealing with different dynamic models. The problem of satellite attitude determination has been extensively studied, and has been the main concern of many studies in recent decades [27–29]. In a study by Kouyama et al. [30], they proposed an automated and robust scheme to determine the satellite attitude, which of course follows an exact map projection. They employed this method in combination with the classic onboard sensors. In another study, Wu et al. [13] proposed a method by which the problem of orientation based on a single sensor observation could be solved.

The enormous ability of fuzzy logic to solve various mathematical problems of modeling, control, and estimation is undeniable. Daley et al. [31] utilized the self-organizer fuzzy logic controller (SOC) for attitude control of a flexible satellite with significant dynamic coupling of the axes that cannot be modeled easily. In another paper, Mukherjee et al. [32] employed fuzzy logic to control the attitude of Earth-pointing satellites, in which they used the genetic algorithm to optimize the performance of their proposed nonlinear fuzzy PID controller. In other research, Huo et al. [33] proposed an adaptive fuzzy fault tolerance attitude control for a rigid spacecraft. In recent years, fuzzy logic has been used for a variety of satellite attitude estimation purposes [34]. However, Ran et al. [35] studied an adaptive fuzzy fault tolerance control for rigid spacecraft attitude maneuvers. Furthermore, Sun et al. [36] utilized an adaptive fuzzy estimator for spacecraft attitude determination.

In this paper, an ANFIS (adapted neuro-fuzzy inference system) [37] controller was introduced to control and estimate the satellite attitude. However, to the best of the authors' knowledge, no study in the literature has been conducted on the integrated control and estimation of satellite attitude using ANFIS, which is a kind of artificial neural network and is based on the Takagi–Sugeno fuzzy inference system. The most significant advantage of the proposed model is the elimination of interphase (sensor equations and equations used to calculate quaternion errors). This, in turn, eliminates systematic errors and noise that are unavoidable in classical approaches. Consequently, the ANFIS control method is mostly applicable in terms of measurement noise, model uncertainty, and external disturbance [38].

The rest of this paper is organized as follows. First, a summary of the satellite attitude dynamics is given. A brief overview of the optimal PID controller design for control systems is then given. Next, the general ANFIS structure and the learning algorithms are discussed. Subsequently, structures of ANFIS controller and satellite attitude estimator are given. Finally, an ANFIS integrated control and estimation subsystem are introduced to reduce the complexity of the control system. The usefulness of this model is then examined by comparing the proposed model results with those of the classical controller.

#### **2. Modeling of System**

#### *2.1. Satellite Dynamics Model*

In this section, we introduce equations of motion of a satellite with the Euler equation and quaternion kinematics. The Euler equation of the rigid body satellite attitude around its principal axes coordinates is [39]:

$$\begin{aligned} I\_1 \dot{\omega}\_1 &= M\_{c1} + M\_{d1} - (I\_{3-}I\_2)\omega\_2 \omega\_3 \\ I\_2 \dot{\omega}\_2 &= M\_{c2} + M\_{d2} - (I\_{1-}I\_3)\omega\_1 \omega\_3 \\ I\_3 \dot{\omega}\_3 &= M\_{c3} + M\_{d3} - (I\_{2-}I\_1)\omega\_2 \omega\_1 \end{aligned} \tag{1}$$

where *ω*1, *ω*2, and *ω*<sup>3</sup> are the elements of the angular velocity vector of the satellite. In addition, *I*1, *I*2, and *I*<sup>3</sup> are the moments of inertia about the principal axes. *M<sup>c</sup>* and *M<sup>d</sup>* are the control and disturbance moments, respectively, which are expressed in the body frame.

For kinematic representation, the quaternion vector *q* = (*q*1, *q*2, *q*3, *q*4) *T* is utilized, which is defined as follows:

$$
\begin{bmatrix} q\_1 \\ q\_2 \\ q\_3 \end{bmatrix} = \sin \frac{\theta}{2} \begin{bmatrix} e\_1 \\ e\_2 \\ e\_3 \end{bmatrix} \quad q\_4 = \cos \frac{\theta}{2} \tag{2}
$$

where *θ* is the rotation angle about the Euler axis *e* = (*e*1,*e*2,*e*3). The kinematic differential equations for quaternions are as follows:

$$
\begin{bmatrix}
\dot{q}\_1\\ \dot{q}\_2\\ \dot{q}\_3\\ \dot{q}\_4
\end{bmatrix} = \frac{1}{2} \begin{bmatrix}
0 & \omega\_3 & -\omega\_2 & \omega\_1\\ -\omega\_3 & 0 & \omega\_1 & \omega\_2\\ \omega\_2 & -\omega\_1 & 0 & \omega\_3\\ -\omega\_1 & -\omega\_2 & -\omega\_3 & 0
\end{bmatrix} \begin{bmatrix}
q\_1\\ q\_2\\ q\_3\\ q\_4
\end{bmatrix} \tag{3}$$

#### *2.2. Measurements*

The sun sensor and the magnetometer were used as reference sensors in this study to estimate the setting. In order to simulate the magnetometer sensor (magnetic field), height, latitude, longitude date, were considered as inputs and the magnetic field vector can be calculated as inertia frame *B I* using the IGRF11 model [40]. Therefore, the magnetic field is transformed into the body frame *B B* including a random white noise *nB*:

$$
\overline{B}^B = \mathcal{C}\_I^B \overline{B}^I + \overline{\pi}\_B \tag{4}
$$

The rotation matrix *C B I* can be calculated using the quaternion vector as follows:

$$\mathbf{C}\_{I}^{B} = \begin{bmatrix} 1 - 2(q\_2^2 + q\_3^2) & 2(q\_1 q\_2 + q\_3 q\_4) & 2(q\_1 q\_3 + q\_2 q\_4) \\ 2(q\_2 q\_1 + q\_3 q\_4) & 1 - 2(q\_1^2 + q\_3^2) & 2(q\_2 q\_3 + q\_1 q\_4) \\ 2(q\_3 q\_1 + q\_2 q\_4) & 2(q\_3 q\_2 + q\_1 q\_4) & 1 - 2(q\_1^2 + q\_2^2) \end{bmatrix} \tag{5}$$

The attitude measurement only needs the direction of the magnetic field, which can be calculated as follows:

$$
\overline{\boldsymbol{\pi}}\_B^B = \overline{\boldsymbol{B}}^B / \left| \overline{\boldsymbol{B}}^B \right| \tag{6}
$$

The sun vector direction in inertial frame *u I s* can be found by the following formulation [41]:

$$\overline{u}\_S^I = \left(\cos\left(\lambda\_{\text{explicit}}\right)\cos(\varepsilon)\sin\left(\lambda\_{\text{elliptic}}\right)\sin(\varepsilon)\sin\left(\lambda\_{\text{elliptic}}\right)\right)^T \tag{7}$$

where

JD <sup>=</sup> 367year<sup>−</sup> INT 7(year+INT( month+9 <sup>12</sup> )) 4 <sup>+</sup> INT 275month 9 + day + 1721013.5 + ( second <sup>60</sup> <sup>+</sup>minute) <sup>60</sup> +hour 24 T = (JD − 2451545.0)/36525 , *λ<sup>M</sup>* = 280.4606184◦ + 36000.77005361T, M = 357.5277233◦ + 35999.05034T, *λecliptic* = *λ<sup>M</sup>* + 1.914666471◦ sin(M) + 0.019994643 sin(2M), *ε* = 23.439291◦ − 0.0130042T,

In the above equations, JD is Julian Day based on the date and time (year, month, day, hour, minute, and second); T is the Julian centuries; *λ<sup>M</sup>* is mean longitude of the sun; M is the mean anomaly of the sun; *λecliptic* is the ecliptic longitude of the sun; and *ε* is the tilt angle of the Earth rotation axis.

Similar to the magnetometer, the output of the sun sensor as the direction of the sun vector in body frame *u B S* can be estimated as follows:

$$
\overline{\boldsymbol{\pi}}\_{\mathcal{S}}^{\mathcal{B}} = \mathsf{C}\_{I}^{\mathcal{B}} \overline{\boldsymbol{\pi}}\_{\mathcal{S}}^{I} + \overline{\boldsymbol{\pi}}\_{\mathcal{S}} \tag{8}
$$

Furthermore, to provide the angular velocity measurements, a three-axis rate-gyro with random white noise was used.

#### **3. Adaptive Neural Fuzzy Inference System**

#### *3.1. Fuzzy Logic*

Most traditional tools for modeling, thinking, and arithmetic are crisp, deterministic, and precise in character, so yes or no types instead of more or less types. In conventional dual logic, for example, a statement may be true or false and nothing in between. For the first time, L.A. Zadeh [42] proposed a fuzzy logic that contained "true", "false", and "partially true". He emphasized that real situations are often not clear and deterministic and cannot be described accurately.

A fuzzy control system is based on fuzzy logic, which analyzes input values in the form of logical variables that assume continuous values between 0 and 1. Rather than designing algorithms that explicitly define the control action as a function of the control input variables, the developer of a fuzzy controller writes rules that associate the input variables with the control variables through expressions of linguistic variables [43,44]. After all rules have been defined, the control process begins with the calculation of all rule consequences. Then, the consequences are summarized into a fuzzy set that describes the possible control actions.

#### *3.2. ANFIS*

In general, the fuzzy control logic has two main approaches: (1) Mamdani [45] and (2) Takagi–Sugeno [46]. The basis of ANFIS as an adaptive network-based fuzzy system is the Takagi–Sugeno fuzzy system method [37,47]. Its inference system corresponds to a set of fuzzy IF–THEN rules that have a learning ability to approximate non-linear functions. ANFIS is a combination of neural networks and fuzzy systems. However, ANFIS has become a very powerful simulation method that uses both fuzzy and neural network methods [48]. Recently, ANFIS modeling has become widespread in various space missions [49–51].

The main characteristic of the ANFIS controller is the ability to handle inaccuracy and uncertainty, which allows the use of real data and, more importantly, the design of a controller based on the provided real data [14,52]. The other considerable superiority of the ANFIS system is the required number of input variables for control and estimation. Simplicity of modeling compared to classical modeling, along with the superiority of this method in the presence of noise and uncertainty compared to PID controllers, which makes our proposed model more accurate.

ANFIS has five layers (as shown in Figure 1) as follows:

**Figure 1.** ANFIS structure.

Layer 1: Define membership function of input variables.

$$O\_{1,i} = \mu\_{A\_i}(\mathfrak{x}) \; for \; i = 1, 2$$

$$O\_{1,i} = \mu\_{B\_{i-2}}(\mathfrak{x}) \; for \; i = 3, 4$$

Layer 2: Product of the membership function for each input.

$$O\_{2,i} = \omega\_i = \mu\_{A\_i}(\mathbf{x})\,\mu\_{B\_i}(\mathbf{x})\,i = 1,2$$

Layer 3: Normalize the output of layer 2.

$$O\_{3,i} = \overline{\omega}\_i = \frac{\omega\_i}{\omega\_1 + \omega\_2} \text{ } i = 1, 2$$

Layer 4: The output of this layer is:

$$O\_{4,i} = \overline{\omega}\_{i} f\_{i} = \overline{\omega}\_{i} (p\_{i}\mathfrak{x} + q\_{i}\mathfrak{y} + r\_{i})$$

Layer 5: The output of this layer is the summation of all outputs in layer 4.

$$O\_{5\dot{i}} = \sum \overline{\omega}\_{i} f\_{\dot{i}} = \frac{\sum \omega\_{i} f\_{\dot{i}}}{\sum \omega\_{\dot{i}}}$$

#### *3.3. Hybrid Learning Algorithm*

Least square gradient reduction was used to train the ANFIS system (locating the membership function parameters) and the pattern between the input and the output data provided by an optimal PID controller.

Each learning level can be divided into two parts. In the forward stage, the inputs and outputs of each layer are calculated and the optimal coefficients are provided. Then, in the reverse stage, the parameters of the ANFIS system are updated.

#### *3.4. Optimal PID Controller*

The control moment vector by using the PID controller can be calculated as follows:

$$M\_c = K\_p q\_\varepsilon + K\_d \omega + K\_q \int q\_\varepsilon dt + K\_\omega \int \omega dt \tag{9}$$

where *q<sup>e</sup>* is the quaternion error and can be obtained from the following equation [39]:

$$
\begin{bmatrix} \overline{q}\_{\varepsilon} \\ q\_{4} \end{bmatrix} = \begin{bmatrix} q\_{1\varepsilon} \\ q\_{2\varepsilon} \\ q\_{3\varepsilon} \\ q\_{4\varepsilon} \end{bmatrix} = \begin{bmatrix} q\_{4\varepsilon} & q\_{3\varepsilon} & -q\_{2\varepsilon} & -q\_{1\varepsilon} \\ -q\_{3\varepsilon} & q\_{4\varepsilon} & q\_{1\varepsilon} & -q\_{2\varepsilon} \\ q\_{2\varepsilon} & -q\_{1\varepsilon} & q\_{4\varepsilon} & -q\_{3\varepsilon} \\ q\_{1\varepsilon} & q\_{2\varepsilon} & q\_{3\varepsilon} & q\_{4\varepsilon} \end{bmatrix} \begin{bmatrix} q\_{1} \\ q\_{2} \\ q\_{3} \\ q\_{4} \end{bmatrix} \tag{10}
$$

where *qc*s are the quaternions of the command attitude.

The control gains *Kp*, *K<sup>d</sup>* , *K<sup>q</sup>* in Equation (9) are optimized in order to minimize the following cost function:

$$J = \int \left(\sum\_{i=1}^{3} |\omega\_i| + \sum\_{i=1}^{3} |q\_{\ell\_i}| \right) dt \tag{11}$$

By considering the following constraint as:

$$|M\_{\mathcal{C}}| \le M\_{\mathcal{C}\_{\text{max}}} \tag{12}$$

Consequently, this constraint guarantees the appropriate signal command to input the modulator for ON–OFF command of the thrusters with torque *Mcmax* .

#### **4. ANFIS Controller and Estimator**

*4.1. ANFIS Controller*

The aim of this training is to model an optimal PID controller as close as possible. The control input variables are angular velocity and quaternion errors, and the control output variable is the control torque *M<sup>C</sup>* (as shown in Figure 2).

**Figure 2.** Block diagram of the ANFIS controller.

After the input and output variables are supplied by a system with PID controller, the collection of these data is repeated several times, taking into account 15 different initial conditions (each simulation for 20 s with 0.01 s sampling time). This means that the initial quaternions and initial angular velocities are changed to provide a wide range of data for ANFIS learning. Thereafter, the ANFIS controller training process begins and the ANFIS system learns the path from the inputs to the outputs. Now, the ANFIS controller can work with all initial conditions.

#### *4.2. ANFIS Estimator*

In this study, we utilized sun sensor and magnetometer outputs to estimate attitude. Therefore, data for ANFIS estimation learning from these two sensors were provided both in the body (sensor) and in the inertia frame (calculation) (as shown in Figure 3). However, several different scenarios were considered to provide a large database for learning the ANFIS estimator.

**Figure 3.** Block diagram of the ANFIS observer.

#### *4.3. Combined Control and Estimation Using ANFIS*

In this study, both the ANFIS estimator and ANFIS controller were used in a closed loop simulation. The nesting simulations show the performance of these two ANFIS subsystems working simultaneously (as shown in Figure 4).

**Figure 4.** Block diagram of the combined ANFIS observer and controller.

#### *4.4. Integrated Control and Estimation Using ANFIS*

As mentioned in the introduction, the main purpose of this study was to evaluate the performance of an ANFIS system as a combination of estimator and controller instead of two separate subsystems (ANFIS estimator and ANFIS controller). As shown in Figure 5, for the proposed ANFIS subsystem, input variables are the inputs of the estimator (sensor data), and output variables are the outputs of the controller (control torque). In fact, the ANFIS integrated control and estimation subsystem receives data read by the sun sensor and the magnetic sensor as input variables and then passes the control torque directly to the system dynamics, as shown in Figure 6).

**Figure 5.** Block diagram of the integrated ANFIS controller and observer.

**Figure 6.** Block diagram of the control system using the ANFIS integrated controller and observer.

#### **5. Evaluation of ANFIS Control and Estimation**

To study the performance of attitude estimation and the control of satellites using ANFIS, a satellite with the moments of inertia that presented in Table 1 was considered. For all simulations, the final simulation duration time was selected to be 20 s, and the sampling time for estimation was 0.01 s. The system initial conditions and the desire attitude are provided in Table 2.

#### **Table 1.** Nominal and indeterminate moments of inertia (in Kg·m<sup>2</sup> ).


**Table 2.** Sample initial condition (this initial condition is not in the training set).


#### *5.1. ANFIS Performance Comparison*

As the simulations are presented for the stabilization of satellite attitude on zero condition, the most important characteristics of the results are the settling time of control, the control effort (fuel consumption), and the steady state error. Therefore, these characteristics are considered as the criteria for a comparison of the results.

The comparison of time histories of control moments for PID and ANFIS in the presence of noise and uncertainty are shown in Figures 7 and 8, respectively. The trajectory of the Euler angles are also presented in Figures 9 and 10. As shown in Figure 7, it can be seen that the PID controller is noisy and the ANFIS controller design method produces smoother control actions. Moreover, the trajectory of the attitude angles using PID controller has larger over-shoot values. As a result, the attitude angles are smoother and they can quickly reach the desired values.

*Mathematics* **2022**, *10*, x FOR PEER REVIEW 10 of 16

**Figure 7.** Comparison of control moments in (**a**) X, (**b**) Y, and (**c**) Z directions using ANFIS and PID in the presence of noise. **Figure 7.** Comparison of control moments in (**a**) X, (**b**) Y, and (**c**) Z directions using ANFIS and PID in the presence of noise. **Figure 7.** Comparison of control moments in (**a**) X, (**b**) Y, and (**c**) Z directions using ANFIS and PID in the presence of noise.

**Figure 8.** Comparison of control moment in (**a**) X, (**b**) Y, and (**c**) Z directions using ANFIS and PID in the presence of uncertainty.

**11**

*Mathematics* **2022**, *10*, x FOR PEER REVIEW 11 of 16

in the presence of uncertainty.

in the presence of uncertainty.

**Figure 9.** Comparison of Euler angles (**a**) φ, (**b**) θ, and (**c**) ψ using ANFIS and PID controllers in the presence of noise. **Figure 9.** Comparison of Euler angles (**a**) *ϕ*, (**b**) *θ*, and (**c**) *ψ* using ANFIS and PID controllers in the presence of noise. **Figure 9.** Comparison of Euler angles (**a**) φ, (**b**) θ, and (**c**) ψ using ANFIS and PID controllers in the presence of noise.

**Figure 8.** Comparison of control moment in (**a**) X, (**b**) Y, and (**c**) Z directions using ANFIS and PID

**Figure 8.** Comparison of control moment in (**a**) X, (**b**) Y, and (**c**) Z directions using ANFIS and PID

**6**

presence of uncertainty. **Figure 10.** Comparison of Euler angles (**a**) φ, (**b**) θ, and (**c**) ψ using ANFIS and PID controllers in the presence of uncertainty. **Figure 10.** Comparison of Euler angles (**a**) *ϕ*, (**b**) *θ*, and (**c**) *ψ* using ANFIS and PID controllers in the presence of uncertainty.

The numerical results of the comparison of the ANFIS controller and PID controller are provided in Table 3 with/without noise and uncertainty. It is clear from this table that the fuel consumption of the ANFIS controller was 5% lower than PID, even if there is no uncertainty and/or measurement noise. The presence of noise and uncertainty induced more fuel consumption (14% and 9%, respectively). Accordingly, the ANFIS controller used less control effort (fuel) in all situations (noise and uncertainty).


**Table 3.** Fuel consumption of the PID and ANFIS controllers (in N.M.S).

The settling time with 1% error is listed in Table 4 for both controllers. The improvement in settling time using ANFIS over the PID was more obvious. In some cases, the settling time of ANFIS was almost half the PID, which is very important in space systems.


**Table 4.** Settling time for 1% error for satellite Euler angles using PID and ANFIS controllers (in seconds).

#### *5.2. Command Modulation*

To evaluate the ANFIS controller results for the real thruster actuator, the control moments should be converted to ON–OFF commands. However, a PWPF (pulse-width pulse-frequency) modulator is used to transform the continuous control moment command to the ON–OFF commands. The trajectory of the attitude angles and the thruster commands are shown in Figures 11 and 12, respectively. It is clear that the limit of thrust results in a slower approach to the final attitudes. However, the results are acceptable considering the model uncertainty and measurement noise.

#### *5.3. Monte Carlo Simulation*

To analyze the robustness of the proposed integrated ANFIS estimator and controller, a Monte-Carlo simulation was conducted. A random initial condition (between −15 and +15 degrees) was considered in addition to the random noise and random uncertainty (I 1 Kg·m<sup>2</sup> ). The attitude control error of Euler angles of time = 20 s are shown for each Monte-Carlo simulation and the average and 3σ (standard deviation) until each iteration are shown in Figure 13 for 200 iterations. The maximum control error was less than 0.02 degrees, which is considerably low.

**-0.1**

**-0.05**

 **Mx (N.M)**

**0.05**

**0.1**

**0**

*5.2. Command Modulation* 

*Mathematics* **2022**, *10*, x FOR PEER REVIEW 12 of 16

*5.2. Command Modulation* 

To evaluate the ANFIS controller results for the real thruster actuator, the control

moments should be converted to ON–OFF commands. However, a PWPF (pulse-width pulse-frequency) modulator is used to transform the continuous control moment command to the ON–OFF commands. The trajectory of the attitude angles and the thruster commands are shown in Figures 11 and 12, respectively. It is clear that the limit of thrust results in a slower approach to the final attitudes. However, the results are acceptable

**Figure 11.** Euler angles time history using a PWPF modulator. **Figure 11.** Euler angles time history using a PWPF modulator. **Figure 11.** Euler angles time history using a PWPF modulator.

**Time (second)**

**Figure 12.** The control moment of the thruster in the (**a**) X, (**b**) Y, and (**c**) Z axis. **Figure 12.** The control moment of the thruster in the (**a**) X, (**b**) Y, and (**c**) Z axis.

To analyze the robustness of the proposed integrated ANFIS estimator and control-

To analyze the robustness of the proposed integrated ANFIS estimator and controller, a Monte-Carlo simulation was conducted. A random initial condition (between −15 and +15 degrees) was considered in addition to the random noise and random uncertainty (I 1 Kg·m2). The attitude control error of Euler angles of time = 20 s are shown for each Monte-Carlo simulation and the average and 3σ (standard deviation) until each iteration are shown in Figure 13 for 200 iterations. The maximum control error was less than 0.02

ler, a Monte-Carlo simulation was conducted. A random initial condition (between −15

Monte-Carlo simulation and the average and 3σ (standard deviation) until each iteration are shown in Figure 13 for 200 iterations. The maximum control error was less than 0.02

**Figure 12.** The control moment of the thruster in the (**a**) X, (**b**) Y, and (**c**) Z axis.

**0 5 10 15 20**

**Time (second)**

(**c**)

degrees, which is considerably low.

*5.3. Monte Carlo Simulation* 

*5.3. Monte Carlo Simulation* 

**-0.1**

**-0.05**

degrees, which is considerably low.

**Figure 13.** Monte-Carlo simulation error for (**a**) φ, (**b**) θ, and (**c**) ψ. **Figure 13.** Monte-Carlo simulation error for (**a**) *ϕ*, (**b**) *θ*, and (**c**) *ψ*.

#### **6. Conclusions 6. Conclusions**

In this study, an ANFIS (adaptive neuro-fuzzy inference system) controller and estimator was proposed in order to estimate and control the attitude of a satellite. However, the ANFIS controller was trained using an optimal PID. The other significant ability of the proposed system is in estimating the necessary states accurately via an ANFIS observer. To train the observer, a satellite in several different conditions (noise and uncertainty) was considered. The performance of the ANFIS controller and estimator was also compared with the PID controller in the presence of uncertainties and noises. In this study, an ANFIS (adaptive neuro-fuzzy inference system) controller and estimator was proposed in order to estimate and control the attitude of a satellite. However, the ANFIS controller was trained using an optimal PID. The other significant ability of the proposed system is in estimating the necessary states accurately via an ANFIS observer. To train the observer, a satellite in several different conditions (noise and uncertainty) was considered. The performance of the ANFIS controller and estimator was also compared with the PID controller in the presence of uncertainties and noises.

A comparison oof the performance of the PID and ANFIS controllers showed that the proposed ANFIS controller consumed less control effort (fuel) in all situations (noise and uncertainty). In addition, the proposed controller outputs behaved smoother and reached stability in a shorter time interval than the PID controller. Likewise, system outputs (control angles) were smoother and reached the desired angles faster. Furthermore, using an ANFIS estimator in the system showed that despite its simple design, it can estimate the states, even in the presence of uncertainty. Results of using the synchronous control and estimation ANFIS simulator showed that although both stages (control and estimation) were conducted in one-step, the performance of the integrated system was similar to the combined controller and estimator. Due to the proven abilities of the ANFIS controller and observer, it can be concluded that it is able to work with black box systems. It means that the determined dynamic is not essential, which makes it possible to be used for unknown space bodies (e.g., space debris) as well as fast parameter varying space objects (e.g., space robots and manipulators). In this study, we aimed to utilize as less feedback parameters as possible while the simplicity and practicability of determining those parameters were considered. Future work will focus on the attitude control of flexible satellites with multi-section appendages as well as considering fluid fuel sloshing using the ANFIS controller. A comparison oof the performance of the PID and ANFIS controllers showed that the proposed ANFIS controller consumed less control effort (fuel) in all situations (noise and uncertainty). In addition, the proposed controller outputs behaved smoother and reached stability in a shorter time interval than the PID controller. Likewise, system outputs (control angles) were smoother and reached the desired angles faster. Furthermore, using an ANFIS estimator in the system showed that despite its simple design, it can estimate the states, even in the presence of uncertainty. Results of using the synchronous control and estimation ANFIS simulator showed that although both stages (control and estimation) were conducted in one-step, the performance of the integrated system was similar to the combined controller and estimator. Due to the proven abilities of the ANFIS controller and observer, it can be concluded that it is able to work with black box systems. It means that the determined dynamic is not essential, which makes it possible to be used for unknown space bodies (e.g., space debris) as well as fast parameter varying space objects (e.g., space robots and manipulators). In this study, we aimed to utilize as less feedback parameters as possible while the simplicity and practicability of determining those parameters were considered. Future work will focus on the attitude control of flexible satellites with multi-section appendages as well as considering fluid fuel sloshing using the ANFIS controller.

**Author Contributions:** Conceptualization, M.C. and S.M.A.; methodology, T.Z. and X.W.; software, S.M.A. and M.C.; validation, X.W., T.Z. and M.C.; formal analysis, S.M.A.; investigation, S.M.A. and M.C.; resources, T.Z.; data curation, X.W.; writing—original draft preparation, S.M.A. and M.C.; writing—review and editing, M.C. and S.M.A.; visualization, S.M.A.; supervision, T.Z.; project administration, X.W.; funding acquisition, T.Z. All authors have read and agreed to the published version of the manuscript.

**Funding:** This study is funded by the key R&D plan of China for Winter Olympics (No. 2021YFF0306401), and the Key Special Project of the National Key Research and Development Program "Technical Winter Olympics" (2018YFF0300502 and 2021YFF0306400).

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Not applicable.

**Conflicts of Interest:** The authors declare no conflict of interest.

### **References**

