Attitude estimation method and device, terminal and storage medium
Through the joint measurement and correction of the accelerometer and gyroscope, the data deviation and noise problems of the accelerometer in attitude measurement are solved, and the accuracy of attitude estimation is improved, especially for gravity acceleration measurements in stationary or low motion states.
Patent Information
- Application Number
- CN202411349384.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing accelerometers have data deviations and noise problems when measuring attitudes, resulting in poor measurement accuracy, especially inaccurate measurement of gravity acceleration in static or low motion states.
The first acceleration value is measured by an accelerometer and its components are decomposed in a three-dimensional coordinate system, the second acceleration value corrected by the gyroscope is calculated in combination with the gyroscope measuring the angle change rate, and the attitude estimate value of the device is calculated based on the respective confidence level.
Improves the accuracy of posture estimation, reduces noise interference, and enhances the accuracy of gravity acceleration measurements in stationary or low motion states.
Smart Images

Figure CN119063765A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of sensor technology, and in particular to a posture estimation method, device, terminal and storage medium. Background Art
[0002] An accelerometer is an instrument for measuring acceleration. Acceleration measurement is an important topic raised by engineering technology. When an object has a large acceleration, the object, the instruments and equipment it carries, and other objects without relative acceleration are all subjected to a force that can produce the same large acceleration, that is, a dynamic load. To know the dynamic load, you must measure the acceleration. Among them, MEMS accelerometers have been widely used in various industries. Accelerometers can be used to measure the inclination of objects in three dimensions. MEMS accelerometers are based on MEMS technology and sense the motion state and posture of an object by measuring its acceleration. Its working principle is to use the inertia of the movable part, and the change in the distance between the capacitor plates causes the capacitance change to be proportional to the acceleration.
[0003] However, in the process of research and practice of the prior art, the applicant found that the data directly measured by the accelerometer is not completely accurate, but has a certain deviation, because the accelerometer measures the inertial force, which is mainly caused by gravity and may also be caused by the acceleration of the object's movement. Even if the accelerometer is in a relatively stable state, it is very sensitive to general vibration and mechanical noise. If they are used for program control, a large amount of noise will inevitably be introduced, causing the data measured by the sensor to be seriously distorted and the measurement accuracy to be poor. Summary of the invention
[0004] Embodiments of the present invention provide a posture estimation method, apparatus, terminal and storage medium, which can estimate the posture of a device based on a first acceleration value measured by an accelerometer and a second acceleration value corrected by a gyroscope, thereby improving the accuracy of posture estimation.
[0005] An embodiment of the present invention provides a posture estimation method, including: Measuring a current first acceleration value by means of an accelerometer, and decomposing the first acceleration value into first components on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system; The gyroscope measures the angle change rate between the projection of the current first acceleration value on the XZ plane and the angle between the Z axis, and the angle change rate between the projection of the current first acceleration value on the YZ plane and the angle between the Z axis; Calculate the second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis and the Z-axis respectively according to the angle change rate; Respectively obtaining confidence levels of the first acceleration value and the second acceleration value; A posture estimation value of the current device is calculated according to the confidence, the first component and the second component.
[0006] The embodiment of the present invention further provides a posture estimation device, comprising: A first measuring unit, configured to measure a current first acceleration value through an accelerometer, and decompose the first acceleration value into first components on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system; A second measuring unit is used to measure, by a gyroscope, an angle change rate between a projection of the current first acceleration value on an XZ plane and an angle between the Z axis, and an angle change rate between a projection of the current first acceleration value on a YZ plane and an angle between the Z axis; a calculation unit, configured to calculate second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis and the Z-axis respectively according to the angle change rate; An acquiring unit, used to respectively acquire the confidence of the first acceleration value and the second acceleration value; An estimation unit is used to calculate a posture estimation value of the current device according to the confidence, the first component and the second component.
[0007] An embodiment of the present invention further provides a terminal, comprising: a memory and a processor, wherein an application processing program is stored on the memory, and when the application processing program is executed by the processor, the steps of any one of the posture estimation methods provided in the embodiments of the present invention are implemented.
[0008] An embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute any posture estimation method provided by the embodiment of the present invention.
[0009] The attitude estimation method provided by the embodiment of the present invention can measure the current first acceleration value through an accelerometer, and decompose it into the first component of the first acceleration value on the X-axis, Y-axis and Z-axis in the three-dimensional coordinate system, measure the angle change rate of the projection of the current first acceleration value on the XZ plane and the Z-axis angle, and the angle change rate of the projection on the YZ plane and the Z-axis angle through a gyroscope, calculate the second component of the second acceleration value corrected by the gyroscope on the X-axis, Y-axis and Z-axis respectively according to the angle change rate, obtain the confidence of each of the first acceleration value and the second acceleration value respectively, and calculate the attitude estimation value of the current device according to the confidence, the first component and the second component. The solution provided by the embodiment of the present application can estimate the attitude of the device according to the first acceleration value measured by the accelerometer and the second acceleration value corrected by the gyroscope, thereby improving the accuracy of attitude estimation. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 is a schematic diagram of a first flow chart of a posture estimation method provided by an embodiment of the present invention; Figure 2 is a second flow chart of the posture estimation method provided by an embodiment of the present invention; Figure 3 is a structural schematic diagram of a posture estimation device provided by an embodiment of the present invention; Figure 4 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0012] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0013] It should be noted that, in this article, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element. In addition, components, features, and elements with the same name in different embodiments of the present application may have the same meaning or different meanings, and their specific meanings need to be determined by their explanation in the specific embodiment or further combined with the context of the specific embodiment.
[0014] It should be understood that, although the various steps in the flowchart in the embodiment of the present application are displayed in sequence according to the indication of the arrows, these steps are not necessarily performed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and it can be performed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and their execution order is not necessarily performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0015] It should be noted that, in this article, step codes such as 101, 102, etc. are used for the purpose of expressing the corresponding content more clearly and concisely, and do not constitute a substantial limitation on the sequence. When implementing the step, those skilled in the art may execute 102 first and then 101, etc., but these should all be within the scope of protection of this application.
[0016] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0017] An embodiment of the present invention provides a posture estimation method, and the executor of the posture estimation method can be the posture estimation device provided by the embodiment of the present invention, or an intelligent terminal and a server integrating the posture estimation device, wherein the posture estimation device can be implemented in hardware or software.
[0018] For details, please refer to Figure 1 , Figure 1 : is a first flow chart of a posture estimation method provided by an embodiment of the present invention. The specific flow of the posture estimation method may be as follows: 101. Measure a current first acceleration value by using an accelerometer, and decompose it into first components of the first acceleration value on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system.
[0019] In one embodiment, the accelerometer can be integrated into an electronic device (such as a smart phone) or a wearable device (such as a smart bracelet, a smart watch). When the accelerometer is stationary, the three coordinate axes of the sensor, x, y, and z, correspond to the right side, the front direction, and the vertical upward direction, respectively. When stationary, the acceleration magnitudes in the X, Y, and Z axes are 0.0m / s2, 0.0m / m / s2, and 9.8m / m / s2, respectively. When in motion, the X, Y, and Z axes will all change. At this time, the acceleration value of the accelerometer in each direction can be read, which can be recorded as Rx_acc, Ry_acc, and Rz_acc, respectively, that is, the first component of the first acceleration value on the X axis, Y axis, and Z axis. Among them, the above sampling frequency is greater than 20hz. In one embodiment, the sampling frequency of the accelerometer can be adjusted according to the current power of the device, thereby improving the battery life of the device.
[0020] In one embodiment, after obtaining the first component of the above-mentioned first acceleration value on the X-axis, Y-axis and Z-axis, two filtering processes may be performed, such as first-order low-pass filtering and sliding average filtering. Low-pass filtering is used to filter out some interference caused by the acceleration sensor hardware itself, and sliding average filtering is used to filter out some pseudo peaks. An FIR filter may be used. In this embodiment, a window function method may be used to design an FIR filter. The sampling points of the walking stage are intercepted. After low-pass filtering and secondary filtering, the waveform is smoother than the original waveform, and the pseudo peaks caused by body shaking are greatly reduced.
[0021] 102. Measure, by a gyroscope, an angle change rate between a projection of the current first acceleration value on the XZ plane and the angle between the Z axis, and an angle change rate between a projection of the current first acceleration value on the YZ plane and the angle between the Z axis.
[0022] In one embodiment, first, the components of the first acceleration value R in the three-dimensional coordinate system on the X-axis, Y-axis, and Z-axis in the gyroscope model can be determined, namely Rx, Ry, and Rz. Then, the angle between the projection of the first acceleration value on the XZ plane and the Z axis can be defined as Axz. Correspondingly, the angle between the projection of the first acceleration value on the YZ plane and the Z axis can be defined as Ayz.
[0023] The right triangle formed by Rz and Axz can be deduced as follows: tan(Axz)=Rx / Rz. After transformation, Axz=atan2(Rx, Rz). Similarly, Ayz=atan2(Ry, Rz). For the angle Axz, since the gyroscope measures the rate of change of the angles Axz and Ayz, the new angles Axz(n) and Ayz(n) can be estimated as follows: Axz(n)= Axz(n-1)+Rate(Axz(n)) T Ayz(n)= Ayz(n-1)+Rate(Ayz(n)) T Where n is the current number of measurements, T is the measurement interval, Axz(n) is the angular change rate of the projection of the first acceleration value on the XZ plane and the Z-axis angle, Ayz(n) is the angular change rate of the projection of the first acceleration value on the YZ plane and the Z-axis angle, Axz(n-1) and Ayz(n-1) are the previous angle change rate measurement results and are related to the previous attitude estimation value, and Rate(Axz(n)) and Rate(Ayz(n)) are read from the ADC of the gyroscope.
[0024] It should be noted that the above Axz(n-1) can be calculated by the component Rx_est(n-1) on the X-axis and the component Rz_est(n-1) on the Z-axis of the previous posture estimation value. The calculation formula is: Axz(n-1)= atan2(Rx_est(n-1), Rz_est(n-1)), and correspondingly, Ayz(n-1)= atan2(Ry_est(n-1), Rz_est(n-1)).
[0025] 103. Calculate second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis, and the Z-axis respectively according to the angle change rate.
[0026] In one embodiment, the second components of the second acceleration value on the X-axis, Y-axis and Z-axis are derived according to the above Axz(n) and Ayz(n), which can be defined as Rx_gyro, Ry_gyro and Rz_gyro. First, according to the Pythagorean theorem R in three-dimensional space, 2 =Rx 2 + Ry 2 + Rz 2 , so R_gyro can be written as:
[0027] At the same time, since R_acc has been standardized, its length can be considered to be 1 and remains unchanged after rotation, so it can be written as follows: |R_gyro|=1, which can be transformed into the above formula to obtain:
[0028]
[0029]
[0030] Among them, when Rz_gyro>=0, Sign(Rz_gyro)=1, and when Rz_gyro<0, Sign(Rz_gyro)=-1.
[0031] 104. Obtain confidence levels of the first acceleration value and the second acceleration value respectively.
[0032] In one embodiment, the first acceleration value is the acceleration directly measured by the accelerometer, so when the accelerometer is stationary or nearly stationary, the acceleration measured by the accelerometer is mainly composed of gravity acceleration. On the surface of the earth, the magnitude of gravity acceleration is about 9.81 m / s². When the device is stationary, the reading of the accelerometer in the vertical direction (usually the Z axis, but depending on the orientation of the device) will be close to this value. Therefore, the readings of the accelerometer on three axes can be read. If the device is stationary, the magnitude of gravity acceleration can be estimated by calculating the vector modulus. The confidence level corresponding to the first acceleration setting can be determined by comparing the calculated g with the theoretical value of 9.81 m / s².
[0033] Furthermore, the gyroscope itself does not directly measure the acceleration of gravity, but it can measure the angular velocity of the device, and thus the rotation of the device can be inferred. Therefore, this embodiment can evaluate the confidence of the accelerometer in measuring the acceleration of gravity by analyzing the gyroscope data. Specifically, the angular velocity of the gyroscope on three axes can be read, and the rotation of the device can be estimated using the gyroscope data. For example, the rotation angle can be estimated by integrating the angular velocity. If the device is rotating rapidly, the accelerometer reading may be affected by centrifugal acceleration, thereby deviating from the true acceleration of gravity. By comparing the rotation speed indicated by the gyroscope data with the change in the accelerometer reading, it can be determined whether the accelerometer reading is affected by non-gravitational acceleration. If the gyroscope data shows that the device is in a relatively stationary or slowly rotating state, and the accelerometer reading is stable, the confidence of the acceleration of gravity is high.
[0034] 105. Calculate a posture estimation value of the current device according to the confidence, the first component, and the second component.
[0035] In one embodiment, the estimated value of the posture of the current device can be calculated by the following formula:
[0036] Among them, R_est(n) is the estimated value of the posture of the current device, w1 is the confidence of the first acceleration value, w2 is the confidence of the second acceleration value, R_acc=[Rx_acc, Ry_acc, Rz_acc], R_gyro=[Rx_gyro, Ry_gyro, Rz_gyro].
[0037] As described above, the attitude estimation method proposed in the embodiment of the present invention can measure the current first acceleration value through an accelerometer, and decompose it into the first component of the first acceleration value on the X-axis, Y-axis and Z-axis in the three-dimensional coordinate system, measure the angle change rate of the projection of the current first acceleration value on the XZ plane and the Z-axis angle, and the angle change rate of the projection on the YZ plane and the Z-axis angle through a gyroscope, calculate the second component of the second acceleration value corrected by the gyroscope on the X-axis, Y-axis and Z-axis respectively according to the angle change rate, obtain the confidence of each of the first acceleration value and the second acceleration value respectively, and calculate the attitude estimation value of the current device according to the confidence, the first component and the second component. The solution provided in the embodiment of the present application can estimate the attitude of the device according to the first acceleration value measured by the accelerometer and the second acceleration value corrected by the gyroscope, thereby improving the accuracy of attitude estimation.
[0038] The method described in the above embodiment will be further described below.
[0039] See also Figure 2 , Figure 2 1 is a second flow chart of a posture estimation method provided by an embodiment of the present invention. The method comprises: 201. Measure a current first acceleration value by using an accelerometer, and decompose it into first components of the first acceleration value on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system.
[0040] In one embodiment, the first component of the first acceleration value on the X-axis, the Y-axis, and the Z-axis may be calculated using the following formula:
[0041]
[0042]
[0043] in, , , are the first components of the first acceleration value on the X-axis, Y-axis and Z-axis respectively, , , , are the analog values output by the accelerometer on the X-axis, Y-axis, and Z-axis, which are read by the ADC. is the reference voltage value of the acquisition system, is the zero drift value of the acceleration chip, The sensitivity of the chip, in units of mV / (deg / s), usually written as mV / deg / s, means that if the rotation speed increases by 1° / s, the output of the gyroscope will increase by how many mV. In the embodiment of the present application, the sensitivity value of the Acc_Gyro board is 2mV / deg / s or 0.002V / deg / s.
[0044] It should be noted that R_acc = [Rx_acc, Ry_acc, Rz_acc], R_acc is the first acceleration value measured by the accelerometer, and R_acc measures gravity when stationary. If the vector length obtained is approximately equal to 1 gravitational acceleration g, then it is correct, that is, it can be expressed as follows:
[0045] 202. Obtain the component on the X-axis, the component on the Y-axis, and the component on the Z-axis of the previous posture estimation value.
[0046] The embodiment of the present application introduces a new vector, namely, the accelerometer data R_est corrected by the gyroscope data, which is expressed as:
[0047] Correspondingly, the component on the X-axis, the component on the Y-axis, and the component on the Z-axis of the previous posture estimation value R_est(n-1) can be expressed as Rx_est(n-1), Ry_est(n-1), and Rz_est(n-1).
[0048] 203. Calculate the angular change rate of the projection of the first acceleration value on the XZ plane and the angle of the Z axis by using the components of the previous posture estimation value on the X and Z axes, and calculate the angular change rate of the projection of the first acceleration value on the YZ plane and the angle of the Z axis by using the components of the previous posture estimation value on the Y and Z axes.
[0049] Furthermore, after obtaining the above Rx_est(n-1) and Rz_est(n-1), we can calculate:
[0050] Among them, Axz(n-1) is the previous angle change rate measurement result. The gyroscope measures the angle change rate of Axz, so the new angle Axz(n) can be calculated as follows: Axz(n)= Axz(n-1)+Rate(Axz(n)) T Where n is the current number of measurements, T is the measurement interval, Axz(n) is the angle change rate of the projection of the first acceleration value on the XZ plane and the Z-axis angle, Axz(n-1) is the previous angle change rate measurement result and is related to the previous attitude estimation value. Rate(Axz(n)) can be read from the ADC of the gyroscope.
[0051] Similarly, we can get: Ayz(n)= Ayz(n-1)+Rate(Ayz(n)) T Wherein, Ayz(n) is the angle change rate of the projection of the first acceleration value on the YZ plane and the Z-axis angle.
[0052] 204. Calculate second components of the second acceleration value corrected by the gyroscope on the X-axis and the Y-axis respectively according to the angle change rate.
[0053] 205. Calculate the second component of the second acceleration value on the Z axis according to the second components of the second acceleration value on the X axis and the Y axis respectively.
[0054] In one embodiment, the second components of the second acceleration value on the X-axis, Y-axis, and Z-axis can be calculated and defined as Rx_gyro, Ry_gyro, and Rz_gyro, respectively. First, according to the Pythagorean theorem in three-dimensional space R 2 =Rx 2 + Ry 2 +Rz 2 , so R_gyro can be written as:
[0055] At the same time, since R_acc has been standardized, its length can be considered to be 1 and remains unchanged after rotation, so it can be written as follows: |R_gyro|=1. Next, for the convenience of calculation, x=Rx_gyro, y= Ry_gyro, z= Rz_gyro can be substituted into the above formula to obtain:
[0056] Divide both its numerator and denominator by Then we get:
[0057] make We can get:
[0058] Multiply the numerator and denominator of the partial inside the square root by z 2 Then we get:
[0059] In the as well as After substitution we get:
[0060] After replacing the original symbols, it becomes:
[0061] The same can be said
[0062] After obtaining Rx_gyro and Ry_gyro, Rz_gyro can be further calculated:
[0063] Among them, when Rz_gyro>=0, Sign(Rz_gyro)=1, and when Rz_gyro<0, Sign(Rz_gyro)=-1.
[0064] 206. Obtain confidence levels of the first acceleration value and the second acceleration value respectively.
[0065] 207. Calculate a posture estimation value of the current device according to the confidence, the first component, and the second component.
[0066] Furthermore, after obtaining the first component and the second component, a weighted average can be used:
[0067] Among them, R_est(n) is the estimated value of the posture of the current device, w1 is the confidence of the first acceleration value, w2 is the confidence of the second acceleration value, R_acc=[Rx_acc, Ry_acc, Rz_acc], R_gyro=[Rx_gyro, Ry_gyro, Rz_gyro].
[0068] In one embodiment, the formula is further simplified by dividing the numerator and denominator in the calculation formula of R_est(n) by w1 to obtain:
[0069] Among them, let w2 / w1=w_gyro to get:
[0070] In this formula, w_gyro represents the degree of trust in the accelerometer and gyroscope. This value can be determined by testing. According to experience, this embodiment can set it to 10. The main difference between this algorithm and Kalman filtering is that its weight is relatively fixed, while the weight in Kalman filtering will change with the noise read by the accelerometer.
[0071] Furthermore, the calculation formula of R_est(n) is decomposed to obtain:
[0072]
[0073]
[0074] As described above, the attitude estimation method proposed in the embodiment of the present invention can measure the current first acceleration value through an accelerometer, and decompose it into the first component of the first acceleration value on the X-axis, Y-axis and Z-axis in the three-dimensional coordinate system, obtain the component on the X-axis, the component on the Y-axis and the component on the Z-axis of the previous attitude estimation value, calculate the projection of the first acceleration value on the XZ plane and the angle of the Z axis through the components of the previous attitude estimation value on the X and Z axes, calculate the projection of the first acceleration value on the YZ plane and the angle of the Z axis through the components of the previous attitude estimation value on the Y and Z axes. The rate of change of the angle, the second component of the second acceleration value corrected by the gyroscope on the X-axis and Y-axis is calculated according to the angle change rate, the second component of the second acceleration value on the Z axis is calculated according to the second component of the second acceleration value on the X-axis and Y-axis, respectively, the confidence of the first acceleration value and the second acceleration value is obtained respectively, and the attitude estimation value of the current device is calculated according to the confidence, the first component and the second component. The solution provided in the embodiment of the present application can estimate the posture of the device according to the first acceleration value measured by the accelerometer and the second acceleration value corrected by the gyroscope, thereby improving the accuracy of the posture estimation.
[0075] In order to implement the above method, an embodiment of the present invention further provides a posture estimation device, which can be integrated into a terminal device such as a mobile phone, a tablet computer, etc.
[0076] For example, Figure 3 FIG. 1 is a schematic diagram of a structure of a posture estimation device provided by an embodiment of the present invention. The posture estimation device may include: The first measuring unit 301 is used to measure a current first acceleration value through an accelerometer, and decompose the first acceleration value into first components on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system; The second measuring unit 302 is used to measure the angle change rate of the projection of the current first acceleration value on the XZ plane and the Z-axis angle, and the angle change rate of the projection on the YZ plane and the Z-axis angle through a gyroscope; A calculation unit 303 is used to calculate the second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis and the Z-axis respectively according to the angle change rate; An acquiring unit 304 is used to acquire confidence levels of the first acceleration value and the second acceleration value respectively; The estimation unit 305 is used to calculate the posture estimation value of the current device according to the confidence, the first component and the second component.
[0077] The attitude estimation device proposed in the embodiment of the present invention can measure the current first acceleration value through an accelerometer, and decompose it into the first component of the first acceleration value on the X-axis, Y-axis and Z-axis in the three-dimensional coordinate system, measure the angle change rate of the projection of the current first acceleration value on the XZ plane and the Z-axis angle, and the angle change rate of the projection on the YZ plane and the Z-axis angle through a gyroscope, calculate the second component of the second acceleration value corrected by the gyroscope on the X-axis, Y-axis and Z-axis respectively according to the angle change rate, obtain the confidence of each of the first acceleration value and the second acceleration value respectively, and calculate the attitude estimation value of the current device according to the confidence, the first component and the second component. The solution provided in the embodiment of the present application can estimate the attitude of the device according to the first acceleration value measured by the accelerometer and the second acceleration value corrected by the gyroscope, thereby improving the accuracy of attitude estimation.
[0078] The embodiment of the present invention further provides a terminal, such as Figure 4 As shown, the terminal may include a radio frequency (RF) circuit 601, a memory 602 including one or more computer-readable storage media, an input unit 603, a display unit 604, a sensor 605, an audio circuit 606, a wireless fidelity (WiFi) module 607, a processor 608 including one or more processing cores, and a power supply 609. Those skilled in the art will appreciate that Figure 4 The terminal structure shown in the figure does not constitute a limitation on the terminal, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. The RF circuit 601 can be used for receiving and sending signals during information transmission or calls. In particular, after receiving the downlink information of the base station, it is handed over to one or more processors 608 for processing; in addition, the data related to the uplink is sent to the base station. Generally, the RF circuit 601 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM) card, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 601 can also communicate with the network and other devices through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0079] The memory 602 can be used to store software programs and modules. The processor 608 executes various functional applications and information processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the terminal (such as audio data, a phone book, etc.), etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 602 may also include a memory controller to provide the processor 608 and the input unit 603 with access to the memory 602.
[0080] The input unit 603 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, in a specific embodiment, the input unit 603 may include a touch-sensitive surface and other input devices. The touch-sensitive surface, also known as a touch display screen or a touch pad, can collect the user's touch operations on or near it (such as the user's operation on or near the touch-sensitive surface using any suitable object or accessory such as a finger, a stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 608, and can receive and execute the command sent by the processor 608. In addition, the touch-sensitive surface can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch-sensitive surface, the input unit 603 may also include other input devices. Specifically, other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0081] The display unit 604 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the terminal, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 604 may include a display panel. Optionally, the display panel may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc. Further, the touch-sensitive surface may cover the display panel. When the touch-sensitive surface detects a touch operation on or near it, it is transmitted to the processor 608 to determine the type of touch event. The processor 608 then provides a corresponding visual output on the display panel according to the type of touch event. Although in Figure 4 In the embodiment, the touch-sensitive surface and the display panel are used as two independent components to realize input and output functions, but in some embodiments, the touch-sensitive surface and the display panel can be integrated to realize input and output functions.
[0082] The terminal may also include at least one sensor 605, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel according to the brightness of the ambient light, and the proximity sensor may turn off the display panel and / or backlight when the terminal is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; As for other sensors that can be configured in the terminal, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0083] The audio circuit 606, the speaker, and the microphone can provide an audio interface between the user and the terminal. The audio circuit 606 can transmit the electrical signal converted from the received audio data to the speaker, which is converted into a sound signal for output; on the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 606 and converted into audio data, and then the audio data is processed by the output processor 608 and sent to, for example, another terminal through the RF circuit 601, or the audio data is output to the memory 602 for further processing. The audio circuit 606 may also include an earplug jack to provide communication between an external headset and the terminal.
[0084] WiFi is a short-range wireless transmission technology. The terminal can help users send and receive emails, browse web pages, and access streaming media through the WiFi module 607. It provides users with wireless broadband Internet access. Figure 4 A WiFi module 607 is shown, but it is understandable that it is not an essential component of the terminal and can be omitted as required without changing the essence of the invention.
[0085] The processor 608 is the control center of the terminal. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 602 and calling data stored in the memory 602, it executes various functions of the terminal and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 608 may include one or more processing cores; preferably, the processor 608 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 608.
[0086] The terminal also includes a power supply 609 (such as a battery) for supplying power to each component. Preferably, the power supply can be logically connected to the processor 608 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 609 can also include one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0087] Although not shown, the terminal may also include a camera, a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the processor 608 in the terminal will load the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 608 will run the applications stored in the memory 602 to implement various functions: Measuring a current first acceleration value by means of an accelerometer, and decomposing the first acceleration value into first components on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system; The gyroscope measures the angle change rate between the projection of the current first acceleration value on the XZ plane and the angle between the Z axis, and the angle change rate between the projection of the current first acceleration value on the YZ plane and the angle between the Z axis; Calculate the second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis and the Z-axis respectively according to the angle change rate; Respectively obtaining confidence levels of the first acceleration value and the second acceleration value; A posture estimation value of the current device is calculated according to the confidence, the first component and the second component.
[0088] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the posture estimation method above, and will not be repeated here.
[0089] As can be seen from the above, the terminal of the embodiment of the present invention can measure the current first acceleration value through an accelerometer, and decompose it into the first component of the first acceleration value on the X-axis, Y-axis and Z-axis in the three-dimensional coordinate system, measure the angle change rate of the projection of the current first acceleration value on the XZ plane and the Z-axis angle, and the angle change rate of the projection on the YZ plane and the Z-axis angle through a gyroscope, calculate the second component of the second acceleration value corrected by the gyroscope on the X-axis, Y-axis and Z-axis respectively according to the angle change rate, obtain the confidence of each of the first acceleration value and the second acceleration value respectively, and calculate the attitude estimation value of the current device according to the confidence, the first component and the second component. The solution provided in the embodiment of the present application can estimate the attitude of the device according to the first acceleration value measured by the accelerometer and the second acceleration value corrected by the gyroscope, thereby improving the accuracy of attitude estimation.
[0090] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0091] To this end, an embodiment of the present invention provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the steps in any one of the posture estimation methods provided in the embodiments of the present invention. For example, the instructions can execute the following steps: Measuring a current first acceleration value by means of an accelerometer, and decomposing the first acceleration value into first components on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system; The gyroscope measures the angle change rate between the projection of the current first acceleration value on the XZ plane and the angle between the Z axis, and the angle change rate between the projection of the current first acceleration value on the YZ plane and the angle between the Z axis; Calculate the second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis and the Z-axis respectively according to the angle change rate; Respectively obtaining confidence levels of the first acceleration value and the second acceleration value; A posture estimation value of the current device is calculated according to the confidence, the first component and the second component.
[0092] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0093] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0094] Since the instructions stored in the storage medium can execute the steps in any one of the posture estimation methods provided in the embodiments of the present invention, the beneficial effects that can be achieved by any one of the posture estimation methods provided in the embodiments of the present invention can be achieved. For details, please refer to the previous embodiments and will not be repeated here.
[0095] The above is a detailed introduction to a posture estimation method, device, terminal and storage medium provided in an embodiment of the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A posture estimation method, characterized in that: include: Measuring a current first acceleration value by means of an accelerometer, and decomposing the first acceleration value into first components on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system; The gyroscope measures the angle change rate between the projection of the current first acceleration value on the XZ plane and the angle between the Z axis, and the angle change rate between the projection of the current first acceleration value on the YZ plane and the angle between the Z axis; Calculate the second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis and the Z-axis respectively according to the angle change rate; Respectively obtaining confidence levels of the first acceleration value and the second acceleration value; A posture estimation value of the current device is calculated according to the confidence, the first component and the second component.
2. The posture estimation method according to claim 1, characterized in that: The first component of the first acceleration value on the X-axis, Y-axis and Z-axis is calculated by the following formula: in, , , are the first components of the first acceleration value on the X-axis, Y-axis and Z-axis respectively, , , , are the analog values output by the accelerometer on the X-axis, Y-axis, and Z-axis respectively. is the reference voltage value of the acquisition system, is the zero drift value of the acceleration chip, is the sensitivity of the chip.
3. The posture estimation method according to claim 1, characterized in that: The angular change rate of the projection of the first acceleration value on the XZ plane and the angle between the Z axis, and the angular change rate of the projection of the first acceleration value on the YZ plane and the angle between the Z axis are calculated by the following formula: Axz(n) = Axz(n-1)+Rate(Axz(n)) T Ayz(n)= Ayz(n-1)+Rate(Ayz(n)) T Where n is the current number of measurements, T is the measurement interval, Axz(n) is the angular change rate of the projection of the first acceleration value on the XZ plane and the Z-axis angle, Ayz(n) is the angular change rate of the projection of the first acceleration value on the YZ plane and the Z-axis angle, Axz(n-1) and Ayz(n-1) are the previous angle change rate measurement results and are related to the previous attitude estimation value, and Rate(Axz(n)) and Rate(Ayz(n)) are read from the ADC of the gyroscope.
4. The posture estimation method as claimed in claim 3, characterized in that: The second components of the second acceleration values corrected by the gyroscope on the X-axis, Y-axis, and Z-axis are calculated using the following formulas: Among them, Rx_gyro, Ry_gyro, and Rz_gyro are the second components of the second acceleration value corrected by the gyroscope on the X-axis, Y-axis, and Z-axis respectively, and when Rz_gyro>=0, Sign(Rz_gyro)=1, and when Rz_gyro<0, Sign(Rz_gyro)=-1.
5. The posture estimation method as claimed in claim 4, characterized in that: The estimated value of the current device's posture is calculated using the following formula: Among them, R_est(n) is the estimated value of the posture of the current device, w1 is the confidence of the first acceleration value, w2 is the confidence of the second acceleration value, R_acc=[Rx_acc, Ry_acc, Rz_acc], R_gyro=[Rx_gyro, Ry_gyro, Rz_gyro].
6. The posture estimation method as claimed in claim 5, characterized in that: The method further comprises: Divide both the numerator and denominator in the calculation formula of R_est(n) by w1 to obtain: Among them, let w2 / w1=w_gyro to get: 。 7. The posture estimation method according to claim 6, characterized in that: The method further comprises: The calculation formula of R_est(n) is decomposed to obtain: 。 8. A posture estimation device, characterized in that: include: A first measuring unit, configured to measure a current first acceleration value through an accelerometer, and decompose the first acceleration value into first components on an X-axis, a Y-axis, and a Z-axis in a three-dimensional coordinate system; A second measuring unit is used to measure, by a gyroscope, an angle change rate between a projection of the current first acceleration value on an XZ plane and an angle between the Z axis, and an angle change rate between a projection of the current first acceleration value on a YZ plane and an angle between the Z axis; a calculation unit, configured to calculate second components of the second acceleration value corrected by the gyroscope on the X-axis, the Y-axis and the Z-axis respectively according to the angle change rate; An acquiring unit, used to respectively acquire the confidence of the first acceleration value and the second acceleration value; An estimation unit is used to calculate a posture estimation value of the current device according to the confidence, the first component and the second component.
9. A terminal, characterized in that: The terminal comprises: a memory and a processor, wherein an application processing program is stored in the memory, and when the application processing program is executed by the processor, the steps of the posture estimation method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the posture estimation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Old person abnormal condition judging method based on mobile phone accelerometer and gyroscope
CN103680063A
Attitude calculation method and relevant devices
CN108413960A
Audio data processing method, chip, earphone and Bluetooth earphone assembly
CN115426563A
Orientation calculation apparatus, orientation calculation program, game apparatus, and game program
JP2010207331A
