Gyroscope data processing method and device
By dynamically adjusting the sampling rate and gain value of the gyroscope and filter parameters, the problem of inaccurate data during high-speed motion of Android devices is solved, and the accuracy and reliability of data processing are improved.
Patent Information
- Application Number
- CN202411728902.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-11
AI Technical Summary
When Android devices are moving at high speed or vibrating violently, the fixed sampling rate and gain value cannot be adjusted in real time, resulting in inaccurate gyroscope data.
The built-in sensor determines the movement speed of the mobile terminal, dynamically adjusts the sampling rate and gain value of the gyroscope according to the movement speed state, and adjusts the parameters of the filter to adapt to changes in the movement state.
It improves the accuracy of gyroscope data processing, enhances the reliability of filter processing results, and adapts to the dynamic changes in the motion state of the mobile terminal.
Smart Images

Figure CN119595940A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and more specifically, to a gyroscope data processing method and device. Background Art
[0002] The gyroscope is one of the important sensors of Android devices. The real-time angular velocity of Android devices can be obtained through the gyroscope. In particular, the high dynamic range gyroscope can capture the angular velocity changes of Android devices under high-speed motion, which is crucial for the implementation of virtual reality, augmented reality and motion tracking in Android devices. Currently, fixed sampling rate and gain value are often used to collect gyroscope data. However, when the Android device is moving at high speed or vibrating violently, the fixed sampling rate and gain value cannot be adjusted in real time according to the changes in the motion state of the Android device, resulting in inaccurate collected data.
[0003] Therefore, how to dynamically adjust the sampling rate and gain value of the gyroscope when the motion state of the Android device changes has become an urgent problem to be solved. Summary of the invention
[0004] The present application provides a gyroscope data processing method and device, which aims to dynamically adjust the sampling rate and gain value of the gyroscope to adapt to the dynamic changes in the motion state of the Android device and improve the accuracy of gyroscope data processing.
[0005] In a first aspect, a gyroscope data processing method is provided, comprising: determining the movement speed of the mobile terminal at a first moment through a built-in sensor; determining the movement speed state of the mobile terminal according to the movement speed and a preset threshold, the movement speed state including a high-speed movement state, a medium-speed movement state, or a low-speed movement state; adjusting the sampling rate and gain value of the gyroscope according to the movement speed state; adjusting the parameters of a filter according to the movement speed state; acquiring at least one angular velocity data of the gyroscope, the at least one angular velocity data being obtained according to the adjusted sampling rate and gain value; and inputting the at least one angular velocity data into the filter after adjusting the parameters, so that the filter processes the at least one angular velocity data.
[0006] Based on the above scheme, the sampling rate and gain of the gyroscope and the parameters of the filter are dynamically adjusted by detecting the movement speed of the mobile terminal, and then the gyroscope data collected after the sampling rate and gain are adjusted are processed according to the filter with adjusted parameters. In this way, the sampling rate and gain of the gyroscope can dynamically adapt to the movement of the mobile terminal, thereby improving the reliability of the filter processing.
[0007] In combination with the first aspect, in certain implementations of the first aspect, the sampling rate and gain value of the gyroscope are adjusted according to the motion speed state, including: when the mobile terminal is in the low-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the second sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the second gain value; when the mobile terminal is in the medium-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the third sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the third gain value; when the mobile terminal is in the high-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the fourth sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the fourth gain value; wherein the first sampling rate is the sampling rate of the gyroscope at a second moment, and the first gain value is the sampling rate of the gyroscope at the second moment, and the second moment is before the first moment.
[0008] In combination with the first aspect, in certain implementations of the first aspect, when the mobile terminal is in the low-speed motion state, the first sampling rate is greater than or equal to the second sampling rate, and the first gain is greater than or equal to the second gain; when the mobile terminal is in the medium-speed motion state, the first sampling rate is greater than the third sampling rate, and the first gain is greater than or equal to the second gain; or the first sampling rate is less than the third sampling rate, and the first gain is less than the second gain; when the mobile terminal is in the high-speed motion state, the first sampling rate is less than the fourth sampling rate, and the first gain is less than the fourth gain.
[0009] In combination with the first aspect, in certain implementations of the first aspect, the parameters of the filter are adjusted according to the motion speed state, including: when the mobile terminal is in the low-speed motion state, the parameters of the filter are adjusted from the first parameter to the second parameter; when the mobile terminal is in the medium-speed motion state, the parameters of the filter are adjusted from the first parameter to the third parameter; when the mobile terminal is in the high-speed motion state, the parameters of the filter are adjusted from the first parameter to the fourth parameter; wherein the first parameter is the parameter of the filter at the second moment.
[0010] In combination with the first aspect, in certain implementations of the first aspect, the first parameter includes the first cutoff frequency of the filter and the first filter coefficient of the filter; the second parameter includes the second cutoff frequency of the filter and the second filter coefficient of the filter; the third parameter includes the third cutoff frequency of the filter and the third filter coefficient of the filter; the fourth parameter includes the fourth cutoff frequency of the filter and the fourth filter coefficient of the filter.
[0011] In combination with the first aspect, in certain implementations of the first aspect, when the mobile terminal is in the low-speed motion state, the first cutoff frequency is greater than or equal to the second cutoff frequency, and the first filter coefficient is greater than or equal to the second filter coefficient; when the mobile terminal is in the medium-speed motion state, the first cutoff frequency is greater than the third cutoff frequency, and the first filter coefficient is greater than the third filter coefficient; or the first cutoff frequency is less than the third cutoff frequency, and the first filter coefficient is less than the third filter coefficient; when the mobile terminal is in the high-speed motion state, the first cutoff frequency is less than the fourth cutoff frequency, and the first filter coefficient is less than the fourth filter coefficient.
[0012] In combination with the first aspect, in certain implementations of the first aspect, determining the movement speed of the mobile terminal at a first moment through a built-in sensor includes: acquiring acceleration data of the mobile terminal at the first moment from the sensor, where the sensor is an accelerometer; and determining the movement speed of the mobile terminal based on the acceleration data.
[0013] In combination with the first aspect, in certain implementations of the first aspect, the movement speed state of the mobile terminal is determined based on the movement speed and a preset threshold, including: when the movement speed of the mobile terminal is less than or equal to the preset first threshold, determining that the mobile terminal is in the low-speed movement state; when the movement speed of the mobile terminal is greater than the preset first threshold and less than the preset second threshold, determining that the mobile terminal is in the medium-speed movement state; when the movement speed of the mobile terminal is greater than or equal to the preset second threshold, determining that the mobile terminal is in the high-speed movement state; wherein the preset first threshold is less than the preset second threshold.
[0014] In a second aspect, a gyroscope data processing device is provided, including: a determination module, used to determine the movement speed of a mobile terminal at a first moment through a built-in sensor, and used to determine the movement speed state of the mobile terminal according to the movement speed and a preset threshold, the movement speed state including a high-speed movement state, a medium-speed movement state, or a low-speed movement state; an adjustment module, used to adjust the sampling rate and gain value of the gyroscope according to the movement speed state, and used to adjust the parameters of the filter according to the movement speed state; the acquisition module, used to obtain at least one angular velocity data of the gyroscope, the at least one angular velocity data is obtained according to the adjusted sampling rate and gain value; a processing module, used to input the at least one angular velocity data into the filter after adjusting the parameters, so that the filter processes the at least one angular velocity data.
[0015] In a third aspect, a gyroscope data processing device is provided, comprising: a processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory to execute a method in any possible implementation of the first aspect above.
[0016] In a fourth aspect, a mobile terminal is provided, comprising a device in any possible implementation manner of the second aspect or the third aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic block diagram of a gyroscope data processing method 100 provided in an embodiment of the present application.
[0018] Figure 2 It is a schematic block diagram of a method 200 for determining a movement speed of a mobile terminal provided in an embodiment of the present application.
[0019] Figure 3 It is a schematic block diagram of a data collection method 300 provided in an embodiment of the present application.
[0020] Figure 4 It is a schematic structural block diagram of a gyroscope data processing device 400 provided in an embodiment of the present application.
[0021] Figure 5 It is a schematic structural block diagram of another gyroscope data processing device 500 provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0023] The present application relates to data processing technology, and more specifically, to gyroscope data processing technology.
[0024] In the present application, the gyroscope may be a high dynamic range (HDR) gyroscope.
[0025] In Android devices, when processing gyroscope data, multiple angular velocity data are collected through fixed sampling rates and gain values, and the data are input into the filter for processing. However, in actual applications, Android devices may run at high speeds, low speeds, or medium speeds. At this time, the gyroscope data collected using fixed sampling rates and gain values will be inaccurate, which will affect the reliability of the filter's processing results for the gyroscope data.
[0026] In this application, an Android device may also be referred to as a mobile terminal, or a mobile device or a communication device. For ease of description, this application is described using a mobile terminal as an example.
[0027] In view of this, the present application proposes a new gyroscope data processing method, which dynamically adjusts the sampling rate and gain value of the gyroscope and the parameters of the filter by detecting the movement speed of the mobile terminal, and then processes the gyroscope data collected after the sampling rate and gain value are adjusted according to the filter with adjusted parameters. In this way, the sampling rate and gain of the gyroscope can dynamically adapt to the movement of the mobile terminal, thereby improving the reliability of the filter processing.
[0028] Figure 1 FIG. 1 is a schematic block diagram of a gyroscope data processing method 100. The gyroscope data processing method 100 is applied to a mobile terminal, which includes a gyroscope, a built-in sensor and a filter. Figure 1 As shown, the gyroscope data processing method 100 includes the following steps.
[0029] S110: Determine a movement speed of the mobile terminal at a first moment through a built-in sensor.
[0030] S120: Determine a motion speed state of the mobile terminal according to the motion speed and a preset threshold, where the motion speed state includes a high-speed motion state, a medium-speed motion state, or a low-speed motion state.
[0031] S130: Adjust the sampling rate and gain value of the gyroscope according to the motion speed state.
[0032] S140: Adjust filter parameters according to the motion speed state.
[0033] S150: Acquire at least one angular velocity data of a gyroscope, where the at least one angular velocity data is obtained according to the adjusted sampling rate and gain value of the gyroscope.
[0034] S160: Input at least one angular velocity data into the filter after adjusting the parameters, so that the filter processes the at least one angular velocity data.
[0035] In the above step S110, if the mobile terminal is in motion, the motion acceleration of the mobile terminal at the first moment can be determined by the built-in sensor, and then the motion speed of the mobile terminal at the first moment can be determined according to the motion acceleration of the mobile terminal.
[0036] Specifically, the built-in sensor may be an accelerometer, which is also called an acceleration sensor. The accelerometer is used to measure the acceleration of the mobile terminal. The mobile terminal obtains its acceleration data on the X-axis, Y-axis and Z-axis through the accelerometer. Then, the speed of the mobile terminal is calculated based on the acceleration data, and then the calculated speed of the mobile terminal is compared with a preset threshold value to determine whether the mobile terminal is in a high-speed motion state or a low-speed motion state.
[0037] It should be noted that the present application does not limit the name of the accelerometer, and any sensor that can measure the acceleration of the mobile terminal can be equivalent to the accelerometer in the present application.
[0038] Figure 2 FIG. 2 is a schematic block diagram of a method 200 for determining a moving speed of a mobile terminal provided in an embodiment of the present application. Figure 2 As shown, the method 200 for determining the motion speed state of a mobile terminal includes the following steps.
[0039] S210: Acquire acceleration data of the mobile terminal at a first moment from a sensor, where the sensor is an accelerometer.
[0040] Specifically, at the first moment, acceleration data is collected by a built-in accelerometer. The collected acceleration data and the acceleration data collected at moments after the first moment can be a continuous time series or a discrete time series. In other words, the built-in sensor can collect acceleration data of the mobile terminal at different moments.
[0041] Among them, the acceleration data can be expressed as: a(t)=(a x (t), a y (t), a z (t)). a(t) represents the acceleration of the mobile terminal at time t, a x (t), a y (t), a z (t) represents the acceleration of the mobile terminal on the X-axis, Y-axis and Z-axis at the tth moment. Among them, a(t) can be specifically expressed as
[0042] S220: Determine the movement speed of the mobile terminal based on the acceleration data.
[0043] Specifically, the first moment is recorded as moment t. When the acceleration data is continuous, the movement speed v(t) of the mobile terminal at the first moment can be determined by the following formula:
[0044]
[0045] Among them, at time T, the acceleration of the mobile terminal is a(T), and the acceleration data from time T to time t are integrated to obtain the movement speed of the mobile terminal as the mobile terminal at time T, where T is less than t.
[0046] Exemplarily, T may be time 0, at which point it is considered that the mobile terminal has just started to move and is in a stationary state, and at which point the acceleration of the mobile terminal is 0.
[0047] Exemplarily, when the acceleration data is a discrete time series, the movement speed v(t) of the mobile terminal can be determined by a numerical integration method, such as a trapezoidal integration method. The present application does not limit the method for determining the movement speed of the mobile terminal based on the acceleration data of a discrete time series.
[0048] Specifically, when the acceleration data is discrete data, at time t1, t2…t n Collect n acceleration data, record them as a(t1), a(t2)…a(t n ). Then we can further get t i The speed v(t i ):
[0049] v(t i )=v(t i-1 )+a(t i-1 )·(t i -t i-1 )
[0050] Among them, a(t i-1 ) represents the time point t i-1 The acceleration value, l i -t i-1 Represents the time interval between two adjacent sampling points. i It can be considered as the first moment.
[0051] Before the above step S110 , the method 100 further includes collecting angular velocity data according to an initial sampling rate and an initial gain value.
[0052] Among them, the initial sampling rate can be understood as the initial sampling rate set for the gyroscope before the gyroscope collects data, that is, the sampling rate set in the initialization stage of the mobile terminal; the initial gain value can be understood as the initial gain value set for the gyroscope before the gyroscope collects data, that is, the gain value set in the initialization stage of the mobile terminal. At this time, the angular velocity data collected according to the initial sampling rate and the initial gain value can be understood as the initial angular velocity data. Further, according to these angular velocity data, the rotation state of the current mobile terminal can be determined and the movement speed of the mobile terminal can be calculated.
[0053] In one implementation, the acceleration data obtained in the above step S210 is angular acceleration data. In step S220, the movement speed of the mobile terminal is determined according to the acceleration data, and specifically, the movement speed of the mobile terminal is determined according to the angular acceleration data. That is, in the embodiment of the present application, the movement speed of the mobile terminal can also be determined according to the angular acceleration data. At this time, the built-in sensor is a gyroscope.
[0054] Specifically, collecting angular velocity data according to the initial sampling rate and the initial gain value includes: Figure 3 Steps S310 to S330 in .
[0055] Figure 3 A schematic block diagram of a method 300 for collecting angular velocity data provided in an embodiment of the present application is shown.
[0056] S310: Set the initial sampling rate and initial gain value of the gyroscope.
[0057] Specifically, the sampling rate of the gyroscope is set to the initial sampling rate, and the gain value of the gyroscope is set to the initial gain value through the control interface of the mobile terminal.
[0058] The initial sampling rate and initial gain value may be set according to the actual application scenario of the mobile terminal. For example, in a motion tracking scenario under a high dynamic environment, a higher initial sampling rate and initial gain value may be set.
[0059] S320, controlling the gyroscope to collect data.
[0060] Specifically, the gyroscope is controlled to start, and a plurality of angular velocity data are recorded through the measurement function of the gyroscope at a set initial sampling rate and initial gain value, and the plurality of angular velocity data are recorded as a first data set.
[0061] Among them, each angular velocity data of the multiple angular velocity data is three-dimensional data, and the three-dimensional data are the angular velocities on the X, Y, and Z axes respectively. The angular velocities on the X, Y, and Z axes respectively represent the rotation rates of the mobile terminal around the X, Y, and Z axes, and can be used to analyze the rotational motion of the mobile terminal.
[0062] In this application, each angular velocity data is the angular velocity at a certain moment, for example, at moments t1, t2, ..., t n The n angular velocity data are collected and recorded as ω(t1), ω(t2)…ω(t n ). Then we can further get t i Angular acceleration α(t i ):
[0063]
[0064] Among them, ω(t i+1 ) and ω(t i ) represent adjacent time points t i+1 and t i The angular velocity value, t i+1 -t i Indicates the time interval between two adjacent sampling points.
[0065] It should be noted that when the gyroscope collects data, it also collects the sensor's timestamp, sensor status information, sensor temperature information, and sensor bias and drift information. Among them, the sensor's timestamp is used to indicate the time when the data was collected, and the sensor's timestamp can be used to synchronize the data of each sensor. The sensor status information includes the current state of the gyroscope, the calibration state, and whether an error has occurred. The sensor status information can be used to further determine the reliability of the data and perform fault diagnosis on the gyroscope. The sensor's bias and drift information is used to correct the system error in the measurement process to improve the accuracy of the data.
[0066] S330: Acquire a first data set from a gyroscope.
[0067] A first data set is read from the gyroscope and the first data set is stored in a cache of the mobile terminal.
[0068] Furthermore, according to the angular velocity data, the angular acceleration data of the mobile terminal is determined, and then the speed data of the mobile terminal is determined.
[0069] According to the angular velocity data obtained in step S330, t i Angular acceleration α(t i ):
[0070]
[0071] Among them, ω(t i+1 ) and ω(t i ) represent adjacent time points t i+1 and t i The angular velocity value, t i+1 -t i Indicates the time interval between two adjacent sampling points.
[0072] It should be noted that when obtaining angular acceleration data according to angular velocity, the above time t i It can be considered as the first moment. Then at the first moment, the movement speed of the mobile terminal is:
[0073] v(t i )=v(t i-1 )+α(t i)·(t i -t i-1 )
[0074] In the above step S120, the movement speed of the mobile terminal is compared with a preset threshold to determine the movement speed state of the movement, and the movement speed state includes a high-speed movement state, a medium-speed movement state, or a low-speed movement state.
[0075] Specifically, the movement speed of the mobile terminal is compared with a preset first threshold and / or a preset second threshold, and the preset first threshold is less than the preset second threshold. The preset first threshold and the preset second threshold can be set according to the type of the mobile terminal and the application scenario. For example, when the mobile terminal is a handheld device or a wearable device, a lower first threshold and a lower second threshold are set. For another example, when the mobile terminal is a car or other fast-moving device, a higher first threshold and a higher second threshold are set.
[0076] In the embodiment of the present application, the first threshold value can be set at 0.1 m / s 2 -0.5m / s 2 The second threshold can be set at 1m / s 2 -5m / s 2 between.
[0077] In one implementation, the movement speed of the mobile terminal is compared with a preset first threshold. When the movement speed is greater than or equal to the preset first threshold, it is determined that the mobile terminal is in a high-speed movement state; when the movement speed of the mobile terminal is less than the preset first threshold, it is determined that the mobile terminal is in a low-speed movement state.
[0078] In one implementation, the movement speed of the mobile terminal is compared with a preset second threshold. When the movement speed of the mobile terminal is greater than or equal to the preset second threshold, it is determined that the mobile terminal is in a high-speed movement state; when the movement speed of the mobile terminal is less than the preset first threshold, it is determined that the mobile terminal is in a low-speed movement state.
[0079] In one implementation, the movement speed of the mobile terminal is compared with a preset first threshold and a preset second threshold. When the movement speed of the mobile terminal is less than or equal to the preset first threshold, it is determined that the mobile terminal is in a low-speed movement state; when the movement speed of the mobile terminal is greater than the preset first threshold and less than the preset second threshold, it is determined that the mobile terminal is in a medium-speed movement state; when the movement speed of the mobile terminal is greater than or equal to the preset second threshold, it is determined that the mobile terminal is in a high-speed movement state.
[0080] Furthermore, the mobile terminal adjusts the sampling rate and gain value of the gyroscope according to the motion speed state.
[0081] In the above step S130, the sampling rate and gain value of the gyroscope are adjusted according to the motion speed state of the mobile terminal.
[0082] Specifically, when the mobile terminal is in a low-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the second sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the second gain value; when the mobile terminal is in a medium-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the third sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the third gain value; when the mobile terminal is in a high-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the fourth sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the fourth gain value. Among them, the first sampling rate is the sampling rate of the gyroscope at the second moment, and the first gain value is the sampling rate of the gyroscope at the second moment, and the second moment is before the first moment.
[0083] It should be noted that when the second moment is moment 0, the first sampling rate and the first gain value are the above-mentioned initial sampling rate and initial gain value.
[0084] In one implementation, when the mobile terminal is in a low-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the second sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the second gain value. The second sampling rate is less than or equal to the first sampling rate, and the second gain value is less than or equal to the second gain value. At this time, the second gain value may be 0.5.
[0085] Specifically, when the mobile terminal is in a low-speed motion state, the sampling rate of the gyroscope is reduced, for example, the sampling rate of the gyroscope at the second moment is the first sampling rate. At this time, the sampling rate of the gyroscope is reduced from the first sampling rate to the second sampling rate. In this way, when the mobile terminal is in a low-speed motion state, the sampling rate of the gyroscope is adjusted in real time to adapt to the low-speed motion, so as to collect more accurate angular velocity data. When the mobile terminal is in a low-speed motion state, the gain value of the gyroscope is reduced, for example, the gain value of the gyroscope at the second moment is the first gain value. At this time, the gain value of the gyroscope is reduced from the first gain value to the second gain value. In this way, when the mobile terminal is in a low-speed motion state, the gain value of the gyroscope is adjusted in real time. In the case of low-speed motion, the signal does not change violently, and reducing the gain value of the gyroscope can suppress the interference of noise.
[0086] As an example, at the second moment, if the mobile terminal is also in a low-speed motion state, at this time, the first sampling is equal to the second sampling rate, and the first gain value is equal to the second gain value, which can be understood as the second sampling rate is the same as the first sampling rate, and the second gain value is the same as the first gain value. In other words, the motion speed of the mobile terminal at the first moment is the same as the motion speed of the mobile terminal at the second moment, and at this time, it can be considered that there is no need to adjust the sampling rate and gain value of the gyroscope.
[0087] As an example, at the second moment, if the mobile terminal is also in a low-speed motion state, the second sampling rate and the second gain value are both smaller than the first sampling rate and the first gain value. It can be understood that the movement speed of the mobile terminal at the first moment is lower than the movement speed of the mobile terminal at the second moment. At this time, the first sampling rate and the first gain value need to be lowered.
[0088] In one implementation, when the mobile terminal is in a medium-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the third sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the third gain value.
[0089] As an example, when the mobile terminal is in a high-speed motion state at the second moment, the third sampling rate is less than the first sampling rate, and the third gain value is less than the first gain value. In other words, the motion speed of the mobile terminal at the second moment is higher than the motion speed of the mobile terminal at the first moment. At this time, it can be considered that the sampling rate and gain value of the gyroscope need to be lowered.
[0090] As an example, when the mobile terminal is in a medium-speed motion state at the second moment, the third sampling rate is equal to the first sampling rate, and the third gain value is equal to the first gain value. In other words, the motion speed of the mobile terminal at the first moment is the same as the motion speed of the mobile terminal at the first moment, and at this time, it can be considered that there is no need to adjust the sampling rate and gain value of the gyroscope.
[0091] As an example, when the mobile terminal is in a low-speed motion state at the second moment, the third sampling rate is greater than the first sampling rate, and the third gain value is greater than the first gain value. In other words, the motion speed of the mobile terminal at the second moment is lower than the motion speed of the mobile terminal at the first moment. At this time, it can be considered that the sampling rate and gain value of the gyroscope need to be increased.
[0092] In one implementation, when the mobile terminal is in a high-speed motion state, the sampling rate of the gyroscope is adjusted from the first sampling rate to the fourth sampling rate, and the gain value of the gyroscope is adjusted from the first gain value to the fourth gain value, the fourth sampling rate is greater than or equal to the first sampling rate, and the fourth gain value is greater than or equal to the first gain value. At this time, the fourth gain value can be 2 or 3.
[0093] Specifically, when the mobile terminal is in a high-speed motion state, the sampling rate of the gyroscope is increased, for example, the sampling rate of the gyroscope at the second moment is the first sampling rate. At this time, the sampling rate of the gyroscope is increased from the first sampling rate to the fourth sampling rate. In this way, when the mobile terminal is in high-speed motion, the sampling rate of the gyroscope can be adjusted in real time to adapt to the high-speed motion, so as to collect more accurate angular velocity data. When the mobile terminal is in a high-speed motion state, the gain value of the gyroscope is increased, for example, the gain value of the gyroscope at the second moment is the first gain value. At this time, the gain value of the gyroscope is increased from the first gain value to the fourth gain value. In this way, when the mobile terminal is in high-speed motion, the gain value of the gyroscope can be adjusted in real time to adapt to the high-speed motion. In the case of high-speed motion, the signal changes dramatically, and increasing the gain value of the gyroscope can make the gyroscope output an amplified signal, and then can detect weaker motion changes of the mobile terminal.
[0094] As an example, at the second moment, if the mobile terminal is also in a high-speed motion state, at this time, the first sampling is equal to the fourth sampling rate, and the first gain value is equal to the fourth gain value. It can be understood that the fourth sampling rate is the same as the first sampling rate, and the fourth gain value is the same as the first gain value. In other words, the motion speed of the mobile terminal at the second moment is the same as the motion speed of the mobile terminal at the first moment. At this time, it can be considered that there is no need to adjust the sampling rate and gain value of the gyroscope.
[0095] As an example, at the second moment, if the mobile terminal is also in a high-speed motion state, the fourth sampling rate and the fourth gain value are both greater than the first sampling rate and the first gain value. It can be understood that the movement speed of the mobile terminal at the second moment is lower than the movement speed of the mobile terminal at the first moment. At this time, the first sampling rate and the first gain value need to be increased.
[0096] In the present application, the low-speed motion state, the medium-speed motion state and the high-speed motion state can be understood as the speed of the mobile terminal in the medium-speed motion state is higher than the speed in the low-speed motion state, but lower than the speed in the high-speed motion state.
[0097] In the above step S140, the parameters of the filter are adjusted according to the motion speed state of the mobile terminal at the first moment.
[0098] Specifically, when the mobile terminal is in a low-speed motion state, the filter parameter is adjusted from the first parameter to the second parameter; when the mobile terminal is in a medium-speed motion state, the filter parameter is adjusted from the first parameter to the third parameter; when the mobile terminal is in a high-speed motion state, the filter parameter is adjusted from the first parameter to the fourth parameter. The first parameter is the parameter of the filter at the second moment, and the second moment is before the first moment.
[0099] Among them, the first parameter includes the first cutoff frequency of the filter and the first filter coefficient of the filter; the second parameter includes the second cutoff frequency of the filter and the second filter coefficient of the filter; the third parameter includes the third cutoff frequency of the filter and the third filter coefficient of the filter; the fourth parameter includes the fourth cutoff frequency of the filter and the fourth filter coefficient of the filter.
[0100] In one implementation, when the mobile terminal is in a low-speed motion state, a parameter of the filter is adjusted from a first parameter to a second parameter, where the second parameter is less than or equal to the first parameter.
[0101] As an example, at the second moment, if the mobile terminal is also in a low-speed motion state, at this time, the first parameter is equal to the second parameter, which can be understood as the motion speed of the mobile terminal at the first moment is the same as the motion speed of the mobile terminal at the second moment. At this time, it can be considered that there is no need to adjust the filter parameters. Specifically, the first cutoff frequency is equal to the second cutoff frequency, and the first filter coefficient is equal to the second filter coefficient.
[0102] As an example, at the second moment, if the mobile terminal is also in a low-speed motion state, the second parameter is smaller than the first parameter. It can be understood that the motion speed of the mobile terminal at the first moment is lower than the motion speed of the mobile terminal at the second moment. At this time, the first parameter needs to be lowered. Specifically, the first cutoff frequency is greater than the second cutoff frequency, and the first filter coefficient is greater than the second filter coefficient. In other words, when the mobile terminal is in a low-speed motion state, the cutoff frequency and filter coefficient of the filter will be reduced.
[0103] In one implementation, when the mobile terminal is in a medium-speed motion state, the parameter of the filter is adjusted from the first parameter to the third parameter.
[0104] As an example, when the mobile terminal is in a high-speed motion state at the second moment, the third parameter is less than the first parameter. That is to say, the motion speed of the mobile terminal at the second moment is higher than the motion speed of the mobile terminal at the first moment. At this time, it can be considered that the parameters of the filter need to be lowered. Specifically, the first cutoff frequency is greater than the third cutoff frequency, and the first filter coefficient is greater than the third filter coefficient. In other words, when the mobile terminal changes from a high-speed motion state to a medium-speed motion state, the cutoff frequency and filter coefficient of the filter will be reduced.
[0105] As an example, when the mobile terminal is in a medium-speed motion state at the second moment, the third parameter is equal to the first parameter. That is, the motion speed of the mobile terminal at the second moment is the same as the motion speed of the mobile terminal at the first moment, and at this time, it can be considered that there is no need to adjust the parameters of the filter.
[0106] As an example, when the mobile terminal is in a low-speed motion state at the second moment, the third parameter is greater than the first parameter. That is to say, the motion speed of the mobile terminal at the second moment is lower than the motion speed of the mobile terminal at the first moment. At this time, it can be considered that the parameters of the filter need to be increased. Specifically, the first cutoff frequency is less than the third cutoff frequency, and the first filter coefficient is less than the third filter coefficient. In other words, when the mobile terminal changes from a low-speed motion state to a medium-speed motion state, the cutoff frequency and filter coefficient of the filter will be increased.
[0107] In one implementation, when the mobile terminal is in a high-speed motion state, the parameter of the filter is adjusted from the first parameter to a fourth parameter, and the fourth parameter is greater than or equal to the first parameter.
[0108] As an example, at the second moment, if the mobile terminal is also in high-speed motion, at this time, the first parameter is equal to the fourth parameter. In other words, the motion speed of the mobile terminal at the first moment is the same as the motion speed of the mobile terminal at the second moment, and at this time, it can be considered that there is no need to adjust the parameters of the filter.
[0109] As an example, at the second moment, if the mobile terminal is in a low-speed motion state or a medium-speed motion state, the first parameter is less than the fourth parameter. That is, the motion speed of the mobile terminal at the first moment is higher than the motion speed of the mobile terminal at the second moment. At this time, it can be considered that the parameters of the filter need to be increased. Specifically, the first cutoff frequency is less than the fourth cutoff frequency, and the first filter coefficient is less than the fourth filter coefficient. In other words, when the mobile terminal changes from a low-speed motion state or a medium-speed motion state to a high-speed motion state, the cutoff frequency and filter coefficient of the filter will be increased.
[0110] In the above step S150, the gyroscope collects at least one angular velocity data according to the adjusted sampling rate and gain value, and then the mobile terminal obtains the at least one angular velocity data from the gyroscope.
[0111] Specifically, at least one angular velocity data of the gyroscope is obtained, and the at least one angular velocity data is obtained according to the adjusted sampling rate and gain value. For example, the sampling rate and gain value of the gyroscope are set to the sampling rate and gain value adjusted according to the motion speed state of the mobile terminal, and then the at least one angular velocity data is collected using the adjusted sampling rate and gain value.
[0112] In one implementation, when the mobile terminal is in a low-speed motion state, the sampling rate of the gyroscope is adjusted to a second sampling rate, the gain value of the gyroscope is adjusted to a second gain value, and the at least one angular velocity data is collected according to the second sampling rate and the second gain value.
[0113] In one implementation, when the mobile terminal is in a medium-speed motion state, the sampling rate of the gyroscope is adjusted to a third sampling rate, the gain value of the gyroscope is adjusted to a third gain value, and the at least one angular velocity data is collected according to the third sampling rate and the third gain value.
[0114] In one implementation, when the mobile terminal is in high-speed motion, the sampling rate of the gyroscope is adjusted to a fourth sampling rate, the gain value of the gyroscope is adjusted to a fourth gain value, and the at least one angular velocity data is collected according to the fourth sampling rate and the fourth gain value.
[0115] In the above step S160, the at least one angular velocity data is input into the filter with adjusted parameters, and the filter with adjusted parameters is used to process the input at least one angular velocity data.
[0116] In this application, the filter with adjusted parameters can better eliminate noise.
[0117] In one implementation, when the mobile terminal is in a low-speed motion state, a parameter of the filter is adjusted to a second parameter, and the at least one angular velocity data is processed using a filter of the second parameter.
[0118] In one implementation, when the mobile terminal is in a medium-speed motion state, a parameter of the filter is adjusted to a third parameter, and the at least one angular velocity data is processed using the filter of the third parameter.
[0119] In one implementation, when the mobile terminal is in a high-speed motion state, a parameter of the filter is adjusted to a fourth parameter, and the at least one angular velocity data is processed using a filter of the fourth parameter.
[0120] In the embodiment of the present application, the movement speed of the mobile terminal is detected to determine the movement speed state of the mobile terminal, and then the sampling rate and gain value of the gyroscope and the parameters of the filter are adjusted according to the movement speed state of the mobile terminal, so that when the movement state of the mobile terminal changes, the gyroscope can also adapt to the change of the movement speed of the mobile terminal, thereby collecting more accurate data. At the same time, the parameters of the filter can also adapt to the movement of the mobile terminal, thereby improving the accuracy of the filter processing result.
[0121] The embodiment of the present application also provides a gyroscope data processing device. Figure 4 A schematic structural block diagram of a gyroscope data processing device 400 provided in an embodiment of the present application is shown.
[0122] like Figure 4 As shown, the gyroscope data processing device 400 may include a determination module 410 , an adjustment module 420 , a collection module 430 , and a processing module 440 .
[0123] The determination module 410 is used to determine the movement speed of the mobile terminal at the first moment through the built-in sensor, and to determine the movement speed state of the mobile terminal according to the movement speed and a preset threshold, and the movement speed state includes a high-speed movement state, a medium-speed movement state, or a low-speed movement state.
[0124] In one implementation, the determination module 410 is specifically configured to determine that the terminal is in a low-speed motion state when the motion speed of the mobile terminal is less than or equal to a preset first threshold.
[0125] In one implementation, the determination module 410 is specifically configured to determine that the mobile terminal is in a medium-speed motion state when the motion speed of the mobile terminal is greater than a preset first threshold and less than a preset second threshold.
[0126] In one implementation, the determination module 410 is specifically configured to determine that the mobile terminal is in a high-speed motion state when the motion speed is greater than or equal to a preset second threshold.
[0127] The adjustment module 420 is used to adjust the sampling rate and gain value of the gyroscope according to the motion speed state, and is used to adjust the parameters of the filter according to the motion speed state.
[0128] In one implementation, when the mobile terminal is in a low-speed motion state, the adjustment module 420 is used to adjust the sampling rate of the gyroscope from a first sampling rate to a second sampling rate, and adjust the gain value of the gyroscope from a first gain value to a second gain value.
[0129] In one implementation, when the mobile terminal is in a medium-speed motion state, the adjustment module 420 is used to adjust the sampling rate of the gyroscope from the first sampling rate to the third sampling rate, and adjust the gain value of the gyroscope from the first gain value to the third gain value.
[0130] In one implementation, when the mobile terminal is in high-speed motion, the adjustment module 420 is used to adjust the sampling rate of the gyroscope from the first sampling rate to the fourth sampling rate, and adjust the gain value of the gyroscope from the first gain value to the fourth gain value.
[0131] The first sampling rate is the sampling rate of the gyroscope at a second moment, and the first gain value is the sampling rate of the gyroscope at a second moment, and the second moment is before the first moment.
[0132] In one implementation, when the mobile terminal is in a low-speed motion state, the adjustment module 420 is used to adjust the parameters of the filter from the first parameters to the second parameters.
[0133] In one implementation, when the mobile terminal is in a medium-speed motion state, the adjustment module 420 is used to adjust the parameters of the filter from the first parameters to the third parameters.
[0134] In one implementation, when the mobile terminal is in high-speed motion, the adjustment module 420 is further configured to adjust the filter parameter from the first parameter to the fourth parameter, wherein the first parameter is the filter parameter at the second moment, which is before the first moment.
[0135] The acquisition module 430 is used to acquire at least one angular velocity data of the gyroscope, where the at least one angular velocity data is obtained according to the adjusted sampling rate and gain value.
[0136] The processing module 440 is used to input at least one angular velocity data into the filter after adjusting the parameters, so that the filter processes the at least one angular velocity data.
[0137] The embodiment of the present application also provides another gyroscope data processing device. Figure 5 Another gyroscope data processing device 500 provided in an embodiment of the present application is shown. The gyroscope data processing device 500 may include a memory 510 and a processor 520 .
[0138] The memory 510 is used to store computer programs.
[0139] The processor 520 is used to call and run the computer program stored in the memory 510 to execute: the gyroscope data processing method provided in the above embodiment.
[0140] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program.
[0141] Optionally, the computer-readable storage medium can be applied to the method of generating test cases for the application in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes in the various methods in the embodiments of the present application. For the sake of brevity, they are not repeated here.
[0142] An embodiment of the present application also provides a computer program product, including computer program instructions.
[0143] Optionally, the computer program product can be applied to the method of generating test cases for the application in the embodiments of the present application, and the computer program instructions enable the computer to execute the corresponding processes in the various methods in the embodiments of the present application, which will not be described in detail here for the sake of brevity.
[0144] The embodiment of the present application also provides a computer program.
[0145] Optionally, the computer program can be applied to the method of generating test cases for the application program in the embodiments of the present application. When the computer program runs on a computer, the computer executes the corresponding processes in the various methods in the embodiments of the present application. For the sake of brevity, they are not described here.
[0146] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0147] It should be understood that the specific examples in this article are only intended to help those skilled in the art better understand the embodiments of the present application, rather than to limit the scope of the embodiments of the present application.
[0148] It should also be understood that the various implementation methods described in this specification can be implemented individually or in combination, and the embodiments of the present application are not limited to this.
[0149] Unless otherwise stated, all technical and scientific terms used in the embodiments of the present application are the same as the meanings generally understood by those skilled in the art of the technical field of the application. The terms used in the present application are only for the purpose of describing specific embodiments, and are not intended to limit the scope of the present application. The singular forms "a kind of", "above" and "the" used in the embodiments of the present application and the appended claims are also intended to include majority forms, unless the context clearly indicates other meanings. In addition, the terms "first", "second" etc. are only used for description purposes, and cannot be interpreted as indicating or suggesting relative importance.
[0150] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0151] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0152] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0153] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0154] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A gyroscope data processing method, applied to a mobile terminal, characterized in that: include: Determining the movement speed of the mobile terminal at a first moment by means of a built-in sensor; Determine the motion speed state of the mobile terminal according to the motion speed and a preset threshold, wherein the motion speed state includes a high-speed motion state, a medium-speed motion state, or a low-speed motion state; According to the motion speed state, adjusting the sampling rate and gain value of the gyroscope; According to the motion speed state, adjusting the parameters of the filter; Acquire at least one angular velocity data of the gyroscope, wherein the at least one angular velocity data is obtained according to the adjusted sampling rate and gain value; The at least one angular velocity data is input into the filter after adjusting the parameters, so that the filter processes the at least one angular velocity data.
2. The method according to claim 1, characterized in that According to the motion speed state, the sampling rate and gain value of the gyroscope are adjusted, including: When the mobile terminal is in the low-speed motion state, adjusting the sampling rate of the gyroscope from the first sampling rate to the second sampling rate, and adjusting the gain value of the gyroscope from the first gain value to the second gain value; When the mobile terminal is in the medium-speed motion state, adjusting the sampling rate of the gyroscope from the first sampling rate to the third sampling rate, and adjusting the gain value of the gyroscope from the first gain value to the third gain value; When the mobile terminal is in the high-speed motion state, adjusting the sampling rate of the gyroscope from the first sampling rate to the fourth sampling rate, and adjusting the gain value of the gyroscope from the first gain value to the fourth gain value; The first sampling rate is the sampling rate of the gyroscope at a second moment, the first gain value is the sampling rate of the gyroscope at the second moment, and the second moment is before the first moment.
3. The method according to claim 2, characterized in that When the mobile terminal is in the low-speed motion state, the first sampling rate is greater than or equal to the second sampling rate, and the first gain is greater than or equal to the second gain; When the mobile terminal is in the medium-speed motion state, the first sampling rate is greater than the third sampling rate, and the first gain is greater than or equal to the second gain; or The first sampling rate is less than the third sampling rate, and the first gain is less than the second gain; When the mobile terminal is in the high-speed motion state, the first sampling rate is lower than the fourth sampling rate, and the first gain is lower than the fourth gain.
4. The method according to claim 3, characterized in that According to the motion speed state, adjusting the parameters of the filter includes: When the mobile terminal is in the low-speed motion state, adjusting the parameter of the filter from the first parameter to the second parameter; When the mobile terminal is in the medium-speed motion state, adjusting the parameter of the filter from the first parameter to the third parameter; When the mobile terminal is in the high-speed motion state, adjusting the parameter of the filter from the first parameter to the fourth parameter; The first parameter is a parameter of the filter at the second moment.
5. The method according to claim 4, characterized in that The first parameter includes a first cutoff frequency of the filter and a first filter coefficient of the filter; The second parameter includes a second cutoff frequency of the filter and a second filter coefficient of the filter; The third parameter includes a third cutoff frequency of the filter and a third filter coefficient of the filter; The fourth parameter includes a fourth cutoff frequency of the filter and a fourth filter coefficient of the filter.
6. The method according to claim 5, characterized in that When the mobile terminal is in the low-speed motion state, the first cutoff frequency is greater than or equal to the second cutoff frequency, and the first filter coefficient is greater than or equal to the second filter coefficient; When the mobile terminal is in the medium-speed motion state, the first cutoff frequency is greater than the third cutoff frequency, and the first filter coefficient is greater than the third filter coefficient; or The first cut-off frequency is smaller than the third cut-off frequency, and the first filter coefficient is smaller than the third filter coefficient; When the mobile terminal is in the high-speed motion state, the first cutoff frequency is smaller than the fourth cutoff frequency, and the first filter coefficient is smaller than the fourth filter coefficient.
7. The method according to any one of claims 1 to 6, characterized in that The determining the movement speed of the mobile terminal at the first moment by using a built-in sensor includes: Acquire acceleration data of the mobile terminal at the first moment from the sensor, where the sensor is an accelerometer; Based on the acceleration data, the movement speed of the mobile terminal is determined.
8. The method according to any one of claims 1 to 6, characterized in that Determining the movement speed state of the mobile terminal according to the movement speed and a preset threshold value includes: When the movement speed of the mobile terminal is less than or equal to the preset first threshold, determining that the mobile terminal is in the low-speed movement state; When the movement speed of the mobile terminal is greater than a preset first threshold and less than a preset second threshold, determining that the mobile terminal is in the medium-speed movement state; When the movement speed of the mobile terminal is greater than or equal to a preset second threshold, determining that the mobile terminal is in the high-speed movement state; Wherein, the preset first threshold is smaller than the preset second threshold.
9. A gyroscope data processing device, characterized in that: include: a determination module, configured to determine the motion speed of the mobile terminal at a first moment through a built-in sensor, and to determine the motion speed state of the mobile terminal according to the motion speed and a preset threshold, wherein the motion speed state includes a high-speed motion state, a medium-speed motion state, or a low-speed motion state; An adjustment module, used for adjusting the sampling rate and gain value of the gyroscope according to the motion speed state, and for adjusting the parameters of the filter according to the motion speed state; An acquisition module, used for acquiring at least one angular velocity data of the gyroscope, wherein the at least one angular velocity data is obtained according to the adjusted sampling rate and gain value; The processing module is used to input the at least one angular velocity data into the filter after adjusting the parameters, so that the filter processes the at least one angular velocity data.
10. A gyroscope data processing device, characterized in that: The gyroscope data processing device comprises: a processor and a memory, wherein the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute: the gyroscope data processing method according to any one of claims 1 to 8.
11. A mobile terminal, characterized in that: The method comprises the gyroscope data processing device as claimed in claim 9 or 10.