WorksEngineering
Robust LEO Attitude Determination via Sun-Horizon Fusion Using Factor Graph Optimization
Abstract
Accurate attitude determination is essential for small satellites in Low Earth Orbit (LEO). A low-cost is to fuse gyroscope and Sun sensor measurements with the nadir direction measured from the Earth horizon by a visible-spectrum camera. However, the horizon in RGB images is degraded by atmospheric scattering, clouds, sun glare, and motion blur, so that the accuracy of the nadir measurement varies from image to image. Conventional image-based horizon sensors extract the horizon with fixed thresholds and edge detectors and assume a constant measurement noise, which assigns the same confidence to degraded and accurate measurements. This work presents an attitude determination framework in which a neural network not only detects the horizon but also predicts how accurately it is localized. A U-Net segments the Earth in the camera image, and an uncertainty head trained with a Gaussian negative log-likelihood loss predicts the standard deviation of the horizon location at each pixel. These per-pixel uncertainties weight the least-squares fit of the horizon cone and are propagated into the covariance of the measured nadir direction, so that each image provides a nadir measurement together with its own covariance and the attitude estimation becomes robust to degraded images. The horizon measurements are fused with the Sun sensor and gyroscope measurements in a sliding-window factor graph optimization, which estimates the attitude on SO(3) together with the gyroscope bias. Rather than using an conventional extended Kalman filter, Sliding Window Factor Graph Optimization is used to naturally incorporates sensors operating at different with varying updated measurement covariances.
Introduction
Attitude determination is a fundamental function of a spacecraft, since the pointing of its payloads, antennas, and solar arrays relies on the knowledge of its orientation [1]. Small satellites in Low Earth Orbit (LEO) typically determine their attitude by combining low-cost sensors, including Sun sensors [2, 3], magnetometers, gyroscopes, and Earth horizon sensors [4]. Since a single direction measurement constrains only two of the three rotational degrees of freedom, the attitude is determined from at least two non-collinear directions.
Earth horizon sensors measure the nadir direction by detecting the boundary between the Earth and space. Since the early days of spaceflight, they have mostly operated in the long-wave infrared [4, 5], where the Earth is bright during both sunlight and eclipse [6], and the carbon dioxide absorption band of the atmosphere yields a stable horizon profile [4]. On small satellites, static infrared thermopiles have been flown together with Sun sensors [3] and used to compute the nadir direction analytically [6]. Imaging sensors, in contrast, observe many horizon points, from which the nadir direction can be estimated directly [5, 7], and Deng et al. [8] applied such an approach to a wide field-of-view infrared camera with the same localization noise assumed for all horizon points. However, dedicated infrared sensors increase the cost and development time of a mission.
Visible-spectrum cameras, on the other hand, are inexpensive and offer higher resolution [5]. Saadat [9] repurposed a spacecraft inspection camera as a horizon sensor, and Braun and Barf [10], whose work is the closest to ours, fused camera-based nadir and Sun directions with inertial and GNSS measurements in an error-state Kalman filter. The main difficulty of visible-spectrum horizon sensing is that the atmosphere does not produce a sharp brightness discontinuity at the horizon, but scatters sunlight and creates an apparent unpredictable horizon thickness [5]. In addition, clouds, sun glare, and spacecraft structures in the field of view corrupt the detected horizon [9, 10], so that the accuracy of the measured nadir direction varies considerably from image to image. However, both approaches extract the horizon with fixed thresholds, and neither measurement model reflects the quality of the individual image.
In parallel, deep learning has improved both the extraction of information from images and the quantification of its uncertainty. Bayesian deep learning enables a network to predict the uncertainty of its outputs [11, 12], and such learned uncertainties have been shown to improve the robustness and accuracy of pose graph optimization in visual odometry [13]. For horizon detection onboard aircraft, deep semantic segmentation has recently shown higher robustness under clouds and glare [14], but it does not indicate when its prediction is unreliable.
For the fusion of attitude measurements, the extended Kalman filter (EKF) has long been the workhorse of spacecraft attitude estimation [15, 16]. Factor graph optimization (FGO), in contrast, jointly estimates the states within a time window and iteratively relinearizes the measurement models, which improves accuracy over the EKF and naturally accommodates asynchronous sensors [17, 18, 19].
Table 1 summarizes the horizon-based approaches most closely related to this work. To the best of our knowledge, no previous work learns the horizon localization uncertainty from the image and propagates it into the measurement covariance of an attitude estimator.
| Work | Spectrum | Horizon extraction | Horizon measurement uncertainty | Estimation |
| Nguyen et al. [6] | Infrared | Thermopile readings | Not modeled | Single epoch |
| Deng et al. [8] | Infrared | Horizon points in image | Constant pixel noise | Single epoch |
| Saadat [9] | Visible | Fixed threshold, Canny edges | Not modeled | Single epoch |
| Braun and Barf [10] | Visible | Fixed threshold, contour tracing | Constant pixel noise | Error-state Kalman filter |
| Kapuscinski and Szczerba [14] (aircraft) | Visible | Deep segmentation | Not modeled | Single epoch |
| This work | Visible | Deep segmentation | Learned per-pixel uncertainty | Sliding-window FGO |
Table 1. Comparison of horizon-based approaches related to this work.
To address this gap, this paper considers a small satellite in LEO equipped with a three-axis gyroscope, Sun sensors mounted on its faces, and a body-fixed RGB camera that observes the Earth horizon. The objective is to estimate the attitude and the gyroscope bias of the spacecraft from the asynchronous gyroscope, horizon, and Sun measurements while accounting for the image-dependent accuracy of the horizon measurements. The spacecraft position is assumed to be known, e.g., from a GNSS receiver, so that the reference nadir direction and, together with the solar ephemeris, the reference Sun direction are available in the Earth-fixed frame. Moreover, the Earth is modeled as a sphere, the camera is calibrated with a known mounting relative to the spacecraft body, and the spacecraft operates in sunlight with the illuminated horizon in the camera field of view, since neither the visible-spectrum camera nor the Sun sensors can operate in eclipse. Missions that require attitude determination during eclipse would need additional sensors, which are beyond the low-cost scope of this study.
The main contributions of this study are summarized as follows:
An uncertainty-aware horizon sensor for visible-spectrum cameras, in which a neural network detects the horizon and predicts its localization uncertainty at each pixel, and these uncertainties are propagated into the covariance of the measured nadir direction. Unlike the constant noise models in [8, 10], this covariance varies from image to image.
A sliding-window FGO that fuses the uncertainty-aware horizon measurements with Sun sensor and gyroscope measurements to estimate the attitude and the gyroscope bias, as an alternative to the EKF commonly used for spacecraft attitude estimation.
A publicly available dataset of real and synthetic RGB horizon images with manually labeled Earth regions.
The remainder of the paper is organized as follows. Section 2 introduces the notation, the attitude kinematics, and the fundamentals of FGO. Section 3 presents the horizon detection network, the uncertainty-aware nadir measurement, the Sun sensor model, and the sliding-window estimator. Section 4 describe the simulation environment and present results, and Section 5 concludes the paper.
Preliminaries
In this section, we establish the notation used throughout the paper and present the attitude kinematics, the sensor measurement models, and the fundamentals of factor graph optimization.
Notations
A rotation matrix transforms vector coordinates from frame to frame , and denotes the corresponding unit quaternion, i.e., . A vector denotes a quantity of frame with respect to frame , resolved in frame . Direction vectors that are not associated with a pair of frames, such as the Sun and nadir directions, carry only the superscript of the resolving frame, e.g., . The frames used in this work are: (Earth-Centered inertial frame aligned with the International Celestial Reference Frame, ICRF), (Earth-Centered Earth-Fixed, ECEF), (spacecraft body), and (camera, whose - and -axes point right and down in the image plane and whose -axis lies along the optical axis).
Scalars are denoted by italic letters, vectors by bold lowercase letters, and matrices by bold uppercase letters. A quantity evaluated at the discrete time instant carries the subscript , and denotes the time derivative. The accents , , and denote nominal, estimated, and measured quantities, respectively, while denotes an error quantity. The identity matrix is denoted by . and the zero matrix by , with . The transpose is denoted by and the Euclidean norm by . For a vector , denotes its -th component, where , and denotes the unit sphere.
The skew-symmetric matrix is defined such that . Quaternions are written with the scalar part first, and the operator denotes the Hamilton product of two quaternions. The exponential map , , converts a rotation vector into a rotation matrix, and denotes its inverse. Finally, denotes a Gaussian distribution with mean and covariance , and denotes the squared Mahalanobis norm.
State Kinematics
The spacecraft attitude is parameterized by the body-to-ECEF rotation, denoted by and . The true-state kinematics are given by [20]
where the angular velocity is the input to the motion model, obtained from the gyroscope measurement and the Earth rotation rate as follows
where is the Earth rotation rate with , and is the gyroscope bias modeled as a random walk. The terms and are zero-mean Gaussian white noises with power spectral densities and , corresponding to the angle random walk and the rate random walk of the gyroscope, respectively.
To construct a state estimator, the true state is decomposed into a nominal state and an error state [20]. The nominal state results from the integration of the gyroscope readings and is given by
where the nominal input is the bias-compensated angular velocity
with .
Meanwhile, the error-state vector is defined as
where is the attitude error and is the gyroscope bias error. The composition is given by
or equivalently with . Substituting (6) into (1)–(2), comparing the result with (3)–(4), and retaining first-order terms, the error-state kinematics are obtained as [20]
where the higher-order terms are ignored. Moreover, the first-order term , which stems from resolving the Earth rate in with the perturbed attitude, is neglected since its magnitude scales with .
In matrix form, (7) is written as
where , and
The nominal kinematics (3) and the error-state dynamics (8) are discretized in § 3.3 to form the gyroscope factor that connects consecutive states in the factor graph.
Factor Graph Optimization
A factor graph is a bipartite graph that represents the factorization of a probability density function, where variable nodes correspond to the unknown states and factor nodes correspond to the probabilistic constraints imposed on these states by measurements and prior information [21]. In this work, the variable nodes are the states at the discrete time instants .
Let denote the set of states and the set of measurements. The maximum a posteriori (MAP) estimate of the states is
where each factor depends only on a subset of states . Under the Gaussian noise assumption, each factor takes the form , where is the residual of the factor and is its covariance. Taking the negative logarithm of (10), the MAP estimation reduces to the nonlinear least-squares problem
Since the attitude evolves on , (11) is solved over the error states rather than over the quaternions [22]. Each residual is linearized around the nominal states as
where stacks the error states of , the operator is applied to each state as in (6), and is evaluated at . Substituting (12) into (11) yields the Gauss–Newton normal equations
with
where each is placed into the columns of the states it involves, and is the information matrix. The solution updates the nominal states as , after which the error states are reset to zero, and the procedure is repeated until convergence.
Since the number of states grows over time, a sliding window that retains only the most recent states, , is used to bound the computational cost [17, 23]. When a new state is added, the oldest state is marginalized rather than discarded, so that its information is retained. To this end, only the factors connected to are linearized, and the resulting normal equations are partitioned as
where the subscript denotes the remaining states connected to . Eliminating through the Schur complement gives
which define a marginalization prior factor on the remaining states with the residual and covariance
where denotes the nominal states at which the marginalization is performed, and is the inverse of , i.e., . The factors connected to are then removed from the graph and replaced by this prior factor.
Methodology
The proposed framework consists of two stages, as illustrated in Figure 1. First, the horizon sensor in § 3.1 and the Sun sensor in § 3.2 provide the nadir and Sun directions in , each with its own covariance. Then, the sliding-window FGO in § 3.3 fuses these measurements with the gyroscope measurements to estimate the attitude and the gyroscope bias.

Figure 1. Sliding-window factor graph for spacecraft attitude and gyroscope-bias estimation, showing the motion factors between consecutive states and the asynchronous Sun and horizon measurement factors.
Horizon Detector Neural Net
The horizon sensor provides the nadir direction in and its covariance from a single RGB image. In this section, we first describe how the nadir direction is determined from horizon points in the image, then present the neural network that detects the horizon and predicts its localization uncertainty, and finally combine them into an uncertainty-aware nadir measurement.
Horizon-Based Nadir Determination
The horizon sensor determines the nadir direction from the apparent Earth limb in a camera image [5, 10]. Modeling the Earth as a sphere of radius , the lines of sight from the spacecraft that are tangent to the Earth form a right circular cone whose axis is the nadir direction, as illustrated in Figure 2, where denotes the origin of and the center of the Earth. The half-angle of this cone satisfies , where is the spacecraft position. Let , , denote the pixel coordinates of the detected horizon points. For a pinhole camera with focal length and principal point , both in pixels, the line of sight of the -th horizon point resolved in is

Figure 2. Geometry of horizon-based nadir determination. The camera-frame nadir direction points from the camera origin toward the Earth center , while denotes the line-of-sight vector associated with the -th detected horizon pixel. The collection of horizon lines of sight forms the apparent Earth-limb cone about .
Since every line of sight lies on the horizon cone, the nadir direction satisfies
which is linear in [7, 10]. Stacking (19) for all horizon points gives , where and , with the least-squares solution
The direction of (20) does not depend on , since scales linearly with . The measured nadir direction in is then
where is the known camera mounting rotation relative to body frame.
Earth Segmentation Network
The accuracy of the nadir direction depends on how precisely the horizon points are localized, which is challenging in real imagery due to clouds, atmospheric glow, and illumination changes near the terminator. To this end, the horizon is extracted from an Earth/non-Earth segmentation predicted by a neural network. We adopt a U-Net
architecture [24] with a ResNet-34 encoder [25] pretrained on ImageNet. For each pixel of an RGB image, the network outputs the probability that the pixel belongs to the Earth, and the predicted mask is obtained by thresholding at 0.5. The network is trained with the loss
where the binary cross-entropy and Dice losses [26] are
is the ground-truth label, and is the set of pixels in a training batch. The cross-entropy term calibrates the per-pixel probabilities, whereas the Dice term measures the region overlap, which prevents the thin horizon boundary from being dominated by the large and easily classified interior regions.
The network is trained on a dataset of 550 RGB horizon images, consisting of 400 real images collected from publicly available sources on the internet and 150 synthetic images rendered in Unreal Engine 5 [27]. The real images cover diverse imaging conditions, such as clouds and spacecraft structures partially occluding the view. All images are manually labeled into Earth and non-Earth regions, which provide the ground-truth labels . The network is first trained on the real images and then fine-tuned on the synthetic images, mixed with real ones, to adapt it to the rendered camera images used in the simulations of § 4.1. The dataset is publicly available at https://doi.org/10.5281/zenodo.22756476.
10.5281/zenodo.22756476
Learned Horizon Uncertainty
The segmentation network provides the location of the horizon but not how accurately it is localized. Therefore, a lightweight convolutional head, fed by the final decoder features in parallel to the segmentation output, is trained to predict the per-pixel log-variance , where is the standard deviation of the horizon localization error in pixels. The regression target is obtained from signed distance maps. Let and denote the signed distances, in pixels, from pixel to the boundaries of the predicted and ground-truth masks, respectively, with positive values inside the Earth region. The residual
is the perpendicular offset between the predicted and true horizons, and it vanishes for a perfect prediction. The head is trained with the Gaussian negative log-likelihood loss [12, 13]
where contains the pixels within a distance of the predicted horizon, excluding gross segmentation failures with . The supervision is applied around the predicted horizon rather than the ground-truth horizon, since the uncertainty is queried at the predicted horizon points during inference. Moreover, the segmentation network is frozen while the head is trained. Hence, is a fixed target, which prevents the uncertainty from being inflated on difficult pixels instead of the prediction being improved, and the segmentation accuracy remains unchanged.
The head in (26) captures the aleatoric uncertainty of the horizon location. The epistemic uncertainty of the segmentation network can additionally be obtained by Monte Carlo (MC) dropout [11]. With dropout active in the decoder, stochastic forward passes produce the probability maps , . Linearizing the level set, the resulting horizon displacement has the standard deviation , where is the sample standard deviation over the passes and is the mean probability, and the total uncertainty becomes . In this work, a single forward pass () is used for computational efficiency, for which .
Figure 3 shows the horizon and its uncertainty predicted by the network on a real Earth-limb image. The predicted uncertainty remains low along the unobstructed horizon, whereas it increases where the robotic arms and the solar array of the spacecraft occlude the limb and the predicted horizon becomes unreliable.

Figure 3. Horizon segmentation and its predicted uncertainty on a real Earth-limb image. (a) Raw RGB image. (b) Horizon predicted by the NN, overlaid with the pixel-wise uncertainty (in pixels) in a narrow band around it. Horizon pixel colors range from white (low , high confidence) to dark red (high , low confidence).
Uncertainty-Aware Nadir Measurement
At inference, the horizon points are extracted from the predicted mask by tracing the boundary of the Earth region connected to the image border, splitting it at the image border, and selecting the resulting arc whose outer side is the darkest, i.e., deep space. The predicted standard deviation at each horizon point, , is then read from the uncertainty map.
The least-squares solution (20) weights all horizon points equally. Instead, the predicted uncertainties are used to weight them. Let denote the residual of (19). A localization error of the -th horizon point perturbs this residual to first order as , with
Since is normal to the projected horizon curve, only the component of perpendicular to the horizon affects , which is precisely the localization error whose standard deviation is predicted by the network. Assuming independent errors among the horizon points, the covariance of the residuals is , and the weighted least-squares solution and its covariance are
Since depends on , (28) is solved iteratively, starting from (20). As a result, horizon points with large predicted uncertainty contribute less to the nadir estimate, and grows when the visible horizon arc is short or nearly straight, i.e., when becomes ill-conditioned.
The measured nadir direction is expressed in by (21), and its covariance by . Since has only two degrees of freedom, the component of along the nadir direction represents a scale uncertainty rather than an angular error. The covariance used in the FGO is therefore obtained by projecting onto the tangent plane of at the nadir direction,
where , with , is the orthonormal tangent-plane basis that is also used to form the horizon factor residual in § 3.3. Consequently, varies from frame to frame with the predicted uncertainties and the visible horizon geometry.
Sun Sensor
The spacecraft carries one coarse Sun sensor head on each of its six faces, so that the Sun is observed from any attitude. Each head consists of photodiodes arranged on a polyhedral surface, whose design and angular response calibration are adopted from [28] and are not repeated here. The diode normals , , are known in from the mounting rotations of the heads.
Let denote the true Sun direction in and the incidence angle of the -th diode. Its normalized output follows the angular response and is corrupted by an angular error , which lumps the mounting misalignment and the albedo-induced distortion of the incidence angle, and by a readout error of the digitized diode current,
A diode is declared lit and retained when its measured incidence angle lies within the reliable half-cone of the head, which discards the grazing readings where the response is flat and the albedo contamination is strongest.
The quantity that is linear in the Sun direction is not the diode output but its cosine, since . Inverting the response of each lit diode therefore gives a linear observation , whose variance follows from propagating the two error terms of (30) to first order,
where the angular term vanishes at normal incidence, so that the readout term prevents an unbounded weight there. Stacking the lit diodes into and , and weighting them by , the Sun direction and its covariance follow from a single weighted least-squares solve,
All heads observe the same Sun direction, so (32) pools every lit diode regardless of its face, instead of solving each head separately and averaging the resulting unit vectors as in common coarse Sun sensor implementations, which discards the cross-head geometry and the per-diode weights. A sample is accepted only when at least three diodes are lit and is well conditioned, since two lit diodes admit two mirrored solutions and nearly coplanar diode normals leave the out-of-plane component unobservable.
As in Section 3.1.4, the measured Sun direction is obtained by normalizing (32),
and its covariance is propagated through the normalization and projected onto the tangent plane of ,
with and the orthonormal tangent-plane basis of the Sun factor residual in Section 3.3.3. The removed radial component is an illumination-scale uncertainty that carries no directional information.
State Estimation Factor Graph Optimization
The attitude and the gyroscope bias are estimated using the sliding-window FGO introduced in Section 2.3. The states are defined at node times , which are created at a lower rate than the gyroscope sampling rate, so that a window of states spans a time interval long enough to contain horizon and Sun measurements. The set of states within the window at time is
The structure of the factor graph is shown in Figure 1. Consecutive states are connected by gyroscope factors, whereas horizon and Sun factors are attached to the states that correspond to the time stamps of the measurements, and the information of the marginalized states is retained by the prior factor (17). Accordingly, the states within the window are estimated by solving
where , , and are the residuals of the gyroscope, horizon, and Sun factors with covariances , , and , respectively, and and are the sets of state indices in the window with horizon and Sun measurements. The prior residual is given by the initial prior with covariance until the first state is marginalized, and by the marginalization prior (17) afterwards.
Whenever a new node is created, its nominal state is predicted by integrating the gyroscope measurements through (3), the oldest state is marginalized if the window is full, and the new factors are added to the graph. Then, (36) is solved by the Gauss–Newton iterations in (13), and the newest state provides the attitude estimate at .
Gyroscope Factor
The gyroscope factor constrains two consecutive states and , separated by , through the attitude kinematics. Let denote the mean of the gyroscope measurements over . Assuming a constant angular velocity over , the discretization of (3)–(4) yields the relative rotation
The residual of the gyroscope factor is defined as
where the first component is the rotation between the attitude propagated from and the attitude of , and the second component enforces the random-walk model of the bias. Perturbing (38) with (6), the Jacobians with respect to to the error states are obtained to first order as
where coincides, to first order, with the state transition matrix of (8) over . The covariance of the residual follows from the discretization of the process noise in (8) [20]
with , , and .
Horizon Factor
The horizon factor relates the measured nadir direction in (21) to the attitude of the state . Assuming that the spacecraft position is known, the reference nadir direction in is
and the predicted nadir direction in is . Since both directions lie on , the residual is defined in the tangent plane at the nominal prediction as
where is an orthonormal basis of the tangent plane at . The projection removes the radial component which carries no directional information. Substituting (6), the predicted direction becomes , which gives the Jacobian
The covariance of the residual is the learned tangent-plane covariance in (29) from NN. Since grows with the predicted horizon uncertainties, horizon factors from degraded images receive less weight in (36), which makes the estimator robust to such measurements. Moreover, since , the horizon factor does not constrain rotations about the nadir direction, which are instead observed through the Sun factor whenever the Sun and nadir directions are not collinear.
Sun Sensor Factor
The Sun factor is constructed in the same way as the horizon factor. The reference Sun direction is obtained from the solar ephemeris at , and with the nominal prediction and an orthonormal tangent-plane basis at , the residual and its Jacobian follow from (42)–(43) with the nadir direction replaced by the Sun direction,
where is the measured Sun direction (33) and the covariance of the residual is the per-sample tangent-plane covariance in (34).
Since , the Sun factor leaves rotations about the Sun direction unconstrained. The two direction factors are thus complementary, and their combined information is full rank in the attitude block unless the Sun and nadir directions become collinear.
Results
In this section, we first describe the simulation environment and then present the attitude and gyroscope bias estimation results of the proposed framework.
Simulation Environment
The proposed framework is evaluated in a simulation environment developed in MATLAB/Simulink, in which the orbital motion, the attitude dynamics, and the onboard sensors of the spacecraft are modeled. The camera images are rendered in Unreal Engine 5 [27], which is co-simulated with Simulink, as shown in Figure 4. The simulation parameters are summarized in Table 2.

Figure 4. Earth limb and small satellite are rendered in Unreal Engine 5.
| Parameter | Value |
| Orbit | |
| Start epoch | 20 March 2021, 09:37 UTC |
| Altitude, eccentricity | 500 km, 0.001 |
| Inclination, RAAN | , |
| Argument of perigee, true anomaly | , |
| Duration | 500 s |
| Gyroscope (100 Hz) | |
| Noise density | (rad/s)/ |
| Rate random walk | (rad/s) |
| Initial bias | deg/s |
| Sun sensor (2 Hz) | |
| Angular error | |
| Readout error | |
| Reliable half-cone | |
| Camera (1 Hz) | |
| Resolution | px |
| Horizontal field of view | |
| Pixel error | 1 px |
| Estimator | |
| Node rate, window size | 10 Hz, 20 |
| Initial attitude error | deg |
| Initial bias estimate | deg/s |
| Prior standard deviation (attitude, bias) | , 1 deg/s |
Table 2. Simulation parameters.
The spacecraft is placed in a near-circular polar orbit at an altitude of 500 km, and the simulation starts on 20 March 2021 at 09:37 UTC and lasts 500 s. The orbit is initialized such that its plane is nearly perpendicular to the Sun direction. Consequently, the Sun and nadir directions remain far from collinear, so that the horizon and Sun factors jointly constrain all three rotational degrees of freedom, as discussed in § 3.3.3, and the spacecraft stays in sunlight throughout the simulation.
The gyroscope measurements are generated by (2) at 100 Hz, including the bias random walk, and the Sun sensor measurements are generated at 2 Hz by the model described in § 3.2. The camera captures images at 1 Hz, and its axes are aligned with , i.e., . The nodes of the factor graph are created at 10 Hz with a window size of , so that each window spans 2 s. The spacecraft position required by (41) is taken from the simulated orbit, and the true attitude and gyroscope bias of the simulation serve as the ground truth. The estimator is initialized with the attitude error and the gyroscope bias estimate listed in Table 2.
Attitude Estimation Results
Figure 5 and Figure 6 show the attitude error and the gyroscope bias error over the simulation, where the attitude error is expressed as the rotation vector between the true and estimated attitudes. Starting from the initial errors in Table 2, the sliding-window FGO successfully estimates all three components of both the attitude and the gyroscope bias. This agrees with the observability discussed in § 3.3.3: the horizon factors constrain the rotations about the axes perpendicular to the nadir direction, the Sun factors additionally constrain the rotation about the nadir direction, and the gyroscope factors, which relate the attitudes of consecutive nodes, render the gyroscope bias observable.

Figure 5. Attitude estimation error about the -, -, and -axes of .

Figure 6. Gyroscope bias estimation error about the -, -, and -axes of .
Conclusion & Future Work
Conclusion & Future Work
This paper presented a low-cost attitude determination framework for small satellites in LEO, in which a neural network detects the Earth horizon in RGB images and predicts its localization uncertainty at each pixel. These uncertainties are propagated into the covariance of the measured nadir direction, which is fused with the Sun sensor and gyroscope measurements in a sliding-window FGO, so that the attitude estimation is robust to degraded horizon measurements. Simulations with camera images rendered in Unreal Engine 5 showed that the framework successfully estimates all three components of both the attitude and the gyroscope bias.
In future work, the same learning-based approach will be applied to the Sun sensor, so that the uncertainty of each Sun measurement, e.g., due to Earth albedo, is also predicted by a neural network. Moreover, the framework will be evaluated on data recorded during a real spacecraft flight. Finally, the spherical Earth assumption will be relaxed by accounting for the Earth oblateness [8], and the epistemic uncertainty of the network will be included through MC dropout when the onboard computational resources allow.
References
- [1]F. Landis Markley and John L. Crassidis. Fundamentals of Spacecraft Attitude Determination and Control. Springer, New York, 2014.
- [2]Pablo Ortega, Gema López-Rodríguez, Jordi Ricart, Manuel Domínguez, Luis M Castañer, José M Quero, Cristina L Tarrida, Juan García, Manuel Reina, Ana Gras, et al. A miniaturized two axis sun sensor for attitude control of nano-satellites. IEEE Sensors Journal, 10(10):1623–1632, 2010.DOI
- [3]Siegfried W. Janson, Brian S. Hardy, Andrew Y. Chin, Daniel L. Rumsey, Daniel A. Ehrlich, and David A. Hinkley. Attitude control on the pico satellite solar cell testbed-2. In 26th Annual AIAA/USU Conference on Small Satellites, number SSC12-II-1. AIAA/USU Small Satellite Conference, 2012.
- [4]RW Astheimer. High precision attitude determination by sensing the earth and lunar horizon in the infrared. Automatica, 7(1):83–88, 1971.
- [5]John A Christian. A tutorial on horizon-based optical navigation and attitude determination with space imaging systems. IEEE Access, 9:19819–19853, 2021.DOI
- [6]Tam Nguyen, Kerri Cahoy, and Anne Marinan. Attitude determination for small satellites with infrared earth horizon sensors. Journal of Spacecraft and Rockets, 55(6):1466–1475, 2018.DOI
- [7]John A Christian and Shane B Robinson. Noniterative horizon-based optical navigation via cholessky factorization. Journal of Guidance, Control, and Dynamics, 39(12):2757–2765, 2016.DOI
- [8]Huajian Deng, Hao Wang, Yang Liu, and Zhonghe Jin. Large field-of-view infrared horizon sensor attitude correction for earth’s oblateness. Journal of Guidance, Control, and Dynamics, 46(10):2024–2032, 2023.DOI
- [9]Atilla Saadat. Attitude determination with self-inspection cameras purposed as earth horizon sensors. In 36th Annual Small Satellite Conference, number SSC22-VII-03. Space Flight Laboratory, University of Toronto Institute for Aerospace Studies, 2022.DOI
- [10]Benjamin Braun and Jochen Barf. Image processing based horizon sensor for estimating the orientation of sounding rockets, launch vehicles and spacecraft: B. braun and j. barf. CEAS Space Journal, 15(3):509–533, 2023.DOI
- [11]Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pages 1050–1059. PMLR, 2016.arxiv.org/abs/1506.02142
- [12]Alex Kendall and Yarin Gal. What uncertainties do we need in bayesian deep learning for computer vision? Advances in neural information processing systems, 30, 2017.arxiv.org/abs/1703.04977
- [13]Yuheng Qiu, Yutian Chen, Zihao Zhang, Wenshan Wang, and Sebastian Scherer. Mac-vo: Metrics-aware covariance for learning-based stereo visual odometry mac-vo. github. io. In 2025 IEEE International Conference on Robotics and Automation (ICRA), pages 3803–3814. IEEE, 2025.
- [14]Tomasz Kapuscinski and Piotr Szczerba. Vision-based horizon detection for in-flight aircraft operations using fused deeplab v3+ models with diverse backbone networks. Engineering Applications of Artificial Intelligence, 165:113553, 2026.DOI
- [15]Ern J Lefferts, F Landis Markley, and Malcolm D Shuster. Kalman filtering for spacecraft attitude estimation. Journal of Guidance, control, and Dynamics, 5(5):417–429, 1982.
- [16]John L Crassidis, F Landis Markley, and Yang Cheng. Survey of nonlinear attitude estimation methods. Journal of guidance, control, and dynamics, 30(1):12–28, 2007.DOI
- [17]Gabe Sibley, Larry Matthies, and Gaurav Sukhatme. Sliding window filter with application to planetary landing. Journal of field robotics, 27(5):587–608, 2010.DOI
- [18]Weisong Wen, Tim Pfeifer, Xiwei Bai, and Li-ta Hsu. Factor graph optimization for gnss/ins integration: A comparison with the extended kalman filter. Navigation, 68(2):315–331, 2021.DOI
- [19]Clark Taylor and Jason Gross. Factor graphs for navigation applications: A tutorial. NAVIGATION: Journal of the Institute of Navigation, 71(3), 2024.DOI
- [20]Joan Sola. Quaternion kinematics for the error-state kalman filter. arXiv preprint arXiv:1711.02508, 2017.arxiv.org/abs/1711.02508
- [21]Frank Dellaert and Michael Kaess. Factor graphs for robot perception. Foundations and Trends® in Robotics, 6(1-2):1–139, 2017.
- [22]Christian Forster, Luca Carlone, Frank Dellaert, and Davide Scaramuzza. On-manifold preintegration for real-time visual–inertial odometry. IEEE transactions on robotics, 33(1):1–21, 2016.DOI
- [23]Stefan Leutenegger, Simon Lynen, Michael Bosse, Roland Siegwart, and Paul Furgale. Keyframe-based visual–inertial odometry using nonlinear optimization. The International Journal of Robotics Research, 34(3):314–334, 2015.DOI
- [24]Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pages 234–241. Springer, 2015.arxiv.org/abs/1505.04597
- [25]Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.arxiv.org/abs/1512.03385
- [26]Fausto Milletari, Nassir Navab, and Seyed-Ahmad Ahmadi. V-net: Fully convolutional neural networks for volumetric medical image segmentation. In 2016 fourth international conference on 3D vision (3DV), pages 565–571. Ieee, 2016.arxiv.org/abs/1606.04797
- [27]Epic Games. Unreal engine 5. https://www.unrealengine.com, 2022.
- [28]Sabire Betül Çınar and Ramazan Yeniçeri. Low-cost sun vector estimation – least squares optimization in polyhedral photodiode arrays. In 2025 12th International Conference on Electrical and Electronics Engineering (ICEEE), pages 225–229. IEEE, 2025.