Ellipsoid-Based Correction Apparatus and Method for Magnetometer
Patent Information
- Application Number
- KR1020250150855
- Authority / Receiving Office
- KR · KR
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-09-16
- Estimated Expiration
- 2045-10-17
Smart Images

Figure 112025116347812-PAT00014_ABST
Abstract
Description
Technology Field
[0001] The present invention relates to technology for correcting output values of magnetometers, calibration technology, azimuth angles, and navigation sensors. More specifically, it relates to an algorithm and device for improving the reliability of output values of magnetometers that measure direction based on the Earth's magnetic field, and in particular, to an ellipsoid model-based correction device and method for precisely correcting errors in a magnetometer caused by hard iron and soft iron distortion. Background Technology
[0002] Magnetometers are core sensors that detect geomagnetism to calculate the absolute heading of a device, and they are utilized in various application fields such as electronic compasses, automotive navigation systems, drones, robots, and mobile terminals. However, magnetometers are sensitive to magnetic interference (soft iron and hard iron distortion) caused by surrounding metal structures and electric currents, which leads to a problem where actual measurement data is distorted into an asymmetric ellipsoidal shape rather than an ideal spherical distribution.
[0003] This distortion stems from a combination of causes, including internal sensor axis misalignment, scale factor mismatch, and center offset; if not corrected, the azimuth error expands to ±5° to ±10°, making precise navigation or attitude control difficult.
[0004] To address this, various calibration techniques have been disclosed. For example, U.S. Patent No. 9,229,084 (US 9,229,084 B2) proposed a method for estimating offset and scale calibration parameters in real time by collecting magnetometer data during a user's normal movements. While this patent has the advantage of automatically updating calibration parameters without external reference equipment, it has limitations in that it is difficult to completely correct the interrelationships between misaligned axes of the sensor or distortions in the shape of an asymmetric ellipsoid because the data distribution is approximated by a simple linear model.
[0005] Furthermore, U.S. Patent Publication No. 2015 / 0354980 (US 2015 / 0354980 A1) proposed a method for rapid calibration of magnetometers and presented a structure capable of estimating calibration parameters even within a limited rotational range. While this technology improves calibration speed based on a minimum data set, it does not include features for ellipsoidal modeling of the entire 3D space or for reflecting local magnetic distortion in real time. In other words, it fails to normalize the output distribution of the magnetometer into a perfect sphere, and it is difficult to resolve the problem of accumulating calibration errors due to changes in the field environment.
[0006] Meanwhile, conventional general calibration methods often limit themselves to post-calibration after offline data collection, mean-based offset correction, and simple transformations using limited linear correction matrices. Consequently, recalibration is required when the sensor's installation orientation, rotational orientation, or ambient magnetic field conditions change, and there is the inconvenience of having to repeatedly set different parameters for each device and environment.
[0007] Consequently, existing magnetometer calibration technologies have limitations in that they cannot mathematically normalize non-linear ellipsoidal magnetic field distortion, cannot correct sensor axis misalignment and scale imbalance in real time, and cannot reflect local distortion, resulting in unstable azimuth accuracy in actual moving objects or outdoor environments.
[0008] Therefore, a high-precision, real-time, and environment-adaptive magnetometer correction technology is required that takes into account not only structural errors of the sensor but also surrounding environmental influences, approximates the 3-axis magnetic flux density data of the magnetometer with an ellipsoid model, normalizes it into a spherical space to simultaneously correct offset, scale, and axis misalignment errors, and performs center coordinate correction based on field rotation (Z-axis rotation) and real-time correction using an azimuth angle deviation table. Prior art literature
[0009] (Patent Document 0001) US 9229084 B2 (Registration Date: January 5, 2016) (Patent Document 0002) US 20150354980 A1 (Publication Date: December 10, 2015) The problem to be solved
[0010] The present invention was devised to solve the problems of the conventional technology described above, and provides a high-precision, low-cost, real-time magnetometer correction technology that reduces the azimuth angle error of the magnetometer through a three-stage correction structure of elimination of geometric errors in the magnetometer through ellipsoidal approximation, correction of environmental offset through field rotation, and real-time dynamic correction based on a deviation table, and enables automatic correction in the field without separate reference equipment.
[0011] The technical problems to be solved by the present invention are not limited to those mentioned above, and other technical problems not mentioned will be clearly understood by those skilled in the art to which the present invention belongs from the description below. means of solving the problem
[0012] To achieve the above objective, an ellipsoid-based correction device for a magnetometer according to one aspect of the present invention comprises: a data collection unit that collects 3-axis magnetic flux density data generated during multi-position rotation of the device from a magnetometer sensor in real time;
[0013] A bias estimation unit that calculates a center offset (Bias) component of a magnetometer sensor by approximating the spatial distribution of the magnetic flux density vector into a three-dimensional ellipsoid based on 3-axis magnetic flux density data transmitted from the data collection unit, and outputs the calculated offset value as a correction factor;
[0014] A correction matrix calculation unit that receives an offset correction factor from the above-mentioned bias estimation unit, moves the center coordinates of the ellipsoid to the origin, and calculates a rotation matrix (R) and a scale matrix (K) to normalize the direction of the ellipsoid's major axis to the unit sphere coordinate system to generate a correction matrix (T);
[0015] An ellipsoid correction unit that corrects scale imbalance and axis misalignment of the sensor by linearly converting real-time measurement data into a spherical space using a correction matrix (T) generated from the above correction matrix operation unit, and outputs a normalized magnetic flux density vector on a unit sphere in real time;
[0016] A field correction unit that analyzes the magnetic flux density trajectory formed during rotation of the device's vertical axis (Z-axis) based on the correction vector normalized from the ellipsoid correction unit, calculates center coordinates by approximating the circular trajectory on the xy plane to a circle using the least squares method, and additionally corrects the residual offset on the horizontal plane using the center coordinates;
[0017] It includes an azimuth correction unit that minimizes the final azimuth error by comparing the azimuth calculated based on the corrected magnetic flux density vector output from the field correction unit with the reference azimuth calculated by gyro sensor integration, storing the remaining deviation for each angle in a table format, and applying a correction value through real-time interpolation.
[0018] In addition, the above-mentioned deflection estimation unit is the quadratic equation of the magnetic flux density data It is characterized by performing eigenvalue decomposition of matrix A by estimating it using the least squares method, and estimating the bias component of the magnetometer sensor from the eigenvector corresponding to the minimum eigenvalue.
[0019] In addition, the correction matrix operation unit is characterized by performing singular value decomposition (SVD) on the covariance matrix of the data after bias correction to separate the orthonormal matrix and the scale matrix, and respectively calculating the rotation matrix (R) and the scale matrix (K) for unit sphere normalization therefrom.
[0020] In addition, the above-mentioned ellipsoid correction unit Corrected magnetic flux density vector by applying a linear transformation of the shape in real time B corr It is characterized by producing.
[0021] In addition, the above-mentioned azimuth correction unit receives a corrected magnetic flux density vector from the above-mentioned field correction unit to calculate a magnetometer-based azimuth (ψ_mag), simultaneously calculates a reference azimuth (ψ_ref) by integrating angular velocity data provided by a gyro sensor, and calculates a residual deviation (Δψ) for each angle by comparing the two azimuths.
[0022] The above residual deviation is divided into specific angle intervals and stored in the form of a look-up table, and is characterized by applying a correction value by interpolating the deviation of adjacent intervals during real-time measurement.
[0023] In addition, the above-mentioned azimuth correction unit includes a communication interface for transmitting real-time correction results to an external system, and the communication interface is configured to output corrected azimuth data through at least one of UART, SPI, or CAN protocols.
[0024] In addition, the data collection unit, bias estimation unit, correction matrix operation unit, ellipsoid correction unit, field correction unit, and orientation correction unit are implemented as software modules on a microcontroller unit (MCU), and are characterized by periodically executing a sequential pipeline of bias, scale, axis misalignment, field correction, and orientation correction to reduce the average error of the output azimuth angle.
[0025] An ellipsoid-based correction method for a magnetometer executed in an electronic device comprising a magnetometer sensor, a processor, and a communication module according to another aspect of the present invention comprises: a data collection step in which the processor collects 3-axis magnetic flux density data generated during multi-position rotation of the device from the magnetometer sensor in real time;
[0026] A bias estimation step for calculating the offset (Bias) component of a magnetometer sensor by approximating an ellipsoid equation in three-dimensional space from magnetic flux density data collected by the above processor;
[0027] A correction matrix operation step in which the processor moves the center coordinates of the ellipsoid to the origin and calculates a rotation matrix and a scale matrix to normalize the direction of the ellipsoid's major axis to the unit sphere coordinate system;
[0028] An ellipsoid correction step that corrects scale imbalance and axis misalignment of the magnetometer sensor by linearly transforming real-time measurement data into a spherical space using the rotation matrix and scale matrix calculated by the above processor, and outputs a normalized magnetic flux density vector;
[0029] A field correction step in which the above processor approximates the magnetic flux density trajectory data in the xy plane generated during rotation of the device's vertical axis (Z-axis) based on a normalized magnetic flux density vector to a circle using the least squares method, calculates the center coordinates of the circular trajectory in the xy plane, and uses this to remove the horizontal plane offset;
[0030] The above processor includes an orientation correction step in which it compares the azimuth angles before and after correction based on the correction result, stores the remaining deviations for each angle in a table form, and updates and applies the correction value through real-time interpolation.
[0031] Each of the above steps is sequentially connected to integrally correct the offset, scale, axis misalignment, and environmental magnetic deviation of the magnetometer, thereby minimizing the average error of the azimuth output in real time.
[0032] In addition, the deflection estimation step is a quadratic equation of magnetic flux density data The method is characterized by the step of estimating the matrix A using the least squares method to perform eigenvalue decomposition, and estimating the bias component of the magnetometer sensor from the eigenvector corresponding to the minimum eigenvalue.
[0033] In addition, the correction matrix operation step described above is,
[0034] The method is characterized by a step of performing singular value decomposition (SVD) on the covariance matrix of the data after bias correction to separate the orthonormal matrix and the scale matrix, and from this, calculating the rotation matrix (R) and the scale matrix (K) for unit sphere normalization, respectively.
[0035] In addition, the above ellipsoid correction step Corrected magnetic flux density vector by applying a linear transformation of the shape in real time B corr It is characterized by being a step of producing.
[0036] In addition, the above-mentioned orientation correction step comprises: a step of receiving the corrected magnetic flux density vector and calculating a magnetometer-based azimuth (ψ_mag); a step of integrating angular velocity data provided from a gyro sensor to calculate a reference azimuth (ψ_ref); and a step of comparing two azimuths to calculate a residual deviation (Δψ) for each angle;
[0037] The method is characterized by including a step of dividing the above residual deviation into specific angle intervals and storing them in the form of a look-up table, and applying a correction value by interpolating the deviation of adjacent intervals during real-time measurement. Effects of the invention
[0038] Through the above-mentioned means of solution, the present invention provides the following effects.
[0039] First, the present invention can simultaneously eliminate problems of bias, scale mismatch, and axis misalignment within the sensor by approximating the 3-axis magnetic flux density data of a magnetometer sensor with an ellipsoid model and normalizing it to a spherical coordinate system. By doing so, the asymmetric magnetic flux distribution caused by hard iron and soft iron distortion is mathematically corrected, and the output vector of the magnetometer is uniformly aligned on a unit sphere, thereby overcoming the limitations of existing linear correction methods and significantly improving geometric accuracy.
[0040] Second, the present invention calculates center coordinates (xc, yc) by approximating the trajectory of the magnetic flux density vector, which is measured in real time while rotating the device around the vertical axis (Z-axis) in the field environment, into a circular shape, and uses this to automatically correct environmental offset (Local Magnetic Distortion) on a horizontal plane. Since this field correction function can immediately eliminate deviations caused by environmental changes through simple rotational motion without the need for separate reference equipment or alignment devices, it is possible to maintain stable orientation output even in variable magnetic environments such as outdoors, vehicles, or drones.
[0041] Third, the present invention compares the magnetometer-based azimuth (ψ_mag) with the reference azimuth (ψ_ref) calculated by gyro sensor integration to cumulatively evaluate the residual deviation (Δψ) for each angle, stores this in the form of an azimuth deviation table (Look-up Table), and then applies the deviation of adjacent sections using a linear interpolation method during real-time measurement, thereby enabling dynamic compensation for various disturbances such as temperature changes, magnetic noise, and long-term drift. Through this, an azimuth error of ±0.5° or less can be maintained even in long-term usage environments, and highly reliable compensation data is provided even during the initialization of sensor fusion (such as a Kalman filter).
[0042] Fourth, the entire correction algorithm of the present invention is composed of lightweight linear algebra operations such as the least squares method, covariance matrix operations, and singular value decomposition (SVD), enabling real-time processing on a 32-bit microcontroller (MCU) without the need for a separate external computing device. Therefore, it can be easily implemented in small, low-power embedded systems such as drones, robots, electronic compasses for vehicles, and wearable devices, while simultaneously ensuring correction accuracy and computational efficiency.
[0043] Fifth, the present invention provides a three-stage integrated correction structure that combines ellipsoid-based mathematical correction, field rotation-based center coordinate correction, and azimuth angle deviation table-based real-time correction, thereby simultaneously eliminating structural and environmental errors in the magnetometer and implementing a fully automated correction system that can reflect non-linear distortion and environmental changes in real time, unlike existing U.S. patents (US 9,229,084 B2, US 2015 / 0354980 A1).
[0044] Accordingly, the present invention has the effect of providing a high-precision magnetometer correction platform capable of stable azimuth calculation in both static and dynamic environments.
[0045] The effects of the present invention are not limited to the effects described above, and should be understood to include all effects that can be inferred from the configuration of the invention described in the detailed description or claims of the present invention. Brief explanation of the drawing
[0046] FIG. 1 is a block diagram illustrating, in an exemplary manner, the hardware configuration of an electronic device including an ellipsoid-based correction device of a magnetometer according to the present invention. FIG. 2 illustrates an overall block diagram of an ellipsoid-based correction device (100) of a magnetometer according to the present invention. FIG. 3 is an example diagram illustrating the three-dimensional spatial distribution of raw magnetic field data obtained from a magnetometer sensor before applying the ellipsoid-based correction method of the magnetometer according to the present invention. FIG. 4 is a flowchart illustrating the overall procedure of the ellipsoid-based correction method of a magnetometer according to the present invention. Specific details for implementing the invention
[0047] Hereinafter, embodiments of the present invention are described in detail with reference to the attached drawings so that those skilled in the art can easily implement the present invention. The present invention may be embodied in various different forms and is not limited to the embodiments described herein. In the drawings, parts unrelated to the explanation have been omitted to clearly explain the present invention, and the same reference numerals have been used for identical or similar components throughout the specification.
[0048] The words and terms used in this specification and claims are not limited to their ordinary or dictionary meanings, but should be interpreted in a meaning and concept consistent with the technical spirit of the invention in accordance with the principles by which the inventor defines terms and concepts to best describe his invention.
[0049] Therefore, the embodiments described in this specification and the configurations illustrated in the drawings correspond to preferred embodiments of the present invention and do not represent all technical concepts of the present invention; thus, various equivalents and modifications that may replace such configurations may exist at the time of filing the present invention.
[0050] In this specification, terms such as "comprising" or "having" are intended to describe the existence of the features, numbers, steps, actions, components, parts, or combinations thereof described in the specification, and should be understood as not precluding the existence or addition of one or more other features, numbers, steps, actions, components, parts, or combinations thereof. Furthermore, the fact that a component is "connected" to another component includes, unless there are special circumstances, cases where they are directly connected as well as indirectly connected.
[0051] In this specification, singular expressions include plural expressions unless the context clearly specifies them as singular. Additionally, plural expressions include singular expressions unless the context clearly specifies them as plural. Throughout the specification, when a part is described as including a certain component, this means that, unless specifically stated otherwise, it does not exclude other components but may include additional components.
[0052] Hereinafter, preferred embodiments of the present invention will be described in detail in conjunction with the attached drawings.
[0053] FIG. 1 is a block diagram illustrating, in an exemplary manner, the hardware configuration of an electronic device (100) including an ellipsoid-based correction device of a magnetometer according to the present invention.
[0054] As illustrated in FIG. 1, the electronic device (100) comprises an IMU module (110), a microcontroller unit (120), and a communication module (130). Sensor data measured by the IMU module (110) is transmitted to the microcontroller unit (120) to perform an ellipsoid-based correction algorithm, and the result is transmitted externally through the communication module (130), thereby forming a series of data collection, correction, and output structures. This structure can be implemented as a lightweight structure capable of real-time processing even in a small MCU environment, and the entire device can be manufactured as an integrated module in the form of a PCB.
[0055] The IMU module (110) includes a 3-axis magnetometer sensor, a 3-axis gyroscope sensor, and a 3-axis accelerometer, and performs the role of measuring the device's attitude change and magnetic field strength in real time. The IMU module (110) provides raw data for magnetometer-based azimuth correction, and in particular, 3-axis magnetic flux density vector data from the magnetometer is used for ellipsoid approximation and offset estimation. The 3-axis gyroscope sensor provides a reference azimuth (ψ_ref) by integrating the rotational speed, and the 3-axis accelerometer provides reference attitude data during the horizontal attitude alignment and Z-axis rotation correction process.
[0056] The microcontroller unit (120) is an operation control unit that executes the core algorithm of the present invention and includes operation modules such as a data collection unit, a bias estimation unit, a correction matrix operation unit, an ellipsoid correction unit, a field correction unit, and an orientation correction unit.
[0057] The data acquisition unit collects magnetic flux density, angular velocity, and acceleration data from the IMU module at a constant frequency (e.g., 100 Hz). The bias estimation unit constructs a three-dimensional ellipsoid equation based on the collected magnetic flux density data and calculates an offset (Bias) vector through the least squares method.
[0058] The correction matrix operation unit performs singular value decomposition (SVD) on the covariance matrix using the bias-removed data, calculates the rotation matrix (R) and scale matrix (K), and generates a correction matrix (T). The ellipsoid correction unit normalizes real-time measurement data into unit sphere space using the correction matrix and corrects scale imbalance and axis misalignment.
[0059] The field correction unit approximates the magnetic flux density trajectory formed during Z-axis rotation as a circle to calculate the center coordinates (xc, yc) and additionally removes environmental horizontal offset. The azimuth correction unit compares the azimuth angle (ψ_mag) calculated from the corrected magnetic flux density vector with the reference azimuth angle (ψ_ref) calculated by gyro sensor integration, tabulates the residual deviation (Δψ) for each angle, and corrects the final azimuth angle through real-time interpolation.
[0060] The microcontroller unit (120) performs calculations in the form of firmware or software and generates corrected magnetic flux density vectors and azimuth data in real time. The microcontroller unit (120) has built-in non-volatile memory to store and update correction matrices and deviation tables.
[0061] The communication module (130) performs data transmission between the microcontroller unit (120) and an external device and outputs corrected azimuth data or magnetic flux density vectors to an external system via at least one of the UART, SPI, or CAN communication protocols. Through this, the device supports an interface with a drone, vehicle, robot, industrial controller, etc.
[0062] FIG. 2 is an overall block diagram of an ellipsoid-based correction device (100) of a magnetometer according to the present invention, and FIG. 3 is an example diagram showing the three-dimensional spatial distribution of raw magnetic field data obtained from a magnetometer sensor before applying the ellipsoid-based correction method of a magnetometer according to the present invention.
[0063] The ellipsoid-based correction device (100) of the magnetometer according to the present invention receives raw data obtained from the magnetometer sensor (110), performs a mathematical correction operation based on ellipsoid approximation, and includes a complex operation structure for outputting the azimuth angle error in a minimized form in real time.
[0064] The data collection unit (210) periodically collects 3-axis magnetic flux density vector (Bx, By, Bz) data from the magnetometer sensor (110) of the IMU module. The collection frequency is, for example, 100 Hz or higher, and is designed to secure spatial omnidirectional data during multi-position rotational motion. The collected data is then transmitted as a time-synchronized and filtered signal to a subsequent stage.
[0065] Figure 3 is an example diagram clearly demonstrating the necessity of the ellipsoidal approximation and spherical normalization processes performed in the present invention, and visually demonstrates the distorted state of the data before correction. As shown in Figure 3, it can be seen that the 3-axis magnetic flux density vectors (Bx, By, Bz) measured during the multi-position rotational motion of the magnetometer sensor do not form an ideal spherical distribution, but are distributed in the form of an ellipsoid tilted in a specific direction.
[0066] This asymmetric distribution is caused by hard iron and soft iron distortion of the sensor, or scale imbalance and misalignment between sensor axes. In particular, when viewed with respect to the coordinate axes indicated by the X-axis (red), Y-axis (green), and Z-axis (blue), the center of the data is off from the origin (0, 0, 0), which means that there is a center offset (bias) of the magnetometer.
[0067] In addition, the major axis of the data is tilted obliquely with respect to the Z-axis, indicating that the scale ratios between the axes differ. If the azimuth is calculated directly in this state, an error of several degrees or more occurs when compared to the actual direction of the Earth's magnetic field.
[0068] The bias estimation unit (220) receives a magnetic flux density vector collected from the data collection unit (210) and estimates the bias component caused by the sensor hard-iron and soft-iron. To do this, the magnetic flux density distribution is approximated by an ellipsoid equation in three-dimensional space, and the ellipsoid center coordinates (bx, by, bz) are calculated through the least squares method and eigendecomposition. The calculated bias is used as an origin shift correction value in a subsequent linear transformation step.
[0069] For example, the bias estimation unit (220) is a quadratic equation of magnetic flux density data The eigenvalue decomposition of matrix A is performed by estimating it using the least squares method, and the bias component of the magnetometer sensor is estimated from the eigenvector corresponding to the minimum eigenvalue.
[0070] The correction matrix operation unit (230) receives the output of the bias estimation unit (220) and calculates a rotation matrix (R) and a scale matrix (K) that reflect the direction of the major axis and the major-minor axis ratio of the ellipsoid. The operation is performed through singular value decomposition (SVD), and as a result, a correction matrix (T) is calculated to normalize the ellipsoid to a unit sphere coordinate system. The calculated correction matrix (T) is transmitted to the ellipsoid correction unit (240) for use.
[0071] The ellipsoid correction unit (240) uses the correction matrix (T) transmitted from the correction matrix calculation unit (230) to measure raw magnetic flux density data in real time B raw corrected magnetic flux density vector ( B corr Converts to ).
[0072]
[0073] This eliminates scale imbalance and axis misalignment errors of the sensor. The corrected magnetic flux density vector is transmitted to the field correction unit (250).
[0074] Even if a magnetometer is calibrated in a laboratory environment, its distribution varies depending on the actual usage environment, and new hard iron and soft iron distortions may occur depending on surrounding structures and the placement of electronic devices. In particular, since the operating locations of equipment such as robots, drones, and mobile platforms change frequently, it is difficult to ensure sufficient accuracy with a one-time calibration at the time of shipment. Accordingly, this invention includes a simple calibration procedure that can be performed directly by the user in the field. Through this process, the bias of the magnetometer is corrected in real time, and azimuth errors are minimized by configuring error characteristics by angle into a table.
[0075] The field correction unit (250) analyzes the trajectory on the xy plane formed when the device rotates along the vertical axis (Z-axis) using the correction vector transmitted from the ellipsoid correction unit (240). The trajectory data is approximated to a circle using the least squares method to calculate the center coordinates (xc, yc), and the horizontal plane offset due to environmental magnetic field fluctuations is corrected in real time using this. The corrected vector is transmitted to the orientation correction unit (260).
[0076] The azimuth correction unit (260) calculates the residual deviation (Δψ) for each angle by comparing the reference azimuth (ψ_ref) calculated by gyro sensor integration with the azimuth (ψ_mag) measured based on the field correction unit (250) based on the data from the field correction unit (250). The deviation is accumulated and evaluated for each angle interval (e.g., in units of 5° or 10°) and stored in a look-up table. By interpolating the deviation of adjacent intervals during real-time measurement and immediately reflecting the correction value, the residual error of the azimuth output is maintained at ±0.5° or less.
[0077] The azimuth correction unit (260) includes a communication interface for transmitting real-time correction results to an external system, and the communication interface is configured to output corrected azimuth data through at least one of the UART, SPI, or CAN protocols.
[0078] The data collection unit (210), bias estimation unit (220), correction matrix operation unit (230), ellipsoid correction unit (240), field correction unit (250), and orientation correction unit (260) are implemented as software modules on a microcontroller unit (MCU) and periodically execute a sequential pipeline of bias, scale, axis misalignment, field correction, and orientation correction to reduce the average error of the output azimuth angle.
[0079] FIG. 4 is a flowchart illustrating the overall procedure of an ellipsoid-based correction method for a magnetometer according to the present invention. The present method includes a process of generating a normalized azimuth output by stepwise removing sensor offset, scale imbalance, axis misalignment, and environmental magnetic deviation based on 3-axis magnetic flux density data obtained from a magnetometer sensor.
[0080] The first step of the ellipsoid-based correction method for a magnetometer according to the present invention is the process of collecting magnetometer data through the rotation of the magnetometer. This process serves as the basis for mathematical ellipsoid modeling performed in subsequent steps and must be performed prior to quantitatively estimate various environmental distortions included in the magnetometer output values.
[0081] First, the magnetometer must be rotated in various directions around the three axes x, y, and z. This rotation can be performed manually by a user rotating the magnetometer by hand, automatically using a rotation table, or by collecting data in the actual operating environment of the equipment. It is important to ensure that the collected magnetometer vectors cover the entire space as uniformly as possible.
[0082] The measured values constituting the output of a magnetometer consist of three-dimensional vectors, and in an ideal environment, these vectors should be distributed on a sphere. That is, if the magnitude of the magnetic field is constant, the magnitude of all vectors must be the same regardless of the direction of rotation, and they must be distributed at equal distances from the origin. However, due to the influence of hard irons, soft irons, etc., actual measured values appear in the form of an asymmetric and tilted ellipsoid rather than the theoretical sphere.
[0083] In the data collection step (411), 3-axis magnetic flux density data generated during the multi-position rotational movement of the device is collected at a constant frequency (e.g., 100 Hz) from an IMU module containing a magnetometer sensor. The data collected in this step comprehensively includes the distribution of the Earth's magnetic field vectors when the device rotates in any direction and is used as basic data for subsequent ellipsoid approximation and correction matrix calculations. In addition, angular velocity (gyro sensor) and acceleration data are also acquired in this step and used to calculate the azimuth reference value and the attitude reference value.
[0084] In the bias estimation step (412), the center offset (Bias) component of the sensor is calculated by approximating the spatial distribution of the collected magnetic flux density data with a three-dimensional ellipsoid equation. Specifically, the measured magnetic flux density vector has a bias and asymmetric deformation from the ideal spherical distribution due to hard iron and soft iron distortion, and this can be mathematically modeled as a quadratic equation in the shape of an ellipsoid.
[0085] At this time, the ellipsoid equation is It is expressed in the form of, and in the bias estimation step (412), the coefficients of the above equation are estimated using the least squares method to perform eigenvalue decomposition of matrix A, and the center coordinates and principal axis directions (eigenvectors) of the ellipsoid are derived. The center coordinates calculated at this time are defined as offsets (Bx, By, Bz) caused by hard iron distortion of the sensor, and by removing them, the center of the magnetometer output can be aligned to the origin. As a result, the bias estimation step (412) generates base data capable of analyzing not only static bias caused by hard iron but also the initial form of axis distortion caused by soft iron, so that normalization operations can be performed in a subsequent step (correction matrix operation step).
[0086] In the correction matrix operation step (413), a covariance matrix is constructed to analyze the geometric characteristics of the ellipsoid from the magnetic flux density data from which the offset has been removed, and Singular Value Decomposition (SVD) is performed on it. Through this, a rotation matrix (R) representing the direction of the principal axis of the ellipsoid and a scale matrix (K) representing the relative scale ratio of each axis are calculated, and these two matrices are combined to obtain a correction matrix ( It generates ). This correction matrix (T) is used as a reference matrix to transform the sensor output vector into an ideal spherical coordinate system.
[0087] In the ellipsoid correction step (414), the correction matrix (T) is input in real time as a magnetic flux density vector ( B raw A normalized vector (applied to ) to remove sensor scale imbalance and axis misalignment B corr ) is calculated using the aforementioned mathematical formula 1. As a result of this process, all magnetic flux density vectors are uniformly distributed on the unit sphere, which means that the geometric error of the sensor is completely corrected.
[0088] In the field correction step (415), the device is rotated around the vertical axis (Z-axis) while observing the trajectory of the normalized magnetic flux density vector, and the circular trajectory formed on the xy plane is approximated by the least squares method to calculate the center coordinates (xc, yc) of the trajectory.
[0089] Since these center coordinates represent the local magnetic distortion on the horizontal plane caused by the field magnetic environment, residual deviations are additionally eliminated using them. Therefore, in this step, real-time correction based on environmental changes is performed in addition to the structural correction of the sensor.
[0090] In the orientation correction step (416), the magnetometer-based azimuth (ψ_mag) is calculated from the magnetic flux density vector that has been field-corrected, and at the same time, the remaining deviation (Δψ) for each angle is calculated by comparing it with the reference azimuth (ψ_ref) obtained by gyro sensor integration. These deviation values are divided into fixed angle intervals (e.g., 5° or 10° units) and stored in the form of an azimuth deviation table (Look-up Table), and when measuring in real time, the deviation of adjacent sections is applied using a linear interpolation method to correct minute errors in the azimuth. Through this process, the magnetometer maintains a stable azimuth output even in environments with long-term temperature changes or magnetic noise.
[0091] In the result output step (417), the normalized magnetic flux density vector and final corrected azimuth data generated through the series of correction steps are stored in the internal memory of the microcontroller unit or transmitted to an external system via a UART, SPI, or CAN interface. The output data can be used as azimuth information input for autonomous driving systems, drone controllers, robot attitude control devices, etc., and the correction results can be recorded in non-volatile memory and automatically applied during subsequent operation.
[0092] The operation method according to an embodiment of the present invention can be implemented by an ellipsoid-based correction device of a magnetometer as illustrated in FIG. 2. This operation process may be performed by a hardware module, but in particular, it may be implemented in the form of a software program, in which case the program may be stored and executed on a computer-readable recording medium. In addition, such a program may be transmitted through a wired or wireless transmission medium or a communication network in a form coupled to a computer data signal, i.e., a carrier wave.
[0093] The above-mentioned computer-readable recording medium may include program instructions, data files, and data structures, either individually or in combination. The program instructions recorded to implement the present invention may be code specifically designed to perform the embodiments of this specification, or they may be appropriately modified and utilized general-purpose software known to those skilled in the art.
[0094] Specific examples of computer-readable recording media include magnetic media such as hard disks, floppy disks, and magnetic tapes; optical recording media such as CD-ROMs, DVDs, and Blu-rays; magneto-optical media such as floptical disks; ROM (Read Only Memory); RAM (Random Access Memory); and various hardware devices configured to store and execute program instructions.
[0095] A computer-readable recording medium according to one embodiment of the present invention may have program instructions recorded thereon, and the program instructions perform the following steps when executed by a processor.
[0096] A data collection step in which the processor collects 3-axis magnetic flux density data generated during multi-position rotation of the device from a magnetometer sensor in real time; and a bias estimation step in which the processor calculates the offset (Bias) component of the magnetometer sensor by approximating an ellipsoid equation in three-dimensional space from the collected magnetic flux density data;
[0097] A correction matrix operation step in which the processor calculates a rotation matrix and a scale matrix to move the center coordinates of the ellipsoid to the origin and normalize the direction of the ellipsoid's major axis to a unit sphere coordinate system; and an ellipsoid correction step in which the processor uses the calculated rotation matrix and scale matrix to linearly transform real-time measurement data into a spherical space to correct scale imbalance and axis misalignment of the magnetometer sensor and output a normalized magnetic flux density vector;
[0098] The above processor includes a field correction step in which the processor approximates the magnetic flux density trajectory data on the xy plane generated when the device rotates along the vertical axis (Z-axis) based on a normalized magnetic flux density vector into a circle using the least squares method, calculates the center coordinates of the circular trajectory on the xy plane, and removes the horizontal plane offset using the same; and an orientation correction step in which the processor compares the azimuth angles before and after correction based on the correction results, stores the remaining deviations for each angle in a table form, and updates and applies the correction values through real-time interpolation.
[0099] Accordingly, the present invention may be implemented by an electromechanical measuring device capable of minimizing heading errors in real time by including an IMU (Inertial Measurement Unit) sensor module comprising a magnetometer, a gyroscope, and an accelerometer, and by calculating a rotation matrix and a scale matrix based on magnetic flux density data collected therefrom, and performing unit sphere normalization and field correction, as well as by a computer-readable recording medium having the above-mentioned program instructions recorded thereon.
[0100] Although embodiments of the present invention have been described, the spirit of the present invention is not limited by the embodiments presented in this specification. Those skilled in the art who understand the spirit of the present invention may easily propose other embodiments within the scope of the same spirit by adding, changing, deleting, or adding components, and such are also to be considered to be included within the spirit of the present invention. Explanation of the symbols
[0101] 100: Electronic device
Claims
Claim 1 A data acquisition unit that collects 3-axis magnetic flux density data during multi-position rotation from a magnetometer sensor; a deflection estimation unit that estimates the sensor offset by approximating an ellipsoid equation from the collected magnetic flux density data; a correction matrix calculation unit that calculates a rotation matrix and a scale matrix to shift the center coordinates of the ellipsoid to the origin and normalize the direction of the ellipsoid's principal axis to a unit sphere coordinate system; an ellipsoid correction unit that corrects scale imbalance and axis misalignment of the magnetometer sensor by mapping real-time measurement data into a spherical space using the calculated rotation matrix and scale matrix, and outputs a normalized magnetic flux density vector; a field correction unit that calculates the center coordinates of a circular trajectory in the xy plane by approximating the magnetic flux density trajectory data in the xy plane generated during vertical axis (Z-axis) rotation to a circle using the least squares method based on the distribution of the normalized magnetic flux density vector output from the ellipsoid correction unit, and reflects this in real-time offset correction; and a magnetometer-based An ellipsoid-based correction device for a magnetometer, characterized by including an azimuth correction unit that calculates an azimuth (ψ_mag), simultaneously calculates a reference azimuth (ψ_ref) by integrating angular velocity data provided from a gyroscope sensor, calculates a residual deviation (Δψ) for each angle by comparing the magnetometer-based azimuth (ψ_mag) and the reference azimuth (ψ_ref), stores the residual deviation in the form of a look-up table by dividing it into certain angle intervals, and corrects the final azimuth by applying a correction value by interpolating the deviation of adjacent intervals during real-time measurement. Claim 2 In claim 1, the deflection estimation unit is a quadratic equation of the magnetic flux density data An ellipsoid-based correction device for a magnetometer characterized by performing eigenvalue decomposition of matrix A by estimating it using the least squares method, and estimating the bias component of the magnetometer sensor from the eigenvector corresponding to the minimum eigenvalue. Claim 3 An ellipsoid-based correction device for a magnetometer according to claim 1 or claim 2, wherein the correction matrix operation unit performs singular value decomposition (SVD) on the covariance matrix of the data after bias correction to separate the orthonormal matrix and the scale matrix, and respectively calculates the rotation matrix (R) and the scale matrix (K) for unit sphere normalization therefrom. Claim 4 In claim 3, the ellipsoid correction unit is, [Mathematical Formula 1] Corrected magnetic flux density vector by applying a linear transformation of the shape in real time B corr An ellipsoid-based correction device for a magnetometer characterized by calculating Claim 5 delete Claim 6 An ellipsoid-based correction device for a magnetometer according to claim 1, wherein the orientation correction unit includes a communication interface for transmitting real-time correction results to an external system, and the communication interface is configured to output corrected azimuth data through at least one of a UART, SPI, or CAN protocol. Claim 7 An ellipsoid-based correction device for a magnetometer according to claim 4, wherein the data collection unit, bias estimation unit, correction matrix operation unit, ellipsoid correction unit, field correction unit, and orientation correction unit are implemented as software modules on a microcontroller unit (MCU), and the sequential pipeline of bias, scale, axis misalignment, field correction, and orientation correction is periodically executed to reduce the average error of the output azimuth angle. Claim 8 An ellipsoid-based correction method for a magnetometer executed in an electronic device comprising a magnetometer sensor, a processor, and a communication module, comprising: a data collection step in which the processor collects 3-axis magnetic flux density data generated during multi-position rotation of the device from the magnetometer sensor in real time; a bias estimation step in which the processor approximates an ellipsoid equation in three-dimensional space from the collected magnetic flux density data to calculate a bias component of the magnetometer sensor; a correction matrix operation step in which the processor calculates a rotation matrix and a scale matrix to shift the center coordinates of the ellipsoid to the origin and normalize the direction of the principal axis of the ellipsoid to a unit sphere coordinate system; an ellipsoid correction step in which the processor corrects scale imbalance and axis misalignment of the magnetometer sensor by linearly transforming real-time measurement data into spherical space using the calculated rotation matrix and scale matrix, and outputs a normalized magnetic flux density vector; and the processor, based on the normalized magnetic flux density vector, [transforms] magnetic flux density trajectory data in the xy plane generated during rotation of the vertical axis (Z-axis) of the device into a circle using the least squares method A field correction step for approximating and calculating the center coordinates of a circular trajectory on the xy plane and using this to remove a horizontal plane offset; a step in which the processor receives the magnetic flux density vector corrected in the field correction step and calculates a magnetometer-based azimuth (ψ_mag); a step in which the processor integrates angular velocity data provided from a gyroscope sensor to calculate a reference azimuth (ψ_ref); and a step in which the processor compares the magnetometer-based azimuth (ψ_mag) and the reference azimuth (ψ_ref) to calculate a residual deviation (Δψ) for each angle;An ellipsoid-based correction method for a magnetometer, characterized in that the processor divides the residual deviation into specific angle intervals and stores them in the form of a look-up table, and during real-time measurement, applies a correction value by interpolating the deviation of adjacent intervals, wherein each of the steps is sequentially connected to integrally correct the offset, scale, axis misalignment, and environmental magnetic deviation of the magnetometer, thereby minimizing the average error of the azimuth angle output in real time. Claim 9 In claim 8, the deflection estimation step is a quadratic equation of magnetic flux density data An ellipsoid-based correction method for a magnetometer, characterized by the step of estimating the matrix A using the least squares method to perform eigenvalue decomposition, and estimating the bias component of the magnetometer sensor from the eigenvector corresponding to the minimum eigenvalue. Claim 10 An ellipsoid-based correction method for a magnetometer according to claim 8 or claim 9, wherein the correction matrix operation step is characterized by performing singular value decomposition (SVD) on the covariance matrix of the data after bias correction to separate the orthonormal matrix and the scale matrix, and respectively calculating the rotation matrix (R) and the scale matrix (K) for unit sphere normalization therefrom. Claim 11 In claim 10, the ellipsoid correction step is [Equation 1] Corrected magnetic flux density vector by applying a linear transformation of the shape in real time B corr An ellipsoid-based correction method for a magnetometer characterized by a step of calculating Claim 12 delete Claim 13 A computer-readable recording medium having instructions recorded thereon for performing the ellipsoid-based correction method of a magnetometer according to paragraph 8.
Citation Information
Patent Citations
Geomagnetic sensor signal processing method of device for measuring posture and aziuth angle
KR101878253B1
Method and system of 2-axis compass calibrationconsidering magnetic environment and method and systemof measuring azimuth using it
KR1020080026395A
