1. Introduction
When performing space missions, spacecraft must often execute many attitude manoeuvres. To gain energy, the solar energy cell array of the spacecraft must always be kept facing the Sun. For Earth-observing satellites, the satellite's camera must maintain its attitude requirement relative to the orientation to the Earth. Although sensors cannot be mounted in the same direction as the solar energy cell array, they must also not be exposed to sunlight. In addition to these attitude constraints, it is also necessary to consider other constraints, such as communication, suppression of stray light and avoidance of space debris. In summary, spacecraft face multiple mandatory pointing constraints and prohibited pointing constraints during orbiting operations. Specifically, when performing Earth observation missions, certain parts of the spacecraft must meet the requirements of orientation to the Earth and the Sun. Concurrently, because the surface of the Earth reflects sunlight, there are multiple reflected light areas in space. The sensors must avoid both direct and reflected sunlight. Considering these constraints, it is necessary to plan attitude change trajectories that satisfy all constraints.
Scholars have investigated the issue of spacecraft attitude manoeuvre planning. Currently, related research can be divided into two categories. One primary concept is online planning methods, such as semidefinite programming (Hablani, Reference Hablani1999), constraint monitoring algorithms (Singh et al., Reference Singh, Macala, Wong and Rasmussen1997) and randomised attitude planning algorithms (Kim and Mesbahi, Reference Kim and Mesbahi2004; Olivares and Staffetti, Reference Olivares and Staffetti2018). However, these methods have disadvantages such as poor universality and a large computing time, which means that they are difficult to use in practical engineering applications. Celani and Lucarelli (Reference Celani and Lucarelli2019) proposed an attitude motion planning approach that uses gradient-based optimisation and special orthogonal group SO(3). However, that method was only used to perform rest-to-rest manoeuvres. Xu et al. (Reference Xu, Wang, Zhu, Jiang and Li2020) proposed a new dynamic-iteration-based multi-objective planning method. However, that method linearises the constraints and relaxes the requirement for the highly accurate satisfaction of the middle target nodes. Cui et al. (Reference Cui, Zhong and Cui2017) proposed an onboard spacecraft slew-planning algorithm. However, that method is not suitable for solving problems facing multiple constraints over a long period of time. Kjellberg and Lightsey (Reference Kjellberg and Lightsey2016) and Tanygin (Reference Tanygin2017) separately used the A* pathfinding algorithm to find the optimal path away from the forbidden zones but did not consider both mandatory pointing constraints and forbidden pointing constraints. However, the A* algorithm tends to make a spacecraft perform ineffective attitude manoeuvres. The same features of particle swarm optimisation were also used by Spiller et al. (Reference Spiller, Ansalone and Curti2016), Showalter (Reference Showalter and Black2014) and Siliang and Shijie (Reference Siliang and Shijie2010). Miao and Pan (Reference Miao and Pan2015) presented a method of encoding based on proportional-differential control. However, that method only considered a few forbidden pointing constraints.
Another primary category is deterministic analytic methods, which primarily includes the potential function method. Lee and Mesbahi (Reference Lee and Mesbahi2011) proposed a convex logarithmic potential function based on the parameterised convex description model of attitude constraints established by Kim et al. (Reference Kim, Kim, Kim, Park, Kim, Kang, Wang, Jang, Lee and Yoon2015). Wu et al. (Reference Wu, Xu and Zhu2015) proposed a multi-constraint attitude manoeuvre planning method based on logarithmic potential functions. However, the process of constructing the logarithmic potential function is complex, and the algorithm is only verified in a two-dimensional plane. Ma et al. (Reference Ma, Liu, Wang and Guo2020) built a general description of spacecrafts’ conical forbidden pointing attitude set and then transformed it into the convex constraints set. Then, a new potential function was proposed to avoid the local minimum of the traditional potential function. However, that method only considers two forbidden pointing constraints within virtual three-dimensional spheres.
The potential function method can easily fall into a local optimum, and there is the problem of GNRON (goals non-reachable with obstacles nearby) (Guo et al., Reference Guo, Liu, Bao, Xu and Lv2020). It is thus not conducive to the expansion of the attitude constraint model. Most related studies simplify the existence conditions of the repulsive potential function and set the parameters improperly, which easily leads to unnecessary attitude manoeuvres (Chen et al., Reference Chen, Huang and Zhang2019). Existing research that uses a potential function to solve the attitude manoeuvre planning problem stays in the static pointing constraint in the virtual space, and the total number of constraints is limited to two or three, which is not practical.
The reinforcement learning algorithm has absorbed the advantages of both optimal control theory and adaptive control theory (Cheng, Reference Cheng2019; Huang et al., Reference Huang, Li, Sun, Liu, Yang and Liu2021); it does not require a complex and tedious modelling process and does not require the system to be fully characterised. More importantly, it can be used for online planning, which is suitable for solving nonlinear problems in continuous space (Reed, Reference Reed2020). The attitude manoeuvre planning problem proposed in this paper is a nonlinear high-dimensional continuous time-varying optimisation problem, which is suitable for solving by reinforcement learning.
A spacecraft in orbit faces many dynamic constraints; thus, there is a need for attitude manoeuvre planning. The problems of existing attitude manoeuvre planning methods include being too complex, having poor generality and yielding low-accuracy solutions. Thus this paper proposes an attitude manoeuvre planning algorithm based on improved policy gradient reinforcement learning. Based on the policy gradient reinforcement learning algorithm, the baseline of return and adaptive policy exploration are introduced. The improved model is simple and has a clear physical meaning, which has strong generality and can provide good expansion. Simulation results demonstrate that the planning results allow the spacecraft to avoid multiple dynamic attitude constraint areas successfully and maintain a high orientation accuracy to the Earth and Sun.
The remainder of this paper is organised as follows. Section 2 describes the attitude manoeuvre planning problem and explains the process of model construction, including reference attitude constraints in detail. Section 3 introduces the scheme of attitude manoeuvre planning and then introduces the process and principles of the attitude manoeuvre planning algorithm based on improved policy gradient reinforcement learning. Section 4 shows the simulation results and analysis. Section 5 concludes the paper.
2. Model construction
The spacecraft in this paper refers to a three-axis stabilisation spacecraft that is used for Earth observation and carries multiple sensors, which cannot work normally when exposed to strong light. The orientation of the solar energy cell array is the same as that of the axis $- {\boldsymbol{y}_\textrm{B}}$
in the spacecraft body frame $O{x_\textrm{B}}{y_\textrm{B}}{z_\textrm{B}}$
, and the orientation of the camera is the same as that of the axis ${\boldsymbol{z}_\textrm{B}}$
. In Earth observation missions, the observation effect is the most important goal, while the spacecraft's energy acquisition requirements are minor. This paper considers the orientation accuracy of the axis ${\boldsymbol{z}_\textrm{B}}$
to the Earth. The above attitude constraints can be divided into two types: mandatory pointing constraints and prohibited pointing constraints.
2.1. Reference attitude modelling
The definition of the reference attitude is the attitude considering the spacecraft's orientation accuracy to the Earth and Sun with different priorities.
When the spacecraft is in the reference attitude under ideal conditions, the axis ${\boldsymbol{z}_\textrm{B}}$
of the spacecraft body frame $O{\textrm{x}_B}{\textrm{y}_B}{\textrm{z}_B}$
points to the centre of the Earth, and the $- {\boldsymbol{y}_\textrm{B}}$
axis points to the centre of the Sun. However, the position vector of the Sun ${\boldsymbol{R}_{\textrm{sun}}}$
is typically not strictly vertical to the position vector of the Earth ${\boldsymbol{R}_{\textrm{earth}}}$
. The reference attitude cannot be directly defined as the axis ${\boldsymbol{z}_\textrm{B}}$
coinciding with the line between the spacecraft and the centre of the Earth and the axis $- {\boldsymbol{y}_\textrm{B}}$
coinciding with the Sun position vector ${\boldsymbol{R}_{\textrm{sun}}}$
.
Therefore, when the spacecraft is in the reference attitude, only the direction of the ${\boldsymbol{x}_\textrm{B}}$
axis is unique:
where ${\boldsymbol{z}_O}$
is the axis $\boldsymbol{z}$
of the orbital coordinate system. The origin of the orbital coordinate system $O{x_O}{y_O}{z_O}$
is located at the mass centre of the spacecraft. The ${\boldsymbol{x}_\textrm{O}}$
axis points in the speed direction of the satellite. The ${\boldsymbol{z}_\textrm{O}}$
axis points to Earth's centre, is vertical and points in the direction of spacecraft flight. The ${\boldsymbol{y}_\textrm{O}}$
axis is defined by the ${\boldsymbol{x}_\textrm{O}}$
axis and the ${\boldsymbol{z}_\textrm{O}}$
axis according to the right-hand rule.
To calculate the ${\boldsymbol{y}_\textrm{B}}$
axis and the ${\boldsymbol{z}_\textrm{B}}$
axis of the spacecraft body frame, two auxiliary coordinate systems $O{x_{\textrm{earth}}}{y_{\textrm{earth}}}{z_{\textrm{earth}}}$
and $O{x_{\textrm{sun}}}{y_{\textrm{sun}}}{z_{\textrm{sun}}}$
are defined, shown in Formula (2), where ${\boldsymbol{x}_{\textrm{sun}}} = {\boldsymbol{x}_{\textrm{earth}}} = {\boldsymbol{x}_\textrm{B}}$
. The origin of auxiliary coordinate systems is the mass centre of the spacecraft. Figure 1 is a graphical representation of the relationship between auxiliary coordinate systems, the Earth and the Sun:
Therefore, the spacecraft body frame coincides with $O{x_{\textrm{earth}}}{y_{\textrm{earth}}}{z_{\textrm{earth}}}$
when priority is given to the accuracy of the orientation to the Earth. The spacecraft body frame coincides with $O{x_{\textrm{sun}}}{y_{\textrm{sun}}}{z_{\textrm{sun}}}$
when the priority is given to the accuracy of the orientation to the Sun.
where ${\kappa _{\textrm{earth}}} \in [{0,1} ]$
and ${\kappa _{\textrm{sun}}} \in [{0,1} ]$
are weight coefficients.
Graphical representation of auxiliary coordinate systems

According to Equations (1), (2) and (3), the reference attitude $({{\varphi_\textrm{d}},{\theta_\textrm{d}},{\psi_\textrm{d}}} )$
of the spacecraft can be described by:
To describe the accuracy of the spacecraft's Earth orientation visually, the angle between axis ${\boldsymbol{z}_\textrm{B}}$
and axis ${\boldsymbol{z}_O}$
is introduced:
2.2. Attitude constraints modelling
The mandatory pointing constraints faced by the spacecraft include the energy acquisition constraints on the Sun and orientation constraints to the Earth. The prohibited pointing constraints refer to the sensor attitude constraints, including direct and reflected sunlight constraints.
The energy acquisition constraint states that the included angle between the solar light and the solar energy cell array is less than ${\theta _{q1}}$
, and the included angle between the $- {\boldsymbol{y}_\textrm{B}}$
-axis and the solar position vector ${\boldsymbol{R}_{\textrm{sun}}}$
in the spacecraft body frame is less than ${\theta _{q1}}$
:
Orientation constraints on the Earth require that the included angle between axis ${\boldsymbol{z}_\textrm{B}}$
and Earth position vector ${\boldsymbol{R}_{\textrm{earth}}}$
in the spacecraft body frame be less than ${\theta _{q2}}$
:
During attitude manoeuvring, it is necessary to avoid direct sunlight and reflected light areas within the conical fields of view of the sensors. Assuming that the position vector of the $i\textrm{th}$
central axis of the sensor's field of view in the spacecraft body frame is $\boldsymbol{r}_{\textrm{f}\hbox{-} i}^\textrm{B}$
, the position vector of the $j\textrm{th}$
central axis of the reflected light area relative to the spacecraft is expressed as $\boldsymbol{r}_{\textrm{m}\hbox{-}j}^\textrm{B}$
in the spacecraft body frame. Figure 2 is a graphical representation of mandatory and prohibited pointing constraints. The position vector of the Sun is expressed in the spacecraft body frame as $\boldsymbol{r}_{\textrm{sun}}^\textrm{B}$
. The prohibited pointing constraints require the included angle between $\boldsymbol{r}_{\textrm{f}\hbox{-}i}^\textrm{B}$
and $\boldsymbol{r}_{\textrm{m}\hbox{-}j}^\textrm{B}$
to be greater than ${\theta _{j\textrm{1}}}$
and the included angle between $\boldsymbol{r}_{\textrm{f}\hbox{-}i}^\textrm{B}$
and $\boldsymbol{r}_{\textrm{sun}}^\textrm{B}$
to be greater than ${\theta _{j\textrm{2}}}$
:
Graphical representation of two types of constraint

3. Attitude manoeuvre planning for spacecraft based on reinforcement learning
Reinforcement learning can be divided into three categories: policy-based only, value-based only, policy-based and value-based. For a high-dimensional problem, it is difficult to isolate each state strictly and to calculate the value function of each state. The value-based only method has no explicit representation policy; thus, the change of the value function cannot reflect the change of the policy well. It is difficult to address the problem of random policy (Liu et al., Reference Liu, Gao and Luo2019). In contrast, the policy gradient algorithm always improves the policy by improving its direction and can effectively manage problems in the high and continuous action space (Tang et al., Reference Tang, Shao, Zhao and Zhu2017). For single-agent reinforcement learning, the optimal baseline and the low variance policy have been proven fruitful (Greensmith et al., Reference Greensmith, Bartlett and Baxter2004; Zhao et al., Reference Zhao, Gang, Ning, Yang and Masashi2015). Therefore, the policy gradient-based reinforcement learning method is used in this paper to perform attitude manoeuvre planning.
3.1. Attitude manoeuvre planning scheme design
Based on the reference attitude and attitude constraints model, this section describes the attitude manoeuvre planning scheme based on reinforcement learning. First, the reinforcement learning model of attitude planning is established, including the basic concepts of policy, reward function and policy value function. Second, the initial database for reinforcement learning is generated. In this paper, the reference attitude is used to establish the database, which can reduce the calculation of attitude manoeuvre planning and accelerate the convergence.
The total amount of data in the database is set to be N. Then, attitude manoeuvre planning is performed based on the improved policy gradient reinforcement learning algorithm. At the end of planning, $N + {k_{\textrm{tol}}}$
attitude manoeuvre trajectories will be obtained, where ${k_{\textrm{tol}}}$
is the total number of iterations.
The policy gradient reinforcement learning algorithm will update the Euler angle along the direction satisfying all constraints. However, it cannot guarantee that all $N + {k_{\textrm{tol}}}$
attitude manoeuvre trajectories meet the attitude constraint requirements. The accuracy is different for different trajectories. Therefore, the acquired attitude manoeuvre trajectories must be screened.
Before screening the results, it is necessary to define the screening index $\chi (k)$
for attitude planning results. The following is an optional screening index $\chi (k)$
for attitude planning results:
where k represents the current iteration serial number; ${\upsilon _1}$
,${\upsilon _2}$
,${\upsilon _3}$
represent the weight coefficient; and $\sigma ({\ast} )$
represents the mean square deviation of ${\ast}$
. The roll angle ${\varphi _k}(m)$
, pitch angle ${\theta _k}(m)$
and yaw angle ${\psi _k}(m)$
are the three Euler angles of the spacecraft at moment m of the $k\textrm{th}$
iteration.
The screening index is not unique and can be designed according to real requirements. For the screening index proposed in this paper, the smaller the value is, the better the attitude planning result will be.
The final selected attitude planning result is the attitude manoeuvre planning result of group ${k_{\textrm{opt}}}$
:
Flutter and other problems may exist in the final selected result, which will improve the difficulty of attitude control. Therefore, it is necessary to smooth the attitude planning results. The smoothing method is not unique. However, the attitude planning results after smoothing should still meet the requirements of attitude constraints. In this paper, the moving average filter is used to smooth the results.
The flow of the attitude manoeuvre planning scheme based on reinforcement learning is shown in Figure 3.
Flow chart of attitude manoeuvre planning

3.2. Attitude manoeuvre planning algorithm based on improved policy gradient reinforcement learning
3.2.1. Attitude manoeuvre planning model for reinforcement learning
The purpose of the policy gradient reinforcement learning method based on the finite difference policy gradient is to optimise policy ${x_k}(m)$
at the current moment m of iteration $k\textrm{th}$
based on policy value function $J[{{x_k}(m)} ]$
:
where $\gamma (m)$
is the discount factor at this moment, and ${r_k}(m)$
is the reward function at time m.
The policy ${x_{k + 1}}(m)$
is updated as:
where $\eta$
is the step size of reinforcement learning and G is the policy gradient.
The policy ${x_{q,k}}(m)({q = 1,2,3} )$
of the attitude manoeuvre is related to the Euler angles of the spacecraft:
where ${x_{1,k}}(m)$
, ${x_{2,k}}(m)$
and ${x_{3,k}}(m)$
represent the roll angle ${\varphi _k}(m)$
, pitch angle ${\theta _k}(m)$
, and yaw angle ${\psi _k}(m)$
, respectively, of the spacecraft at time m of iteration $k\textrm{th}$
.
The reward function shown in Equation (15) is related to the accuracy of the orientation to the Earth and the Sun and the prohibited pointing constraints:
where m is the moment, k is the current serial number of iterations, ${R_{\textrm{d,}k}}(m)$
is the reward function related to the orientation to the Earth and the Sun, and ${R_{\textrm{d,}k}}(m)$
in Equation (15) is the reward function of mandatory pointing constraints. There are two mandatory pointing constraints in this paper; thus, ${R_{\textrm{d,}k}}(m)$
consists of two fractions. If we must add new mandatory pointing constraints to the spacecraft, just add new fractions to ${R_{\textrm{d,}k}}(m)$
.
${R_{\textrm{m}\hbox{-}i\hbox{-}j\textrm{,}k}}(m)$
and ${R_{\textrm{s,}k}}(m)$
represent reward functions of two different types of prohibited pointing constraints. ${N_o}$
represents the total number of sensors carried by spacecraft and ${N_J}$
represents the total number of reflected light areas. Therefore, ${N_o}$
and ${N_J}$
represent the number of two different types of prohibited pointing constraints. If we must add new prohibited pointing constraints to the spacecraft, just add new items to ${R_{\textrm{m}\hbox{-}i\hbox{-}j\textrm{,}k}}(m)$
or ${R_{\textrm{s,}k}}(m)$
.
${R_{\textrm{m}\hbox{-}i\hbox{-}j\textrm{,}k}}(m)$
is the reward function related to the angle between the $i\textrm{th}$
central axis of the sensor's field of view and the $j\textrm{th}$
central axis of the reflected light area. ${\mu _{\textrm{f}\hbox{-}j\hbox{-}i}}$
is the weight coefficient of the reward function related to the included angle between the $i\textrm{th}$
central axis of the sensor's field of view and $j\textrm{th}$
the central axis of the reflected light area. ${R_{\textrm{s,}k}}(m)$
is the reward function related to the included angle between all central axes of the sensor's fields of view and the position vector of the Sun. ${\mu _{\textrm{f}\hbox{-}j\hbox{-}i}}$
is the weight coefficient of the reward function related to the included angle between the $i\textrm{th}$
central axis of the reflected light area and the position vector of the Sun. When the relevant included angle meets the attitude constraint requirements, the weight coefficient can be set to 0.
Because the attitude manoeuvre can be accomplished by circling the two coordinate axes of the spacecraft body frame, the total reward function of the policy is set as follows:
The value function $J[{{x_{q,k}}(m)} ]$
of ${x_{q,k}}(m)({q = 1,2,3} )$
policy is:
3.2.2. Attitude manoeuvre planning algorithm based on improved policy gradient reinforcement learning
This section describes the process of the attitude manoeuvre planning algorithm based on improved policy gradient reinforcement learning. The process begins with the data in the database and then the outer iteration starts. First, initialise the serial number of iterations $k = 1$
and time $m = 1$
.
To update the policy gradient, it is necessary to set the inner iteration. Let the current one be the ${k_G}$
. Initialise ${k_G} = 0$
. After the first generation, the initial policy at time m of the $k\textrm{th}$
iteration adopts the policy $x_{q,k}^{(0)}(m)$
at time m of the $k - 1\textrm{th}$
iteration:
Calculated reference expected value function $\hat{J}_{q,\textrm{ref}}^{({k_G})}$
of policy $x_{q,k}^{({k_G})}(m)$
:
where $E[{\cdot} ]$
is the expect of $[{\cdot} ]$
.${R_{q,n}}(m)$
is the reward of the policy of the $q\textrm{th}$
Euler angle at the moment.
$\varepsilon$
is a small value greater than zero. The policy $x_{q,k}^{(0)}(m)$
at time m of the $k\textrm{th}$
iteration satisfies $|{x_{q,k}^{(0)}(m) - x_{q,k}^{}(m)} |\le \varepsilon$
.
In the inner iteration, the difference of the policy $\Delta x_{q,k}^{({k_G})}(m)$
must be calculated first, and then the expected value function $\hat{J}_q^{({k_G})}\,\, (q = 1,2,3)$
of $x_{q,k}^{({k_G})}(m) + \Delta x_{q,k}^{({k_G})}(m)$
:
where $\Delta \hat{J}_{q,k}^{({k_G})}(m)$
is the expected value function difference with the return baseline, and ${R_{q,k - 1}}(m)$
is the return at time m of the $k - 1\textrm{th}$
iteration, where ${R_{q,k - 1}}(m)/k - 1$
is the return baseline. Generally, reinforcement learning algorithms based on policy gradients lack evaluation of policies. In some problems, the returns of the policy are always positive. Therefore, even a poor policy will be strengthened, resulting in a larger variance (Wang et al., Reference Wang, Fang and Li2015). To solve this problem, the return baseline is introduced to distinguish the quality of the strategy and reduce the variance of the policy gradient. To improve the calculation efficiency, this paper uses ${R_{q,k - 1}}(m)/k - 1$
to approximate the mean value the return baseline at time m of the $1\sim k - 1\textrm{th}$
iteration:
The policy gradient is updated to:
We now introduce the error between policy ${x_{q,n}}(m)$
and reference attitude $x_{q,n}^\textrm{e}(m), (q = 1,2,3)$
:
If ${G_{q,k}}(m)$
converges, reset${k_G} = 0$
, and ${\mu _\textrm{e}} \ge 0$
is the weight coefficient. Then, calculate the final policy gradient ${G_{q,k}}(m)$
:
If ${G_{q,k}}(m)$
does not converge, add ${k_G} + 1$
then repeat Equations (21)–(26) until the policy gradient converges.
In Equation (27), ${\mu _\textrm{e}}$
is a positive error weight coefficient less than 1, and $x_{q,n}^\textrm{e}(m)$
can guide the attitude of the spacecraft towards the reference attitude, which can mitigate any non-directionality in attitude updates. After obtaining the converged policy gradient at the current time, the time is updated until all times of the current outer iteration are completed.
Policy exploration is an important step in policy updating. If only the current obtained optimal policy gradient is used to guide updating, it can easily fall into a local optimum when the policy gradient is insufficient. A good policy exploration can consider other actions while learning the optimal actions and may find a better policy than the current one. Based on Equation (27), this paper proposes an adaptive exploration method for policy updating, as shown in Equation (28). ${c_1}$
is the fixed policy weight coefficient, ${c_{q1}}\ast \sin (k/{k_{\textrm{tol}}})\ast (\pi /2)$
is the dynamic policy weight coefficient, ${c_2}$
is the fixed exploration coefficient and ${c_{q2}}\ast \cos (k/{k_{\textrm{tol}}})\ast (\pi /2)$
is the dynamic exploration coefficient. In the early stage of the iteration, to keep the change in attitude stable, ${c_1}$
cannot be too large. However, ${c_2}$
can be marginally larger to enable the policy to gain stronger exploration ability and avoid falling into the local optimum prematurely. ${c_{q2}}\ast \cos (k/{k_{\textrm{tol}}})\ast (\pi /2)$
should increase gradually, and ${c_2}$
decreases gradually as the iteration progresses. The intention of the change is to balance the ability to follow the policy gradient and free exploration, which can speed up the process of convergence:
After updating the policy according to Equation (28), the outer iteration continues until the maximum number of iterations is reached. Finally, multiple groups of attitude manoeuvre planning trajectories were obtained to be screened.The flow chart of the algorithm proposed in this paper is shown in Figure 4.
Flow chart of attitude manoeuvre planning based on improved policy gradient reinforcement learning

4. Simulation and analysis
This paper analyses spacecraft operating in a Sun-synchronous orbit. The parameters of the orbit are shown in Table 1.
Parameters of Sun-synchronous orbit

Note: Time 1 January 2021 04:00:00⋅000 Universal Time Coordinated.
To gain a more intuitive understanding of the problem of attitude manoeuvre planning, this paper analyses a typical scene of spacecraft in orbit under complex and multi-constraint conditions first.
In this paper, sunlight is reflected by five reflection points on the surface of the Earth; thus, five reflected light areas will be formed. In the spacecraft body frame, the position vectors of the central axes of the sensor's field of view are:
where ${\boldsymbol{C}_\textrm{z}}(\alpha )$
and ${\boldsymbol{C}_\textrm{y}}(\alpha )$
are the direction cosine matrices around the axis ${\boldsymbol{z}_\textrm{B}}$
and the axis ${\boldsymbol{y}_\textrm{B}}$
, respectively.
After preliminary analysis, the relative position relationship between the spacecraft and the reflected light areas changes periodically. We can thus draw the following conclusion: sometimes all fields of view for the sensors do not face any reflected light areas; sometimes sensors simultaneously face several reflected light areas in a short period of time, which means prohibited pointing constraints are violated. The selected most ‘dangerous’ situation is called the intensive pointing situation shown in Figure 5: in a short period of time, the fields of view of different sensors are successively directed to the reflected light areas. The next part of this paper focuses on the situation shown in Figure 5 (26 May 2021 23:00:26~23:03:51) to develop the attitude manoeuvre planning strategy.
Intensive pointing situation

The simulation parameters are shown in Table 2. The position vectors of the central axes of reflected light areas and the Sun are both unit vectors in the Earth-centred inertial system.
Simulation parameters

This paper requires that the included angle between the $- {\boldsymbol{y}_\textrm{B}}$
axis and the position vector of the Sun be less than ${20^ \circ }$
. In the spacecraft body frame, the included angles between the central axes of the sensor's fields of view and the central axes of the reflected light areas must be greater than ${30^ \circ }$
. The included angles between all the central axes of the sensor's fields of view and the position vector of the Sun must be greater than ${40^\circ }$
. After using the proposed algorithm to plan the spacecraft's attitude manoeuvre, the results of the attitude manoeuvre planning are finally obtained using Equation (10) as the screening index, as shown in Figure 6. The results of attitude manoeuvre planning in this paper leave a time margin of 10 seconds, which means that the attitude manoeuvre planning in all simulation results actually begins from the $10\textrm{th}$
second. Because the attitude adjustment of spacecraft can be accomplished by circling the two coordinate axes of the spacecraft body frames, Figure 6 shows that the change in pitch angle $\theta$
is nearly zero.
Results of attitude manoeuvre planning

During the entire attitude manoeuvre planning time, the roll angle $\phi$
varies from $20{\cdot}37^{\circ }$
(in $10\textrm{th}$
second) to $25{\cdot}19^{\circ }$
(in $220\textrm{th}$
second). The yaw angle $\psi$
changes greatly. The minimum yaw angle is ${21{\cdot}86^\circ }$
(in $10\textrm{th}$
second), and the maximum yaw angle is ${30{\cdot}12^\circ }$
(in $46\textrm{th}$
second). Throughout the planning process, the change range is only ${8{\cdot}26^\circ }$
.
Figure 7 shows the components of angular velocity $\boldsymbol{w}$
and angular acceleration $\boldsymbol{a}$
of the attitude manoeuvre along the coordinate axes of the spacecraft body frame. The maximum value of the components of angular velocity is ${\boldsymbol{w}_z}$
in the $10\textrm{th}$
second, which is $0{\cdot}55^\circ{/}s$
. The maximum absolute value of angular acceleration is ${\boldsymbol{a}_z}$
in the $20\textrm{th}$
second, which is $- 0{\cdot}021^\circ{/}{s ^{2}}$
; this result indicates that in the planning time, the changing ranges of angular velocity and angular acceleration are very low. The changes in angular velocity and angular acceleration are small and slow, which is convenient for micro spacecraft.
Angular velocity and angular acceleration

Although the changes in Euler angles are small, spacecraft still maintain a high orientation accuracy to the Earth and to the Sun, as shown in Figure 8. In most cases, the included angle between the $- {\boldsymbol{y}_\textrm{B}}$
axis and Sun is less than ${10^ \circ }$
, which ensures the ability to gather solar energy. The included angles between the central axes of all reflected light areas and all central axes of the sensor's fields of view are shown in Figures 9–13. All fields of view for the sensors are far away from reflected light areas. The smallest included angle is ${41{\cdot}69^\circ }$
(the included angle between the centre axis of the sensor's field of view 2 and the reflected light area 2), which is still greater than ${30^\circ }$
. In addition, as shown in Figure 14, the angle between the central axes of all sensor fields of view and the Sun position vector is larger than ${40^\circ }$
, which effectively avoids sunlight.
Orientation accuracy of spacecraft to the Earth and to the Sun

Included angle between the central axes of the sensor field of view and the central axis of reflected light area 1

Included angle between the central axes of the sensor field of view and the central axis of the reflected light area 2

Included angle between the central axes of the sensor field of view and the central axis of the reflected light area 3

Included angle between the central axes of the sensor field of view and the central axis of the reflected light area 4

Included angle between the central axes of the sensor field of view and the central axis of the reflected light area 5

Included angles between central axes of sensor attitude forbidden zones and the position vector of the Sun

Using the improved policy gradient reinforcement learning proposed in this paper, the spacecraft can effectively avoid dynamic direct and reflected sunlight while maintaining a high accuracy of pointing to the Earth and to the Sun. All sensors also avoid exposure to strong light with a large safety margin. The above results are not at the cost of a large attitude manoeuvre, and the process of changing the Euler angles in the planning results is smooth and slow, which conforms to the manoeuvrability of the micro spacecraft and can be executed smoothly by a control mechanism.
To demonstrate the originality and advantage of improved policy gradient reinforcement learning, the proposed method is compared with other relevant methods, which are shown in Table 3. Paper 5 in Table 3 shows the improved policy gradient reinforcement learning method proposed in this paper. The four methods in Table 3 represent different ideas to solve the problem of attitude manoeuvre planning.
Comparison with other methods

Table 3 shows that the first four methods only consider static constraints. The focus of the first three methods is the time-optimal reorientation manoeuvre problem of the spacecraft. In the above four methods, few static constraints exist on the virtual sphere, which makes the problem model too idealistic and far from the real-world situation. The start and end points of attitude are often known quantities when planning. These methods thus equate the known end point with mandatory pointing constraints, which cannot solve the problem of multiple mandatory pointing constraints concurrently. Compared with that method, the proposed method can successfully manage two dynamic mandatory pointing constraints concurrently in Sun-synchronous orbit, which is a difficult problem to solve.
The policy gradient reinforcement learning proposed in this paper is compared with the convex potential function (CPF) from Ma et al. (Reference Ma, Liu, Wang and Guo2020) to demonstrate its effectiveness. The relevant parameters are still set as shown in Table 2. To meet the need for orientation to the Sun, the desired attitude is defined: the included angle between the $- {\boldsymbol{y}_\textrm{B}}$
axis and the Sun is ${0^ \circ }$
if the spacecraft is defined in the desired attitude. The desired attitude expressed by Euler angles is shown in Figure 15. The results of attitude manoeuvre planning using the method of Ma et al. (Reference Ma, Liu, Wang and Guo2020) are shown in Figure 16. The orientation accuracies to the Sun and to the Earth are shown in Figure 17 and Figure 18, respectively.
Desired attitude (CPF)

Results of attitude manoeuvre planning (CPF)

Orientation accuracy to the Sun (CPF)

Orientation accuracy to the Earth (CPF)

The planning results clearly do not track with the desired attitude. The included angle between the $- {\boldsymbol{y}_\textrm{B}}$
axis and Sun is much larger than ${20^\circ }$
, which cannot meet the needs of power generation. The included angles between all central axes of reflected light areas and all central axes of the sensor's fields of view are shown in Figures 19–23. Note that the smallest included angle is smaller than ${30^\circ }$
.
Included angle with reflected light area 1 (CPF)

Included angle with reflected light area 2(CPF)

Included angle with reflected light area 3 (CPF)

Included angle with reflected light area 4 (CPF)

Included angle with reflected light area 5(CPF)

Figures 15–23 show that the CPF from Ma et al. (Reference Ma, Liu, Wang and Guo2020) does not seem to be suitable for solving the problems raised in this paper. The underlying reason for this result lies in Formula (16) of Ma et al. (Reference Ma, Liu, Wang and Guo2020), which is shown here as Equation (30):
where $\boldsymbol{\widetilde{e}}$
is the error quaternion when the desired attitude is given, and ${k_i} > 0$
are weight coefficients of different prohibited pointing areas in the potential function. Every prohibited pointing area has a threat zone, which is a set of attitudes, and weight coefficients are greater than zero (${k_i} > 0$
) only if the attitude of the spacecraft is within the threat zone. However, once the attitude is adjusted outside the threat zone, the coefficient is equal to zero (${k_i} = 0$
). When the attitude is outside all threat zones, all weight coefficients ${k_i}$
are equal to zero. When all ${k_i}$
are equal to zero, Equation (30) will equal zero because ${k_i}$
is part of the numerator. If the above situation occurs during the attitude manoeuvre planning process, the potential function will be invalid and the spacecraft will perform redundant invalid manoeuvres. In severe cases, the attitude control will be lost.
The first three methods in Table 3 require long computation times compared with the proposed improved policy gradient reinforcement learning method. In contrast, in the fourth method, the potential function combined with the backstepping method is efficient, and its focus is on using the control law to plan the attitude manoeuvre. The first step is to design an appropriate potential function and control law based on constraints. At this step, there is an inevitable problem in which the control parameters are difficult to design. On the premise of obtaining a suitable control law, the second step is to calculate the attitude manoeuvre trajectories based on dynamics and kinematics. However, the method proposed in this paper directly calculates the attitude manoeuvre trajectories, which indicates one step less than the control law method. From this perspective, this paper can be considered to provide a new idea for solving the problem of attitude manoeuvre planning.
5. Conclusions
This paper studies the problem of attitude manoeuvre planning when spacecraft face multiple dynamic constraints. By introducing return baseline and adaptive policy exploration methods, it proposes an attitude manoeuvre planning algorithm based on improved policy gradient reinforcement learning. The attitude manoeuvre planning model proposed in this paper is concise and clearly defined, and can accurately describe multiple dynamic constraints of the spacecraft in real three-dimensional space. The model exhibits strong practicability and is convenient to expand to include more constraints in the future. Simulation results show that the proposed method can simultaneously meet the requirements of multiple attitude constraints while ensuring high orientation accuracy to the Earth and the Sun at a small cost of attitude manoeuvres.
There are some limitations to this study:
1. A few iterations are required before obtaining the results of attitude manoeuvre planning. The planning method thus must be performed in advance.
2. The initial attitude of the attitude manoeuvre planning does not allow for Euler angles that equal zero, indicating that there are restrictions on the initial attitude. This feature may require additional attitude adjustments before attitude manoeuvres.
The future directions of this research are:
1. Design a more accurate value function to evaluate the strategy to avoid unnecessary posture manoeuvres.
2. Add the execution ability of the attitude control mechanism as a constraint to the value function.
3. Reduce computation time while considering the computing power of a satellite-based computer.
Funding statement
This work was supported by the National Natural Science Foundation of China (61973513).

























