The content of the invention
The many aspects of the present invention provide a kind of magnetometer calibration method and apparatus, to improve the standard to magnetometer calibration
True property.
The embodiment of the present invention provides a kind of magnetometer calibration method, including:
From three axles of magnetometer, the first axle to be measured and the second axle to be measured are selected;Wherein, the described first axle to be measured and institute
State any two axle in three axles that the second axle to be measured is the magnetometer;
In the magnetometer in the described first axle to be measured and the second axle institute to be measured planar around the 3rd axle rotation to be measured
During turning, the described first axle to be measured is read respectively and second axle to be measured is rotated to multiple specified angles in the magnetometer
When multiple measured values;Wherein, the 3rd axle to be measured is to remove the described first axle to be measured and institute in three axles of the magnetometer
State the axle outside the second axle to be measured;
According to multiple measured value fitted ellipse sides of multiple measured values of the described first axle to be measured, second axle to be measured
Journey;
According to the elliptic equation to the actual measured value of the described first axle to be measured and the actual survey of second axle to be measured
Value is calibrated, and obtains the calibration value of first axle to be measured and the calibration value of second axle to be measured.
Alternatively, for the first specified angle in the multiple specified angle, described to read described first respectively to be measured
The measured value of axle and second axle to be measured when the magnetometer is rotated to first specified angle, including:
In the magnetometer in the described first axle to be measured and the second axle institute to be measured planar around the 3rd axle rotation to be measured
During turning, obtain the magnetometer three axles of accelerometer in a device acceleration magnitude;Wherein, described first treat
Plane where surveying axle and second axle to be measured is non-horizontal surface;
By the acceleration magnitude of three axles of the accelerometer in anglec of rotation pass corresponding with benchmark 3-axis acceleration value
Matched in system;
When the acceleration magnitude of three axles of the accelerometer axle of benchmark three corresponding with first specified angle accelerates
When angle value matches, reading first axle to be measured and second axle to be measured rotate to described first in the magnetometer and specified
Measured value during angle.
Alternatively, the reading first axle to be measured and second axle to be measured are rotated to described the in the magnetometer
Measured value during one specified angle, including:
Read at least two of the described first axle to be measured and second axle to be measured when the magnetometer rotates along the horizontal plane
Individual measured value;
The described first axle to be measured and second axle to be measured are asked for respectively when the magnetometer rotates along the horizontal plane extremely
The average value of few two measured values, rotates to described as the described first axle to be measured and second axle to be measured in the magnetometer
Measured value during the first specified angle.
Alternatively, methods described also includes the following at least one information of display:
Show benchmark 3-axis acceleration value corresponding to first specified angle;
Show the acceleration magnitude of three axles of the accelerometer;
When the acceleration magnitude of three axles of the accelerometer axle of benchmark three corresponding with first specified angle accelerates
When angle value matches, the information that the match is successful is shown;
When the magnetometer rotates along the horizontal plane, if the acceleration magnitude of three axles of the accelerometer and described first
Benchmark 3-axis acceleration value corresponding to specified angle mismatches, and shows horizontal plane prompt message.
Alternatively, it is described read respectively the described first axle to be measured and second axle to be measured the magnetometer rotate to
Before multiple measured values during multiple specified angles, methods described also includes:
In the range of 360 degree, multiple specified angles are uniformly determined;Wherein, the multiple is more than or equal to 5.
The embodiment of the present invention also provides a kind of electronic equipment, including processor and the storage that is connected with the processor
Device;
The memory, for storing one or more computer instruction;
The processor, for performing one or more computer instruction, for:
From three axles of magnetometer, the first axle to be measured and the second axle to be measured are selected;Wherein, the described first axle to be measured and institute
State any two axle in three axles that the second axle to be measured is the magnetometer;
In the magnetometer in the described first axle to be measured and the second axle institute to be measured planar around the 3rd axle rotation to be measured
During turning, the described first axle to be measured is read respectively and second axle to be measured is rotated to multiple specified angles in the magnetometer
When multiple measured values;Wherein, the 3rd axle to be measured is to remove the described first axle to be measured and institute in three axles of the magnetometer
State the axle outside the second axle to be measured;
According to multiple measured value fitted ellipse sides of multiple measured values of the described first axle to be measured, second axle to be measured
Journey;
According to the elliptic equation to the actual measured value of the described first axle to be measured and the actual survey of second axle to be measured
Value is calibrated, and obtains the calibration value of first axle to be measured and the calibration value of second axle to be measured.
Alternatively, for the first specified angle in the multiple specified angle, the processor, it is additionally operable to:
In the magnetometer in the described first axle to be measured and the second axle institute to be measured planar around the 3rd axle rotation to be measured
During turning, obtain the magnetometer three axles of accelerometer in a device acceleration magnitude;Wherein, described first treat
Plane where surveying axle and second axle to be measured is non-horizontal surface;
By the acceleration magnitude of three axles of the accelerometer in anglec of rotation pass corresponding with benchmark 3-axis acceleration value
Matched in system;
When the acceleration magnitude of three axles of the accelerometer axle of benchmark three corresponding with first specified angle accelerates
When angle value matches, reading first axle to be measured and second axle to be measured rotate to described first in the magnetometer and specified
Measured value during angle.
Alternatively, the processor, is additionally operable to:
Read at least two of the described first axle to be measured and second axle to be measured when the magnetometer rotates along the horizontal plane
Individual measured value;
The described first axle to be measured and second axle to be measured are asked for respectively when the magnetometer rotates along the horizontal plane extremely
The average value of few two measured values, rotates to described as the described first axle to be measured and second axle to be measured in the magnetometer
Measured value during the first specified angle.
Alternatively, the electronic equipment also includes the display being connected with the processor;
The display is used to show following at least one information:
Show benchmark 3-axis acceleration value corresponding to first specified angle;
Show the acceleration magnitude of three axles of the accelerometer;
When the acceleration magnitude of three axles of the accelerometer axle of benchmark three corresponding with first specified angle accelerates
When angle value matches, the information that the match is successful is shown;
When the magnetometer rotates along the horizontal plane, if the acceleration magnitude of three axles of the accelerometer and described first
Benchmark 3-axis acceleration value corresponding to specified angle mismatches, and shows horizontal plane prompt message.
Alternatively, the processor, is additionally operable to:
In the range of 360 degree, multiple specified angles are uniformly determined;Wherein, the multiple is more than or equal to 5.
In embodiments of the present invention, compared to 8 word calibration method of the prior art, magnetometer is in the first axle to be measured and second
Axle to be measured institute is planar around the 3rd axle rotation to be measured, the specification rotation mode of magnetometer, if magnetometer is user's rotation
, then it is convenient for the user to operate;Further, rotated by reading the first axle to be measured and the second axle to be measured respectively in magnetometer to multiple
Multiple measured values during specified angle, the specification reading manner of measured value;And then revolved in magnetometer in a manner of specification
Multiple measured values are read when turning in a manner of specification, and are fitted according to multiple measured values of reading for entering to actual measured value
The elliptic equation of row calibration, improves the accuracy of elliptic equation, further improves the accuracy to magnetometer calibration.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with the specific embodiment of the invention and
Technical solution of the present invention is clearly and completely described corresponding accompanying drawing.Obviously, described embodiment is only the present invention one
Section Example, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not doing
Go out under the premise of creative work the every other embodiment obtained, belong to the scope of protection of the invention.
Below in conjunction with accompanying drawing, the technical scheme that various embodiments of the present invention provide is described in detail.
Fig. 1 is the schematic flow sheet for the magnetometer calibration method that one embodiment of the invention provides.As shown in figure 1, this method
Comprise the following steps:
101st, from three axles of magnetometer, the first axle to be measured and the second axle to be measured are selected;Wherein, the first axle to be measured and
Two axles to be measured be magnetometer three axles in any two axle.
102nd, magnetometer in the first axle to be measured and the second axle to be measured institute planar in the 3rd axle rotary course to be measured,
The multiple measured values of the first axle to be measured and the second axle to be measured when magnetometer is rotated to multiple specified angles are read respectively;Wherein,
3rd axle to be measured be magnetometer three axles in axle in addition to the first axle to be measured and the second axle to be measured.
103rd, according to multiple measured values of the first axle to be measured, multiple measured values of the second axle to be measured and multiple specified angles
Degree, fitted ellipse equation.
104th, the actual measured value of the first axle to be measured and the actual measured value of the second axle to be measured are carried out according to elliptic equation
Calibration, obtain the calibration value of the first axle to be measured and the calibration value of the second axle to be measured.
The sensor that magnetometer is intensity by measuring magnetic field and direction to position equipment.Magnetometer typically has
Three mutually perpendicular axles, for example, X-axis, Y-axis and Z axis, for measuring the magnetic induction intensity value on three directions.Yet with
Magnetic field of the earth only has 0.5 faint Gauss in general, and a common Mobile phone horn still has when at a distance of 2 centimetres
The magnetic field of about 4 Gausses, a motor for cell phone have the magnetic field of about 6 Gausses when at a distance of 2 centimetres, and this feature to be directed to
The measurement in electronic equipment surface magnetic field of the earth is highly susceptible to the interference of electronic equipment in itself.It is therefore desirable to accurately to magnetometer
Measurement data calibrated, to obtain accurate magnetic induction intensity value.
At step 101, any two axle in three axles can be selected as the first axle to be measured and the second axle to be measured.Example
Such as, X-axis and Y-axis is selected to select Y-axis and Z axis as axle to be measured, or selection X-axis and Z axis are as axle to be measured as axle to be measured.
No matter any two axles are selected, and the method that its processing method all same, i.e. step 102, step 103 and subsequent embodiment provide is equal
It is identical.In order to describe simplicity, the present embodiment selects Y-axis to describe this in detail as the second axle to be measured as the first axle to be measured, Z axis
The method that embodiment provides.
At step 102, either mechanical arm can operate magnetometer or the interior equipment rotation provided with magnetometer to user,
Keep magnetometer in its first axle to be measured and the second axle institute to be measured planar around the 3rd axle rotation to be measured when rotated.If the
One axle to be measured is that Y-axis, the second axle to be measured are Z axis, then.3rd axle to be measured be exactly magnetometer three axles in except Y-axis and Z axis it
Outer X-axis.
It is alternatively possible to from being started rotation, the angle of the first axle rotation to be measured or the second axle to be measured are rotated
The angle that angle rotates as magnetometer.When the angle of magnetometer rotation is default specified angle, the first axle to be measured is read
With the measured value of the second axle to be measured.Wherein, specified angle is multiple to rotate to each of multiple specified angles and specify in magnetometer
During angle, it is intended to read the measured value of the first axle to be measured and the second axle to be measured.So, rotated in magnetometer to multiple specified angles
When, or multiple measured values of the corresponding multiple measured values and the second axle to be measured for reading the first axle to be measured.
When in the absence of extraneous magnetic disturbance, in magnetometer in the first axle to be measured and the second axle institute to be measured planar around the 3rd
In axle rotary course to be measured, the obtained rounded distribution of multiple measured values, and the center of circle is located at the first axle to be measured and the second axle to be measured
Point of intersection.When magnetic disturbance be present in the external world, in step 102, multiple measurements of the magnetometer when rotation is to multiple specified angles
It is worth oval distribution, and oval center may not be located at the point of intersection of the first axle to be measured and the second axle to be measured.Based on this,
Step 103 place, multiple measured values of multiple measured values of the obtained in step 102 first axle to be measured and the second axle to be measured are distinguished
As two coordinate values of multiple coordinate points, the coordinate value of multiple coordinate points is thus obtained.Then according to multiple coordinate points
Coordinate value fitted ellipse equation.It is alternatively possible to directly the coordinate value of obtained multiple coordinate points is brought into elliptic equation,
The unknown number in elliptic equation is solved, to obtain elliptic equation.
Wherein, elliptic equation is used in actual applications, enter the actual measured value of the first axle to be measured and the second axle to be measured
Row calibration.In actual applications, magnetometer may be planar to be measured around the 3rd in the first axle to be measured and the second axle institute to be measured
Axle rotates, it is also possible to will not.Based on this, the actual measured value of the actual measured value of the first axle to be measured and the second axle to be measured is
For example, using Y-axis as the first axle to be measured, Z axis is as the second axle to be measured, and then according to the multiple gaugers and Z of Y-axis
Multiple measured value fitted ellipse equations of axle.Because elliptic equation is multiple measured values plan with the multiple measured values and Z axis of Y-axis
Close out, obtained elliptic equation is used to calibrate the actual measured value of Y-axis and Z axis.
In addition to using Y-axis and Z axis as axle to be measured, in the present embodiment can also using X-axis and Y-axis as axle to be measured, and
Magnetometer planar about the z axis in rotary course, reads X-axis respectively and Y-axis is rotated to multiple in magnetometer in X-axis and Y-axis institute
Multiple measured values during specified angle;According to multiple measured values of X-axis, multiple measured value fitted ellipse equations of Y-axis, this is ellipse
Equation of a circle is used to calibrate the actual measured value of X-axis and Y-axis.This completes the calibration to X-axis, Y-axis and Z axis.For
The accuracy of calibration is improved, can also further using X-axis and Z axis as axle to be measured, and in magnetometer where X-axis and Z axis
In plane about the z axis in rotary course, the multiple measurements of X-axis and Z axis when magnetometer is rotated to multiple specified angles are read respectively
Value;According to multiple measured values of X-axis, multiple measured value fitted ellipse equations of Z axis, this elliptic equation is used for further to X
The actual measured value of axle and Z axis is calibrated.
In actual applications, the actual measured value that the first axle to be measured and the second axle to be measured measure can be located at the wheel of elliptic equation
On exterior feature.Based on this, at step 104, actual measured value that can be according to elliptic equation to the first axle to be measured and the second axle to be measured
Actual measured value is calibrated, so that the calibration value of the calibration value of the first axle to be measured and the second axle to be measured is located at the wheel of circular equation
On exterior feature.As shown in Fig. 2 the major semiaxis of elliptic equation is a, semi-minor axis b, centre coordinate is (Z0, Y0), and β is major semiaxis and Z axis
Angle.After ellipse is fitted, Z0, Y0, a, b and β can be known.Assuming that the actual measured value of Y-axis is y, the actual survey of Z axis
Value is z, and the calibration value y of Y-axis can be obtained according to formula (1)ok, the calibration value z of Z axis can be obtained according to formula (2)ok。
zok=cos β (z-Z0)+sin β (y-Y0) (2)
In the present embodiment, compared to 8 word calibration method of the prior art, magnetometer is in the first axle to be measured and the second axle to be measured
Institute is planar around the 3rd axle to be measured rotation, the specification rotation mode of magnetometer, if magnetometer is user's rotation, just
Operated in user;Further, rotated by reading the first axle to be measured and the second axle to be measured respectively in magnetometer to multiple specified angles
Multiple measured values when spending, the specification reading manner of measured value;And then when magnetometer is rotated in a manner of specification with
The mode of specification reads multiple measured values, and is fitted according to multiple measured values of reading for being calibrated to actual measured value
Elliptic equation, improve the accuracy of elliptic equation, further improve the accuracy to magnetometer calibration.
Further, in the present embodiment, by reading measured value when magnetometer is rotated to multiple specified angles, without
Measured value is read in magnetometer rotary course in real time so that the data of reading are less, the amount of calculation of less fitting, improve magnetometer
The efficiency of calibration.
In above-described embodiment or following embodiments, for the first specified angle in multiple specified angles, read respectively
The measured value of first axle to be measured and the second axle to be measured when magnetometer is rotated to the first specified angle, including:
Magnetometer in the first axle to be measured and the second axle to be measured institute planar in the 3rd axle rotary course to be measured, obtain
Magnetometer three axles of accelerometer in a device acceleration magnitude;Wherein, the first axle to be measured and the second axle place to be measured
Plane is non-horizontal surface;The acceleration magnitude of three axles of accelerometer is corresponding with benchmark 3-axis acceleration value in the anglec of rotation
Matched in relation;When the acceleration magnitude of three axles of accelerometer benchmark 3-axis acceleration corresponding with the first specified angle
When value matches, the measured value of the first axle to be measured and the second axle to be measured when magnetometer is rotated to the first specified angle is read.Its
In, the unspecified angle in the first specified angle to multiple specified angles.For example, the first specified angle is 0 degree or 60 degree or 120
Degree.
In the present embodiment, magnetometer is located in same equipment with accelerometer.The equipment can include but is not limited to virtual
Real world devices, augmented reality equipment, intelligent wearable device etc..Preferably, three of three axles of magnetometer and accelerometer
The direction of axle is parallel, then the acceleration magnitude of three axles of the acceleration magnitude of the three of accelerometer axle i.e. magnetometer.If
The direction of three axles of magnetometer and three axles of accelerometer is not parallel, then according to accelerometer body coordinate system and magnetometer
Body coordinate system transformational relation, the acceleration magnitude of three axles of accelerometer is transformed into three axle place sides of magnetometer
Upward acceleration magnitude., can be parallel with the direction of three axles of accelerometer by three axles of magnetometer in order to facilitate description
The acceleration magnitude of three axles of brief acceleration meter, and the direction of three axles of three axles of magnetometer and accelerometer are not parallel
When, the acceleration magnitude where the acceleration magnitude of three axles of accelerometer to be transformed into three axles of magnetometer on direction is referred to as
The acceleration magnitude of three axles of accelerometer.
In general, speed when magnetometer rotates is that comparison is slow, and spinning movement is to three axles of accelerometer
Acceleration magnitude influences smaller.Based on this, it is believed that the acceleration magnitude of three axles of accelerometer is acceleration of gravity at three
The component of axle.In order to determine the angle of magnetometer rotation by the acceleration magnitude of the three of accelerometer axle, magnetic force should be made
When counting different rotation angle, the acceleration magnitude of accelerometer or at least one axle of magnetometer is different.Based on this, magnetometer can be made
Rotated on non-horizontal surface, i.e., plane where the first axle to be measured and the second axle to be measured is non-horizontal surface.Wherein, non-horizontal surface refers to not
The plane vertical with the direction of acceleration of gravity.Because when magnetometer rotates in the horizontal plane, the first axle to be measured and second to be measured
Axle is vertical with the direction of acceleration of gravity, and the component of acceleration of gravity is also just not present, or the first axle to be measured and second is treated
The gravitational acceleration component surveyed on direction of principal axis is 0, and is not changed with magnetometer rotation in the horizontal plane.
Alternatively, pre-establish magnetometer in the first axle to be measured and the second axle to be measured planar around the 3rd axle to be measured
The corresponding relation of the anglec of rotation (the hereinafter referred to as anglec of rotation) and benchmark 3-axis acceleration value.Preferably, the anglec of rotation includes more
Individual specified angle.Benchmark 3-axis acceleration value refers to three axles of the accelerometer of each specified angle in corresponding multiple specified angles
Acceleration magnitude.
In one example, as shown in Figure 3 a, the first specified angle is 0 degree of the angle of Y-axis rotation, and now Y-axis adds with gravity
The direction of speed is parallel.When Y-axis rotates to 0 degree, the reference acceleration value of the y-axis of accelerometer should be-g, wherein, negative sign table
Show in opposite direction with acceleration of gravity.The z-axis of accelerometer and the reference acceleration value of x-axis should be 0.In view of in magnetometer
Rotary course in, acceleration magnitude might have deviation, then by benchmark 3-axis acceleration value is appropriate plus or minus 0.1g, with
To benchmark 3-axis acceleration scope corresponding to 0 degree:Y-axis reference acceleration scope -1.1g~-0.9g, x-axis reference acceleration model
Enclose -0.1g~-0.1g, z-axis reference acceleration scope -0.1g~-0.1g.
In another example, shown in Fig. 3 b, the first specified angle is 90 degree of the angle of Y-axis rotation, and now Y-axis adds with gravity
The direction of speed is vertical.When Y-axis rotates to 90 degree, the reference acceleration value of the y-axis of accelerometer should be 0, and the benchmark of z-axis adds
Velocity amplitude is g, and the reference acceleration value of x-axis is 0.It is identical with above-mentioned example, by benchmark 3-axis acceleration value plus or minus
0.1g, to obtain benchmark 3-axis acceleration scope corresponding to 90 degree:Z-axis reference acceleration scope 1.1g~0.9g, y-axis benchmark add
Velocity interval -0.1g~-0.1g, x-axis reference acceleration scope -0.1g~-0.1g.
Alternatively, in magnetometer in the first axle to be measured and the second axle to be measured institute planar around the 3rd axle rotary course to be measured
In, benchmark 3-axis acceleration value corresponding to the specified angle of real-time display first, and display acceleration on a display of the device
The real time acceleration value of three axles of meter, so as to direction of rotation of the user according to benchmark 3-axis acceleration value adjustment magnetometer and rotation
Gyration.
For example, in the example shown in Fig. 3 a, benchmark 3-axis acceleration value corresponding to 0 degree or the axle of benchmark three can be added
Velocity interval, and real time acceleration value, shown over the display, as shown in table 1 in the form of form or picture and text.
Table 1
X axis datum acceleration range |
- 0.1g~0.1g |
X-axis real time acceleration value |
0g |
Y axis datum acceleration range |
- 1.1g~-0.9g |
Y-axis real time acceleration value |
1g |
Z axis datum acceleration range |
- 0.1g~0.1g |
Z axis real time acceleration value |
0g |
When the acceleration magnitude of three axles of accelerometer benchmark 3-axis acceleration value phase corresponding with the first specified angle
The acceleration figure benchmark 3-axis acceleration value corresponding with the first specified angle of three axles of timing, i.e. accelerometer, or fall
When in the range of the reference acceleration in above-mentioned example, it is meant that magnetometer rotates to the first specified angle, then reads first and treats
Survey the measured value of axle and the second axle to be measured.
Alternatively, when the acceleration magnitude of three axles of accelerometer benchmark 3-axis acceleration corresponding with the first specified angle
When value matches, the information that the match is successful is shown on a display of the device.
In the present embodiment, by by the acceleration magnitude of three axles of accelerometer in the anglec of rotation and benchmark 3-axis acceleration
Matched in the corresponding relation of value, and then the acceleration magnitude base corresponding with the first specified angle of three axles when accelerometer
When quasi- 3-axis acceleration value matches, the first axle to be measured and the second axle to be measured are read when magnetometer is rotated to the first specified angle
Measured value, enabling by acceleration magnitude, determine that magnetometer rotates to specified angle.Further, by showing benchmark
3-axis acceleration value and real-time measurement values so that calibration process is high-visible, and user can also accelerate in the axle of benchmark three of display
Under the guiding of angle value, direction of rotation and the anglec of rotation of magnetometer are adjusted;Moreover, the real time acceleration of user's rotation magnetic force timing
Value can also be shown, and then feed back to user, strengthen the experience of user.
In general, the storyteller's fan of magnetic induction line is different, causes the magnetic induction intensity of different directions can be slightly different.Based on this,
Can when the acceleration magnitude benchmark 3-axis acceleration value corresponding with the first specified angle of three axles of accelerometer matches,
At least two measured values are read, to improve the accuracy of measured value.
In an optional embodiment, can three axles of accelerometer acceleration magnitude it is corresponding with the first specified angle
Benchmark 3-axis acceleration value when matching, guide user or control machinery arm to be stayed for some time in this angle, so as to
At least two measured values of the first axle to be measured and the second axle to be measured are read respectively.Then the first axle to be measured and second is asked for respectively to treat
The average value of at least two measured values of the axle when magnetometer rotates along the horizontal plane is surveyed, as the first axle to be measured and the second axle to be measured
Measured value when magnetometer is rotated to the first specified angle.
It is corresponding with the first specified angle in the acceleration magnitude of three axles of accelerometer in another optional embodiment
When benchmark 3-axis acceleration value matches, user or control machinery arm can be guided to rotate magnetometer along the horizontal plane.Example
Such as, the information rotated along the horizontal plane is shown over the display;And the first axle to be measured and the second axle to be measured are read on magnetometer edge
At least two measured values when horizontal plane rotates;The first axle to be measured is asked for respectively and the second axle to be measured revolves along the horizontal plane in magnetometer
The average value of at least two measured values when turning, rotate to first and specify in magnetometer as the first axle to be measured and the second axle to be measured
Measured value during angle.
Due to the direction of acceleration of gravity be vertically downward, when magnetometer rotates along the horizontal plane, the three of accelerometer
The real time acceleration value of individual axle should match with benchmark 3-axis acceleration value all the time.Based on this, rotated along the horizontal plane in magnetometer
During, can be with the reality of three axles of benchmark 3-axis acceleration value and accelerometer corresponding to the specified angle of real-time display first
Brief acceleration value, so that user is under the guiding of benchmark 3-axis acceleration value, remains and rotate magnetometer along the horizontal plane.If
The acceleration magnitude benchmark 3-axis acceleration value corresponding with the first specified angle of three axles of accelerometer mismatches, then shows water
Planar tilt prompt message.Further, the measured value read this moment is abandoned.
In the present embodiment, ask for be the first axle to be measured and the second axle to be measured when magnetometer rotates along the horizontal plane at least
The average value of two measured values is as measured value, but not limited to this.Can also be when magnetometer rotates along the horizontal plane, from least two
In individual measured value, the measured value of optional first axle to be measured, and the measured value of optional second axle to be measured.Or may be used also
To ask for the median of at least two measured values of the first axle to be measured and the second axle to be measured when magnetometer rotates along the horizontal plane work
For measured value.
What deserves to be explained is benchmark 3-axis acceleration corresponding to the first specified angle can be shown on a display of the device
At least one of value, acceleration magnitude, the information that the match is successful and the horizontal tilt prompt message of three axles of accelerometer,
User or developer can set display content according to the actual requirements.
In an optional embodiment, rotated in the first axle to be measured of reading and the second axle to be measured respectively in magnetometer to multiple
Before multiple measured values during specified angle, multiple specified angles can be uniformly determined in the range of 360 degree;Wherein, Duo Gewei
More than or equal to 5.
Oval expression formula shown in Fig. 2 is
Wherein, make The one of elliptic equation can then be obtained
As expression formula, as shown in formula (4):
x2+Axy+By2+ Cx+Dy+E=0 (4)
The general expression of elliptic equation includes 5 unknown parameters, is A, B, C, D, E, if it is desired to this 5 unknown numbers are obtained,
Need at least five coordinate points.Based on this, it may be determined that more than or equal to 5 specified angles, rotated in magnetometer to being more than or wait
In 5 specified angles, the measured value for being more than or equal to 5 of the first axle to be measured and the second axle to be measured can be read respectively, and then is obtained
To at least five coordinate points.
When obtaining 5 coordinate points, this 5 coordinate points can be brought into elliptic equation, to obtain A, B, C, D, E ginseng
Numerical value, and then fit elliptic equation.
When obtaining being more than 5 coordinate points, can optional 5 coordinate points bring into elliptic equation, fit elliptic equation.
Curve fitting algorithm can also be used, obtains A, B, C, D, E parameter value, and then fit elliptic equation.Alternatively, curve is intended
Hop algorithm includes but is not limited to least square method, Lagrange interpolation or Based on Interpolating Spline etc..
According to oval related geometric knowledge, there is following formula:
Then the major semiaxis a in Fig. 2 can be obtained, semi-minor axis b, centre coordinate Z0, Y0, the angle of major semiaxis and Z axis
β.Assuming that the actual measured value of Y-axis is y, the actual measured value of Z axis is z, and the calibration value y of Y-axis can be obtained according to formula (1)ok, root
The calibration value z of Z axis can be obtained according to formula (2)ok。
It is oval more accurate to make to fit, it can uniformly determine multiple specified angles in the range of 360 degree.For example, choosing
Take 0 degree, 60 degree, 120 degree, 180 degree, 240 degree and 300 degree, as shown in figure 4,6 equally distributed coordinate values can be obtained.Below
The angle rotated using the angle of Y-axis rotation as magnetometer, illustrates that magnetometer is rotated to the shape of above-mentioned 6 specified angles listed
State.
Fig. 5 a show that Y-axis is rotated to state at 0 degree, Y-axis and acceleration of gravity it is in opposite direction, Fig. 5 b show that Y-axis is revolved
State when going to 60 degree, Fig. 5 c show that Y-axis is rotated to state at 120 degree, and Fig. 5 d show that Y-axis is rotated to shape during 180 degree
State, Y-axis is identical with the direction of acceleration of gravity, and Fig. 5 e show that Y-axis is rotated to state at 240 degree, Fig. 5 f show Y-axis rotate to
State at 300 degree.User can be by magnetometer since the state shown in Fig. 5 a, according to Fig. 5 b, Fig. 5 c, Fig. 5 d, Fig. 5 e, figure
5f order rotation, or by magnetometer since the state shown in Fig. 5 f, according to Fig. 5 e, Fig. 5 d, Fig. 5 c, 5b, 5a order
Rotation.
The present embodiment also provides a kind of electronic equipment, as shown in fig. 6, electronic equipment 600 includes processor 602, Yi Jiyu
The memory 601 that processor 602 connects.
Memory 601, for storing one or more computer instruction.
Processor 602, for performing one or more computer instruction stored in memory 601, for:
From three axles of magnetometer, the first axle to be measured and the second axle to be measured are selected;Wherein, the first axle to be measured and second is treated
Survey any two axle in three axles that axle is magnetometer;Magnetometer the first axle to be measured and the second axle to be measured institute planar around
In 3rd axle rotary course to be measured, read the first axle to be measured respectively and the second axle to be measured is rotated to multiple specified angles in magnetometer
When multiple measured values;Wherein, the 3rd axle to be measured be magnetometer three axles in addition to the first axle to be measured and the second axle to be measured
Axle;According to multiple measured values of the first axle to be measured, multiple measured value fitted ellipse equations of the second axle to be measured;According to ellipse side
Journey is calibrated to the actual measured value of the first axle to be measured and the actual measured value of the second axle to be measured, obtains the school of the first axle to be measured
The calibration value of quasi- value and the second axle to be measured.
Alternatively, the first axle to be measured is being read respectively for the first specified angle in multiple specified angles, processor 602
It is specifically used for during with measured value of second axle to be measured when magnetometer is rotated to the first specified angle:
Magnetometer in the first axle to be measured and the second axle to be measured institute planar in the 3rd axle rotary course to be measured, obtain
Magnetometer three axles of accelerometer in a device acceleration magnitude;Wherein, the first axle to be measured and the second axle place to be measured
Plane is non-horizontal surface.
By the acceleration magnitude of three axles of accelerometer in the corresponding relation of the anglec of rotation and benchmark 3-axis acceleration value
Matched.
When the acceleration magnitude of three axles of accelerometer benchmark 3-axis acceleration value phase corresponding with the first specified angle
Timing, read the measured value of the first axle to be measured and the second axle to be measured when magnetometer is rotated to the first specified angle.
Alternatively, processor 602 is rotated to first in the first axle to be measured of reading and the second axle to be measured in magnetometer specifies angle
During measured value when spending, it is specifically used for:The first axle to be measured and the second axle to be measured are read when magnetometer rotates along the horizontal plane extremely
Few two measured values;At least two surveys of the first axle to be measured and the second axle to be measured when magnetometer rotates along the horizontal plane are asked for respectively
The average value of value, as the measured value of the first axle to be measured and the second axle to be measured when magnetometer is rotated to the first specified angle.
Alternatively, as shown in fig. 6, electronic equipment 600 also includes the display 603 being connected with processor 602.
Display 603 is used to show at least one of following information:
Show benchmark 3-axis acceleration value corresponding to the first specified angle.
Show the acceleration magnitude of three axles of accelerometer.
When the acceleration magnitude of three axles of accelerometer benchmark 3-axis acceleration value phase corresponding with the first specified angle
Timing, show the information that the match is successful.
When magnetometer rotates along the horizontal plane, if the acceleration magnitude of three axles of accelerometer is corresponding with the first specified angle
Benchmark 3-axis acceleration value mismatch, show horizontal plane prompt message.
Alternatively, processor 602 is rotated to multiple fingers in the first axle to be measured of reading and the second axle to be measured respectively in magnetometer
Before multiple measured values when determining angle, it is additionally operable to:In the range of 360 degree, multiple specified angles are uniformly determined;Wherein, it is multiple
For more than or equal to 5.
In the present embodiment, compared to 8 word calibration method of the prior art, magnetometer is in the first axle to be measured and the second axle to be measured
Institute is planar around the 3rd axle to be measured rotation, the specification rotation mode of magnetometer, if magnetometer is user's rotation, just
Operated in user;Further, rotated by reading the first axle to be measured and the second axle to be measured respectively in magnetometer to multiple specified angles
Multiple measured values when spending, the specification reading manner of measured value;And then when magnetometer is rotated in a manner of specification with
The mode of specification reads multiple measured values, and is fitted according to multiple measured values of reading for being calibrated to actual measured value
Elliptic equation, improve the accuracy of elliptic equation, further improve the accuracy to magnetometer calibration.
Further, in the present embodiment, by reading measured value when magnetometer is rotated to multiple specified angles, without
Measured value is read in magnetometer rotary course in real time so that the data of reading are less, the amount of calculation of less fitting, improve magnetometer
The efficiency of calibration.
The embodiment of the present invention also provides a kind of computer-readable storage medium, the meter of computer-readable storage medium storage one or more
Calculation machine instructs, and when one or more computer instruction is computer-executed, can be achieved:From three axles of magnetometer, selection
First axle to be measured and the second axle to be measured;Wherein, the first axle to be measured and the second axle to be measured be magnetometer three axles in any two
Axle;Magnetometer in the first axle to be measured and the second axle to be measured institute planar in the 3rd axle rotary course to be measured, read respectively
The multiple measured values of first axle to be measured and the second axle to be measured when magnetometer is rotated to multiple specified angles;Wherein, the 3rd is to be measured
Axle be magnetometer three axles in axle in addition to the first axle to be measured and the second axle to be measured;According to multiple measurements of the first axle to be measured
Value, multiple measured value fitted ellipse equations of the second axle to be measured;According to elliptic equation to the actual measured value of the first axle to be measured and
The actual measured value of second axle to be measured is calibrated, and obtains the calibration value of the first axle to be measured and the calibration value of the second axle to be measured.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program
Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Apply the form of example.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more
The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of product.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer-readable instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moved
State random access memory (DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus
Or any other non-transmission medium, the information that can be accessed by a computing device available for storage.Define, calculate according to herein
Machine computer-readable recording medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant are intended to nonexcludability
Comprising so that process, method, commodity or equipment including a series of elements not only include those key elements, but also wrapping
Include the other element being not expressly set out, or also include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that wanted including described
Other identical element also be present in the process of element, method, commodity or equipment.
Embodiments of the invention are the foregoing is only, are not intended to limit the invention.For those skilled in the art
For, the present invention can have various modifications and variations.All any modifications made within spirit and principles of the present invention, it is equal
Replace, improve etc., it should be included within scope of the presently claimed invention.