Magnetic compass error model calibration method and system
By obtaining the three-axis magnetic field data and geographical location information of the magnetic compass in various postures, combining the geomagnetic conversion matrix and iterative algorithm, the problem of low calibration accuracy of the magnetic compass in outdoor environments is solved, and high-precision magnetism in complex environments is achieved Compass error model calibration.
Patent Information
- Application Number
- CN202411819802.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-12-11
AI Technical Summary
In outdoor environments, the lack of accurate and reliable leveling and north-search conditions makes the traditional magnetic compass calibration process complicated and difficult to achieve high precision.
By obtaining the three-axis magnetic field data of the target magnetic compass in various postures, combining geographical location information (longitude and latitude), the magnetic declination angle and magnetic inclination angle are determined, and the geomagnetic conversion matrix and iterative algorithm are used to correct the error model of the magnetic compass to achieve magnetic matching Accurate calibration of compass sensor.
Without relying on external precise leveling and north-search equipment, the measurement accuracy of the magnetic compass in complex environments is improved, the dependence on external equipment is reduced, and the effective error model calibration of the magnetic compass sensor is realized.
Smart Images

Figure CN119289956A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of navigation technology, and in particular to a magnetic compass error model calibration method and a magnetic compass error model calibration system. Background Art
[0002] In the calibration process of traditional magnetic compass sensors, it is usually necessary to obtain the standard value of the magnetic field at the sensor location, or to calibrate using multiple locations determined by angles relative to each other. However, in outdoor environments, there is often a lack of accurate and reliable leveling and north-seeking conditions, which poses a challenge to the calibration of magnetic compasses. Therefore, how to calibrate a magnetic compass without accurate and reliable leveling and north-seeking conditions has become an urgent problem to be solved. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems in the related art to a certain extent. To this end, the first object of the present invention is to provide a magnetic compass error model calibration method, which uses a single stable lower and side surface position and combines the data of 24 positions in space generated by the magnetic compass sensor and the surface in different ways to achieve effective calibration of the magnetic compass sensor.
[0004] The second object of the present invention is to provide a magnetic compass error model calibration system.
[0005] To achieve the above-mentioned purpose, the first embodiment of the present invention proposes a magnetic compass error model calibration method, comprising: obtaining three-axis magnetic field data of a target magnetic compass in a target posture; determining the magnetic declination and magnetic inclination of a target position according to the longitude and latitude of the target magnetic compass in the target posture; determining the real geomagnetic data in the target posture according to the magnetic declination and magnetic inclination; determining a geomagnetic conversion matrix according to the three-axis magnetic field data; wherein the vector difference between the three-axis magnetic field data and the real geomagnetic data after the operation of the geomagnetic conversion matrix is not greater than a preset vector difference; determining an objective function according to the real geomagnetic data and the geomagnetic conversion matrix; solving the objective function through an iterative algorithm to obtain an optimal solution of the objective function; obtaining corrected three-axis magnetic field data according to the geomagnetic conversion matrix corresponding to the optimal solution, and calculating the magnetic heading of a magnetic compass sensor according to the corrected three-axis magnetic field data.
[0006] In addition, the data processing method according to the above embodiment of the present invention may also have the following additional technical features: Optionally, obtain three-axis magnetic field data of the target magnetic compass in the target attitude, including: The target magnetic compass is fixedly installed in the calibration fixture, and the placement of the calibration fixture is changed to obtain different postures of the target magnetic compass. When the target magnetic compass is in a steady state, the three-axis magnetic field data of the target magnetic compass in at least twenty-four target postures are collected; wherein the calibration fixture is a regular hexahedron fixture.
[0007] Optionally, determining the magnetic declination and magnetic inclination of the target position according to the longitude and latitude of the target magnetic compass in the target attitude includes: Obtain the longitude and latitude of the target magnetic compass in the target attitude; The longitude and latitude are input into the geomagnetic field model to obtain the magnetic declination and inclination of the target magnetic compass in the target attitude.
[0008] Optionally, the geomagnetic transformation matrix is expressed as:
[0009] in, is the geomagnetic transformation matrix, is the magnetic declination of the target magnetic compass in the target attitude, is the cross-coupling error of the target magnetic compass in the X and Y axis directions, is the cross-coupling error of the target magnetic compass in the X and Z axis directions, is the cross-coupling error of the target magnetic compass in the Y and X axis directions, is the cross-coupling error of the target magnetic compass in the Y and Z axis directions, is the cross-coupling error of the target magnetic compass in the Z and X axis directions, is the cross-coupling error of the target magnetic compass in the Z and Y axis directions, is the component of the three-axis magnetic field data in the X-axis direction, is the component of the three-axis magnetic field data in the Y-axis direction, is the component of the three-axis magnetic field data in the Z-axis direction, is the sensor zero bias error of the target magnetic compass in the X-axis direction, is the sensor zero bias error of the target magnetic compass in the Y-axis direction, is the sensor zero bias error of the target magnetic compass in the Z-axis direction, is the scale factor error of the target magnetic compass in the X-axis direction, is the scale factor error of the target magnetic compass in the Y-axis direction, is the scale factor error of the target magnetic compass in the Z-axis direction.
[0010] Optionally, the objective function is determined according to the real geomagnetic data and the geomagnetic conversion matrix, including: Determine the residual function according to the real geomagnetic data and the geomagnetic conversion matrix; Determine the L2 norm of the vector difference between the three-axis magnetic field data and the true geomagnetic data according to the residual function; The objective function is determined based on the L2 norm.
[0011] Optionally, the residual function is expressed as:
[0012] in, is the residual function, is the real geomagnetic data, is the geomagnetic transformation matrix.
[0013] Optionally, the L2 norm is expressed as:
[0014] in, is the L2 norm.
[0015] Optionally, the objective function is expressed as:
[0016] in, is the objective function.
[0017] Optionally, iterative algorithms include: For the objective function, set an initial guess solution ; For the kth iteration, find an increment , so that the objective function is in the current solution Reaching a local minimum; Determine the increment at this time If the increment If the value of is less than the preset increment threshold, the iteration process is stopped; Let the next solution of the objective function be , and perform the k+1th iteration.
[0018] According to a magnetic compass error model calibration method provided by the present invention, the three-axis magnetic field data of the target magnetic compass in various postures is obtained, and the magnetic declination and magnetic inclination are determined in combination with the geographical location information (longitude and latitude), so as to accurately calculate the real geomagnetic data. The three-axis magnetic field data is converted using the geomagnetic conversion matrix, and the optimal solution of the objective function is solved by an iterative algorithm, so as to effectively correct the cross-coupling error, sensor zero bias error and scale factor error of the magnetic compass, and then the error model of the target magnetic compass is calibrated according to the corrected geomagnetic conversion matrix.
[0019] To achieve the above-mentioned purpose, the present invention proposes a magnetic compass error model calibration system in a second aspect, comprising: a measurement module, configured to obtain three-axis magnetic field data of a target magnetic compass in a target posture; a first determination module, configured to determine the magnetic declination and magnetic inclination of a target position according to the longitude and latitude of the target magnetic compass in the target posture; a second determination module, configured to determine the real geomagnetic data in the target posture according to the magnetic declination and magnetic inclination; a third determination module, configured to determine the geomagnetic conversion matrix according to the three-axis magnetic field data; wherein the vector difference between the three-axis magnetic field data and the real geomagnetic data after the operation of the geomagnetic conversion matrix is not greater than a preset vector difference; a fourth determination module, configured to determine the objective function according to the real geomagnetic data and the geomagnetic conversion matrix; an iteration module, configured to solve the objective function through an iterative algorithm to obtain the optimal solution of the objective function; a correction module, configured to obtain the corrected three-axis magnetic field data according to the geomagnetic conversion matrix corresponding to the optimal solution, and perform magnetic heading calculation of the magnetic compass sensor according to the corrected three-axis magnetic field data.
[0020] According to a magnetic compass error model calibration system provided by the present invention, the three-axis magnetic field data of the target magnetic compass in various postures is obtained, and the magnetic declination and magnetic inclination are determined in combination with the geographical location information (longitude and latitude), so as to accurately calculate the real geomagnetic data. The three-axis magnetic field data is converted using the geomagnetic conversion matrix, and the optimal solution of the objective function is solved by an iterative algorithm, so as to effectively correct the cross-coupling error, sensor zero bias error and proportional factor error of the magnetic compass, and then the magnetic heading of the magnetic compass sensor is calculated according to the corrected three-axis magnetic field data.
[0021] To achieve the above-mentioned purpose, the third aspect of the present invention proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the magnetic compass error model calibration method as described above when executing the program.
[0022] In order to achieve the above-mentioned purpose, a fourth aspect of the present invention proposes a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the magnetic compass error model calibration method described above.
[0023] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 A schematic diagram of a flow chart of a magnetic compass error model calibration method provided by an embodiment of the present invention; Figure 2 A schematic diagram of a magnetic compass error model calibration system provided by an embodiment of the present invention; Figure 3 A more specific schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0027] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0028] As described in the background technology section, in order to ensure high-precision direction indication in existing magnetic compass sensor calibration technologies, it is usually necessary to rely on complex calibration processes, which often require accurate and reliable leveling equipment and precise north-finding benchmarks on site. However, in outdoor environments, especially in the absence of professional equipment and stable geographic references, it becomes extremely difficult and costly to implement such a calibration process. In addition, although the traditional multi-position calibration method can improve the calibration accuracy, it also relies on multiple reference points with precisely known angles, which are often difficult to obtain directly in outdoor natural environments.
[0029] In the process of implementing the present invention, the applicant discovered that by sequentially placing the magnetic compass sensor close to different sides and edges of the lower support surface and the measuring support surface, combined with operations such as rotation and flipping, a variety of different magnetic field sensing scenarios can be simulated without relying on external precise leveling and north-finding equipment. By recording and analyzing the data output by the sensor at these positions, the magnetic compass deviation caused by manufacturing deviation, installation error or environmental factors can be systematically identified and eliminated, and the sensor can be accurately calibrated.
[0030] The technical solution of the present invention is further described in detail below through specific embodiments.
[0031] refer to Figure 1 , is a schematic flow chart of a magnetic compass error model calibration method provided in an embodiment of the present invention.
[0032] Step S101, obtaining three-axis magnetic field data of a target magnetic compass in a target posture.
[0033] In an embodiment of the present invention, the magnetic compass includes a three-axis magnetic sensor, and the three-axis magnetic sensor is used to measure three-axis direction magnetic field data.
[0034] As an optional embodiment, obtaining three-axis magnetic field data of a target magnetic compass in a target posture includes: fixing the target magnetic compass in a calibration fixture, changing the placement of the calibration fixture to obtain different postures of the target magnetic compass, and collecting three-axis magnetic field data of the target magnetic compass in at least twenty-four target postures when the target magnetic compass is in a steady state; wherein the calibration fixture is a regular hexahedron fixture.
[0035] Specifically, first, the target magnetic compass can be fixedly installed in the calibration fixture to ensure that the connection between the magnetic compass and the fixture is stable to avoid relative movement or shaking when changing the posture, which affects the accuracy of the magnetic field data.
[0036] In the specific implementation, the calibration tool is designed in the shape of a regular hexahedron, which can be understood as having six different faces (upper, lower, left, right, front, and back) and multiple possible edge and corner positions. This design enables the tool to easily simulate the various postures of the magnetic compass in three-dimensional space through operations such as rotation and flipping. Furthermore, the target magnetic compass can be placed in different postures by changing the placement of the calibration tool. These postures may include but are not limited to: The front of the tooling faces up, down, left, right, front or back; the tooling is rotated around its axis at a certain angle (such as every 45 degrees or 90 degrees); the edge or corner of the tooling faces up or down, etc.
[0037] Through the above operation, it can be ensured that the magnetic compass is measured in at least twenty-four different attitudes, and these attitudes should cover as much as possible all directions that the magnetic compass may encounter.
[0038] Furthermore, at each target attitude, wait for the magnetic compass to reach a steady state (i.e., the magnetic field reading is stable and no longer changes or changes very little). It should be noted that this step usually takes a certain amount of time to ensure that the magnetic compass has fully responded to the magnetic field environment at the current attitude. Finally, use a high-precision magnetic field measurement device (such as a magnetometer) to collect the three-axis magnetic field data of the target magnetic compass. These data include magnetic field intensity components along the X-axis, Y-axis, and Z-axis, which together describe the magnetic field vector felt by the magnetic compass at the current attitude.
[0039] In the specific implementation, the collected three-axis magnetic field data can be recorded and initially analyzed and sorted. Check whether the data is complete and accurate, and identify possible outliers or sources of error. Subsequent data processing and analysis will be based on these raw data, by calculating parameters such as magnetic declination and magnetic inclination, constructing the geomagnetic conversion matrix, and ultimately achieving accurate calibration of the magnetic compass.
[0040] Step S102, determining the magnetic declination and magnetic inclination of the target position according to the longitude and latitude of the target magnetic compass in the target posture.
[0041] The magnetic compass uses the inherent directivity of the geomagnetic field to measure the spatial attitude angle. The geomagnetic north and south poles do not coincide with the geographic north and south poles. The direction pointed by the freely suspended magnetic needle has a deviation angle from the geographic north and south direction, which is the magnetic declination (also known as magnetic variation). In the specially drawn navigation map, the magnetic variation correction amount of each place will be noted so that correction can be made when using the magnetic compass. In addition, the angle between the geomagnetic field intensity vector and the horizontal plane is called the magnetic inclination. The magnetic inclination of each place is also not equal. The closer to the geomagnetic pole, the greater the magnetic inclination.
[0042] In a specific implementation, the geomagnetic declination and inclination of the location can be calculated based on the longitude and latitude information of the location of the target magnetic compass using a geomagnetic field model (such as the International Geomagnetic Reference Field IGRF). These two parameters describe the angle between the direction of the Earth's magnetic field and the geographic meridian and the angle between the direction of the magnetic field and the horizontal plane, respectively.
[0043] Step S103, determining the real geomagnetic data under the target posture according to the magnetic declination and magnetic inclination.
[0044] As an optional embodiment, the magnetic declination and magnetic inclination of the target magnetic compass are determined according to the longitude and latitude of the target magnetic compass in the target posture, including: obtaining the longitude and latitude of the target magnetic compass in the target posture; inputting the longitude and latitude into the geomagnetic field model to obtain the magnetic declination and magnetic inclination of the target magnetic compass in the target posture.
[0045] Specifically, GPS or other geolocation technologies can be used to obtain the precise longitude and latitude of the target magnetic compass in the target posture. These data are the basis for the subsequent calculation of magnetic declination and magnetic inclination. Select a suitable geomagnetic field model, such as the International Geomagnetic Reference Field (IGRF) or other high-precision geomagnetic field models. These models are usually constructed based on a large amount of geomagnetic observation data and geophysical theories, and can accurately describe the changes in the earth's magnetic field at different times and places. Further, the longitude and latitude obtained are used as input parameters and input into the selected geomagnetic field model. Based on these geographic location information, the model calculates the geomagnetic field intensity (i.e., geomagnetic real data), direction and other parameters at the point. The geomagnetic field model will output a series of parameters related to the geomagnetic field, including magnetic declination and magnetic inclination. Magnetic declination is the angle between the geomagnetic meridian and the geographic meridian, which indicates the offset of the geomagnetic field direction relative to the geographic direction; magnetic inclination is the angle between the geomagnetic field intensity vector and the horizontal plane, which indicates the degree of inclination of the geomagnetic field direction relative to the horizontal plane.
[0046] It should be noted that the calculated declination and inclination can be recorded and used in the subsequent magnetic compass error model calibration process. These parameters will be used to correct the deviation in the magnetic compass readings so that it can more accurately indicate the geographic direction.
[0047] Step S104, determining the geomagnetic conversion matrix according to the three-axis magnetic field data; wherein the vector difference between the three-axis magnetic field data and the geomagnetic real data after the geomagnetic conversion matrix operation is not greater than a preset vector difference.
[0048] In a specific implementation, a geomagnetic conversion matrix can be constructed by mathematical methods (such as least squares method, matrix transformation, etc.). The function of this matrix is to make the vector difference between the actually measured three-axis magnetic field data and the real geomagnetic data less than or equal to the preset vector difference, where the upper limit of the vector difference is the preset vector difference and the lower limit of the vector difference is zero, so as to convert it into a form as close to the real geomagnetic data as possible. The determination of the conversion matrix depends on the deviation between the three-axis magnetic field data and the real geomagnetic data.
[0049] To explain further, during the calibration process of the magnetic compass sensor, the goal is to find a mapping relationship (expressed as a geomagnetic conversion matrix) so that the sensor readings (i.e., three-axis magnetic field data) can reflect the actual geomagnetic field vector (i.e., geomagnetic real data) as accurately as possible.
[0050] Step S105, determining the objective function according to the real geomagnetic data and the geomagnetic conversion matrix.
[0051] In the specific implementation, an objective function is constructed based on the real geomagnetic data and the geomagnetic conversion matrix. The purpose of this function is to minimize the vector difference between the converted three-axis magnetic field data and the real geomagnetic data. The objective function is solved by an iterative algorithm (such as gradient descent method, Newton method, etc.) until the optimal solution is found that makes the vector difference less than the preset target difference.
[0052] Step S106, solving the objective function through an iterative algorithm to obtain the optimal solution of the objective function.
[0053] In a specific implementation, the original three-axis magnetic field data is corrected according to the optimal solution obtained, and the corrected three-axis magnetic field data is obtained. These corrected data more accurately reflect the actual situation of the earth's magnetic field.
[0054] Step S107, obtaining corrected three-axis magnetic field data according to the geomagnetic conversion matrix corresponding to the optimal solution, and calculating the magnetic heading of the magnetic compass sensor according to the corrected three-axis magnetic field data.
[0055] In the specific implementation, the corrected data is used to calibrate the error model of the target magnetic compass to ensure that the direction indicated by it is consistent with the direction of the earth's magnetic field, thereby improving the measurement accuracy.
[0056] The magnetic compass error model calibration method provided by the present invention realizes accurate calibration of the magnetic compass error model by comprehensively considering the geographical location information, attitude data and magnetic field model. The method not only improves the measurement accuracy of the magnetic compass in a complex environment, but also reduces the dependence on external calibration equipment and environment, and has broad application prospects.
[0057] Next, the detailed process of step S101 to step S107 will be described in conjunction with a more specific embodiment.
[0058] For example, suppose the average vector of magnetic compass sensor readings collected in a certain steady state of the calibration test is , which is expressed in component form as:
[0059] in, is the component of the three-axis magnetic field data in the X-axis direction, is the component of the three-axis magnetic field data in the Y-axis direction, is the component of the three-axis magnetic field data in the Z-axis direction.
[0060] Similarly, the component form of the actual magnetic field vector at the target magnetic compass (i.e., the real geomagnetic data under the target attitude) can be expressed as:
[0061] in, is the component of the real geomagnetic data in the X-axis direction, is the component of the real geomagnetic data in the Y-axis direction, It is the component of the real geomagnetic data in the Z-axis direction.
[0062] Among them, the calibration process of the magnetic compass can be transformed into the search for a mapping relationship, under which the three-axis magnetic field data The converted geomagnetic transformation matrix Each data point collected (i.e. the three-axis magnetic field data collected at different positions and orientations) is consistent with the real geomagnetic data. For a target magnetic compass in a certain orientation, the real geomagnetic data of each axial magnetic field , which can be obtained by inputting the longitude and latitude of the target magnetic compass into the geomagnetic field model or by consulting relevant network data. At the same time, the magnetic field size, the values of the magnetic declination and the magnetic inclination can be confirmed, and solved in combination with the geomagnetic field model described in step S102, wherein the geomagnetic conversion matrix is expressed as:
[0063] in, is the geomagnetic transformation matrix, is the magnetic declination of the target magnetic compass in the target attitude, is the cross-coupling error of the target magnetic compass in the X and Y axis directions, is the cross-coupling error of the target magnetic compass in the X and Z axis directions, is the cross-coupling error of the target magnetic compass in the Y and X axis directions, is the cross-coupling error of the target magnetic compass in the Y and Z axis directions, is the cross-coupling error of the target magnetic compass in the Z and X axis directions, is the cross-coupling error of the target magnetic compass in the Z and Y axis directions, is the component of the three-axis magnetic field data in the X-axis direction, is the component of the three-axis magnetic field data in the Y-axis direction, is the component of the three-axis magnetic field data in the Z-axis direction, is the sensor zero bias error of the target magnetic compass in the X-axis direction, is the sensor zero bias error of the target magnetic compass in the Y-axis direction, is the sensor zero bias error of the target magnetic compass in the Z-axis direction, is the scale factor error of the target magnetic compass in the X-axis direction, is the scale factor error of the target magnetic compass in the Y-axis direction, is the scale factor error of the target magnetic compass in the Z-axis direction.
[0064] Among them, the zero bias error on each axis is the offset of the sensor reading when the device is in a magnetic field-free environment or the magnetic field is zero. The scale factor on each axis is used to correct the proportional relationship between the sensor reading and the actual magnetic field strength. In the local coordinate system, the magnetic declination and magnetic inclination of the geomagnetic field are crucial for converting magnetic compass readings into accurate geographic directions.
[0065] It should be noted that the calibration process of the magnetic compass is to confirm the mapping relationship between the magnetic compass sensor reading vector before calibration and the three-axis magnetic field data after calibration formed by the above parameters through an iterative method, so that the optimization objective function obtains the minimum value.
[0066] It should be noted that when the calibration site can only guarantee a constant magnetic field, but cannot guarantee the same magnitude and vector direction as the geomagnetic field, the magnetic declination and inclination need to be added to the estimated parameters for calibration. At this time, only the relative relationship between the rotation positions of the target magnetic compass and the geomagnetic field is considered, and the local magnetic field is defined only relative to the coordinate system corresponding to this calibration test, not the navigation coordinate system. For example, assuming the magnetic declination is , the magnetic inclination is , then the components of the real data of the geomagnetic field at the 24 position are shown in the following table: Refer to Table 1, which is the real geomagnetic data under the target posture provided by an embodiment of the present invention.
[0067] Table 1 Real geomagnetic data under target attitude
[0068] For example, when the target magnetic compass is oriented southeast, the component of the real geomagnetic data in the X-axis direction is cosd(β)*sind(α), the component of the real geomagnetic data in the Y-axis direction is -cosd(β)*cosd(α), and the component of the real geomagnetic data in the Z-axis direction is sind(β).
[0069] By multiplying each position component shown in Table 1 by the magnetic field at that location, the true geomagnetic data of each axis of the magnetic compass sensor can be obtained.
[0070] Furthermore, for each data point in the calibration process (i.e., the three-axis magnetic field data collected at different positions and orientations), the original output measured by the target magnetic compass sensor at that point can be obtained through experiments. The theoretical value of the magnetic field of the target magnetic compass under this orientation (i.e. the real geomagnetic data) can be obtained through the geomagnetic model. .
[0071] The residual function can be set , i corresponds to the i-th geomagnetic calibration data point:
[0072] in, is the residual function, is the real geomagnetic data, is the geomagnetic transformation matrix.
[0073] As an optional embodiment, the residual function can be determined based on the real geomagnetic data and the geomagnetic conversion matrix; the L2 norm of the vector difference between the three-axis magnetic field data and the real geomagnetic data can be determined based on the residual function; and the objective function can be determined based on the L2 norm.
[0074] The L2 norm is expressed as:
[0075] Among them, It is the L2 norm of the vector difference between the calibrated magnetic compass sensor output and the theoretical value of the magnetic field.
[0076] Among them, the L2 norm (also known as the Euclidean norm) is a commonly used metric when constructing an objective function to minimize the vector difference between the converted three-axis magnetic field data and the true geomagnetic data. The L2 norm calculates the square root of the sum of the squares of the elements of the vector, which measures the length or size of the vector in Euclidean space.
[0077] Furthermore, we can define the objective function , taking into account the optimization status at each data point:
[0078] in, is the objective function, is a mapping constructed from the residuals at each point.
[0079] In the embodiment of the present invention, a nonlinear least squares algorithm is applied, that is, when the objective function (the difference between the calibration model and the theoretical value) cannot be expressed as an input vector (parameter to be optimized) In the case of a linear combination of , the algorithm used to find the minimum value of the objective function.
[0080] As an optional embodiment, the optimization method is an iterative method, and the specific algorithm is as follows: For the objective function, set an initial guess solution ; For the kth iteration, find an increment , so that the objective function is in the current solution Reach the local minimum; determine the increment at this time If the increment If the value of is less than the preset increment threshold, the iteration process is stopped; let the next solution of the objective function be , and perform the k+1th iteration.
[0081] In detail, the optimization method may include steps S1 to S4, including: Step S1: For the objective function, assume an initial value ; Step S2: For the kth iteration, find an increment , so that reaches a minimum value; Step S3: Determine at this time If the value of If it is less than the preset threshold, the iteration process is stopped; Step S4: Set , return to step S2.
[0082] Furthermore, with respect to the confirmation of iterative parameters, the present invention relates to the internal implementation of a nonlinear least squares algorithm. This part of the calculation in the actual magnetic compass calibration work may be performed, but is not limited to, by the MATLAB built-in function lsqnonlin. The components of the algorithm objective function (vector value function) may be defined by the user. The use method and routine of the function in the present invention will be described in detail below.
[0083] For nonlinear least squares problems, a general form of the objective function can be determined, for example:
[0084] in, To calibrate the residual of the model in each preset dimension, that is, each sensor axis corresponding to each magnetic compass orientation.
[0085] Define the residual vector , can be given The gradient and Hesser matrix (second-order partial derivative matrix) are:
[0086] in, is represented by the matrix method Gradient components along each independent variable dimension.
[0087] When the number of equations is less than the number of variables (parameters to be optimized), Levenburg-Marquardt (an estimation method for least squares estimation of regression parameters in nonlinear regression) can be used. It is essentially a trust region method, and its update direction is the solution of the following linear least squares problem:
[0088] The above formula means that, based on the current value of the independent variable, a new set of independent variable step increments is found so that within the small interval, the objective function achieves the minimum value in the new step.
[0089] The specific process of the algorithm is as follows: Step S1, give the maximum radius , initial radius , initial point ; Step S2, given parameters ; Step S3, before reaching the convergence criterion, loop through the following steps; Step S4, calculate the iteration direction ; Step S5, calculate the drop ratio ; Step S6, updating the trust region radius;
[0090] Step S7, update the independent variable.
[0091]
[0092] in, The optimal independent variable step increment currently calculated.
[0093] When the optimization problem contains boundary constraints, a projection operator can be used to project points that exceed the boundary of the value to be estimated during the iteration onto the boundary points. The projection operator P independently projects each component according to the following conditions: Perform the calculation:
[0094] In the above formula and Represents the lower and upper bounds of the i-th parameter to be estimated. The projection operator will only take effect when the independent variable exceeds its respective preset boundaries, fixing the independent variable that exceeds the boundary to the boundary value.
[0095] In the specific implementation, the calibration algorithm uses the collected three-axis magnetic field data of the magnetic compass sensor as input, supplemented by accelerometer data to determine the direction. The estimated parameters include 6 non-orthogonal factors, 3 zero biases and 3 scale factors, as well as the magnetic declination and magnetic inclination in the local coordinate system (non-navigation coordinate system). The program iteratively calculates by inputting the mean value of the magnetic compass sensor at each position. The iterative goal is to minimize the difference between the model composed of each estimated parameter and the input data. Among them, the accelerometer data is an auxiliary input, which is used to determine the direction of the magnetic compass (such as horizontal or tilted state) and help distinguish between the geomagnetic field component and the magnetic field changes caused by the device posture. During the calibration process, after the magnetic compass rotates in multiple different directions, the mean of the magnetic compass sensor readings in each orientation collected and calculated is used for iterative calculation to optimize the model parameters.
[0096] It should be noted that before calibration, it is necessary to ensure that the support surface is in close contact with all surfaces of the product, roughly adjust the support surface to a horizontal level, and use a portable device to make the vertical support surface roughly point to geographic north.
[0097] In the specific implementation, before calibration, it is necessary to ensure that all surfaces of the product fit tightly against the backrest to reduce errors caused by gaps. Furthermore, the backrest is roughly adjusted to be level to reduce errors introduced by non-level backrests. Furthermore, a portable device (such as a compass) is used to roughly adjust the vertical backrest to point to geographic north to provide an initial reference direction. During the calibration process, ensure that the product tooling is rotated at a precise angle (such as every 90°) and collect data after each position is stabilized. Finally, the program should automatically identify and eliminate time periods of magnetic field interference to ensure the accuracy of the calibration results.
[0098] It should be noted that after the turntable is pointed to the north and leveled, the product fixture is rotated 24 positions in any order, including four 90° rotations when each axis is facing the positive and negative directions, and the product fixture is positioned close to the turntable working surface during each data collection. The program will automatically identify each steady-state segment and automatically eliminate the time period when magnetic field interference occurs.
[0099] In the specific implementation, first of all, it is necessary to ensure that the equipment, turntable and support surface are ready, and adjust the support surface to be roughly horizontal and pointing to geographic north. Then place the product tooling on the turntable and rotate it in a predetermined order (such as rotating 90° 4 times when each axis is facing the sky in the positive and negative directions), and collect magnetic compass and accelerometer data after each position is stable. Calculate the mean of the magnetic compass sensor readings at each position and eliminate possible magnetic field interference data. Use the calibration algorithm to iteratively calculate the preprocessed data, optimize parameters such as non-orthogonal factors, zero bias, scale factor, magnetic declination and magnetic inclination, until the difference between the model and the input data is minimized. Verify whether the calibration results meet the requirements. If necessary, repeat the calibration process to further improve the accuracy.
[0100] The calibrated parameters are applied to the magnetic compass sensor to improve the accuracy and reliability of magnetic field measurement.
[0101] From the above description, it can be seen that the magnetic compass error model calibration method provided by the present invention obtains the three-axis magnetic field data of the target magnetic compass in various postures, and combines the geographical location information (longitude and latitude) to determine the magnetic declination and magnetic inclination, and then accurately calculates the real geomagnetic data. The three-axis magnetic field data is converted using the geomagnetic conversion matrix, and the optimal solution of the objective function is solved by an iterative algorithm, which effectively corrects the cross-coupling error, sensor zero bias error and scale factor error of the magnetic compass, and then the error model of the target magnetic compass is calibrated according to the corrected three-axis magnetic field data.
[0102] It should be noted that the method of the embodiment of the present invention can be performed by a single device, such as a computer or a server. The method of this embodiment can also be applied in a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present invention, and the multiple devices will interact with each other to complete the described method.
[0103] It should be noted that some embodiments of the present invention are described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0104] Based on the same inventive concept, corresponding to the method provided in any of the above embodiments, the present invention also provides a magnetic compass error model calibration system.
[0105] refer to Figure 2 , is a schematic diagram of a magnetic compass error model calibration system provided in an embodiment of the present invention.
[0106] The system comprises: The measurement module 201 is configured to obtain three-axis magnetic field data of a target magnetic compass in a target posture; A first determination module 202 is configured to determine the magnetic declination and magnetic inclination of the target position according to the longitude and latitude of the target magnetic compass in the target posture; The second determination module 203 is configured to determine the real geomagnetic data under the target posture according to the magnetic declination and the magnetic inclination; The third determination module 204 is configured to determine the geomagnetic conversion matrix according to the three-axis magnetic field data; wherein the vector difference between the three-axis magnetic field data and the geomagnetic real data after the geomagnetic conversion matrix operation is not greater than a preset vector difference; The fourth determination module 205 is configured to determine the target function according to the real geomagnetic data and the geomagnetic conversion matrix; The iteration module 206 is configured to solve the objective function through an iterative algorithm to obtain an optimal solution of the objective function; The correction module 207 is configured to obtain corrected three-axis magnetic field data according to the geomagnetic conversion matrix corresponding to the optimal solution, and calculate the magnetic heading of the magnetic compass sensor according to the corrected three-axis magnetic field data.
[0107] According to a magnetic compass error model calibration system provided by the present invention, the three-axis magnetic field data of the target magnetic compass in various postures is obtained, and the magnetic declination and magnetic inclination are determined in combination with the geographical location information (longitude and latitude), so as to accurately calculate the real geomagnetic data. The three-axis magnetic field data is converted using the geomagnetic conversion matrix, and the optimal solution of the objective function is solved by an iterative algorithm, so as to effectively correct the cross-coupling error, sensor zero bias error and proportional factor error of the magnetic compass, and then the error model of the target magnetic compass is calibrated according to the corrected three-axis magnetic field data.
[0108] For the convenience of description, the above system is described as being divided into various modules according to their functions. Of course, when implementing the present invention, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0109] The system of the above embodiment is used to implement the corresponding method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0110] Based on the same inventive concept, corresponding to the method described in any of the above embodiments, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in any of the above embodiments when executing the program.
[0111] Figure 3 A more specific schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention, the device may include: a processor 310, a memory 320, an input / output interface 330, a communication interface 340 and a bus 350. The processor 310, the memory 320, the input / output interface 330 and the communication interface 340 are connected to each other in communication within the device through the bus 350.
[0112] The processor 310 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0113] The memory 320 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 320 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 320 and are called and executed by the processor 310.
[0114] The input / output interface 330 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0115] The communication interface 340 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0116] The bus 350 comprises a pathway that transmits information between the various components of the device (eg, the processor 310 , the memory 320 , the input / output interface 330 , and the communication interface 340 ).
[0117] It should be noted that, although the above device only shows the processor 310, the memory 320, the input / output interface 330, the communication interface 340 and the bus 350, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0118] The electronic device of the above embodiment is used to implement the corresponding method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.
[0119] Based on the same inventive concept, corresponding to the method described in any of the above embodiments, the present invention also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method described in any of the above embodiments.
[0120] The above-mentioned non-transitory computer-readable storage medium can be any available medium or data storage device that can be accessed by a computer, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NAND FLASH), solid-state drive (SSD)), etc.
[0121] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method described in any embodiment of the above exemplary method part, and have the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0122] In addition, although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted in the flow chart can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.
[0123] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0124] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The "first", "second" and similar words used in the embodiments of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0125] Although the spirit and principles of the present invention have been described with reference to several specific embodiments, it should be understood that the present invention is not limited to the specific embodiments disclosed, and the division into various aspects does not mean that the features in these aspects cannot be combined to benefit. This division is only for convenience of expression.
[0126] The present invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
[0127] The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
Claims
1. A magnetic compass error model calibration method, characterized in that: include: Acquire the three-axis magnetic field data of the target magnetic compass in the target attitude; Determine the magnetic declination and magnetic inclination of the target position according to the longitude and latitude of the target magnetic compass in the target posture; Determine the real geomagnetic data under the target posture according to the magnetic declination and magnetic inclination; Determine the geomagnetic conversion matrix according to the three-axis magnetic field data; wherein the vector difference between the three-axis magnetic field data after the geomagnetic conversion matrix operation and the geomagnetic real data is not greater than a preset vector difference; Determine the objective function according to the real geomagnetic data and the geomagnetic conversion matrix; Solving the objective function through an iterative algorithm to obtain an optimal solution of the objective function; According to the geomagnetic conversion matrix corresponding to the optimal solution, corrected three-axis magnetic field data is obtained, and the magnetic heading of the magnetic compass sensor is calculated according to the corrected three-axis magnetic field data.
2. The magnetic compass error model calibration method according to claim 1, characterized in that: The step of obtaining the three-axis magnetic field data of the target magnetic compass in the target posture includes: The target magnetic compass is fixedly installed in a calibration tool, and the placement position of the calibration tool is changed to obtain different postures of the target magnetic compass. When the target magnetic compass is in a steady state, the three-axis magnetic field data of the target magnetic compass in at least twenty-four target postures are collected; wherein the calibration tool is a regular hexahedron tool.
3. The magnetic compass error model calibration method according to claim 1, characterized in that: Determining the magnetic declination and magnetic inclination of the target position according to the longitude and latitude of the target magnetic compass in the target posture includes: Acquiring the longitude and latitude of the target magnetic compass in the target posture; The longitude and latitude are input into the geomagnetic field model to obtain the magnetic declination and inclination of the target magnetic compass in the target posture.
4. The magnetic compass error model calibration method according to claim 1, characterized in that: The geomagnetic conversion matrix is expressed as: in, is the geomagnetic transformation matrix, is the magnetic declination of the target magnetic compass in the target attitude, is the cross-coupling error of the target magnetic compass in the X and Y axis directions, is the cross-coupling error of the target magnetic compass in the X and Z axis directions, is the cross-coupling error of the target magnetic compass in the Y and X axis directions, is the cross-coupling error of the target magnetic compass in the Y and Z axis directions, is the cross-coupling error of the target magnetic compass in the Z and X axis directions, is the cross-coupling error of the target magnetic compass in the Z and Y axis directions, is the component of the three-axis magnetic field data in the X-axis direction, is the component of the three-axis magnetic field data in the Y-axis direction, is the component of the three-axis magnetic field data in the Z-axis direction, is the sensor zero bias error of the target magnetic compass in the X-axis direction, is the sensor zero bias error of the target magnetic compass in the Y-axis direction, is the sensor zero bias error of the target magnetic compass in the Z-axis direction, is the scale factor error of the target magnetic compass in the X-axis direction, is the scale factor error of the target magnetic compass in the Y-axis direction, is the scale factor error of the target magnetic compass in the Z-axis direction.
5. The magnetic compass error model calibration method according to claim 1, characterized in that: The determining of the objective function according to the real geomagnetic data and the geomagnetic conversion matrix comprises: Determine a residual function according to the real geomagnetic data and the geomagnetic conversion matrix; Determine the L2 norm of the vector difference between the three-axis magnetic field data and the real geomagnetic data according to the residual function; The objective function is determined according to the L2 norm.
6. The magnetic compass error model calibration method according to claim 5, characterized in that: The residual function is expressed as: in, is the residual function, is the real geomagnetic data, is the geomagnetic transformation matrix.
7. The magnetic compass error model calibration method according to claim 6, characterized in that: The L2 norm is expressed as: in, is the L2 norm.
8. The magnetic compass error model calibration method according to claim 7, characterized in that: The objective function is expressed as: in, is the objective function.
9. The magnetic compass error model calibration method according to claim 8, characterized in that: The iterative algorithm includes: For the objective function, set an initial guess solution ; For the kth iteration, find an increment , so that the objective function is in the current solution Reaching a local minimum; Determine the increment at this time If the increment If the value of is less than the preset increment threshold, the iteration process is stopped; Let the next solution of the objective function be , and perform the k+1th iteration.
10. A magnetic compass error model calibration system, characterized in that: include: A measurement module is configured to obtain three-axis magnetic field data of a target magnetic compass at a target attitude; A first determination module is configured to determine the magnetic declination and magnetic inclination of the target position according to the longitude and latitude of the target magnetic compass in the target posture; A second determination module is configured to determine the real geomagnetic data under the target posture according to the magnetic declination and magnetic inclination; A third determination module is configured to determine a geomagnetic conversion matrix according to the three-axis magnetic field data; wherein the vector difference between the three-axis magnetic field data and the geomagnetic real data after the geomagnetic conversion matrix operation is not greater than a preset vector difference; A fourth determination module is configured to determine an objective function according to the real geomagnetic data and the geomagnetic conversion matrix; An iteration module is configured to solve the objective function through an iterative algorithm to obtain an optimal solution of the objective function; The correction module is configured to obtain corrected three-axis magnetic field data according to the geomagnetic conversion matrix corresponding to the optimal solution, and calculate the magnetic heading of the magnetic compass sensor according to the corrected three-axis magnetic field data.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 9 is implemented.
12. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause the computer to execute any one of claims 1 to 9.
Citation Information
Patent Citations
Method for simulating magnetic compass based on positioning attitude information, and magnetometer simulator
CN106556852A
Self-correcting electronic compass and method for correcting same
CN108088431A
Full compass error real-time calibration and compensation method for magnetic compass
CN111982089A
Magnetic sensor correction method and system based on INS / GNSS integrated navigation assistance
CN115507849A
Cited By
Measurement precision correction method for digital geological compass
CN121140750A