# Attitude Determination with Magnetometers and Accelerometers to Use in Satellite Simulator

Authors: Helio Koiti Kuga; Valdemir Carrara
Journal: Mathematical Problems in Engineering
 (2013)

---

## Abstract

Attitude control of artificial satellites is dependent on information provided by its attitude determination process. This paper presents the implementation and tests of a fully self-contained algorithm for the attitude determination using magnetometers and accelerometers, for application on a satellite simulator based on frictionless air bearing tables. However, it is known that magnetometers and accelerometers need to be calibrated so as to allow that measurements are used to their ultimate accuracy. A calibration method is implemented which proves to be essential for improving attitude determination accuracy. For the stepwise real-time attitude determination, it was used the well-known QUEST algorithm which yields quick response with reduced computer resources. The algorithms are tested and qualified with actual data collected on the streets under controlled situations. For such street runaways, the experiment employs a solid-state magnetoresistive magnetometer and an IMU navigation block consisting of triads of accelerometers and gyros, with MEMS technology. A GPS receiver is used to record positional information. The collected measurements are processed through the developed algorithms, and comparisons are made for attitude determination using calibrated and noncalibrated data. The results show that the attitude accuracy reaches the requirements for real-time operation for satellite simulator platforms.


---

## Body

## 1. Introduction

Systems of attitude control of artificial satellites are dependent on attitude information, provided by an attitude determination process, which involves several satellite components [1]. In situations where high pointing accuracy is not required, as emergency, standby, or during satellite orbital maneuvers, one often uses magnetometers and solar sensors, which are simpler and more reliable than more accurate instruments. These instruments are not autonomous, which means that some processing is required to estimate the attitude from their measurements.This paper presents the implementation and tests of a fully self-contained algorithm for the determination of attitude using magnetometer and accelerometer units, for application on a satellite attitude simulator based on frictionless air bearing tables [2]. Because of the design and physical difficulties to install a solar sensor in this table, one preferred to use accelerometers, which, similarly to the solar sensor, provides one of the directions necessary for the process of attitude determination. It is intended to apply this algorithm in the development and qualification of an on-board 3-axis attitude control system to support the upcoming Brazilian space missions.However, it is known that magnetometers and accelerometers need to be calibrated so as to allow that such measurements are used to their ultimate accuracy. Therefore a calibration method is implemented [3], so that systematic biases and errors arising from misalignments and scale factors can be removed, and the remaining source of errors is, hopefully, minor noises. This proves to be an essential part of the procedure to achieve better attitude determination accuracy [3–6].  For the stepwise real-time attitude determination, it was used the well-known QUEST algorithm [7] which yields quick response with reduced computer resources, although other derivations are possible [8, 9].The algorithms are tested and qualified with actual data collected on the streets under controlled situations [10]. The very final aim is to deploy the ADS (Attitude Determination System) algorithms on a small PC computer board with Linux operational system, operating in real-time, in an air bearing table for spacecraft environment simulation. For such street runaways, the experiment employs a Honeywell (solid-state magnetoresistive technology) magnetometer HMR-2300 [11] and a Crossbow (Xbow-CD-400) IMU navigation block [12] consisting of a triad of accelerometers and a triad of gyros, with technology MEMS, both with serial communication interfaces. A GPS receiver [13] is used to obtain positional information. The collected measurements are processed through the developed algorithms. Procedure calibration results are shown for both magnetometers and accelerometers, assessing the impacts of estimating biases primarily or biases plus scale factors altogether. Comparisons are made for attitude determination using calibrated and noncalibrated data. It is shown that attitude accuracy may be restrained under lack of calibration with impact on performance. The results show that the implemented process of attitude determination reaches the requirements for real-time operation with accuracy enough to a regular standby or emergency mode operation.


## 2. Characteristics of the Sensors

In order to carry out the experiment, three types of sensors have been utilized: a 3-axis magnetometer, an IMU (Inertial Measurement Unit) with 3-axis gyros and accelerometers, and a GPS receiver for positioning data. The used sensors are described in the sequel.


### 2.1. Inertial Measurement Unit (IMU)

The IMU-MEMS used in this work is a Crossbow IMU model CD400-200 [12], which measures linear accelerations around 3 orthogonal axes and rotations rate also in 3 orthogonal axes aligned properly. Figure 1 shows the main characteristics of the IMU. Being a COTS (Commercial Off-The-Shelf) equipment, it is a low cost IMU with limited range of applications (not very accurate), notwithstanding, just enough for the application intended herein. The data is output through a RS-232 serial interface in several sampling rates (from 1 to 120 Hz). In this experiment the accelerometer data was sampled at 20 Hz.Figure 1
Characteristics of the Crossbow IMU-MEMS.


### 2.2. Three-Axis Magnetometer

The magnetometer used herein is a Honeywell model HMR-2300 [11], which measures the local magnetic field along the 3 directions. The HMR-2300 possesses 3 magnetoresistive sensors mounted triorthogonally as in Figure 2. The data is obtained through a RS-232 serial port at configurable sampling rates, and one used 50 Hz in the experiment. The full scale covers the whole Earth surface magnetic fields, and the mean performance has an accuracy of 0.1% of 1 G (Gauss), translating to 1 mG (milli-G) at 25°C.Figure 2
Honeywell HMR 2300 3-axis magnetometer.


### 2.3. GPS Receiver

The GPS receiver used is the Ashtech model Z12 [13], which provides 12 channels for GPS satellites tracking, and provides measurements in two-frequencies (L1 and L2), see Figure 3. It makes full use of the GPS constellation and yields navigation accuracy with aeronautical quality, although such accuracy is not needed herein. The data were stored internally in its mass memory and retrieved further through a RS-232 serial port. Actually, it may provide real-time PVT (position, velocity, and time) navigation solution at 1-2 Hz at most, besides the GPS time (accurate to 10 microseconds) and DOP (dilution of precision) quality flag which indicates the geometrical strength of the solution. The PVTs were obtained in this work at 1 Hz rate, allowing to compute the theoretical geomagnetic field at that position, which is an important information to the calibration and to the attitude determination system.Figure 3
Ashtech Z12 dual frequency GPS receiver.


## 2.1. Inertial Measurement Unit (IMU)

The IMU-MEMS used in this work is a Crossbow IMU model CD400-200 [12], which measures linear accelerations around 3 orthogonal axes and rotations rate also in 3 orthogonal axes aligned properly. Figure 1 shows the main characteristics of the IMU. Being a COTS (Commercial Off-The-Shelf) equipment, it is a low cost IMU with limited range of applications (not very accurate), notwithstanding, just enough for the application intended herein. The data is output through a RS-232 serial interface in several sampling rates (from 1 to 120 Hz). In this experiment the accelerometer data was sampled at 20 Hz.Figure 1
Characteristics of the Crossbow IMU-MEMS.


## 2.2. Three-Axis Magnetometer

The magnetometer used herein is a Honeywell model HMR-2300 [11], which measures the local magnetic field along the 3 directions. The HMR-2300 possesses 3 magnetoresistive sensors mounted triorthogonally as in Figure 2. The data is obtained through a RS-232 serial port at configurable sampling rates, and one used 50 Hz in the experiment. The full scale covers the whole Earth surface magnetic fields, and the mean performance has an accuracy of 0.1% of 1 G (Gauss), translating to 1 mG (milli-G) at 25°C.Figure 2
Honeywell HMR 2300 3-axis magnetometer.


## 2.3. GPS Receiver

The GPS receiver used is the Ashtech model Z12 [13], which provides 12 channels for GPS satellites tracking, and provides measurements in two-frequencies (L1 and L2), see Figure 3. It makes full use of the GPS constellation and yields navigation accuracy with aeronautical quality, although such accuracy is not needed herein. The data were stored internally in its mass memory and retrieved further through a RS-232 serial port. Actually, it may provide real-time PVT (position, velocity, and time) navigation solution at 1-2 Hz at most, besides the GPS time (accurate to 10 microseconds) and DOP (dilution of precision) quality flag which indicates the geometrical strength of the solution. The PVTs were obtained in this work at 1 Hz rate, allowing to compute the theoretical geomagnetic field at that position, which is an important information to the calibration and to the attitude determination system.Figure 3
Ashtech Z12 dual frequency GPS receiver.


## 3. Calibration Method

The calibration method implemented does not require any special laboratory framework, as it is independent of the attitude knowledge. Clearly stating, one does not need to know the attitude if sufficient data is provided, so that observability of the biases is guaranteed. The procedure only needs to know the magnitude of the phenomenon being measured, such as geomagnetic field or gravity. LetB be the magnitude of the B=(BxByBz) field:
(1)B2=Bx2+By2+Bz2.
If b=(bxbybz) is the bias vector, K=(KxKyKz) is the scale factors, and (ρϕλ) is the misalignment (small) angles, then the corrected measured values are [3]
(2)B^x=KxBx+bx,B^y=Ky(Bycosρ+Bxsinρ)+by,B^z=Kz(Bzcosϕcosλ+Bxsinϕcosλ+Bysinλ)+bz.Using the magnitude squared and the definitions, one arrives at an equation like(3)AB^x2+BB^xB^y+CB^xB^z+DB^y2+EB^yB^z+FB^z2+GB^x+HB^y+IB^z+J=0,
where A,B,C,D,E,F,G,H,I, and J are functions of  b,K,(ρϕλ). Now ordering adequately (1) with the unknowns A,B,C,D,E,F,G,H,I, and J, one obtains a single equation relating them with the measured values (BxByBz), nice and clearly explained in Foster and Elkaim [3]. Then by accumulating more measurements where the magnitude of the measured vector is known, one obtains enough equations to statistically solve the problem, by a standard least squares method.The procedure was coded with slight improvements like introducing the weights related to the standard deviations of the measurements and considering the magnitude changes dynamically due to motion of the measurement sensor. A care to be taken is to make sure that the system is observable enough, so that meaningful results are obtained, as is pointed, for instance, in Alonso and Shuster [14].


## 4. Quest Attitude Determination Method

The attitude determination problem consists of finding the attitude matrixA which relates two reference frames as
(4)vb=Av,
where, for example, vb is vector of sensor measurements in the body frame and v is the vector in a reference frame (e.g., inertial frame). Normally one defines a suitable quadratic loss function J to be minimized:
(5)J=12∑w∥vb-Av∥2,
which is commonly referred to as Wahba’s problem. The w is adequate weights to be defined later. The minimization of J corresponds to the application of the q-method, where the attitude matrix is written in terms of quaternions q-≡(qTq4), so that
(6)A=(q42-qTq)I+2qqT-2q4q×,
where × is the vector product. That way, minimizing J means maximizing the gain function g:
(7)g(A)=∑wvbTAv=g(q-)=q-TKq-,
where K is a 4×4 matrix defined by
(8)K≡[S-σIZZTσ],B=∑w(vbvT),S=B+BT,Z=[B23-B32B31-B13B12-B21]T,σ=tr[B].In other words, this is now a problem of solving for eigenvectors and eigenvalues. Details of this algebra may be found in Shuster and Oh  [7], who after proving that que optimal gain is
(9)g≈∑w,
arrive at the QUEST solution:
(10)q-=11+pTp[p1],
where p is the vector of Rodrigues parameters as computed in Shuster and Oh  [7]:
(11)p=[(g+σ)I-S]-1Z.It means that, given at least twovb measurement vectors (linearly independent of course), it is possible to quickly find the quaternion solution q- from where the attitude matrix may be completely recovered and so the corresponding Euler angles (roll, pitch, and yaw).


## 5. Test Conditions

The experimental assembly is shown in the right picture of Figure4, where one sees the laboratory trailer (nonmagnetic fiber structure) with the GPS unity, IMU, power supply, and a notebook for data recording. The magnetometer unity is hidden because it is fixed on top of the roof outside the trailer. The axes of the IMU and magnetometer are aligned horizontally and with the longitudinal axis of the trailer motion. The trailer was towed by a car along a path of 542 m depicted in the left of Figure 4, starting from the southeast gate (45.86138141°W, 23.20844975°S, and 609.222 m) through the main gate (45.85760508°W, 23.21187649°S, and 613.866 m), recording all the data from the IMU, GPS, and magnetometer units. The path was made in a very slow movement so as not to excite longitudinal accelerations on the accelerometer. Because the calibration is, in principle, an offline procedure, the different batches of different sensors were all correlated in time (GMT) so as to guarantee a synchronization when all the data are assembled and merged. Unreliable GPS navigation solution with PDOP (position dilution of precision) ≥5 was disregarded and not used to tag the position. The left of Figure 4 shows also the approximate azimuth angles along the full trajectory (yellow, blue, and red).Figure 4
Trajectory of the experiment and assembly.


## 6. Results

The Foster and Elkaim [3] procedure was used to calibrate the biases and scale factors of the magnetometers and the accelerometers. The misalignments for both were also estimated, but they barely played an important role in the experiment. Table 1 shows the bias and scale factor values for the HMR-2300 magnetometer, in the 3 axes, along with the standard deviations of the calibration algorithm. The mean value of the geomagnetic field as per the IGRF (International Geomagnetic Reference Field) model was around 230 mG along the path of the car. One can see that the bias values are quite pronounced (42 mG magnitude) which is almost 20% of the total geomagnetic field. The scale factors are nearly unity meaning that the performance of the AD (Analog Digital) circuit inside is quite good.Table 1
Calibration results of the 3-axis magnetometer: biases and scale factors.
Variable
Values  (mG)
Standard deviation (mG)
BiasN
-
25.93094
0.00041
BiasE
2.61724
0.00059
BiasD
-
33.46204
0.00044
Scale factorN
1.00047
0.00000
Scale factorE
0.99929
0.00000
Scale factorD
1.00000
0.00000Table2 shows the bias and scale factors values for the Crossbow model CD-400-200 accelerometers in the 3 axes, along with the standard deviations obtained from the calibration algorithm. The mean value of the gravity acceleration in total is around 1 g, because of the very slow movement of the car. It is noticed that the bias values are rather small in agreement with the 12 mg of the IMU data sheet. The bias level (36 mg) contributes to only 4% of the total magnitude. The scale factors for this sensor were also almost unity.Table 2
Calibration results of the 3-axis accelerometers: biases and scale factors.
Variable
Values (g)
Standard deviation (g)
BiasN
0.03572
0.00080
BiasE
-
0.02001
0.00088
BiasD
-
0.00328
0.00008
Scale factorN
1.00000
0.00000
Scale factorE
1.00000
0.00000
Scale factorD
1.00000
0.00000In the attitude determination algorithm, the quaternions were computed by the algorithm QUEST [7] based on the magnetometer and accelerometer measurements. The weights of the sensors were chosen somewhat ad hoc based on the accuracy, that is, 5 mG in 300 mG scale to magnetometer and  0.01 g in 1 g scale to accelerometer. Therefore the magnetometer measurements contribute to 62.5% and the accelerometer with 37.5% weights in the QUEST algorithm. Figure 5 shows the attitude determination results for calibrated (biases taken into account) and uncalibrated (raw-biased data) altogether.Attitude angles computed from calibrated and uncalibrated sensors.
(a)
(b)
(c)The roll and pitch angles are small meaning that the vehicle stayed close to horizontal (leveled). Because pitch is almost always positive, the mobile is most of time moving slightly in uphill ascent direction. The roll angle reflects the car rolling around the longitudinal motion axis. The heading (azimuth) angle differences are not perceptible in the scale of Figure5. The difference in the pitch angles computed by both sources of data (raw and calibrated ones) is remarkable. This fact was somehow expected because of the higher bias level of magnetometer in roll (N) and yaw (D) directions (angle on xz plane), according to Table 1. Note in Figure 5 that the heading estimates follow closely the azimuth angles of Figure 4. At the beginning, the vehicle stayed static near the southeast gate pointed opposite to the motion until 51316 s then made a 180° turn to go along the straight line (main street) and then up to the main gate (yellow). Then in the way back, the vehicle followed the blue and red paths. The heading angles of Figure 5 may be correlated in time with the trajectory colors of Figure 4: yellow from 51270 s to 51538 s, blue from 51538 s to 51657 s, and red from 51657 s to the end.Figure6 shows the difference between attitude angles computed using calibrated and raw measurements of the magnetometers and accelerometers. Most of the time, the angles are confined to ±10°, with some ripples in some periods (see, e.g., between 51550 and 51650 s), mainly due to high frequency noise of the sensors. It depicts the type of attitude errors that arise without proper calibration of the sensors. The minimum and maximum errors were approximately −5° and 3°, −7° and 1°, and −7° and 5°, for roll, pitch, and heading angles, respectively. On the other hand, the noises of the sensors should be adequately dealt with by some real-time preprocessing such as smoothing, low-pass filter, or some similar technique to discard bad data. If angular rates are available, for example, from gyros, then a simple quaternion propagator would solve the issue, by comparison with estimated quaternion (by QUEST algorithm) and rejection when abnormal differences due to data outliers are present.Figure 6
Differences between calibrated and uncalibrated attitude angles.


## 7. Conclusions

This work presented an experimental calibration and attitude determination scheme for a moving mobile (trailer towed by a car). The calibration procedure is based on the Foster and Elkaim [3] algorithm which does not need the attitude knowledge, so that it can be applied without special approaches or environment. Magnetometer was the most biased sensor as expected and the major source of attitude angles error (62.5%). Accelerometer biases contributed only to 37.5% of the weight in the attitude determination algorithm. There were some noises present in the sensors measurements, and in the future this must be addressed properly in order not to impair the performance of the real-time attitude determination. The presence of gyros, commonly present in IMU-MEMS, may be beneficial to avoid the data outliers to be input to the ADS (Attitude Determination System). For the test results presented herein, the errors in the attitude angles were limited roughly to less than 10°. Thus the ADS without calibration presented an error magnitude which cannot be endured and definitely makes the calibration (primarily bias removal) a mandatory step in the implementation of ADS in the air bearing table to act as a spacecraft simulator environment. Future work points to the need of  porting such scheme to the real air bearing table and tests it exhaustively, so that its ADS performs smoothly and reliably.



---

*Source: 401282-2013-08-05.xml*