Three-Dimensional Magnetometer Calibration with ...

2 downloads 0 Views 4MB Size Report
with the earth true north, it represents the device heading, and. represents .... (ii) The platform frame is the frame of the moving platform as shown in Figure 2.
This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

1

Three-Dimensional Magnetometer Calibration with Small Space Coverage for Pedestrians Ahmed Wahdan1, 2, Jacques Georgy2, and Aboelmagd Noureldin 1,3 1 NavINST – Navigation and Instrumentation Research Group, ECE Department, Queen’s University 2 Trusted Positioning Inc. 3 NavINST – Navigation and Instrumentation Research Group, ECE Department, Royal Military College of Canada / Queen’s University 

Abstract— Magnetometers are sensors that can sense the earth magnetic field from which heading can be determined. Gyroscopes can provide the angular rate from which the heading can be calculated, they can be available in low-cost and light weight. Nevertheless, the problem of using gyroscopes as a sole source of heading is that gyroscopes readings are drifting with time in addition to the accumulated errors due to mathematical integration operation. Magnetometer is available in low-cost, it does not suffer from mathematical integration errors, and it can provide an absolute heading from magnetic north. Magnetometer readings are usually affected by magnetic fields, other than the earth’s field, and by other error sources. Therefore magnetometer calibration is required to use magnetometer as a reliable source of heading. In this paper, two techniques are proposed for fast automatic 3D-space magnetometer calibration requiring small space coverage. There is no user involvement during calibration and there are no required specific movements. The proposed techniques perform 3D-space magnetometer calibration by calibrating the three magnetometer readings in the device frame which makes the magnetometer useful for determining heading in untethered devices, especially in pedestrian navigation. In which, portable navigation devices (such as smartphones) are always moving freely between the user’s hands, belt, pocket, or placed on the ear during phone calls. The two proposed magnetometer calibration techniques are also capable of calibrating magnetometers in tethered devices, given that the platform to which the device is tethered is capable of performing 3D motion. Index Terms— Magnetometers, Calibration, navigation, Pedestrian navigation, Electronic compass.

Portable

Copyright (c) 2013 IEEE. Personal use of this material is permitted. However, permission to use this material for any other purposes must be obtained from the IEEE by sending a request to [email protected]. A.Wahdan is with Trusted Positioning Inc. Calgary, AB T2L 2K7 (email: [email protected], [email protected]) J. Georgy is with Trusted Positioning Inc. Calgary, AB T2L 2K7 (e-mail [email protected]) A. Noureldin is with the Department of Electrical and Computer Engineering, Queen’s University, Kingston, ON K7L 3N6, Canada, and also with the Department of Electrical and Computer Engineering, Royal Military College of Canada, Kingston, ON K7K 7B4, Canada (e-mail: [email protected]). I. INTRODUCTION

Navigation was one of the first applications that used magnetometers. Nowadays, magnetometers are still used in heading determination in many navigation applications. Other parameters that can be detected using magnetometers and make the magnetometers useful in many applications other

than navigation are such as wheel speed, presence of a magnetic ink, and vehicle detection [1]. These parameters cannot be measured directly, but can be extracted from changes, or disturbances, in magnetic fields. Absolute navigation systems (such as Global Navigation Satellite System (GNSS)) has proved to be insufficient for indoor navigation, or when navigating in urban canyons; due to multipath and obstruction. This opened the gate widely for sensors-based navigation systems to be used, especially after the development of low-cost micro-electro-mechanical systems (MEMS) sensors. Gyroscopes are inertial sensors that can provide the angular rate from which the heading can be calculated, they can be available in low-cost and light weight [2]. Nevertheless, one problem of using gyroscopes as a sole source of heading is gyroscopes readings are drifting with time in addition to the accumulated errors due to mathematical integration operation [2, 3]. Magnetometers are also available in low-cost but they do not suffer from mathematical integration errors and can provide an absolute heading from magnetic north by sensing the earth’s magnetic field. However, magnetometers readings are usually influenced by magnetic fields, other than the earth magnetic field, and by other error sources; these effects result in an inaccurate heading measurement due to perturbed magnetometer readings [4]. The earth magnetic field can be expressed as a dipole magnet where the magnetic north and south poles lie in an axis that does not coincide with the earth’s true north and south poles[5]. The difference between the true north and the magnetic north defines an angle called “declination angle” that should be accounted for when determining heading using magnetometer. Heading can be obtained from the two levelled horizontal magnetometer signals as follows: 𝒉𝒚

𝝍 = − 𝒂𝒓𝒄𝒕𝒂𝒏 ( ) ± 𝑫 𝒉𝒙

(1)

where hx and hy represent the two levelled measurements of the earth’s magnetic field vector in a coordinate system attached to the compass body (or the device comprising the magnetometer).The angle 𝝍 is the angle the device makes with the earth true north, it represents the device heading, and 𝐷 represents the declination angle [4]. The presence of electronic magnetometers and the availability of microcontrollers in low-cost that can be programmed to perform a real-time calibration enabled researchers to implement real-time magnetometer calibration. However, the calibration always suffers from one of two

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

2 major problems. The first is that the user is involved in the calibration process; he should perform specific movements. The second is that the calibration requires large space coverage which makes the calibration process slow and not efficient in navigation applications if the user is not involved in the calibration process. Different approaches were used for calibrating magnetometers; the main goal of magnetometers calibration is to use magnetometers as a heading source. One of the old and well known methods for calibrating compass is “Compass Swinging”. Compass swinging was used for compass calibration to be used for heading determination in marine [4] and aviation [6]. The procedure involves leveling and rotating the vehicle or the aircraft containing the compass through a series of known headings[7]. The main drawback of using traditional compass swinging is that the method is limited to use with two-axis systems as it cannot be used to calibrate a 3D compass [7, 8]. It also requires the user to be instructed to rotate the compass in certain predefined directions [7] which involve the user in the calibration process. Another approach for compass calibration that does not require an external heading source is known as Ellipse/Ellipsoid fitting. In this approach, calibration is done in the magnetic field domain depending on the fact that the error-free locus made by the compass is a circle when it makes full rotation in 2D or a sphere when rotated in 3D covering all possible orientations [1, 5, 9, 10]. In some implementations it is assumed that the locus the magnetometer readings forms a translated hyperbolic shape in 2D (ex. ellipse) or translated hyperboloid shape in 3D (ex. ellipsoid) when rotated in normal operation conditions (in the presence of ferrous interference) [5, 7, 9, 11-13]. Either geometric [8] or algebraic [7, 14-16] methods can be used to best fit the magnetometer measurements to the assumed manifold such fitting the measurements to an ellipse in 2D or to an ellipsoid in 3D. The main drawback of the methods depending on the Ellipse/Ellipsoid fitting approach is that they require the device having the magnetometers to rotate at least 360 degrees in horizontal plane in case of 2D. In case of 3D calibration the device should cover a big portion of an ellipsoid in 3D to define the ellipsoid eccentricity and rotation [17]. Consequently, in 3D calibration, the calibration process nearly requires rotating the device having the magnetometers in all directions to cover all possible orientations [8]. This drawback either makes the calibration process slow, or it may require the user to perform certain movements (such as for example moving the device in “figure eight” if the device is portable) or rotating the vehicle for one complete loop to cover 360 degrees. The other drawback in the latter scenarios is that the user becomes involved in the calibration process which is not efficient in daily life scenarios [8, 17]. For example, when the user requires an accurate heading from magnetometer without getting involved in a calibration process; either from his portable device (smart phone or personal navigator), or from his vehicle navigation device. In this paper two techniques are proposed that perform full 3D-space magnetometer calibration. The user is not required

to get involved in the calibration process; therefore the techniques are fully automatic. Moreover, the techniques are fast and magnetometer calibration is performed with very little space coverage. The first proposed technique performs 3D-space calibration when external heading information is available with very little pitch and roll changes. The second technique can perform 3Dspace calibration without depending on external heading information, but with relatively larger pitch and roll coverage. The major application of the proposed techniques is heading determination in untethered devices such as personal navigators and smart phones which can work in walking and/or driving[18]. However, the technique can be used in tethered devices when the platform is capable of changing the pitch and roll orientations sufficiently to be able to perform the 3D-space calibration for example in airborne applications with high dynamics. To assure the quality of the calibration, two quality check routines are developed. The first routine is called directly after the calibration to decide whether the calculated calibration parameters are correct or not. The other quality check is called periodically after calibration to consider the case if the magnetic environment is changed.

In this paper three frames are used: (i) The device frame which is the frame of the device comprising the magnetometer as shown in Figure 1. (ii) The platform frame is the frame of the moving platform as shown in Figure 2. (iii) The Local Level Frame LLF, it is referred as NED (North-East-Down).

Figure 1 Device frame

Figure 2 Platform frame

II. MAGNETOMETER ERROR SOURCES Magnetometers readings are usually affected by magnetic fields other than the earth magnetic field, these fields in addition to some other error sources perturbs the magnetometer readings [7, 8]. Some examples of error sources and their effects on magnetometer readings are among others: (i) Hard iron distortion that is considered a constant bias added to each axis of sensor output. This kind of distortion comes from permanent magnets or magnetized iron or steel placed close to the magnetic sensor. Hard iron effects mimic the effect of sensor biases. (ii) Sensitivity errors arise due to different sensitivities of magnetometer sensors in different axis. The sensitivity errors are considered as scale factor errors. Calibrating the scale factor error involves determining the multiplicative factor that has to be applied to each magnetometer such that the outputs will be the same when subjected to identical magnetic fields.(iii) Soft iron effect

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

3 arises from the interaction of earth’s magnetic field and any magnetically soft iron material such as nickel or iron. Soft iron distortion distorts the earth’s magnetic field lines depending on which direction the field acts relative to the sensor. In most cases, hard iron distortion has a much larger contribution to the total error than soft iron. (iv) Temperature can affect the magnetic sensors causing inaccurate heading determination [9]. (v) Other error sources may be due to different factors such as sensor material or sensor fabrication that can cause errors in the magnetometer readings. Also the magnetometer readings can be affected by sensor noise that also adds other source of error. The above-mentioned error sources are the most effective sources that make the magnetometer readings corrupted. Due to these error sources, the perturbed magnetometer readings require calibration to be used in various applications especially heading determination in navigation applications. Calibration involves calculating different calibration parameters which can be added to or subtracted from each magnetometer signal along each axis so that they correct for sensor biases and/or hard iron effects. The parameters can also be multiplied to each magnetometer signal along each axis to correct for scale factor errors caused by different sensitivities and/or soft iron effects. III. AUTOMATIC 3D MAGNETOMETER CALIBRATION WITH LITTLE SPACE COVERAGE This paper proposes two techniques for full 3D-space magnetometer calibration. There are several key advantages for the proposed techniques. First, the techniques are fully automatic; the user is not involved in the calibration process. Consequently there are no instructions or certain process that the user has to perform to calibrate the magnetometer, for example moving the portable device in “figure eight”. Moreover, the calibration techniques proposed require little space coverage compared to other calibration techniques in literature [5, 7, 8]. Therefore the proposed calibration techniques can perform fast and automatic 3D-calibration. Two techniques are proposed to cover different navigation scenarios that involve different available information. In some navigation scenarios heading information can be available from another source such as GNSS or an integrated navigation solution (INS/GPS) that does not used magnetometer updates till calibration is done. In other scenarios heading information from another source is not available. The two proposed techniques can also work simultaneously on the same device to achieve the best calibration results. The major application of the proposed techniques is heading determination in untethered devices such as personal navigators and smart phones which can work in walking and/or driving. However, the technique can be used in tethered devices when the platform is capable of changing the pitch and roll orientations sufficiently to be able to perform the 3Dspace calibration for example in airborne applications with high dynamics. The minimum space coverage for the developed techniques will be discussed in the next sections. The advantage of performing magnetometer 3D calibration in portable devices is that the calibration can only be done

once, and then works with all device orientations without the need of performing new calibration at each pitch and/or roll change like in 2D calibration. This makes the proposed techniques more suitable for determining heading in untethered and portable devices when they are moving with high frequency covering different pitch and roll sectors in very short time periods. To perform magnetometer calibration using the two proposed techniques, reference earth magnetic field information is required for the region where the calibration is performed. Earth magnetic field information can be obtained according to any model that describes the earth magnetic field (For example International Geomagnetic Reference Field (IGRF) model)[19]. Information that may be required from the earth magnetic field model are (i) the value of the components of the magnetic field vector (from which the horizontal field magnitude or the 3D magnitude of the magnetic field can be calculated); and (ii) the declination angle. In order to acquire the earth’s magnetic field information the position of the device on earth in terms of latitude, longitude and altitude is required. The position can be obtained using any absolute navigation information updates (such as GNSS, WiFi, or any other wireless technology), or an integrated navigation system integrating any absolute navigation system with other sensors (such as gyroscopes, accelerometers, barometer, odometer). In this paper, the earth magnetic field information acquired from the earth magnetic field model is not updated except if the device having the magnetometer moves a very long distance. This can be implemented by defining a threshold value for the distance traveled after performing calibration, after which the information for earth magnetic field is updated. This approach limits the computation requirements. However, in some other cases the earth magnetic field model used in calibration is accessed whenever there is an absolute navigational information update available (GNSS). This is more applicable when magnetometer is used for heading determination in aviation where large distances are covered during one trip. The first technique in this paper requires an external heading information source to be used during calibration to supply the calibration method by different readings of the device heading. The device heading can be calculated using: (i) Any absolute navigational information (for example, GNSS, WiFi, or any other wireless technology). (ii) Any integrated navigation solution using any type of integration technique and integrating different sensors and/or systems such as accelerometers, gyroscopes, magnetometers, barometer, odometer, or any navigational information (for example, GNSS, WiFi, or any other wireless technology). The magnetometer heading always represents the device heading. Therefore in cases when the device and the platform have a heading misalignment (i.e. the heading of the device is not the same as the heading of the platform), and when an absolute navigational information source is used to obtain platform heading; heading compensation for the misalignment

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

4 between device and platform is required to obtain the device heading. The external heading information mentioned above is the device heading to be able to perform the calibration. Both proposed techniques require the pitch and roll angles of the device comprising the magnetometer to perform calibration. The pitch and roll angles may be calculated from any one of the following: (i) Accelerometers readings or averaged accelerometer readings (whether fixed-time average or moving average) that senses the direction of gravity [2]. (ii) Gyroscopes to maintain a known inertial reference orientation at all times through any one of different methods such as quaternions [9], [2]. (iii) Integrated navigation solution using any type of integration technique and integrating different sensors and/or systems such as: accelerometers, gyroscopes, magnetometers, barometer, odometer, or any navigational information updates (for example, GNSS, WiFi, or any other wireless technology) [2]. The two developed techniques in this paper are capable of calculating different calibration parameters to correct for all different error sources that affect magnetometers; however, biases and scale factors in magnetometers readings are the only calibration parameters that are calculated and calibrated for in this research work. The calibrated magnetometer readings can be used reliably for heading determination. At the same time less space coverage during calibration and simpler calibration equations will be required. Biases in magnetometer readings can be mapped to the sensor biases due to sensor material, sensor fabrication, or temperature. Biases can also be mapped to hard iron effects. Scale factors in magnetometer readings can be mapped to the combined effect of sensitivity errors and soft iron effects that turn the circular/spherical locus of magnetometer readings when magnetometer is rotated in 2D/3D into an ellipse/ellipsoid. Experimental results show how the proposed techniques are capable of calculating biases and scale factors for correcting magnetometer readings and how the heading calculated using the calibrated magnetometer readings is close to the reference. An INS/GNSS reference heading is used for evaluating the techniques developed in this paper. To assure the quality of the calibration, two quality check routines are developed. The first routine is used directly after the calibration, to decide whether the calculated calibration parameters are correct or not, and called “Post calibration Check Routine”. The other quality check is used periodically after calibration to consider the case if the magnetic environment is changed; “Periodic Check Routine”. The “Post calibration Check Routine” depends on three factors: (i) checking the scale factor is in the suitable range according to experimental results; (ii) comparing the magnetometer heading after calibration with a reference heading when external heading information is available; (iii) comparing the calibrated magnetometer readings with the magnetic field components acquired according to the earth magnetic field model. The “Periodic Check Routine” only compares the magnitude of the calibrated magnetometer

readings with the magnetic field components acquired according to the earth magnetic field model. It doesn’t repeat checking the scale factor to avoid redundancy and it doesn’t perform heading comparison to avoid being dependent on an external heading source. A. Magnetometer Calibration in 3D space when heading information is available during calibration This technique performs automatic fast magnetometer calibration with small space coverage depending on an available external heading information source. The following inputs are required to calculate 3D calibration parameters in device frame: (i) Raw magnetometer readings Raw magnetic field readings are collected prior to the calibration and used as inputs to the calibration algorithm used. (ii) External heading information The external heading used during calibration can be acquired from an integrated navigation solution that integrates accelerometers, gyroscopes, barometer with GPS [20, 21]. The external heading is only required during calibration while after calibrating the magnetometer, magnetometer heading can be used as an independent heading source. (iii) Reference 3D magnetic field components Reference 3D magnetic field components for a certain region on earth at which calibration is performed can be acquired according to any earth magnetic model. In this work the IGRF model: the eleventh generation [19] is used. (iv)Pitch and roll angles Used with the heading to rotate the earth magnetic field components from local level frame to the device frame. Heading readings with the corresponding pitch and roll values are used for transforming the reference earth magnetic field components from local level North-EastDown (N-E-D) frame to be in device frame (X-Y-Z). Different sets of heading pitch and roll values that should be different enough to be able to solve calibration equations are collected. The raw 3D magnetometer readings are represented as functions of biases and scale factors together with earth magnetic field components acquired according to the IGRF model. Mathematical or estimation approaches such as Least Square (LS) can be used to solve for 3D biases and scale factors using different sets of values including heading, pitch, and roll. This technique of 3D magnetometer calibration can be used when the device’s pitch and roll angles are changing with the regular usage; such as holding the mobile in hand while hand dangling during walking, putting the mobile device in pocket or using the mobile for voice calls and placing it close to the ear. The method does not require the user to perform certain specific movements with the mobile to perform the calibration; therefore the method is completely automatic and online. Figure 3 shows a hand dangling use-case for a smart phone. The user is walking while hand dangling the device where the device’s pitch and roll angles changes with values that can range from 15 to 30 degrees.

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

5 magnetometer readings. The previous equations can be written as follows: 𝒃𝒚 𝟏 𝒃𝒙 𝟏 𝒉𝒙 = 𝒉′𝒙 . ( ) − ( ) , 𝒉𝒚 = 𝒉′𝒚 . ( ) − ( ), 𝜸𝒙 𝜸𝒙 𝜸𝒚 𝜸𝒚 𝟏

𝒃𝒛

𝜸𝒛

𝜸𝒛

𝒉𝒛 = 𝒉′𝒛 . ( ) − (

)

(7)

The unknowns are represented as follows: 𝟏

𝒃

𝟏

𝒃𝒚

𝟏

𝜸𝒙

𝜸𝒙

𝜸𝒚

𝜸𝒚

𝜸𝒛

𝑨 = ( ) , 𝑩 = ( 𝒙) , 𝑪 = ( ) , 𝑫 = ( ) , 𝑬 = ( ) , 𝒃

𝑭 = ( 𝒛)

(8)

𝜸𝒛

Figure 3 Hand dangling while walking

The following equations are given to describe how the present technique makes use of external heading information to calibrate magnetometer by calculating 3D biases and scale factors in magnetometer readings. The technique starts with equation (2) describing the unperturbed reference magnetic field vector 𝑯𝒃 in device frame. The subscript b stands for body which is considered the device in this technique. 𝒉𝒙 𝒉𝑵 𝑯𝒃 = [𝒉𝒚 ] = 𝑹𝒃𝒍 . [ 𝒉𝑬 ] (2) 𝒉 𝒉𝒛 𝑫 where 𝒉𝑵 , 𝒉𝑬 , 𝒉𝑫 are the three magnetic field components taken from IGRF model in the local level frame, where N represents North, E for East and D for Down, while 𝒉𝒙 , 𝒉𝒚 , 𝒉𝒛 represent the three components of the earth’s magnetic field in the device frame (X-Y-Z) forming the vector 𝑯𝒃 . 𝑹𝒃𝒍 is a 3x3 rotation matrix. It converts the magnetic field vector from the local level frame to the device frame [2]. 𝑹𝒃𝒍 = 𝒄𝒐𝒔(𝒑) 𝒄𝒐 𝒔(𝒉) 𝒄𝒐𝒔(𝒑) 𝒔𝒊 𝒏(𝒉) −𝒔𝒊 𝒏(𝒑) (− 𝒄𝒐𝒔(𝒓) 𝒔𝒊𝒏(𝒉) + 𝒔𝒊 𝒏(𝒓) 𝒔𝒊 𝒏(𝒑) 𝒄𝒐 𝒔(𝒉) 𝒄𝒐𝒔(𝒓) 𝒄𝒐𝒔(𝒉) + 𝒔𝒊𝒏(𝒓) 𝒔𝒊𝒏(𝒑) 𝒔𝒊 𝒏(𝒉) 𝒔𝒊 𝒏(𝒓) 𝒄𝒐 𝒔(𝒑) ) 𝒔𝒊𝒏(𝒓) 𝒔𝒊𝒏(𝒉) + 𝒄𝒐𝒔(𝒓) 𝒔𝒊𝒏(𝒑) 𝒄𝒐𝒔(𝒉) − 𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒉) + 𝒄𝒐𝒔(𝒓) 𝒔𝒊𝒏(𝒑) 𝒔𝒊 𝒏(𝒉) 𝒄𝒐 𝒔(𝒓) 𝒄𝒐 𝒔(𝒑)

(3) In the 𝑹𝒃𝒍 matrix the letter (𝒉) refers to an external heading acquired from an integrated navigation solution that integrates accelerometers, gyroscopes, barometer with GPS, after subtracting declination angle to map to the heading measured from the magnetic north. The declination angle can be acquired from the IGRF model. The letter (𝒑) refers to the pitch angle while the letter (𝒓) refers to the roll angle of the device. From equations (2) and (3) the left hand side for the three following equations (4), (5) and (6) become known and can be used to calibrate the magnetometer readings and calculate the biases and scale factors for the three magnetometer readings in the device frame. Assuming the magnetic field components are modeled as follows: 𝒉𝒙 = 𝒉𝒚 = 𝒉𝒛 =

𝒉′𝒙 −𝒃𝒙 𝜸𝒙 𝒉′𝒚 −𝒃𝒚 𝜸𝒚 𝒉′𝒛 −𝒃𝒛 𝜸𝒛

(4) (5) (6)

In equations (4), (5) and (6) 𝒃𝒙 , 𝒃𝒚 and 𝒃𝒛 represent the reading biases in the device frame axes X, Y and Z respectively, while 𝜸𝒙 , 𝜸𝒚 and 𝜸𝒛 represent the reading scale factor error while 𝒉′𝒙 , 𝒉′𝒚 𝐚𝐧𝐝 𝒉′𝒛 represent the raw 3D

Using least square approach for solving the previous equations using N readings in which the heading, pitch and roll values are unique enough to solve the system of equations. 𝑨 𝑪 𝑬 𝑿𝟏 = ( ) , 𝑿𝟐 = ( ), 𝑿𝟑 = ( ) (9) 𝑩 𝑫 𝑭 ′ ′ ′ 𝒉𝒙𝟏 𝒉′ 𝑯𝟏 = 𝒙 𝟐 ⋮ ′ [𝒉𝒙𝑵

−𝟏 −𝟏 , ⋮ −𝟏]

𝒉𝒚𝟏 𝒉′ 𝑯𝟐 = 𝒚 𝟐 ⋮ ′ [𝒉𝒚𝑵

−𝟏 −𝟏 ⋮ −𝟏]

𝒉𝒛𝟏 𝒉′ , 𝑯𝟑 = 𝒛𝟐 ⋮ ′ [𝒉𝒛𝑵

−𝟏 −𝟏 ⋮ −𝟏]

(10)

𝒉 𝒚𝟏 𝒉𝒙𝟏 𝒉 𝒛𝟏 𝒉 𝒚𝟐 𝒉 𝒉 𝒀𝟏 = ( 𝒙𝟐 ) , 𝒀𝟐 = , 𝒀𝟑 = ( 𝒛𝟐 ) (11) ⋮ ⋮ ⋮ 𝒉𝒙𝑵 𝒉 𝒛𝑵 (𝒉 𝒚 𝑵 ) The subscript N represents the number of readings; multiple readings can be collected for each device attitude (heading, pitch and roll). 𝑯𝟏 ∗ 𝑿𝟏 = 𝒀𝟏 , 𝑯𝟐 ∗ 𝑿𝟐 = 𝒀𝟐 , 𝑯𝟑 ∗ 𝑿𝟑 = 𝒀𝟑 (12) [𝑯𝟐

𝑻

[𝑯𝟏 𝑻 ∗ 𝑯𝟏 ] 𝑿𝟏 = 𝑯𝟏 𝑻 ∗ 𝒀𝟏 , ∗ 𝑯𝟐 ] 𝑿𝟐 = 𝑯𝟐 𝑻 ∗ 𝒀𝟐 , [𝑯𝟑 𝑻 ∗ 𝑯𝟑 ] 𝑿𝟑 = 𝑯𝟑 𝑻 ∗ 𝒀𝟑

(13)

𝑿𝟏 = [𝑯𝟏 𝑻 ∗ 𝑯𝟏 ] −𝟏 ∗ 𝑯𝟏 𝑻 ∗ 𝒀𝟏 , 𝑿𝟐 = [𝑯𝟐 𝑻 ∗ 𝑯𝟐 ] −𝟏 ∗ 𝑯𝟐 𝑻 ∗ 𝒀𝟐 , 𝑿𝟑 = [𝑯𝟑 𝑻 ∗ 𝑯𝟑 ] −𝟏 ∗ 𝑯𝟑 𝑻 ∗ 𝒀𝟑 (14)

From equation (14) the unknown values representing biases and scale factors can be calculated for 3D magnetometer using LS approach, as follows, 𝟏 𝑩 𝟏 𝑫 𝟏 𝑫 𝜸𝒙 = , 𝒃𝒙 = , 𝜸𝒚 = , 𝒃𝒚 = , 𝜸𝒛 = , 𝒃𝒛 = (15) 𝑨 𝑨 𝑪 𝑪 𝑪 𝑪 The device comprising the magnetometer is assumed to be aligned to the platform (ex. the human body) having zero heading misalignment during calibration. The X-axis represents the forward direction for both the platform (the person) and device while Y-axis is perpendicular on X-axis pointing to the right and Z-axis pointing down for both the platform and device. Solving heading misalignment problem is out of the scope of this work and it is assumed compensated using another module. This technique can be used to calibrate magnetometer for heading determination in a Pedestrian Dead Reckoning (PDR) solution where the device used is untethered and free to move by a pedestrian (portable device) after being calibrated. For 3D calibration to be achieved using an external heading information source, sufficient data must be collected during calibration. The minimum data required is exactly two heading readings from two different directions, exactly two different pitch values and two roll values. By experimental trials, the minimum absolute difference between the two heading values required is set empirically to 70 to 80 degrees. Also by experimental trials the minimum absolute difference between the two pitch values required is set empirically to 20 degrees and the same for roll. To collect sufficient data for this technique to perform 3D calibration for biases and scale

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

6 factors, the device is required to be moved covering one heading turn, which is very common and easy to achieve during walking, and to change its pitch and roll only by 20 degrees each. This gives the chance to perform 3D magnetometer calibration while hand dangling or when the mobile is in the trousers pocket while the pedestrian turns by 70 to 80 degrees. B. Magnetometer Calibration in 3D space when heading information is not available during calibration This technique performs automatic fast magnetometer calibration with small space coverage without depending on an external heading information source. The following inputs are required to calculate 3D calibration parameters in device frame: (i) Raw magnetometer readings Raw magnetic field readings are collected prior to the calibration and used as inputs to the calibration algorithm used (ii) Reference vertical magnetic field Reference vertical magnetic field for a certain region in earth at which calibration is performed can be acquired according to any earth magnetic model. In this work the IGRF model: the eleventh generation [19] is used. (iii) Gravity model A model for gravity that is able to calculate the free fall acceleration value in certain region on earth given latitude and altitude. The source providing the gravity acceleration can be, for example, any of the following among others: (i) a model for gravity that is able to calculate the free fall acceleration value in certain region on earth, together with pitch and roll values, (ii) readings of a sensor capable of providing the gravity vector, such as for example accelerometer readings or filtered/smoothed accelerometer readings (for example averaged accelerometer readings). In this paper a gravity model is used and stored in the device memory and accessed once the initial position is known using GPS given the latitude and altitude values. (iv)Pitch and roll angles They are used for rotating the gravity vector from local level frame to the device frame since a gravity model is used in this paper. The heading is not required for calculating 3D calibration parameters in this technique, which introduces a selfcontained calibration method where several pitch and roll values are needed, the absolute difference between the maximum and the minimum pitch or roll values are sufficient to solve the calibration equations. The gravity model used to calculate the earth’s gravity at a certain region of earth can be given only latitude and altitude values. These values can be calculated using any absolute navigational information (for example, GNSS, WiFi, or any other wireless technology), or an integrated navigation system integrating any absolute navigation system with any sensor or sensors (such as gyroscopes, accelerometers, barometer, odometer). For altitude, it can also be acquired using barometer only. The way the 3D biases and scale factors are calculated starts after collecting sufficient data of pitch and roll values, the

gravity value is acquired from the gravity model. The gravity vector in local level frame has zero components in north and east directions, while the only nonzero component is the component in the down direction whose value is the one acquired from the gravity model. This vector is rotated using pitch and roll according to the device motion. After rotation using pitch and roll the vector will represent the gravity vector in device frame. The 3D earth’s magnetic field vector in local level frame is represented in three components; one pointing to the earth’s north, one to the east and one pointing down and they are taken from the IGRF model directly when the region on earth is known. The same 3D earth’s magnetic field vector can be represented in device frame as a function of the 3D magnetometer readings with biases added as unknowns and then multiplied by scale factors also as unknowns. There is a fact that the angle between the gravity vector and the 3D magnetic field vector is constant (90 - Inclination angle)[4]. Consequently the dot product between the gravity vector and the earth magnetic field vector in local level frame is equal to the dot product between the gravity vector and the earth magnetic field vector in device frame. Figure 5 illustrates the relation between the magnetic field vector and the gravity vector in the device frame. In Figure 5, B represents the magnetic field vector in the device frame while 𝒈𝑿𝒀𝒁 represents the gravity vector in device frame. It is clear from the figure that the angle between 𝒈𝑿𝒀𝒁 and B is constant whatever was the device orientation.

Figure 4 Relation between gravity vector and magnetic field vector in device frame

Depending on this relation, mathematical or estimation approaches such as Least Square (LS) can be used to get biases and scale. The following equations are given to describe how the present technique calibrates magnetometer by calculating 3D biases and scale factors in magnetometer readings without depending on external heading. The gravity vector used is as follows: 𝟎 ⃑⃑⃑⃑⃑⃑⃑⃑⃑⃑ 𝒈𝑵𝑬𝑫 = ( 𝟎 ) (16) 𝒈𝑫 The subscript 𝑫 in 𝒈𝑫 stands for the Down direction in local level frame, where 𝒈𝑫 can be calculated from the formula given in equation (17) as follows: 𝒈𝑫 = 𝒂𝟏 (𝟏 + 𝒂𝟐 𝒔𝒊𝒏(𝑳𝒂𝒕𝟐 )) + 𝒂𝟑 𝒔𝒊𝒏(𝑳𝒂𝒕𝟒 ) + 𝑨𝒍𝒕 × (𝒂𝟒 + 𝒂𝟓 𝒔𝒊𝒏(𝑳𝒂𝒕𝟐 )) + 𝒂𝟔 𝑨𝒍𝒕𝟐 (17) The symbol 𝑳𝒂𝒕 stands for Latitude while 𝑨𝒍𝒕 stands for Altitude both in local level frame which can be calculated when GPS is available or the Altitude can be calculated using barometer and the latitude is given initially to the calibration

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

7 algorithm using any navigation technique to provide accurate latitude. In the device frame the gravity vector can be read directly from a 3D accelerometer, but this will only be true when the device is completely static or moving with a uniform speed which is not the case in pedestrian applications. Therefore the gravity vector is rotated from the local level frame to the device frame using a rotation matrix 𝑹 which is formed of only pitch and roll values that can be collected while moving with any speed. This matrix needs the pitch and roll angles to be calculated accurately before applying the calibration algorithm. The gravity vector in device frame is given as follows: 𝟎 ⃑⃑⃑⃑⃑⃑⃑⃑⃑ 𝒈𝑿𝒀𝒁 = 𝑹 ( 𝟎 ) (18) 𝒈𝑫 while the matrix 𝑹 is as follows 𝒄𝒐𝒔(𝒑) 𝟎 −𝒔𝒊𝒏(𝒑) 𝒄𝒐𝒔(𝒓) 𝒔𝒊𝒏(𝒓)𝒄𝒐𝒔(𝒑) ) 𝑹 = ( 𝒔𝒊𝒏(𝒓)𝒔𝒊𝒏(𝒑) 𝒄𝒐𝒔(𝒓) 𝒔𝒊𝒏(𝒑) − 𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒓)𝒄𝒐𝒔(𝒑)

(19)

Substituting equation (19) in equation (18) − 𝒔𝒊𝒏(𝒑). 𝒈𝑫 𝟎 ⃑⃑⃑⃑⃑⃑⃑⃑⃑ 𝒈𝑿𝒀𝒁 = 𝑹. ( 𝟎 ) = (𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒑) . 𝒈𝑫 ) (20) 𝒈𝑫 𝒄𝒐𝒔(𝒓) 𝒄𝒐𝒔(𝒑) . 𝒈𝑫 The reference magnetic field components are assumed to be modeled as follows:

Assuming that: 𝑴 = −𝒔𝒊𝒏(𝒑) 𝒈𝑫 𝒉′ 𝒙 𝑵 = 𝒔𝒊𝒏(𝒑) 𝒈𝑫 𝑷 = 𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒑) 𝒈𝑫 𝒉′ 𝒚 𝑸 = − 𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒑)𝒈𝑫 𝑹 = 𝒄𝒐𝒔(𝒓) 𝒄𝒐𝒔(𝒑) 𝒈𝑫 𝒉′ 𝒛 𝑺 = − 𝒄𝒐𝒔(𝒓) 𝒄𝒐𝒔(𝒑) 𝒈𝑫 The unknowns are represented as follows: 𝟏

𝒃

𝟏

𝒃𝒚

𝟏

𝜸𝒙

𝜸𝒙

𝜸𝒚

𝜸𝒚

𝜸𝒛

𝑨 = ( ) , 𝑩 = ( 𝒙) , 𝑪 = ( ) , 𝑫 = ( ) , 𝑬 = ( ) , 𝒃

𝑭 = ( 𝒛)

𝜸𝒙 𝒉′𝒚 −𝒃𝒚

(21)

𝜸𝒚

(

𝒉′𝒛 − 𝒃𝒛

𝜸𝒛 ) In equation (21), 𝒃𝒙 , 𝒃𝒚 and 𝒃𝒛 represent the readings biases in the device frame axes X, Y and Z respectively while 𝜸𝒙 , 𝜸𝒚 and 𝜸𝒛 represent the readings scale factor error. 𝒉′𝒙 , 𝒉′𝒚 𝐚𝐧𝐝 𝒉′𝒛 represent the raw 3D magnetometer readings. The relation acquired from knowing that the dot product is constant in device frame and in local level frame is as follows: 𝒉𝒙 𝒉𝑵 (𝒉𝒚 ) ∙ ⃑⃑⃑⃑⃑⃑⃑⃑⃑ 𝒈𝑿𝒀𝒁 = ( 𝒉𝑬 ) ∙ ⃑⃑⃑⃑⃑⃑⃑⃑⃑⃑ 𝒈𝑵𝑬𝑫 (22) 𝒉𝑫 𝒉𝒛 By substituting for ⃑⃑⃑⃑⃑⃑⃑⃑⃑⃑ 𝒈𝑵𝑬𝑫 from equation (16), substituting for the vector representing the earth magnetic field components from equation (21), and substituting for ⃑⃑⃑⃑⃑⃑⃑⃑⃑ 𝒈𝑿𝒀𝒁 from equation (20) in equation (22): 𝒉𝒙′ −𝒃𝒙 𝜸𝒙

− 𝒔𝒊𝒏(𝒑). 𝒈𝑫 . ( 𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒑) . 𝒈𝑫 ) = 𝒈𝑫 . 𝒉𝑫 𝒄𝒐𝒔(𝒓) 𝒄𝒐𝒔(𝒑) . 𝒈𝑫

𝒉𝒚′−𝒃𝒚 𝜸𝒚 𝒉𝒛′ −𝒃𝒛

(

𝜸𝒛

) (23)

Solving equation (23) 𝟏

𝒃

𝜸𝒙

𝜸𝒙

−𝒔𝒊𝒏(𝒑) 𝒈𝑫 𝒉′ 𝒙 ( ) + 𝒔𝒊𝒏(𝒑) 𝒈𝑫 ( 𝒙) + 𝒃𝒚

𝟏

𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒑) 𝒈𝑫 𝒉′ 𝒚 ( ) − 𝒔𝒊𝒏(𝒓) 𝒄𝒐𝒔(𝒑)𝒈𝑫 ( ) + 𝜸𝒚

𝒄𝒐𝒔(𝒓) 𝒄𝒐𝒔(𝒑) 𝒈𝑫 𝒃𝒛

𝒄𝒐𝒔(𝒓) 𝒄𝒐𝒔(𝒑) 𝒈𝑫 ( ) 𝜸𝒛

𝜸𝒚

𝒉′

𝟏

𝒛 (𝜸 ) 𝒛



= 𝒈𝑫 𝒉𝑫

(24)

(31)

𝜸𝒛

Using least square approach for solving the previous equations using N readings in which the pitch and roll values are unique enough to solve the equations. 𝑴𝟏 𝑴 ( 𝟐 ⋮ 𝑴𝑵

𝑵𝟏 𝑵𝟐 ⋮ 𝑵𝑵

𝑷𝟏 𝑷𝟐 ⋮ 𝑷𝑵

𝑸𝟏 𝑸𝟐 ⋮ 𝑸𝑵

𝑹𝟏 𝑹𝟐 ⋮ 𝑹𝑵

𝑺𝟏 𝑺𝟐 ) ⋮ 𝑺𝑵

𝑨 𝒈𝑫𝟏 𝒉𝑫𝟏 𝑩 𝑪 = 𝒈𝑫𝟐 𝒉𝑫𝟐 𝑫 ⋮ 𝑬 (𝒈𝑫𝑵 𝒉𝑫𝑵 ) (𝑭)

(32)

Assuming that 𝑨 𝑩 𝑿= 𝑪 𝑫 𝑬 (𝑭)

𝒉′𝒙 −𝒃𝒙

𝒉𝒙 (𝒉𝒚 ) = 𝒉𝒛

(25) (26) (27) (28) (29) (30)

𝑴𝟏 𝑴 𝑯=( 𝟐 ⋮ 𝑴𝑵

𝑵𝟏 𝑵𝟐 ⋮ 𝑵𝑵

(33)

𝑷𝟏 𝑷𝟐 ⋮ 𝑷𝑵

𝑸𝟏 𝑹𝟏 𝑺𝟏 𝑸𝟐 𝑹𝟐 𝑺𝟐 ) (34) ⋮ ⋮ ⋮ 𝑸𝑵 𝑹𝑵 𝑺𝑵 𝒈𝑫𝟏 𝒉𝑫𝟏 𝒈 𝒉 𝒀𝟏 = ( 𝑫 𝟐 𝑫 𝟐 ) (35) ⋮ 𝒈 𝑫𝑵 𝒉𝑫𝑵 The subscript N represents the number of readings; multiple readings can be collected for each device pitch or roll. 𝑯∗𝑿=𝒀 (36) [𝑯𝑻 ∗ 𝑯] 𝑿 = 𝑯𝑻 ∗ 𝒀 (37) 𝑿 = [𝑯𝑻 ∗ 𝑯] −𝟏 ∗ 𝑯𝑻 ∗ 𝒀 (38) From equation (38) the unknown values representing biases and scale factors can be calculated for the 3D magnetometer readings using LS approach as follows: 𝟏 𝑩 𝟏 𝑫 𝟏 𝑫 𝜸𝒙 = , 𝒃𝒙 = , 𝜸𝒚 = , 𝒃𝒚 = , 𝜸𝒛 = , 𝒃𝒛 = (39) 𝑨 𝑨 𝑪 𝑪 𝑪 𝑪 For 3D calibration to be achieved without using an external heading information source, sufficient data must be collected during calibration. The minimum data required to solve the calibration equations is several (at least 3 unique) pitch values and roll values. By experimental trials the minimum absolute difference between each pitch angle required is set empirically to 20 degrees and the same for roll angles. For each pitch or roll orientation multiple samples can be collected to give a smoother solution and to avoid taking a reading affected by noise due to the use of a low cost. LS approach is able to solve the calibration equation when extra readings are collected. IV. EXPERIMENTAL RESULTS The performance of the two developed magnetometer calibration techniques is examined with different pedestrian

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

8 trajectories using a portable device that is free to move with different pitch and roll angles. In the following experiments, a low-cost prototype unit consisting of a six degrees of freedom inertial unit from Invensense (i.e. tri-axial gyroscopes and tri-axial accelerometer) (MPU-6050), tri-axial magnetometers from Honeywell (HMC5883L), barometer from Measurement Specialties (MS5803), and a GPS receiver from u-blox (LEA5T) was used. The Mean error is used as a measure to assess the calibration quality in the following experiments The Mean error after calibration is the average error between the reference heading and the calculated heading from magnetometer after calibration, while the Mean error before calibration is the average error between the reference heading and the calculated heading from magnetometer before calibration. The Mean error is used just for simplicity and to avoid taking the effect of noise into consideration when assessing the heading accuracy. Having a heading source whose absolute value (indicated by the mean error in the experiments) is around the correct heading, even if it is noisy, is a useful heading update during GPS absence. It can help to cover for inertial drift while the INS will smooth out the noise in this heading update. Data is collected at each time epoch according to the frequency the sensors are working with. For each heading, pitch, or roll value multiple samples can be collected to give a smoother solution and to avoid taking a reading affected by noise due to the use of a low cost sensor. For each heading direction, pitch or roll, multiple samples can be collected to give a smoother solution and to avoid taking a reading affected by noise due to the use of a low cost sensor. The calibrated magnetometer heading is compared to a reference heading obtained from an integrated navigation solution that integrates accelerometers, gyroscopes, barometer with GPS in open sky, assuming zero heading misalignment between the device and the platform (the human body). It should be noted that the discontinuity of the drawn curves in the following figures is due to the cyclicity of the heading and roll values where their range is from -180 degrees to 180 degrees. A. Results of magnetometer Calibration in 3D-space when heading information is available during calibration Three pedestrian trajectories are conducted to test the first proposed magnetometer calibration technique when external heading information source is available. The first trajectory is a PDR walking trajectory in which heading is calculated from magnetometer after 3D calibration is performed. The pedestrian moves in rectangular loops holding the device in his hand, this device usage scenario is called “hand held” use-case, in each two consecutive rectangular loops he holds the device with a different pitch and/or roll, and then changes the devices pitch and/or roll in the next two rectangular loops. The figure shows the heading after data collection is made and calibration is applied. Data is collected using the same trajectory by changing the device

heading by 90 degrees, changing the pitch by 20 degrees and roll by 20 degrees. In this experiment, for demonstration the calibration parameters are calculated offline and then applied to calculate the heading for the whole trajectory. However, the implementation is capable to run in real-time. Figure 5 shows the heading calculated using magnetometer in handheld use-case after calibration is performed compared to the reference heading. For more demonstration a zoomed section of the heading plot is shown in Figure 6. Another two trajectories are conducted for more demonstration and to show how the 3D calibration technique proposed is capable of performing 3D calibration using regular device movements and use-cases without the involvement of the user to perform the calibration. These trajectories are Hand-dangling trajectory and Trousers-pocket trajectory. In the Hand-dangling use-case trajectory the device is held in the users hand while walking where he dangles his hands normally performing the regular walking dynamics. While in the trousers pocket use-case trajectory the user puts the device in his pocket and walks normally. The dynamics accompanied with either Hand-dangling or trousers pocket use-cases allows enough changes in both pitch and roll that ranges from 20 to 25 degrees of absolute difference allowing for 3D calibration if a heading turn is made as described earlier for this technique. In order to prove the robustness of the proposed 3D calibration technique, the calibration parameters (biases and scale factors in magnetometer readings) calculated in one trajectory will be used to calibrate magnetometer readings in the other two trajectories. Figure 7 shows the heading calculated using magnetometer after calibration is performed in Hand-dangling trajectory. In this testing trajectory, for demonstration, data is collected and calibration parameters are calculated from the same handdangling trajectory data then the calibration parameters are applied offline to calculate the heading for the whole trajectory. Figure 9 shows the heading calculated using magnetometer after calibration is performed in Trouserspocket trajectory. In this testing trajectory, data is also collected and calibration parameters are calculated from the same Trousers-pocket trajectory data then the calibration parameters are applied offline to calculate the heading for the whole trajectory. The heading is shown in the figures after calibration is performed. The calibrated magnetometer heading is compared to a reference heading obtained from an integrated navigation solution that integrates accelerometers, gyroscopes, barometer with GPS in open sky, assuming zero heading misalignment between the device and the platform. Figure 8 and Figure 10 are two zoomed sections for the Hand-dangling and the Trousers-pocket trajectories respectively. Mean error results are shown in Table 1: Trajectory name

Mean Error in heading before calibration (degrees)

Mean Error in heading after calibration (degrees)

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

9 Handheld (using calibration parameters calculated from the same Handheld Trajectory )

144

Handheld (using calibration parameters calculated from Hand-dangling trajectory )

144

4.8

Pitch

5.3

50

7.1

-50

Trousers-pocket (using calibration parameters calculated from the same Trousers-pocket trajectory)

-120

Trousers-pocket (using calibration parameters calculated from Handheld trajectory)

-120

6.4

Trousers-pocket (using calibration parameters calculated from Handdangling trajectory)

-120

-7.5

Hand-dangling (using calibration parameters calculated from the same Hand-dangling trajectory)

70

1.9

Hand-dangling (using calibration parameters calculated from Handheld trajectory )

70

3

Hand-dangling (using calibration parameters calculated from Trouserspocket trajectory )

70

9.5

Degree

144

Magnetometer heading before calibration

-150

8

-200

-250 1050

1055

1060 Time in seconds

1065

1070

Figure 6 Zoomed section of handheld trajectory magnetometer heading calculated using 3D calibration parameters calculated using the same trajectory data when external heading is available Magnetometer Heading before Calibration

Reference Heading

Roll

Pitch

Magnetometer Heading after Calibration

200

150

100

Degree

50

Pitch

Reference Heading

0

-50

-100

The resulted heading calculated after magnetometer calibration shows how magnetometer can be used as a reliable heading source in pedestrian navigation after 3D calibration is performed by the technique demonstrated herein. Moreover the time required for calibration is very small compared to the total trajectory time (15 min), in case the motion is enough it can be performed 10 seconds on average, given that the magnetometer used has data rate of 20 Hz.

-150

-200 240

250

260

270

280 290 Time in seconds

300

310

320

Figure 7 Hand-dangling trajectory magnetometer heading calculated using 3D calibration parameters calculated using the same trajectory data when external heading is available Magnetometer Heading before Calibration

Reference Heading

Roll

Pitch

Magnetometer Heading after Calibration

Magnetomeetr Heading after Calibration

200

150

150

100

100 Degree

50

50 Degree

Magnetometer heading after calibration

-100

Table 1 Mean errors before and after 3D calibration using external heading

Roll

Reference heading

0

Handheld (using calibration parameters calculated from Trousers-pocket trajectory )

Magnetometer Heading before Calibration

Roll

100

0

-50

0

-100

-50

-150

-100

310

315

-150

320

325

Time in seconds

200

400

600 Time in seconds

800

1000

Figure 5 Handheld trajectory magnetometer heading calculated using 3D calibration parameters calculated using the same trajectory data when external heading is available

1200

Figure 8 Zoomed section of Hand-dangling trajectory magnetometer heading calculated using 3D calibration parameters calculated using the same trajectory data when external heading is available Magnetometer Heading before Calibration

Reference Heading

Roll

Pitch

Magnetometer Heading after Calibration

150

100

Degree

50

0

-50

-100

-150

120

140

160

180 Time in seconds

200

220

Figure 9 Trousers-pocket trajectory magnetometer heading calculated using 3D calibration parameters calculated using the same trajectory data when external heading is available

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

10

Magnetometer Heading before Calibration

Reference Heading

Roll

Pitch

Magnetometer Heading after Calibration

200

150

100

Degree

50

0

-50

-100

-150

170

175

180

185 Time in seconds

190

195

200

Figure 10 Zoomed section of Trousers-pocket trajectory magnetometer heading calculated using 3D calibration parameters calculated using the same trajectory data when external heading is available B. Results of magnetometer Calibration in 3D-space when heading information is not available during calibration A PDR walking trajectory is conducted to test the second proposed magnetometer calibration technique when external heading information source is not available during magnetometer calibration. In the PDR trajectory, the pedestrian walks in rectangular loops in a hand held use-case. In each two consecutive rectangular loops he holds the device with a different pitch and/or roll, then changes the devices pitch and/or roll in the next two rectangular loops. Figure 11 shows the heading calculated using magnetometer after calibration is performed compared to the reference heading. For more demonstration a zoomed section of the heading plot are shown in Figure 12. Mean heading error was 40 degrees and became 4.8 degrees after calibration. Magnetometer heading before calibration

Roll

Pitch

Reference heading

Magnetometer heading afer calibration

200

150

100

Degree

50

0

-50

-100

-150

800

1000

1200

1400 Time in seconds

1600

1800

2000

Figure 11 Pedestrian heading calculated using magnetometer after performing 3D calibration without using external heading during calibration Magnetometer heading before calibration

Roll

Pitch

Reference heading

Magnetometer heading afer calibration

200 150 100

Figure 12 Zoomed section of pedestrian heading calculated using magnetometer after performing 3D calibration without using external heading during calibration V. CONCLUSION In this paper 3D-space magnetometer calibration is performed in an automatic and fast approach. The two proposed techniques can perform magnetometer calibration with small space coverage and they do not require any user involvement. No specific movements are required from the user to perform the calibration like some other calibration techniques from literature. The proposed calibration techniques depend on different available navigation information from different navigation sensors and/or systems included in most modern smart phones. Thus, they can perform automatic calibration in real-time. Moreover, quality check routines are developed to check the calibration performance, to make sure that the magnetometer can be used as a reliable source for heading calculation in navigation applications. Experimental results proved that the calibrated magnetometer using the proposed technique can be used as a reliable heading source in portable navigation applications. The magnetometer used in the experiments is a low cost sensor, and the device comprising the magnetometer is not tethered to the human body where it is affected by jittering and vibrations. Therefore it is expected that the heading from the un-calibrated magnetometer would be extremely unreliable. Moreover, the device containing the magnetometer can have other components that can affect the magnetic field dramatically due to hard iron or soft iron effects. Having a magnetic signal whose scale factor is not corrected can give wrong or flat heading, the magnetometer heading can to be shrunk to one heading quadrant as shown in the figures. All these challenges contribute in an extremely wrong and unreliable heading from the magnetometer. Despite all these challenges the proposed calibration methods were able to correct the magnetometer readings and provide reliable heading. The main application in which the proposed techniques can be used in is heading determination using portable devices (such as smartphones). However, the technique can be used in tethered devices when the platform is capable of changing the pitch and roll orientations sufficiently to be able to perform the 3D-space calibration for example in airborne applications with high dynamics. Regarding navigation applications, the magnetometer can be used as an independent heading information source. Magnetometer heading can be used solely or it can be integrated with other sensors (such as gyroscopes), or systems that provide absolute navigational information, or with any combination of sensors and/or systems. REFERENCES

Degree

50

[1]

0 -50 -100

[2]

-150

1650

1655

1660

1665 Time in seconds

1670

1675

1680

M. J. Caruso, T. Bratland, C. H. Smith, and R. Schneider, "A new perspective on magnetic field sensing," SENSORSPETERBOROUGH-, vol. 15, pp. 34-47, 1998. T. B. K. Aboelmagd Noureldin, Jacques Georgy, "Fundamentals of Inertial Navigation, Satellite-based Positioning and their Integration."

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].

This is the author's version of an article that has been published in this journal. Changes were made to this version by the publisher prior to publication. The final version of record is available at http://dx.doi.org/10.1109/JSEN.2014.2348552

11 [3]

[4] [5]

[6] [7]

[8]

[9]

[10]

[11] [12]

[13]

[14]

[15]

[16]

[17]

[18]

[19]

[20]

[21]

M. H. Afzal, V. Renaudin, and G. Lachapelle, "Use of earth’s magnetic field for mitigating gyroscope errors regardless of magnetic perturbation," Sensors, vol. 11, pp. 11390-11414, 2011. N. Bowditch and J. I. Bowditch, American practical navigator: US Government Printing Office, 1826. M. J. Caruso, "Applications of magnetoresistive sensors in navigation systems," PROGRESS IN TECHNOLOGY, vol. 72, pp. 159-168, 1998. F. LITEF Corporatoin, Germany, "LCR-92 Attitude Heading Reference System," 2001. D. Gebre-Egziabher, G. H. Elkaim, J. D. Powell, and B. W. Parkinson, "Calibration of strapdown magnetometers in magnetic field domain," Journal of Aerospace Engineering, vol. 19, pp. 87102, 2006. J. Vasconcelos, G. Elkaim, C. Silvestre, P. Oliveira, and B. Cardeira, "A geometric approach to strapdown magnetometer calibration in sensor frame," in Navigation, Guidance and Control of Underwater Vehicles, 2008, pp. 172-177. M. J. Caruso, "Applications of magnetic sensors for low cost compass systems," in Position Location and Navigation Symposium, IEEE 2000, 2000, pp. 177-184. J. L. Crassidis, K.-L. Lai, and R. R. Harman, "Real-time attitudeindependent three-axis magnetometer calibration," Journal of Guidance Control and Dynamics, vol. 28, pp. 115-120, 2005. D. Gebre-Egziabher, "Design and performance analysis of a lowcost aided dead reckoning navigator," stanford university, 2004. V. Petrucha, P. Kaspar, P. Ripka, and J. M. Merayo, "Automated system for the calibration of magnetometers," Journal of Applied Physics, vol. 105, pp. 07E704-07E704-3, 2009. F. Camps, S. Harasse, and A. Monin, "Numerical calibration for 3axis accelerometers and magnetometers," in Electro/Information Technology, 2009. eit'09. IEEE International Conference on, 2009, pp. 217-221. R. Alonso and M. D. Shuster, "Complete linear attitudeindependent magnetometer calibration," Journal of the Astronautical Sciences, vol. 50, pp. 477-490, 2002. C. Foster and G. Elkaim, "Extension of a two-step calibration methodology to include nonorthogonal sensor axes," Aerospace and Electronic Systems, IEEE Transactions on, vol. 44, pp. 10701078, 2008. V. Y. Skvortzov, H.-K. Lee, S. Bang, and Y. Lee, "Application of electronic compass for mobile robot in an indoor environment," in Robotics and Automation, 2007 IEEE International Conference on, 2007, pp. 2963-2970. Q. Zhang, Q. Gao, Y. Chen, and X. Huang, "A novel magnetic compass calibration method based on improved ellipse model," in Intelligent Control and Information Processing (ICICIP), 2010 International Conference on, 2010, pp. 11-15. A. M. Sabatini, "Quaternion-based extended Kalman filter for determining orientation by inertial and magnetic sensing," Biomedical Engineering, IEEE Transactions on, vol. 53, pp. 13461356, 2006. C. Finlay, S. Maus, C. Beggan, T. Bondar, A. Chambodut, T. Chernova, et al., "International geomagnetic reference field: the eleventh generation," Geophysical Journal International, vol. 183, pp. 1216-1230, 2010. Q. Ladetto, V. Gabaglio, and B. Merminod, "Two different approaches for augmented GPS pedestrian navigation," in International Symposium on Location Based Services for Cellular Users, Locellus, 2001. A. Solimeno, "Low-cost INS/GPS data fusion with extended Kalman filter for airborne applications," Masters of Science, Universidade Technica de Lisboa, 2007.

Ahmed Wahdan is a Software developer and a former Algorithms Designer at Trusted Positioning Inc. He received his B.Sc. degree from Ain Shams University, Cairo, Egypt, in 2010. He worked as Embedded Software Engineer for a year in Valeo developing embedded software modules for automotive applications. He achieved his M.Sc. degree with the Department of Electrical and Computer Engineering, Queen’s University Kingston, ON, Canada in April 2013.His research interests include sensor-based navigation, magnetometer calibration and portable navigation. Jacques Georgy (S’09-M’10) is the VP of Research and Development and a co-founder of Trusted Positioning Inc., Calgary, AB, Canada. He received his Ph.D. degree in Electrical and Computer Engineering from Queen’s University, Canada in 2010, and his B.Sc. and M.Sc. degrees in Computer and Systems Engineering from Ain Shams University, Egypt, in 2001 and 2007, respectively. He is working in positioning and navigation systems for portable, vehicular, and machinery applications. His research interests include linear and nonlinear state estimation, positioning and navigation systems, autonomous mobile robot navigation, and underwater target tracking. He has 19 patent applications, co-authored a book, and authored or co-authored over 60 papers. He is the recipient of the Institute of Navigation’s 2013 Early Achievement Award for contributions to portable and indoor navigation using MEMS inertial sensors on consumer devices.

Aboelmagd Noureldin (M’98–SM’08) M’98–SM’08) Dr. Aboelmagd Noureldin is Cross-Appointment Professor at the Departments of Electrical and Computer Engineering of Both Queen’s University and the Royal Military College (RMC) of Canada. He is also the founder and the leader of the Navigation and Instrumentation research group at RMC. His research is related to artificial intelligence, digital signal processing, spectral estimation and de-noising, wavelet multi-resolution analysis, nonlinear estimation and adaptive filtering with emphasis on their applications in mobile multi-sensor system integration for navigation and positioning technologies. He is the developer of several innovative methods for reliable navigation in urban and indoor areas as well as other denied or challenging GPS environments. Dr. Noureldin holds B.Sc. degree in Electrical Engineering (1993) and M.Sc. degree in Engineering Physics (1997) from Cairo University, Giza, Egypt. In addition, he holds Ph.D. degree in Electrical and Computer Engineering (2002) from The University of Calgary, Alberta, Canada. Dr. Noureldin is a Senior member of IEEE. He has published more than 75 journal papers and more than 80 papers in conference proceedings. Dr. Noureldin’s research work led to 6 patents in the area of position, location and navigation. http://www.ece.queensu.ca/directory/crossappointed/noureldin.html

Copyright (c) 2014 IEEE. Personal use is permitted. For any other purposes, permission must be obtained from the IEEE by emailing [email protected].