# Patent

## Title
Method and system for compensating for soft iron magnetic disturbances in a heading reference system

## Abstract

A method and system for compensating for significant soft iron magnetic disturbances in a heading reference system, such as an aircraft heading reference system, such as an integrated standby unit; or a vehicle inertial system, provides a heading correction signal to the heading reference system when a detected difference in value between a gyro heading relative to magnetic north and a magnetometer reading during a defined measurement period exceeds a predetermined acceptable threshold value of change, such as one based on the expected gyro drift over that period. Upon receipt of the heading correction signal, the gyro heading is adjusted to maintain an accurate heading relative to true magnetic north. If this threshold value is not exceeded, then the magnetometer reading is used for the heading value. This method is iteratively repeated in order to continually maintain an accurate heading and may be employed for each heading measurement axis.

## Background
CROSS-REFERENCE TO RELATED APPLICATIONS
The present application claims the benefit and is a divisional of U.S. patent application Ser. No. 13/529,894, filed Jun. 21, 2012. The contents of the above-identified application are incorporated by reference in their entirety as if recited in full herein.


FIELD OF THE INVENTION
The present invention relates to heading reference systems and particularly to such systems in which magnetic disturbances due to the presence of local soft iron can result in errors in magnetic heading determinations which affect the provision of a heading relative to magnetic north.
BACKGROUND OF THE INVENTION
Traditionally in heading reference systems for providing a heading relative to magnetic north, such as Attitude and Heading Reference Systems, Air Data and Attitude Heading Reference Systems, Inertial Navigation Systems, or Integrated Standby Systems of the type conventionally employed in aircraft, the heading gyro is periodically corrected by means of data from an external magnetometer that relies on the earth's magnetic field to provide a heading relative to magnetic north. However, the accuracy of such readings can significantly be affected by the presence of local soft iron, such as from local electric circuits on board the aircraft, resulting in meaningful errors in the calculation and ultimate display of the magnetic heading relative to true magnetic north. This can result in serious problems, such as with respect to the proper guidance of the aircraft along its designated flight path. Because of the seriousness of this problem, as well as the desire for a cost effective and efficient solution various attempts have been made to try and avoid these affects which, while helpful, have not totally achieved the objective. One such prior art attempt to try and avoid the effects of the local presence of soft iron which provides these undesirable magnetic disturbances, has involved carefully locating the external magnetometers in aircraft areas where there are minimal local magnetic disturbances present; however, this approach has not proved to be sufficiently cost effective and efficient since it involves locating the external magnetometers on the aircraft wings away from the other electrical devices which can cause such soft iron magnetic disturbances. Such an approach introduces a significant cost due to the presence of such factors as increased installation costs as well as the increased cost of additional units.
This problem of soft iron magnetic disturbances affecting the provision of a correct heading relative to magnetic north while significant with respect to aircraft guidance is not limited to aircraft instruments and is important as well in the guidance of other vehicles which utilize heading reference systems for guidance. Thus, the same problem can occur in any vehicle and any inertial system that normally requires a source of heading that can be subject to variations as a result of local electric field changes. Consequently, it is believed that the present invention is applicable to any magnetic heading indication system where disturbances of local soft iron can result in errors in magnetic heading determinations.
Prior art attempts at solving such problems, in applicant's view, are not as efficient or cost effective as the claimed invention and, thus, have not adequately solved the problem. Examples of other such prior art attempts, which applicant believes do not satisfactorily solve the problem, are described, by way of example, in U.S. Pat. No. 4,414,753, entitled “Process for Compensating the Magnetic Disturbances In The Determination of a Magnetic Heading and Devices for Carrying Out This Process”; U.S. Pat. No. 5,737,226, entitled “Vehicle Compass System With Automatic Calibration”; and U.S. Pat. No. 5,878,370, entitled “Vehicle Compass System With Variable Resolution”. Other prior art attempts at compensating for errors in the measurement of magnetometers, which applicant also believes do not satisfactorily solve the problem presented here, are described, by way of example in U.S. Pat. No. 5,682,335, entitled “Method and Device for Simultaneous Identification and Correction of Errors in the Measurements of a Magnetometer”; U.S. Pat. No. 7,146,740, entitled “Methods and Apparatus for Automatic Magnetic Compensation”; U.S. Pat. No. 6,860,023, entitled “Methods and Apparatus for Automatic Magnetic Compensation”; U.S. Pat. No. 5,990,679, entitled “Method Using Corrective Factors for Determining a Magnetic Gradient”; U.S. Pat. No. 5,321,631, entitled “Method and Self-Contained System for Harmonizing Equipments On Boiardo a Vehicle Using Means of Measuring the Earth's Gravitational and Magnetic Fields”; U.S. Pat. No. 4,843,865, entitled “Method of Calibrating a Compass Heading”; U.S. Pat. No. 4,733,179, entitled “Method of Determining an Interference-Magnetic Field in a Motor Vehicle Provided with an Electronic Compass”; and U.S. Pat. No. 4,005,358, entitled “Magnetometer with Out-of-Phase Correction”.
Thus, it is believed that there is a need for an efficient and cost effective solution for avoiding the effects of local soft iron on magnetic heading calculations in magnetic heading reference systems whether in an aircraft or any other vehicle employing such a system for proper guidance.
SUMMARY OF PARTICULAR EMBODIMENTS OF THE INVENTION
The present invention provides a method for compensating for soft iron magnetic disturbances in a heading reference system by detecting changes both in the magnetometer reading due to the presence of any soft iron magnetic disturbances and the gyro heading relative to magnetic north during a detection period, and then comparing the difference in these detected changes against a predetermined acceptable threshold value in order to determine if this difference exceeds the predetermined acceptable threshold value. If this difference exceeds the predetermined acceptable threshold value, then a heading correction signal is provided for enabling adjustment of the gyro heading in order to maintain true north in the face of the detected soft iron magnetic disturbances. If this difference does not exceed the predetermined acceptable threshold value, then the magnetometer reading is used for the heading value. The predetermined acceptable threshold value is based on the expected gyro drift over the measurement period, with the comparison of the difference in the detected values being based on whether this difference exceeds the expected gyro drift over the measurement period since the immediately previous reading. These steps are iteratively repeated over subsequent measurement periods in order to continue to maintain true magnetic north in the face of any significant soft iron magnetic disturbances.
Various compensation algorithms may be employed for various systems in accordance with the present invention, from a relatively simplistic algorithm which periodically compares the change in the magnetic heading as measured by the magnetometers against the change in heading measured by the rate sensors to much more complex approaches in which the rates of change of the magnetometers and rate sensors for each axis are compared. Typically, in accordance with the present invention, if the change is greater than the expected drift error of the rate sensors, it is assumed that the magnetometer is being affected by a local change in magnetic field and the rate sensor data is used to compensate for effects of the change in the local magnetic field.
The above method of the present invention may be employed to improve the compensation of any magnetic indication heading reference system for the presence of significant soft iron magnetic disturbances which can result in errors in magnetic heading determinations, such as in aircraft systems, such as integrated standby units or other aircraft systems employing heading reference systems, as well as in any vehicle or inertial system that requires a source of heading that may be subject to significant variations as a result of local electric field changes. Such systems may be employed as primary or secondary systems and, if desired, may utilize a Kalman filter to blend the gyro measurement with the magnetometer measurement, with the acceptable difference being dependent on the gyro error covariance.
Various benefits and features of the present invention may become apparent from the following detailed description considered in conjunction with the accompanying drawings. It is to be understood, however, that the drawings are designed solely for purposes of illustration and not as a definition of the limits of the invention for which reference should be made to the appended claims.



BRIEF DESCRIPTION OF THE DRAWINGS
Further features of the invention, its nature and various advantages will be more apparent from the following detailed description of the embodiments, taken in conjunction with the accompanying drawings in which:
FIG. 1 is a flow chart in accordance with the method of the present invention which may be implemented in a heading reference system subject to soft iron magnetic disturbances;
FIG. 2 is a block diagram of a typical heading reference system, such as an improved integrated standby system employing a heading reference system, implementing the method of the present invention illustrated in FIG. 1; and
FIG. 3 is a flow chart, similar to FIG. 1, in accordance with the method of the present invention, which may, alternatively, be implemented in the heading reference system of FIG. 2.



DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION
Referring now to the drawings in detail, and initially to FIG. 1, a flow chart is shown which illustrates the presently preferred compensation method of the present invention for minimizing the affects of soft iron magnetic disturbances in a heading reference system, such as the system 100 illustrated in FIG. 2. As will be described in greater detail hereinafter, the presently preferred compensation method of the present invention may be conventionally implemented in firmware or software housed in the conventional heading reference system 100 of the instrument, such as the integrated standby unit 200 illustrated in FIG. 2. The implementation of the compensation method of the present invention in firmware or software may readily be accomplished by one of ordinary skill in the art once the presently preferred compensation method of the present invention is understood from reference to the following description of this method below.
As shown and preferred, FIG. 1 diagrammatically illustrates a flow chart in accordance with the presently preferred compensation method of the present invention depicted as an iterative control loop 10 for repetitively compensating for any defined significant changes in the accuracy of a heading system 100 due to soft iron magnetic disturbances, such as can occur from local electric circuits adjacent to the heading reference system 100. This is preferably accomplished, as will be described in greater detail hereinafter, from a comparison of the change in the reading of the magnetometer, illustrated as a triaxial magnetometer 102 in FIG. 2, associated with the heading reference system 100, with the reading of the heading reference system gyro, illustrated as a triaxial gyro 104 in FIG. 2, against an expected gyro drift over that measurement period since the prior reading.
As illustrated in FIG. 1, the steps involved in iteratively carrying out the presently preferred compensation method of the present invention are as follows. The output data from both the magnetometer 102 and the gyro 104 are read and processed to provide signals corresponding to any change in the value of the magnetometer 102 reading and the gyro 104 reading. This step is represented by block 12 in FIG. 1. These signals are then compared to determine the actual changes in these values against each other since the previous reading. This step is represented by block 14 in FIG. 1. A determination is then made if any detected difference in value from the previous reading exceeds a predetermined acceptable threshold value which, in accordance with the present invention, is preferably defined as the expected gyro drift over the period since the prior reading. This step is represented in FIG. 1 by block 16. If as a result of this comparison the difference exceeds the expected gyro drift or acceptable threshold value, then, in accordance with the presently preferred compensation method of the present invention a corrected heading signal is provided which corresponds to the actual gyro change plus the last heading and this corrected heading signal is output to the heading reference system 100 to adjust the gyro heading to maintain accuracy. These steps are represented in FIG. 1 by blocks 18 and 20. On the other hand, if this detected difference does not exceed the predetermined acceptable threshold value, in other words, it is not greater than the expected gyro drift over this period, then the detected magnetometer 102 reading is used to provide the heading value for the gyro 104. These steps are represented by blocks 22 and 20 in FIG. 1. As previously mentioned, and as illustrated in the flow chart of FIG. 1, these steps continue to be iteratively periodically repeated in order to continue to maintain an accurate heading for the heading reference system 100 in the face of significant soft iron magnetic disturbances throughout the operation of the heading reference system 100.
The above described flow chart illustrated in FIG. 1 may be represented by the following algorithm:
In the case where:


    k is a positive constant derived from expected gyro drift over the period Δt;
    ΔMH is the change in magnetometer derived heading over the period Δt;
    ΔGH is the change in gyro derived heading over the period Δt;

Heading=fn(GH, MH) for ΔH=<k 

Heading=GH and MH=MH+ΔH for ΔH>k 

As described above, this algorithm can be readily implemented in firmware or software, such as employed in the microprocessor 120 of the heading reference system 100, such as a Freescale microprocessor conventionally programmed in C. As noted above, the algorithm relies on the periodic correction of the heading gyro 104 only when the difference between the magnetometer 102 reading and the gyro 104 measurements is in the order of the expected gyro drift over the period since the last correction was made to the gyro 104.



Summarizing the above described compensation method, preferably the magnetometer data is read for each axis as well as the gyro data for each axis. The gyro data is converted from body to inertial coordinates. The rate of change of heading based on the magnetometer readings over time is determined. The rate of change of heading is compared with the inertial coordinate rate of change of yaw from the gyros. Then, in accordance with the method of the present invention, the algorithm records the difference in rates of change if this difference is greater than a predetermined threshold value and uses it as a bias to correct for the soft iron impact on the magnetometer. On the other hand, if this difference is not greater than the predetermined threshold value, the algorithm uses the actual magnetometer value to correct for the drift in the gyros.
In accordance with the presently preferred compensation method of the present invention, a conventional extended Kalman filter (not shown) may also be employed in order to blend the gyro 104 measurement with the magnetometer 102 measurement, with the aforementioned difference between the magnetometer 102 and the gyro 104 being the gyro error covariance.
The above method can be employed in any magnetic heading indication system in which disturbances due to the presence of local soft iron can result in errors in magnetic heading calculations. In such an instance, by placing a gyro in the heading measurement axis and comparing the magnitude of the change in the magnetometer against the change in the gyro, any significant changes in the output of the magnetometer that is due to local magnetic field changes can be detected and corrected. Thus, the compensation method of the present invention may be employed not only in aircraft heading reference systems, such as in the integrated standby unit 200 illustrated in FIG. 2, to be described in greater detail hereinafter, but in other aircraft instruments such as primary or secondary attitude and heading reference systems, air data and attitude heading reference systems, or inertial navigation systems; as well as in non-aircraft systems such as vehicle or inertial systems that require a source of heading that may be subject to variations as a result of local electric field changes.
Referring now to FIG. 2, an example of a presently preferred integrated standby unit 200 is shown which has been enhanced and improved by implementing the previously described compensation method of the present invention. As shown and preferred in FIG. 2, the integrated standby unit 200 includes an inertial measurement unit 210 which includes triads of conventional accelerometers 212, gyros 104 and magnetometers 102, with the compensation method of the present invention being utilized with the gyros 104 and magnetometers 102 as described above. As shown and preferred, the integrated standby unit 200 may also include an integral air data measurement module 238 for conventional measurement of airspeed and altitude. The integrated standby unit 200 also preferably includes a conventional differential pressure transducer 214 and conventional absolute pressure transducer 216 fed by pitot 218 and a static port 220 as shown. In addition, the standby unit 200 also preferably includes a conventional LCD display 222, backlight 224, light sensor 226, internal temperature sensor 228, and bezel controls 230. As further shown and preferred in FIG. 2, the microprocessor 120 receives external inputs from an external configuration module 232 and a static air temperature probe 234.
Thus, the above integrated standby unit 200 illustrated in FIG. 2, comprises a series of temperature, pressure, magnetic, acceleration and rate sensors controlled by a microprocessor, such as a Freescale IMX series microprocessor, and presented on an LCD display. As such, the integrated standby system 200 provides for measurement, computation and display of flight critical information, including indicated and true airspeed, mach, static air temperature, altitude, pitch, roll, slip angle and magnetic heading. If desired, the integrated standby system 200 can be further augmented with GPS or other navigation sensors to also provide for display of course, wind and other navigational information.
In the system 200 illustrated in FIG. 2, the initial attitude and heading information is determined by means of the triaxial accelerometers 212 and magnetometers 102. At initialization, the vehicle or aircraft is assumed to be in zero acceleration state and, therefore, the combination of accelerometers 212 and magnetometers 102 provide an accurate initial state for pitch, roll and heading of the aircraft.
In the operational phase of the integrated standby unit 200, the triaxial rate sensors are preferably utilized to determine the current attitude and heading of the aircraft by monitoring and compensating for changes from the initial state. Computed angles based on rate sensor data normally suffer from a random drift, generally referred to as random walk. This drift is normally due to integration of the noise which is in the signal bandwidth and, thus, is not easily filtered by traditional signal conditioning algorithms. In order to compensate for this drift in the method of the present invention, the gyro outputs are periodically recalibrated against the magnetometer and accelerometer data. Variations of an extended Kalman filter are preferably used to periodically correct for the rate sensors drift as well as to blend all sensor data based on their corresponding error covariance. These blending and compensating algorithms provide for an accurate estimate of the aircraft attitude and heading. An example of such a blending algorithm is provided below:



  
    
      i
      →
    
    =
    
      
        
          
            
              
                v
                1
              
              ⁢
              
                
              
            
            →
          
          
            
            
              
                
                  v
                  ⁢
                  
                    
                  
                
                1
              
              →
            
            
          
        
        ⁢
        
          
        
        ⁢
        
          
            i
            D
          
          →
        
      
      =
      
        
          
            
              
                B
                D
              
              →
            
            
              
              
                
                  B
                  D
                
                →
              
              
            
          
          ⁢
          
            
          
          ⁢
          
            
              i
              E
            
            →
          
        
        =
        
          
            
              B
              E
            
            →
          
          
            
            
              
                B
                E
              
              →
            
            
          
        
      
    
  




  
    
      j
      →
    
    =
    
      
        
          
            
              
                v
                1
              
              →
            
            ×
            
              
                v
                2
              
              →
            
          
          
            
            
              
                v
                1
              
              →
            
            
          
        
        ⁢
        
          
        
        ⁢
        
          
            j
            D
          
          →
        
      
      =
      
        
          
            
              
                
                  B
                  D
                
                →
              
              ×
              
                
                  G
                  D
                
                →
              
            
            
              
              
                
                  
                    B
                    D
                  
                  →
                
                ×
                
                  
                    G
                    D
                  
                  →
                
              
              
            
          
          ⁢
          
            
          
          ⁢
          
            
              j
              E
            
            →
          
        
        =
        
          
            
              
                B
                E
              
              →
            
            ×
            
              
                G
                E
              
              →
            
          
          
            
            
              
                
                  B
                  E
                
                →
              
              ×
              
                
                  G
                  E
                
                →
              
            
            
          
        
      
    
  




  
    
      k
      →
    
    =
    
      
        
          i
          →
        
        ×
        
          j
          →
        
        ⁢
        
          
        
        ⁢
        
          
            k
            D
          
          →
        
      
      =
      
        
          
            
              i
              D
            
            →
          
          ×
          
            
              j
              D
            
            →
          
          ⁢
          
            
          
          ⁢
          
            
              k
              E
            
            →
          
        
        =
        
          
            
              i
              E
            
            →
          
          ×
          
            
              j
              E
            
            →
          
        
      
    
  




  
    
      R
      
        D
        →
        I
      
    
    =
    
      [
      
        
          
            
              i
              Dx
            
          
          
            
              j
              Dx
            
          
          
            
              k
              Dx
            
          
        
        
          
            
              i
              Dy
            
          
          
            
              j
              Dy
            
          
          
            
              k
              Dy
            
          
        
        
          
            
              i
              Dz
            
          
          
            
              j
              Dz
            
          
          
            
              k
              Dz
            
          
        
      
      ]
    
  




  
    
      R
      
        E
        →
        I
      
    
    =
    
      [
      
        
          
            
              i
              Ex
            
          
          
            
              j
              Ex
            
          
          
            
              k
              Ex
            
          
        
        
          
            
              i
              Ey
            
          
          
            
              j
              Ey
            
          
          
            
              k
              Ey
            
          
        
        
          
            
              i
              Ez
            
          
          
            
              j
              Ez
            
          
          
            
              k
              Ez
            
          
        
      
      ]
    
  




  
    
      R
      
        D
        →
        E
      
    
    =
    
      
        R
        
          D
          →
          I
        
      
      ·
      
        R
        
          I
          →
          E
        
      
    
  




  
    
      
        
          v
          D
        
        →
      
      ·
      
        R
        
          D
          ->
          E
        
      
    
    =
    
      
        v
        E
      
      →
    
  



A variation of the above algorithm can be used to update the attitude estimate utilizing a variation of a Kalman filter, such as illustrated below:

{circumflex over (x)}k|k−1=Fk{circumflex over (x)}k−1|k−1+Bkuk 

Pk|k−1=FkPk−1|k−1FkT+Qk 

{tilde over (y)}k=zk−Hk{circumflex over (x)}k|k−1 

Sk=HkPk|k−1HkT+Rk 

Kk=Pk|k−1HkTSk−1 

{circumflex over (x)}k|k={circumflex over (x)}k|k−1+Kk{tilde over (y)}k 

Pk|k=(I−KkHk)Pk|k−1 

As is well known, the local magnetic environment which surrounds the standby unit 200 in a typical aircraft panel installation is subject to variations such as magnetic effects of power switching to a nearby instrument. At install time, the standby unit 200 would preferably be calibrated in its intended environment to compensate for the effects of the local environment. However, in the course of a typical flight, various equipment is normally turned on or off which could result in an error in the magnetic heading measured by the internal magnetometers. The method of the present invention enables the system to compensate for these errors, with the algorithm ΔH>k detecting their occurrence and compensating for the resultant error above a predetermined threshold value.
It will be appreciated by one of ordinary skill in the art that numerous compensation algorithms may be used for various systems without departing from the spirit and scope of the present invention. Thus, the compensation algorithm may range from a relatively simple algorithm that periodically compares the change in the magnetic heading as measured by the magnetometers against the change in heading measured by the rate sensors, such as illustrated in FIG. 1 and represented by the previously enumerated expression:

Heading=fn(GH, MH) for ΔH=<k 

Heading=GH and MH=MH+ΔH for ΔH>k 

to more complex or elaborate schemes in which the rates of change of the magnetometers and rate sensors for each axis are compared, such as represented by the flow chart of FIG. 3 and the following expression:

In the case where:

    XGI, YGI, ZGI represent change of angle in X, Y, Z axis as derived from gyros in inertial reference and XM, YM, ZM represent X, Y, Z magnetometer readings and XKI, YKI, ZKI represent maximum expected gyro angular rate drift in inertial reference:

ΔX=|rate of change of XGI−rate of change of XM|

ΔY=|rate of change of YGI−rate of change of YM|

ΔZ=|rate of change of ZGI−rate of change of ZM|

Pitch=fn(YGI, Accelerometer data, Magnetometer data)

Roll=fn(XGI, Accelerometer data, Magnetometer data)

Heading=fn(ZGI, Magnetometer data)

If ΔX>XKI, XM=XM+ΔX Δt 

If ΔY>YKI, YM=YM+ΔY Δt 

Typically, in accordance with the method of the present invention, if the change is greater than the expected drift error of the rate sensors, which is a predetermined threshold value, it is assumed that the magnetometer is being affected by a local change in magnetic field and the rate sensor data is used to compensate for the effects of the change in the local magnetic field.



Referring now to FIG. 3, FIG. 3 diagrammatically illustrates an alternative flow chart, similar to FIG. 1, in accordance with the compensation method of the present invention, that accomplishes the above described method which utilizes the complex scheme represented by the above algorithm. It will be apparent to one of ordinary skill in the art, that the steps of the method illustrated in FIG. 3 may be performed in different orders without departing from the spirit and scope of the present invention. Like with the flow chart illustrated in FIG. 1, the flow chart of FIG. 3 is illustrated as an iterative control loop 300 for repetitively compensating for any defined significant changes in the accuracy of the heading system due to soft iron magnetic disturbances. In carrying out this compensation method, the steps may comprise saving the current value of the magnetometer readings; subtracting the current value of the magnetometer readings from the previously saved magnetometer values; dividing the difference in magnetometer readings by the time period to obtain the rate of change; subtracting the determined magnetometer rate of change from the average rate sensor change for the time period; and, if the difference is less than or equal to the maximum expected drift of the rate sensor, using the magnetometer data to compensate for the rate sensor drift. However, if that is not the case, then the rate sensor data is used to compensate for the effect of soft iron on the magnetometer.
Alternatively, as referred to above, more elaborate schemes may be utilized in which the rates of change of the magnetometers and rate sensors for each axis are compared, such as in the system 200 illustrated in FIG. 2 employing a triaxial gyro 104, triaxial magnetometer 102, and triaxial accelerometer 212. In such an instance, the compensation method of the present invention may comprise the steps of reading the magnetometer data for each axis; reading the gyro data for each axis; converting the gyro data from body to inertial coordinates; determining the rate of change of each magnetic axis based on the magnetometer readings over time; comparing the rate of change of each magnetic axis with the inertial coordinate rate of change of the gyro for the same axis; and, if the difference in rates of change is greater than a predetermined value, recording the difference and using it as a bias to correct for the soft iron impact on each axis of the magnetometer. However, if that is not the case, then the magnetometer values are used in the algorithm such as the Kalman filter algorithm described below which is as follows:
Predict

Predicted state estimate {circumflex over (x)}k|k−1=Fk{circumflex over (x)}k−1|k−1+Bkuk 

Predicted estimate covariance Pk|k−1=FkPk−1|k−1FkT+Qk 

Update

Innovation {tilde over (y)}k=zk−Hk{circumflex over (x)}k|k−1 

Innovation covariance Sk=HkPk|k−1HkT+Rk 

Optimal Kalman gain Kk=Pk|k−1HkTSk−1 

Updated state estimate {circumflex over (x)}k|k={circumflex over (x)}k|k−1+Kk{tilde over (y)}k 

Updated estimate covariance Pk|k=(I−KkHk)Pk|k−1 

to correct for the drift in the gyros. Alternatively, the accelerometer data can be used in this algorithm to augment the magnetometer data during no acceleration modes such as un-accelerated straight and level motion of the vehicle or when the vehicle is stationary.

In the above situation, where the compensation method of the present invention is employed in connection with each axis, such as in the system 200 of FIG. 2, in which the compensation method compares and compensates for effects of soft iron on each of the magnetometers, an internal model of the expected magnetic readings for each magnetometer is developed that estimates the expected value of each magnetometer based on estimated heading, pitch and roll of the aircraft as determined by the gyros and accelerometers. This model is constantly updated by taking into account the magnetometer readings and, as such, the change in the estimated magnetometer readings is preferably compared with the change in the actual magnetometer reading for each axis and is used to compensate for the effects of soft iron on each magnetometer or to correct the drift on each gyro.
As illustrated in FIG. 3, the steps involved in iteratively carrying out the compensation method of the present invention may involve reading and processing the magnetometer 102, accelerometer 212, and gyro 104 data to provide signals corresponding to any change in magnetometer value and gyro value. This step is represented by block 312 in FIG. 3. These signals are then compared against each other to determine any actual change since the previous reading. This step is represented by block 314 in FIG. 3. A determination is then made if any detected difference in value from the previous reading is greater than the expected gyro drift over the period since the previous reading. This step is represented by block 316 in FIG. 3. If as a result of this comparison the difference exceeds the expected gyro drift, then, in accordance with the compensation method illustrated in FIG. 3, the gyro change plus the last magnetometer reading is used for the magnetometer value, represented by block 318 in FIG. 3, and the calibration value for the magnetometer is updated using the difference, represented by block 320 in FIG. 3. The corrected gyro and magnetometer values are then output, represented by block 322 in FIG. 3, and the best estimate of attitude and heading is computed, represented by block 324 in FIG. 3, and the steps are iteratively periodically repeated, as illustrated in FIG. 3. On the other hand, if the detected difference is less than the expected gyro drift over the period since the previous reading, the calibration value for the gyro is updated using the magnetometer and the accelerometer data. This step is represented by block 326 in FIG. 3, and then the corrected gyro and magnetometer values are output, as represented by block 322, the best estimate of attitude and heading is computed, represented by block 324, and the process is iteratively periodically repeated.
While there have shown and described various novel features of the invention, it will be understood that various omissions and substitutions and changes in the form and details of the methods described and devices illustrated, and in their operation, may be made by those skilled in the art without departing from the spirit and scope of the invention which is defined by the scope of the claims appended hereto.

## Claims

1. A method for compensating for soft iron magnetic disturbances in a heading reference system, said system comprising a heading gyro disposed along a heading measurement axis and a magnetometer coupled to said heading gyro for providing an accurate heading relative to magnetic north; said method comprising the steps of:
providing an iterative control loop for controlling an output heading value corresponding to true magnetic north, and providing a compensated output heading reference value to said heading reference system from said iterative control loop for compensating for soft iron magnetic disturbances above a predetermined acceptable threshold value, said iterative control loop being configured to perform the steps of:
reading and processing a value of data from said magnetometer and said heading gyro for providing a change in each of said values from an immediately previous reading of said values;
comparing said change in magnetometer value with said change in gyro value since said immediately previous reading; determining whether any difference in said compared values exceeds an expected gyro drift over a period since said immediately previous reading; and
providing a new heading value comprising said gyro change in value plus the immediately previous heading value as an output to said gyro when said difference exceeds said expected gyro drift over said period since said immediately previous reading, said predetermined acceptable threshold value comprising said expected gyro drift; whereby said gyro heading is capable of maintaining said accurate heading in the face of said soft magnetic disturbances.

2. The compensation method in accordance with claim 1 wherein said iterative control loop being further adapted to use said magnetometer reading for said heading value when said difference in said compared values does not exceed said expected gyro drift over said period.

3. The compensation method in accordance with claim 2 further comprising the step of iteratively repeating said steps performed by said iterative control loop for subsequent readings of said magnetometer and gyro data values for maintaining said accurate heading in the face of said soft magnetic disturbances.

4. The compensation method in accordance with claim 1 further comprising the step of iteratively repeating said steps performed by said iterative control loop for subsequent readings of said magnetometer and gyro data values for maintaining said accurate heading in the face of said soft magnetic disturbances.

5. The compensation method in accordance with claim 1 further comprising the step of periodically correcting said gyro heading utilizing data provided from said magnetometer.

6. The compensation method in accordance with claim 1 wherein said compensation method further comprises blending heading gyro measurements with magnetometer measurements, said predetermined acceptable threshold value comprising a gyro error covariance.

7. The compensation method in accordance with claim 6 wherein said blending comprises using a Kalman filter to blend said heading gyro measurements with said magnetometer measurements.

8. The compensation method in accordance with claim 1 wherein said heading gyro comprises a triaxial heading gyro comprising three gyro components each being disposed along a different heading measurement axis, and said magnetometer comprises a triaxial magnetometer comprising three magnetometer components each being disposed along a different heading measurement axis.

9. The compensation method in accordance with claim 1 further comprising the step of correcting said magnetometer for the effect of soft iron magnetic disturbances utilizing data provided from said heading gyro.

10. The compensation method in accordance with claim 9 wherein correcting said magnetometer uses the heading gyro change plus the last magnetometer reading for the magnetometer value.

11. The compensation method in accordance with claim 1 further comprising periodically recalibrating the heading gyro using said magnetometer and at least one accelerometer.

12. The compensation method in accordance with claim 1 wherein said heading reference system comprises an aircraft heading reference system.

13. The compensation method in accordance with claim 12 wherein said aircraft heading reference system comprises an integrated standby unit.

14. The compensation method in accordance with claim 1 wherein said heading reference system comprises a vehicle inertia system.

15. The compensation method in accordance with claim 1 wherein said heading reference system comprises an air data and attitude heading reference system.

16. The compensation method in accordance with claim 1 wherein said heading reference system comprises a primary air data and attitude heading reference system.

17. The compensation method in accordance with claim 1 wherein said heading reference system comprises a secondary air data and attitude heading reference system.

18. The compensation method in accordance with claim 1 wherein said heading reference system comprises a primary inertial navigation system.

19. The compensation method in accordance with claim 1 wherein said heading reference system comprises a secondary inertial navigation system.