Automatic calibration method, system, medium and computer for geomagnetic sensor
By acquiring the three-axis data of the accelerometer, gyroscope and geomagnetic sensor, and calculating the difference in attitude angle and magnetic field extreme value, the automatic calibration of the geomagnetic sensor is achieved, solving the problems of manual intervention and inability to automatically adjust in the prior art, and improving the accuracy of the data.
Patent Information
- Application Number
- CN202410247353.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-05
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2044-03-05
AI Technical Summary
Existing geomagnetic sensor calibration methods require manual intervention and cannot be automatically adjusted in real time when magnetic field interferes.
Three-axis data is obtained through an accelerometer, gyroscope and geomagnetic sensor, and the attitude solver algorithm is used to calculate the attitude angle data, calculate the difference between the attitude angle and the magnetic field extreme value, and determine whether the calibration conditions are met. If they are met, automatic calibration will be performed.
Automatic calibration of geomagnetic sensors is realized without manual intervention, and can be adjusted in real time when magnetic field interference is interfered, improving data accuracy.
Smart Images

Figure CN118209134B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of sensor technology, and more specifically, to a geomagnetic sensor automatic calibration method, system, medium and computer. Background Art
[0002] Geomagnetic sensors are widely used in various electronic products such as mobile phones, watches, toys and virtual reality. They are mainly used in conjunction with accelerometer and gyroscope chips for spatial positioning to achieve navigation, gesture and posture recognition.
[0003] The working principle of the geomagnetic sensor is to determine the direction and angle of the product based on the difference in the magnetic flux components of the earth's magnetic field in different directions of the geomagnetic sensor. Therefore, in electronic products, the magnetic flux components of the earth's magnetic field in different directions of the geomagnetic sensor need to be accurately written into the product in order to determine the standard state of the product.
[0004] Currently, the commonly used calibration methods for geomagnetic sensors are plane calibration method and three-dimensional eight-shaped calibration method. These two methods mainly rely on the earth's own magnetic field to allow the product to rotate in a plane or three-dimensional space to determine the initial position and angle of the product. The disadvantages of these two methods are that they require manual activation of the calibration switch and cannot be automatically adjusted in real time when interfered by the magnetic field. Summary of the invention
[0005] In view of the shortcomings of the prior art, the purpose of the present invention is to provide a method, system, medium and computer for automatic calibration of a geomagnetic sensor, so as to overcome the disadvantage that the geomagnetic sensor in the prior art cannot be automatically calibrated.
[0006] The above technical objectives of the present invention are achieved through the following technical solutions: A method for automatic calibration of a geomagnetic sensor, comprising:
[0007] S1. Acquire three-axis acceleration data through an accelerometer, acquire three-axis angular velocity data through a gyroscope, and acquire three-axis magnetic field intensity data through a geomagnetic sensor;
[0008] S2, obtaining attitude angle data by using an attitude calculation algorithm according to the three-axis acceleration data, the three-axis angular velocity data and the three-axis magnetic field intensity data;
[0009] S3. Calculate the attitude angle extreme value difference according to the attitude angle data; calculate the magnetic field extreme value difference according to the three-axis magnetic field intensity data;
[0010] S4. Determine whether a geomagnetic sensor calibration condition is met based on the attitude angle extreme value difference and the magnetic field extreme value difference. If so, calibrate the geomagnetic sensor using the magnetic field extreme value difference.
[0011] Optionally, obtaining three-axis acceleration data through an accelerometer includes: obtaining X-axis acceleration data a x , Get Y-axis acceleration data a y And get the Z-axis acceleration data a z ;
[0012] The three-axis angular velocity data is obtained by the gyroscope, including: obtaining the X-axis angular velocity data ω x , Get the Y-axis angular velocity data ω y And get the Z-axis angular velocity data ω z ;
[0013] The method of obtaining three-axis magnetic field strength data by using a geomagnetic sensor includes: obtaining X-axis magnetic field strength data m xn , obtain the Y-axis magnetic field strength data m yn And obtain the Z-axis magnetic field strength data m zn ;
[0014] The method uses an attitude calculation algorithm to obtain attitude angle data based on the three-axis acceleration data, the three-axis angular velocity data, and the three-axis magnetic field intensity data, including: obtaining pitch angle data A pitch , obtain heading angle data A yaw And get the roll angle data A rol l.
[0015] Optionally, calculating the attitude angle extreme value difference according to the attitude angle data includes:
[0016] S31, pitch angle data A pitch Monitor and obtain the maximum pitch angle data A pitchmax and minimum pitch angle data A pitchmin ; Calculate the extreme difference of pitch angle PV pitch :PV pitch =A pitchmax -A pitchmin ;
[0017] S32, heading angle data A yaw Monitor and obtain the maximum heading angle data A yawmax and minimum heading angle data A yawmin ; Calculate the heading angle extreme value difference PV yaw :PV yaw =A yawmax -A yawmin ;
[0018] S33, roll angle data A roll Monitor and obtain the maximum roll angle data A rollmax and minimum roll angle data A rollmin ; Calculate the roll angle extreme value difference PVroll :PV roll =A rollmax -A rollmin .
[0019] Optionally, calculating the magnetic field extreme value difference according to the three-axis magnetic field intensity data includes:
[0020] S34, X-axis magnetic field strength data m xn Monitor and obtain the maximum X-axis magnetic field strength m xmax And the minimum X-axis magnetic field strength m xmin ; Calculate the extreme difference PV of the X-axis magnetic field intensity mx :PV mx =m xmax -m xmin ;
[0021] S35, Y-axis magnetic field strength data m yn Monitor and obtain the maximum Y-axis magnetic field strength m ymax And the minimum Y-axis magnetic field strength m ymin ; Calculate the extreme difference PV of the Y-axis magnetic field intensity my :PV my =my max -m ymin ;
[0022] S36, Z-axis magnetic field strength data m zn Monitor and obtain the maximum Z-axis magnetic field strength m zmax And the minimum Z-axis magnetic field strength m zmin ; Calculate the extreme difference PV of the Z-axis magnetic field intensity mz :PV mz =m zmax -m zmin .
[0023] Optionally, judging whether a geomagnetic sensor calibration condition is met according to the attitude angle extreme value difference and the magnetic field extreme value difference includes:
[0024] S41, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0025] [(PV mx >0.5G)∩(PV my >0.5G)∩(PVmz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]};
[0026] If yes, execute step S42;
[0027] S42, recording the current time point as the first time point, and resetting the attitude angle data;
[0028] S43, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0029] [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]};
[0030] If yes, execute step S44;
[0031] S44, recording the current time point as the second time point, and resetting the attitude angle data;
[0032] S45. Determine whether the time interval between the second time point and the first time point is greater than or equal to 30 seconds and less than or equal to 600 seconds. If so, determine whether the calibration condition of the geomagnetic sensor is met, calibrate the geomagnetic sensor using the magnetic field extreme value difference, reset the three-axis magnetic field intensity data, the first time point and the second time point, and re-execute step S41; if not, replace the first time point with the second time point, and re-execute step S43.
[0033] Optionally, the calibrating the geomagnetic sensor by using the magnetic field extreme value difference includes:
[0034] Using the X-axis magnetic field intensity extreme value difference PV mx Update the X-axis magnetic field strength bias m x0 :m x0 =PV mx / 2;
[0035] Using the X-axis magnetic field strength bias m x0 The X-axis magnetic field strength data m measured by the geomagnetic sensor xn Compensation is performed to obtain the actual magnetic field strength m of the X axis x :m x =m xn -m x0 ;
[0036] Using the extreme difference PV of the Y-axis magnetic field intensity my Update Y-axis magnetic field strength bias m y0 :m y0 =PV my / 2;
[0037] Using the Y-axis magnetic field strength bias m y0 Y-axis magnetic field strength data m measured by the geomagnetic sensor yn Compensation is performed to obtain the actual magnetic field strength m of the Y axis y :m y =m yn -m y0 ;
[0038] Using the Z-axis magnetic field intensity extreme value difference PV mz Update Z-axis magnetic field strength bias m z0 :m z0 =PV mz / 2;
[0039] Using the Z-axis magnetic field strength bias m z0 The Z-axis magnetic field strength data m measured by the geomagnetic sensor zn Compensation is performed to obtain the actual magnetic field strength m of the Z axis z :m z =m zn -m z0 .
[0040] Optionally, also include:
[0041] Get the data statistics time length T, determine the data statistics time length T, X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz, Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0042] (T>10min)∩(PV mx <0.5G)∩(PV my <0.5G)∩(PV mz <0.5G)∩(PV pitch <100°)∩(PV yaw <100°)∩(PV roll <100°)
[0043] If so, reset the attitude angle data, three-axis magnetic field strength data and statistical time length T.
[0044] The geomagnetic sensor automatic calibration system includes:
[0045] Data monitoring module: used to obtain three-axis acceleration data through the accelerometer, three-axis angular velocity data through the gyroscope, and three-axis magnetic field intensity data through the geomagnetic sensor;
[0046] Attitude angle calculation module: used to obtain attitude angle data by using attitude calculation algorithm according to the three-axis acceleration data, three-axis angular velocity data and three-axis magnetic field intensity data;
[0047] Extreme value difference calculation module: used to calculate the extreme value difference of the attitude angle according to the attitude angle data; calculate the extreme value difference of the magnetic field according to the three-axis magnetic field strength data;
[0048] The geomagnetic sensor calibration module is used to determine whether the geomagnetic sensor calibration conditions are met based on the attitude angle extreme value difference and the magnetic field extreme value difference. If so, the geomagnetic sensor is calibrated using the magnetic field extreme value difference.
[0049] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0050] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0051] In summary, the present invention proposes a geomagnetic sensor automatic calibration method, which does not require manual activation and can automatically and real-time calibrate the zero bias parameters of the geomagnetic sensor. The implementation method is simple and can effectively improve the accuracy of geomagnetic sensor data. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 This is a flow chart of the automatic calibration method of the geomagnetic sensor of the present invention;
[0053] Figure 2 It is a structural diagram of the geomagnetic sensor automatic calibration system of the present invention;
[0054] Figure 3 1 is a diagram showing the internal structure of a computer device in an embodiment of the present invention.
[0055] In the figure: 1. Data monitoring module; 2. Attitude angle calculation module; 3. Extreme value difference calculation module; 4. Geomagnetic sensor calibration module. DETAILED DESCRIPTION
[0056] In order to make the purpose, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings. Several embodiments of the present invention are shown in the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein.
[0057] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. The terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
[0058] In the present invention, unless otherwise clearly specified and limited, the first feature being "above" or "below" the second feature may include the first and second features being in direct contact, or may include the first and second features being in contact not directly but through another feature between them. Moreover, the first feature being "above", "above" and "above" the second feature includes the first feature being directly above and obliquely above the second feature, or simply indicates that the first feature is higher in level than the second feature. The first feature being "below", "below" and "below" the second feature includes the first feature being directly below and obliquely below the second feature, or simply indicates that the first feature is lower in level than the second feature. The terms "vertical", "horizontal", "left", "right", "above", "below" and similar expressions are for illustrative purposes only, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0059] The present invention is described in detail below in conjunction with the accompanying drawings and embodiments.
[0060] The present invention provides a method for automatically calibrating a geomagnetic sensor, such as Figure 1 As shown, including:
[0061] S1. Acquire three-axis acceleration data through an accelerometer, acquire three-axis angular velocity data through a gyroscope, and acquire three-axis magnetic field intensity data through a geomagnetic sensor;
[0062] S2, obtaining attitude angle data by using an attitude calculation algorithm according to the three-axis acceleration data, the three-axis angular velocity data and the three-axis magnetic field intensity data;
[0063] S3. Calculate the attitude angle extreme value difference according to the attitude angle data; calculate the magnetic field extreme value difference according to the three-axis magnetic field intensity data;
[0064] S4. Determine whether a geomagnetic sensor calibration condition is met based on the attitude angle extreme value difference and the magnetic field extreme value difference. If so, calibrate the geomagnetic sensor using the magnetic field extreme value difference.
[0065] In practical applications, the zero deviation of the sensor is caused by the characteristics of the sensor itself. It is difficult to achieve 100% accuracy during the manufacturing process. There are also reasons such as the influence of ambient temperature. There are mainly two cases of zero deviation of the sensor: 1. Static zero deviation: the deviation of the output when the sensor itself is not subjected to external force, also known as zero offset. 2. Dynamic zero deviation: the deviation of the output value drift caused by factors such as ambient temperature and working time when the sensor is working. The zero deviation of the sensor will seriously affect the measurement accuracy and stability of the sensor. If the sensor has a large zero deviation, the measurement error of the sensor will be large, and the minimum measurable range of the sensor may also change, and even cause the sensor to fail. In order to improve the accuracy of the geomagnetic sensor, it is necessary to calibrate the geomagnetic sensor in time. The traditional calibration method is mainly manual calibration, including plane calibration method and three-dimensional eight-character calibration method. These two methods mainly rely on the earth's own magnetic field to rotate the product in a plane or three-dimensional space, so as to determine the initial position and angle of the product. This method cannot be used in the navigation process, and requires manual intervention calibration, which cannot meet the actual needs. Therefore, this application provides an automatic calibration method. First, it is necessary to obtain acceleration data, angular velocity data and magnetic field strength data; and use these data to calculate the attitude angle data; based on the above monitored data, determine whether the current zero bias of the geomagnetic sensor meets the needs of the geomagnetic sensor. If it does, continue to measure. If not, it means that the geomagnetic sensor needs to be calibrated, so the geomagnetic sensor is calibrated using the magnetic field extreme value difference.
[0066] Furthermore, the obtaining of three-axis acceleration data by means of an accelerometer includes: obtaining X-axis acceleration data a x , Get Y-axis acceleration data a y And get the Z-axis acceleration data a z ;
[0067] The three-axis angular velocity data is obtained by the gyroscope, including: obtaining the X-axis angular velocity data ω x , Get the Y-axis angular velocity data ω y And get the Z-axis angular velocity data ω z ;
[0068] The method of obtaining three-axis magnetic field strength data by using a geomagnetic sensor includes: obtaining X-axis magnetic field strength data m xn , Get the Y-axis magnetic field strength data m yn And obtain the Z-axis magnetic field strength data m zn , where n refers to the nth magnetic field strength data of the X, Y and Z axes;
[0069] The method uses an attitude calculation algorithm to obtain attitude angle data based on the three-axis acceleration data, the three-axis angular velocity data, and the three-axis magnetic field intensity data, including: obtaining pitch angle data A pitch , obtain heading angle data A yaw And get the roll angle data A roll .
[0070] Further, the calculating the attitude angle extreme value difference according to the attitude angle data includes:
[0071] S31, pitch angle data A pitch Monitor and obtain the maximum pitch angle data A pitchmax and minimum pitch angle data A pitchmin ; Calculate the extreme difference of pitch angle PV pitch :PV pitch =A pitchmax -A pitchmin ;
[0072] S32, heading angle data A yaw Monitor and obtain the maximum heading angle data A yawmax and minimum heading angle data A yawmin ; Calculate the heading angle extreme value difference PV yaw :PV yaw =A yawmax -A yawmin ;
[0073] S33, roll angle data A roll Monitor and obtain the maximum roll angle data A rollmaxand minimum roll angle data A rollmin ; Calculate the roll angle extreme value difference PV roll :PV roll =A rollmax -A rollmin .
[0074] In practical applications, the pitch angle data A pitch Monitoring is based on the pitch angle data A pitch With the vertical coordinate and time as the horizontal coordinate, a time domain curve of the pitch angle data is established, and the maximum and minimum values on the time domain curve are monitored; and the pitch angle extreme value difference PV between the maximum and minimum values is calculated. pitch ; Similarly, for the heading angle data A yaw Monitor and analyze the roll angle data A roll For monitoring, corresponding time domain curves are established respectively, and the maximum and minimum values on the time domain curves are obtained respectively, and the difference therebetween is calculated.
[0075] Further, the calculating the magnetic field extreme value difference according to the three-axis magnetic field intensity data includes:
[0076] S34, X-axis magnetic field strength data m xn Monitor and obtain the maximum X-axis magnetic field strength m xmax And the minimum X-axis magnetic field strength m xmin ; Calculate the extreme difference PV of the X-axis magnetic field intensity mx :PV mx =m xmax -m xmin ;
[0077] S35, Y-axis magnetic field strength data m yn Monitor and obtain the maximum Y-axis magnetic field strength m ymax And the minimum Y-axis magnetic field strength m ymin ; Calculate the extreme difference PV of the Y-axis magnetic field intensity my :PV my =my max -my min ;
[0078] S36, Z-axis magnetic field strength data m zn Monitor and obtain the maximum Z-axis magnetic field strength m zmax And the minimum Z-axis magnetic field strength m zmin ; Calculate the extreme difference PV of the Z-axis magnetic field intensity mz :PV mz =m zmax -m zmin .
[0079] In practical applications, the X-axis magnetic field strength data mx The monitoring is based on the X-axis magnetic field strength data m x The X-axis magnetic field intensity time domain curve is established with time as the ordinate and the time as the abscissa; the maximum and minimum values on the time domain curve are monitored; and the X-axis magnetic field intensity extreme value difference PV between the maximum and minimum values is calculated. mx Similarly, for the Y-axis magnetic field strength data m y Monitor and calculate the Z-axis magnetic field strength data m z For monitoring, corresponding time domain curves are respectively established, and the maximum and minimum values on the time domain curves are respectively obtained, and the difference therebetween is calculated.
[0080] Further, judging whether the geomagnetic sensor calibration condition is met according to the attitude angle extreme value difference and the magnetic field extreme value difference includes:
[0081] S41, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0082] [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]};
[0083] If yes, execute step S42;
[0084] S42, recording the current time point as the first time point, and resetting the attitude angle data;
[0085] S43, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PVroll Whether it meets:
[0086] [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]};
[0087] If yes, execute step S44;
[0088] S44, recording the current time point as the second time point, and resetting the attitude angle data;
[0089] S45. Determine whether the time interval between the second time point and the first time point is greater than or equal to 30 seconds and less than or equal to 600 seconds. If so, determine whether the calibration condition of the geomagnetic sensor is met, calibrate the geomagnetic sensor using the magnetic field extreme value difference, reset the three-axis magnetic field intensity data, the first time point and the second time point, and re-execute step S41; if not, replace the first time point with the second time point, and re-execute step S43.
[0090] In practical applications, whether the geomagnetic sensor calibration conditions are met, the following conditions:
[0091] 1. Magnetic field extreme value difference PV in three directions mx PV my PV mz All are greater than 0.5 Gauss;
[0092] 2. The difference between any two attitude angle extremes is greater than 170°, that is, PV pitch PV yaw All greater than 170°, or PV pitch PV roll Greater than 170°, or PV roll PV yaw Greater than 170°;
[0093] The above two conditions are the ones mentioned above:
[0094] [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch>170°)∩(PV yaw >170°)]∪[(PV pitcg >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]};
[0095] When the above two conditions are met at the same time at a certain moment, the counting flag CNT is increased by 1, the data of the attitude angle is cleared, and the current reaching time point Tn is recorded;
[0096] When the count flag CNT is greater than or equal to 2, and T n -T n-1 In the interval of [30,600] seconds, the geomagnetic calibration mode is automatically entered, that is, the zero bias of the geomagnetic sensor is recalculated, and the original zero bias of the geomagnetic sensor is replaced by the new zero bias. When the two time points are less than 30 seconds or greater than 600 seconds, the geomagnetic sensor will not be reset, but 1 will be added to the counting flag, and at the next time point, it will be re-judged whether it is in the time interval. If so, it will enter the calibration mode, if not, continue the above statistical steps. When the geomagnetic sensor enters the geomagnetic calibration mode, the extreme value of the magnetic field strength is reset, and the extreme value of the magnetic field strength is restarted. The magnetic field is reset, and the time point is also reset, that is, the time point and the extreme value of the magnetic field strength are restarted.
[0097] In summary, the reset condition of the attitude angle is when the difference between any two attitude angle extreme values is greater than 170°; the reset condition of the geomagnetic sensor is when the geomagnetic sensor enters the calibration mode.
[0098] Furthermore, the calibrating the geomagnetic sensor by using the magnetic field extreme value difference includes:
[0099] Using the X-axis magnetic field intensity extreme value difference PV mx Update the X-axis magnetic field strength bias m x0 :m x0 =PV mx / 2;
[0100] Using the X-axis magnetic field strength bias m x0 The X-axis magnetic field strength data m measured by the geomagnetic sensor xn Compensation is performed to obtain the actual magnetic field strength m of the X axis x :m x =m xn -m x0 ;
[0101] Using the extreme difference PV of the Y-axis magnetic field intensity myUpdate Y-axis magnetic field strength bias m y0 :m y0 =PV my / 2;
[0102] Using the Y-axis magnetic field strength bias m y0 Y-axis magnetic field strength data m measured by the geomagnetic sensor yn Compensation is performed to obtain the actual magnetic field strength m of the Y axis y :m y =m yn -m y0 ;
[0103] Using the Z-axis magnetic field intensity extreme value difference PV mz Update Z-axis magnetic field strength bias m z0 :m z0 =PV mz / 2;
[0104] Using the Z-axis magnetic field strength bias m z0 The Z-axis magnetic field strength data m measured by the geomagnetic sensor zn Compensation is performed to obtain the actual magnetic field strength m of the Z axis z :m z =m zn -m z0 .
[0105] Furthermore, it also includes:
[0106] Get the data statistics time length T, determine the data statistics time length T, X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0107] (T>10min)∩(PV mx <0.5G)∩(PV my <0.5G)∩(PV mz <0.5G)∩(PV pitch <100°)∩(PV yaw <100°)∩(PV rol l<100°)
[0108] If so, reset the attitude angle data, three-axis magnetic field strength data and statistical time length T.
[0109] In practical applications, in order to eliminate the influence of location changes on the magnetic field during long-term use and make the geomagnetic correction more accurate, it is necessary to reset the data in the geomagnetic sensor after a certain period of time, that is, when the data statistical time length T is greater than 10 minutes, but the pitch angle extreme value difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll All are less than 100°, and the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz If all are less than 0.5 Gauss, the attitude angle data, three-axis magnetic field strength data and statistical time length T need to be reset to ensure the accuracy of the data.
[0110] like Figure 2 As shown, the present invention also provides a geomagnetic sensor automatic calibration system, comprising:
[0111] Data monitoring module: used to obtain three-axis acceleration data through the accelerometer, three-axis angular velocity data through the gyroscope, and three-axis magnetic field intensity data through the geomagnetic sensor;
[0112] Attitude angle calculation module: used to obtain attitude angle data by using attitude calculation algorithm according to the three-axis acceleration data, three-axis angular velocity data and three-axis magnetic field intensity data;
[0113] Extreme value difference calculation module: used to calculate the extreme value difference of the attitude angle according to the attitude angle data; calculate the extreme value difference of the magnetic field according to the three-axis magnetic field strength data;
[0114] The geomagnetic sensor calibration module is used to determine whether the geomagnetic sensor calibration conditions are met based on the attitude angle extreme value difference and the magnetic field extreme value difference. If so, the geomagnetic sensor is calibrated using the magnetic field extreme value difference.
[0115] For the specific definition of the geomagnetic sensor automatic calibration system, please refer to the definition of the geomagnetic sensor automatic calibration method above, which will not be repeated here. Each module in the above-mentioned geomagnetic sensor automatic calibration system can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0116] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 3As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the automatic calibration method of the geomagnetic sensor is implemented.
[0117] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0118] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0119] S1. Acquire three-axis acceleration data through an accelerometer, acquire three-axis angular velocity data through a gyroscope, and acquire three-axis magnetic field intensity data through a geomagnetic sensor;
[0120] S2, obtaining attitude angle data by using an attitude calculation algorithm according to the three-axis acceleration data, the three-axis angular velocity data and the three-axis magnetic field intensity data;
[0121] S3. Calculate the attitude angle extreme value difference according to the attitude angle data; calculate the magnetic field extreme value difference according to the three-axis magnetic field intensity data;
[0122] S4. Determine whether a geomagnetic sensor calibration condition is met based on the attitude angle extreme value difference and the magnetic field extreme value difference. If so, calibrate the geomagnetic sensor using the magnetic field extreme value difference.
[0123] In one embodiment, the obtaining of three-axis acceleration data by an accelerometer includes: obtaining X-axis acceleration data a x , Get Y-axis acceleration data a y And get the Z-axis acceleration data a z ;
[0124] The three-axis angular velocity data is obtained by the gyroscope, including: obtaining the X-axis angular velocity data ω x , Get the Y-axis angular velocity data ω y And get the Z-axis angular velocity data ω z ;
[0125] The method of obtaining three-axis magnetic field strength data by using a geomagnetic sensor includes: obtaining X-axis magnetic field strength data m x , Get the Y-axis magnetic field strength data m y And obtain the Z-axis magnetic field strength data m z ;
[0126] The method uses an attitude calculation algorithm to obtain attitude angle data based on the three-axis acceleration data, the three-axis angular velocity data, and the three-axis magnetic field intensity data, including: obtaining pitch angle data A pitch , obtain heading angle data A yaw And get the roll angle data A roll .
[0127] In one embodiment, the step of calculating the attitude angle extreme value difference according to the attitude angle data includes:
[0128] S31, pitch angle data A pitch Monitor and obtain the maximum pitch angle data A pitchmax and minimum pitch angle data A pitchmin ; Calculate the extreme difference of pitch angle PV pitch :PV pitch =A pitchmax -A pitchmin ;
[0129] S32, heading angle data A yaw Monitor and obtain the maximum heading angle data A yawmax and minimum heading angle data A yawmin ; Calculate the heading angle extreme value difference PV yaw :PV yaw =A yawmax -A yawmin ;
[0130] S33, roll angle data A roll Monitor and obtain the maximum roll angle data A rollmax and minimum roll angle data A rollmin ; Calculate the roll angle extreme value difference PV roll :PV roll =A rollmax -A rollmin .
[0131] In one embodiment, calculating the magnetic field extreme value difference according to the three-axis magnetic field strength data includes:
[0132] S34, X-axis magnetic field strength data m x Monitor and obtain the maximum X-axis magnetic field strength m xmax And the minimum X-axis magnetic field strength m xmin; Calculate the extreme difference PV of the X-axis magnetic field intensity mx :PV mx =m xmax -m xmin ;
[0133] S35, Y-axis magnetic field strength data m y Monitor and obtain the maximum Y-axis magnetic field strength m ymax And the minimum Y-axis magnetic field strength m ymin ; Calculate the extreme difference PV of the Y-axis magnetic field intensity my :PV my =m ymax -m ymin ;
[0134] S36, Z-axis magnetic field strength data m z Monitor and obtain the maximum Z-axis magnetic field strength m zmax And the minimum Z-axis magnetic field strength m zmin ; Calculate the extreme difference PV of the Z-axis magnetic field intensity mz :PV mz =m zmax -m zmin .
[0135] In one embodiment, judging whether a geomagnetic sensor calibration condition is met according to the attitude angle extreme value difference and the magnetic field extreme value difference includes:
[0136] S41, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0137] [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]};
[0138] If yes, execute step S42;
[0139] S42, recording the current time point as the first time point, and resetting the attitude angle data;
[0140] S43, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0141] [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]};
[0142] If yes, execute step S44;
[0143] S44, recording the current time point as the second time point, and resetting the attitude angle data;
[0144] S45. Determine whether the time interval between the second time point and the first time point is greater than or equal to 30 seconds and less than or equal to 600 seconds. If so, determine whether the calibration condition of the geomagnetic sensor is met, calibrate the geomagnetic sensor using the magnetic field extreme value difference, reset the three-axis magnetic field intensity data, the first time point and the second time point, and re-execute step S41; if not, replace the first time point with the second time point, and re-execute step S43.
[0145] In one embodiment, the calibrating the geomagnetic sensor using the magnetic field extreme value difference includes:
[0146] Using the X-axis magnetic field intensity extreme value difference PV mx Update the X-axis magnetic field strength bias m x0 :m x0 =PV mx / 2;
[0147] Using the X-axis magnetic field strength bias m x0 The X-axis magnetic field strength m measured by the geomagnetic sensor xnCompensation is performed to obtain the actual magnetic field strength m of the X axis x :m x =m xn -m x0 ;
[0148] Using the extreme difference PV of the Y-axis magnetic field intensity my Update Y-axis magnetic field strength bias m y0 :m y0 =PV my / 2;
[0149] Using the Y-axis magnetic field strength bias m y0 Y-axis magnetic field strength m measured by the geomagnetic sensor yn Compensation is performed to obtain the actual magnetic field strength m of the Y axis y :m y =m yn -m y0 ;
[0150] Using the Z-axis magnetic field intensity extreme value difference PV mz Update Z-axis magnetic field strength bias m z0 :m z0 =PV mz / 2;
[0151] Using the Z-axis magnetic field strength bias m z0 The Z-axis magnetic field strength m measured by the geomagnetic sensor zn Compensation is performed to obtain the actual magnetic field strength m of the Z axis z :m z =m zn -m z0 .
[0152] In one embodiment, it further includes:
[0153] Get the data statistics time length T, determine the data statistics time length T, X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets:
[0154] (T>10min)∩(PV mx <0.5G)∩(PV my <0.5G)∩(PV mz <0.5G)∩(PV pitch <100°)∩(PV yaw <100°)∩(PVroll <100°)
[0155] If so, reset the attitude angle data, three-axis magnetic field strength data and statistical time length T.
[0156] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0157] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0158] The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above embodiments. All technical solutions under the concept of the present invention belong to the protection scope of the present invention. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present invention should also be regarded as the protection scope of the present invention.
Claims
1. A method for automatic calibration of a geomagnetic sensor, characterized in that: include: S1. Acquire three-axis acceleration data through an accelerometer, acquire three-axis angular velocity data through a gyroscope, and acquire three-axis magnetic field intensity data through a geomagnetic sensor; S2, obtaining attitude angle data by using an attitude calculation algorithm according to the three-axis acceleration data, the three-axis angular velocity data and the three-axis magnetic field intensity data; S3, calculating the attitude angle extreme value difference according to the attitude angle data; Calculating the magnetic field extreme value difference according to the three-axis magnetic field intensity data; S4, judging whether the geomagnetic sensor calibration condition is met according to the attitude angle extreme value difference and the magnetic field extreme value difference, including: S41, judging the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets: [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]}; If yes, execute step S42; S42, recording the current time point as the first time point, and resetting the attitude angle data; S43, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets: [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]}; If yes, execute step S44; S44, recording the current time point as the second time point, and resetting the attitude angle data; S45, determining whether the time interval between the second time point and the first time point is greater than or equal to 30 seconds and less than or equal to 600 seconds, if so, determining that the geomagnetic sensor calibration condition is met, calibrating the geomagnetic sensor using the magnetic field extreme value difference, resetting the three-axis magnetic field intensity data, the first time point and the second time point, and re-executing step S41; If not, the second time point is used to replace the first time point, and step S43 is executed again; If it is satisfied, the geomagnetic sensor is calibrated using the magnetic field extreme value difference.
2. The automatic calibration method of geomagnetic sensor according to claim 1, characterized in that: The method of obtaining the three-axis acceleration data by the accelerometer includes: obtaining the X-axis acceleration data a x , Get Y-axis acceleration data a y And get the Z-axis acceleration data a z ; The three-axis angular velocity data is obtained by the gyroscope, including: obtaining the X-axis angular velocity data ω x 、Get Y-axis angular velocity data ω y And get the Z-axis angular velocity data ω z ; The method of obtaining three-axis magnetic field strength data by using a geomagnetic sensor includes: obtaining X-axis magnetic field strength data m xn , obtain the Y-axis magnetic field strength data m yn And obtain the Z-axis magnetic field strength data m zn ; The attitude angle data is obtained by using an attitude calculation algorithm according to the three-axis acceleration data, the three-axis angular velocity data and the three-axis magnetic field strength data, including: obtaining pitch angle data A pitch , obtain heading angle data A yaw And get the roll angle data A roll .
3. The automatic calibration method of geomagnetic sensor according to claim 2, characterized in that: The step of calculating the attitude angle extreme value difference according to the attitude angle data comprises: S31, pitch angle data A pitch Monitor and obtain the maximum pitch angle data A pitchmax and minimum pitch angle data A pitchmin ; Calculate the pitch angle extreme difference PV pitch :PV pitch =A pitchmax -A pitchmin ; S32, heading angle data A yaw Monitor and obtain the maximum heading angle data A yawmax and minimum heading angle data A yawmin ; Calculate the heading angle extreme value difference PV yaw :PV yaw =A yawmax -A yawmin ; S33, roll angle data A roll Monitor and obtain the maximum roll angle data A rollmax and minimum roll angle data A rollmin ; Calculate the roll angle extreme value difference PV roll :PV roll =A rollmax -A rollmin .
4. The automatic calibration method of geomagnetic sensor according to claim 3, characterized in that: The step of calculating the magnetic field extreme value difference according to the three-axis magnetic field intensity data comprises: S34, X-axis magnetic field strength data m xn Monitor and obtain the maximum X-axis magnetic field strength m xmax And the minimum X-axis magnetic field strength m xmin ; Calculate the extreme difference PV of the X-axis magnetic field intensity mx :PV mx =m xmax -m xmin ; S35, Y-axis magnetic field strength data m yn Monitor and obtain the maximum Y-axis magnetic field strength m ymax And the minimum Y-axis magnetic field strength m ymin ; Calculate the extreme difference PV of the Y-axis magnetic field intensity my :PV my =m ymax -m ymin ; S36, Z-axis magnetic field strength data m zn Monitor and obtain the maximum Z-axis magnetic field strength m zmax And the minimum Z-axis magnetic field strength m zmin ; Calculate the extreme difference PV of the Z-axis magnetic field intensity mz :PV mz =m zmax -m zmin .
5. The automatic calibration method of geomagnetic sensor according to claim 1, characterized in that: The method of calibrating the geomagnetic sensor by using the magnetic field extreme value difference comprises: Using the X-axis magnetic field intensity extreme value difference PV mx Update the X-axis magnetic field strength bias m x0 :m x0 =PV mx / 2; Using the X-axis magnetic field strength bias m x0 The X-axis magnetic field strength data m measured by the geomagnetic sensor xn Compensation is performed to obtain the actual magnetic field strength m of the X axis x :m x =m xn -m x0 ; Using the extreme difference PV of the Y-axis magnetic field intensity my Update Y-axis magnetic field strength bias m y0 :m y0 =PV my / 2; Using the Y-axis magnetic field strength bias m y0 Y-axis magnetic field strength data m measured by the geomagnetic sensor yn Compensation is performed to obtain the actual magnetic field strength m of the Y axis y :m y =m yn -m y0 ; Using the Z-axis magnetic field intensity extreme value difference PV mz Update Z-axis magnetic field strength bias m z0 :m z0 =PV mz / 2; Using the Z-axis magnetic field strength bias m z0 The Z-axis magnetic field strength data m measured by the geomagnetic sensor zn Compensation is performed to obtain the actual magnetic field strength m of the Z axis z :m z =m zn -m z0 .
6. The automatic calibration method of geomagnetic sensor according to claim 5, characterized in that: Also includes: Get the data statistics time length T, determine the data statistics time length T, X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets: (T>10min)∩(PV mx <0.5G)∩(PV my <0.5G)∩(PV mz <0.5G)∩(PV pitch <100°)∩(PV yaw <100°)∩(PV roll <100°) If so, reset the attitude angle data, three-axis magnetic field strength data and statistical time length T.
7. The geomagnetic sensor automatic calibration system is characterized by: include: Data monitoring module: used to obtain three-axis acceleration data through the accelerometer, three-axis angular velocity data through the gyroscope, and three-axis magnetic field intensity data through the geomagnetic sensor; Attitude angle calculation module: used to obtain attitude angle data by using attitude calculation algorithm according to the three-axis acceleration data, three-axis angular velocity data and three-axis magnetic field intensity data; Extreme value difference calculation module: used for calculating the extreme value difference of the attitude angle according to the attitude angle data; Calculating the magnetic field extreme value difference according to the three-axis magnetic field intensity data; The geomagnetic sensor calibration module is used to determine whether the geomagnetic sensor calibration conditions are met according to the attitude angle extreme value difference and the magnetic field extreme value difference, including: S41, determine the extreme difference PV of the X-axis magnetic field intensity mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets: [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]}; If yes, execute step S42; S42, recording the current time point as the first time point, and resetting the attitude angle data; S43, determining the X-axis magnetic field intensity extreme value difference PV mx , Y-axis magnetic field intensity extreme value difference PV my , Z-axis magnetic field intensity extreme value difference PV mz , Pitch angle extreme difference PV pitch , heading angle extreme value difference PV yaw And the roll angle extreme difference PV roll Whether it meets: [(PV mx >0.5G)∩(PV my >0.5G)∩(PV mz >0.5G)]∩{[(PV pitch >170°)∩(PV yaw >170°)]∪[(PV pitch >170°)∩(PV roll >170°)]∪[(PV roll >170°)∩(PV yaw >170°)]}; If yes, execute step S44; S44, recording the current time point as the second time point, and resetting the attitude angle data; S45. Determine whether the time interval between the second time point and the first time point is greater than or equal to 30 seconds and less than or equal to 600 seconds. If so, determine that the calibration condition of the geomagnetic sensor is met, calibrate the geomagnetic sensor using the magnetic field extreme value difference, reset the three-axis magnetic field intensity data, the first time point and the second time point, and re-execute step S41; if not, replace the first time point with the second time point, and re-execute step S43; if satisfied, calibrate the geomagnetic sensor using the magnetic field extreme value difference.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Passive integrated positioning method based on space environment magnetic field characteristics
CN107421546A
Method and device for correcting magnetic field in plane
CN110031020A