Gyroscope data processing method and device, storage medium and electronic equipment

By calculating the median value of gyroscope data in segments and identifying the device status, the smoothness and sensitivity issues of data processing in both static and dynamic states are resolved, thereby improving the stability and accuracy of attitude detection.

CN121898484APending Publication Date: 2026-04-21SHENZHEN ZTE TRUNKING TECH CORP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN ZTE TRUNKING TECH CORP
Filing Date
2026-01-19
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively reduce noise and ensure high data sensitivity simultaneously in both static and dynamic states, impacting the posture detection accuracy and real-time performance of smart devices.

Method used

By acquiring gyroscope data, calculating the median value in segments, identifying the device status, and processing the data according to the status, noise is suppressed in the static state and data smoothness is maintained in the dynamic state. The median value is used as the effective data output.

Benefits of technology

It improves the stability and accuracy of attitude detection of the equipment in both static and dynamic states, reduces noise interference, and enhances the smoothness and sensitivity of data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121898484A_ABST
    Figure CN121898484A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a gyroscope data processing method and device, a storage medium and electronic equipment. The method comprises the following steps: acquiring to-be-processed data of a gyroscope; segmenting the to-be-processed data according to a preset standard data segment size, and determining a first median value of each data segment; determining the state of the gyroscope based on the to-be-processed data, wherein the state of the gyroscope comprises a static state and a non-static state; and processing the to-be-processed data based on the state and the first median value. According to the technical scheme, the problem that in the prior art, smoothness and sensitivity are difficult to consider during data processing of the gyroscope in the static state, and consequently noise interference affects the equipment attitude detection precision can be effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of sensor data processing, and more specifically, to a gyroscope data processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] In existing sensor data processing technologies, especially for gyroscope data processing, the traditional approach is to use a fixed-order digital filter to eliminate noise and ensure the smoothness of the output data.

[0003] However, this method has significant limitations. When smart devices such as mobile terminals, drones, or smart wearables are stationary, the data output by the gyroscope is often affected by environmental noise, resulting in data jitter. Even when the device is stationary, the gyroscope data is unstable, directly impacting the accuracy of attitude detection. On the other hand, when the device is in dynamic motion, high sensitivity of the gyroscope data is required to capture subtle changes in motion. However, the fixed characteristics of traditional digital filters often sacrifice sensitivity while improving data smoothness, leading to an inability to respond promptly to changes in the actual motion state in fast-moving scenarios, thus reducing the real-time performance and accuracy of attitude detection. Furthermore, current virtual gyroscopes on the market, i.e., gyroscope functions implemented through software algorithms, while avoiding additional hardware costs, have weak anti-interference capabilities and high noise levels when stationary. Especially when users are using the device for AR games, shooting games, or racing games, these software-based gyroscope data processing mechanisms often cannot provide stable and reliable data input, thus affecting the gaming experience and the performance of other applications that rely on gyroscope data.

[0004] In summary, existing technologies struggle to achieve a balance between static and dynamic states when processing gyroscope data. They cannot effectively reduce noise in static states, nor can they guarantee high sensitivity of data in dynamic states. This negatively impacts the performance of intelligent devices that require precise attitude detection. Summary of the Invention

[0005] This application provides a gyroscope data processing method, apparatus, storage medium, and electronic device to at least solve the problem that the prior art is unable to achieve a balance between static and dynamic motion states when processing gyroscope data, and cannot effectively reduce noise in the static state or guarantee high sensitivity of data in the dynamic state.

[0006] According to one embodiment of this application, a gyroscope data processing method is provided, the method comprising:

[0007] Acquire the data to be processed from the gyroscope;

[0008] The data to be processed is segmented according to a preset standard data segment size, and the first median value of each data segment is determined.

[0009] The state of the gyroscope is determined based on the data to be processed, and the state of the gyroscope includes a stationary state and a non-stationary state.

[0010] The data to be processed is processed based on the state and the first median value.

[0011] In an exemplary embodiment, the process of presetting the standard data segment size includes: acquiring raw data from the gyroscope in the stationary state; segmenting the raw data according to a preset initial data segment size, and determining the second median value of each data segment; determining whether the difference between the second medians of adjacent data segments satisfies a stability condition, wherein the stability condition is that the difference between the second medians is lower than a first preset threshold; if the stability condition is satisfied, confirming the data segment size as the standard data segment size; if the stability condition is not satisfied, using the preset initial data segment size as a reference, sequentially increasing the initial data segment size with a set step size until a data segment size that satisfies the stability condition is found as the standard data segment size.

[0012] In one exemplary embodiment, before determining the current state of the gyroscope based on the data to be processed, the method further includes: determining calibration data of the gyroscope; and subtracting the calibration data from the data to be processed to obtain calibrated data.

[0013] In an exemplary embodiment, determining the calibration data of the gyroscope in a stationary state includes: placing the gyroscope stationary, sampling the gyroscope data at a preset sampling frequency, and using the last sampled data as the calibration data of the gyroscope when the difference between a set number of consecutive sampled data is lower than a second preset threshold.

[0014] In an exemplary embodiment, determining the current state of the gyroscope based on the data to be processed includes: if the difference between the data to be processed and a set value is less than a third set threshold, the state of the gyroscope is a stationary state; if the difference between the data to be processed and the set value is greater than or equal to the third set threshold, the state of the gyroscope is a non-stationary state.

[0015] In an exemplary embodiment, processing the data to be processed based on the state and the first median value includes: when the gyroscope is in a non-stationary state, using the first median value as valid data for the data segment; when the gyroscope is in a stationary state, if the difference between the data to be processed in the data segment and the first median value of the previous data segment is greater than a fourth threshold, then using the first median value of the previous data segment as valid data for the data segment; if the difference between the data to be processed in the data segment and the first median value of the previous data segment is less than or equal to the fourth threshold, then setting the data to be processed in the data segment to zero.

[0016] In one exemplary embodiment, after determining the first median value of each data segment, the method further includes: storing the data to be processed and the first median value in a data storage area.

[0017] According to another embodiment of this application, a gyroscope data processing device is also provided, the device comprising:

[0018] The data acquisition module is used to acquire the data to be processed from the gyroscope;

[0019] The median value determination module is used to segment the data to be processed according to a preset standard data segment size and determine the first median value of each data segment;

[0020] A state determination module is used to determine the state of the gyroscope based on the data to be processed, wherein the state of the gyroscope includes a stationary state and a non-stationary state.

[0021] The data processing module is used to process the data to be processed based on the state and the first median value.

[0022] According to yet another embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to perform the steps in any of the above method embodiments when it is run.

[0023] According to yet another embodiment of this application, an electronic device is also provided, including a memory and a processor, wherein a computer program is stored in the memory and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0024] In this embodiment of the invention, the method first acquires the gyroscope data to be processed, then segments the data according to a preset standard data segment size, and calculates the median value of each data segment, which serves as a stable reference value representing the data segment. Next, the state of the gyroscope is identified through data analysis, i.e., whether it is in a stationary state. Finally, based on the gyroscope's state and the previously calculated first median value, the data is processed: in a non-stationary state, the median value of each data segment is used as the effective data output, which helps improve data smoothness; while in a stationary state, the difference between the median value of the new data and the previous data segment is compared to determine whether to set it to zero, thereby effectively suppressing noise interference and improving data accuracy in a stationary state. This method avoids data abrupt changes caused by switching between stationary and dynamic states, while reducing the impact of noise on gyroscope data, improving the stability and accuracy of device attitude detection, and effectively solving the problem in the prior art where gyroscope data processing in a stationary state is difficult to balance smoothness and sensitivity. Attached Figure Description

[0025] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0026] Figure 1 This is a schematic diagram of the hardware environment for an optional gyroscope data processing method according to an embodiment of this application;

[0027] Figure 2 This is a flowchart of an optional gyroscope data processing method according to an embodiment of this application;

[0028] Figure 3 This is a schematic diagram illustrating the relationship between data and data segments in an optional gyroscope data processing method according to an embodiment of this application.

[0029] Figure 4 This is a schematic diagram of an optional gyroscope data processing device according to an embodiment of this application. Detailed Implementation

[0030] The embodiments of this application will be described in detail below with reference to the accompanying drawings and examples.

[0031] It should be noted that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0032] The methods and embodiments provided in this application can be executed on a computer terminal or similar computing device. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for an optional gyroscope data processing method according to an embodiment of this application. For example... Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. The computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0033] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining the adaptability of heat dissipation equipment in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thereby implementing the above-described method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0034] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0035] This embodiment provides an example of a gyroscope data processing method. Figure 2 This is a flowchart of an optional gyroscope data processing method on the board management controller side according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:

[0036] Step S202: Obtain the data to be processed from the gyroscope.

[0037] In this embodiment, the gyroscope can be a device for detecting the angular velocity of a high-speed rotating body relative to inertial space around one or two axes orthogonal to its rotation axis. The data to be processed in this invention refers to the raw data obtained from the gyroscope, including angular velocity information along the x, y, and z axes.

[0038] Step S204: Divide the data to be processed into segments according to the preset standard data segment size, and determine the first median value of each data segment.

[0039] In this embodiment, the preset standard data segment size refers to the fixed data segment size used to calculate the median. The first median value refers to the median value calculated from the data segment, which is used to replace the original data in the data segment to improve data smoothness.

[0040] For example, Figure 3 This is a schematic diagram illustrating the relationship between data and data segments in an optional gyroscope data processing method according to an embodiment of this application, as shown below. Figure 3 As shown, this is the 5 sets of data with the preset standard data segment size.

[0041] Optionally, the process of presetting the standard data segment size includes: acquiring the raw data of the gyroscope in the static state; segmenting the raw data according to a preset initial data segment size, and determining the second median value of each data segment; determining whether the difference between the second medians of each adjacent data segment satisfies a stability condition, wherein the stability condition is that the difference between the second medians is lower than a first preset threshold; if the stability condition is satisfied, then confirming the data segment size as the standard data segment size; if the stability condition is not satisfied, then using the preset initial data segment size as a benchmark, sequentially increasing the initial data segment size with a set step size until a data segment size that satisfies the stability condition is found as the standard data segment size.

[0042] In this embodiment, the first preset threshold can be a preset threshold that can be set according to actual needs, and is not specifically limited in this embodiment. The initial data segment size is the data segment size set at the beginning of the algorithm, used for initial data processing and median calculation, and may be adjusted later according to the actual data. The step size is a fixed value used to gradually increase the data segment size when a suitable data segment size is determined, for example, starting from 5 sets of data and gradually increasing to 10 sets, 15 sets, etc.

[0043] Specifically, the process of determining the standard data segment size includes: first, acquiring raw gyroscope data in a static state; then, segmenting this raw data according to a preset initial data segment size and calculating the second median value of each data segment; next, checking whether the difference between the second medians of adjacent data segments meets the stability condition, i.e., whether these differences are all below a first preset threshold; if the condition is met, the data segment size is confirmed as the standard data segment size; if the condition is not met, the data segment size is increased sequentially according to a set step size, based on the aforementioned initial data segment size, until a data segment size that meets the stability condition is found and confirmed as the standard data segment size. This process ensures that the selected data segment size can effectively filter noise while maintaining data accuracy and sensitivity, thus providing accurate gyroscope data in both static and dynamic states, significantly improving the performance of device attitude detection. By dynamically adjusting the data segment size, the method can adapt to the noise characteristics of different devices and environments, providing a more stable data processing effect.

[0044] For example, acquire a number of gyroscope data (which could be 1000 sets) in a static state. In these data, take every 5 sets of data as a reference and take the corresponding median of the x-axis, y-axis, and z-axis. Determine whether the difference between the medians on each axis is lower than a limit. If it is satisfied, determine the size of every 5 sets as the data segment. If it is not satisfied, take 10, 15, 20, 25, and 30 sets of data as a reference and perform corresponding operations to determine the size of the data segment.

[0045] Step S206: Determine the state of the gyroscope based on the data to be processed. The state of the gyroscope includes a stationary state and a non-stationary state.

[0046] In this embodiment, "state" refers to the current motion state of the device, used to determine whether data zeroing is required. A stationary state can refer to a state where the device is not moving or is only slightly moving; in this case, gyroscope noise has a significant impact. A non-stationary state can refer to a state where the device is in motion; in this case, the gyroscope needs higher data sensitivity to capture subtle motion changes.

[0047] Specifically, the state of the gyroscope is identified through data analysis, that is, whether it is in a stationary state.

[0048] Optionally, before determining the current state of the gyroscope based on the data to be processed, the method further includes: determining the calibration data of the gyroscope; and subtracting the calibration data from the data to be processed to obtain the calibrated data.

[0049] In this embodiment, determining the calibration data of the gyroscope in a static state is a prerequisite step. The calibrated data is obtained by subtracting the calibration data from the acquired data to be processed. This preprocessing step can eliminate the influence of the initial state offset of the device and ensure the accuracy of subsequent data processing.

[0050] Optionally, determining the calibration data of the gyroscope in a static state includes: placing the gyroscope at rest, sampling the gyroscope data at a preset sampling frequency, and using the last sampled data as the calibration data of the gyroscope when the difference between a set number of consecutive sampled data is lower than a second preset threshold.

[0051] In this embodiment, a strategy based on the difference of continuously sampled data is adopted when determining the gyroscope calibration data in a static state. Specifically, the device is placed in a static state, and gyroscope data is continuously collected at a preset sampling frequency. When the difference of a set number of consecutive sampled data, such as 50 sets of data, is lower than a second preset threshold, it indicates that the gyroscope is in a stable state and is not affected by external interference. At this time, the last sampled data is used as the gyroscope calibration data. This method can ensure that gyroscope data closest to the true zero point is obtained when the device is stationary, thereby effectively improving the accuracy and reliability of subsequent data processing. By setting a reasonable sampling frequency and difference threshold, the static state of the device can be accurately identified, avoiding the influence of data in non-static states on the calibration process, thereby improving the purity of the calibration data. In practical applications, this strategy can effectively reduce noise interference and ensure more accurate attitude detection of the device in static or slightly moving states.

[0052] Step S208: Process the data to be processed based on the state and the first median value.

[0053] Specifically, based on the gyroscope's state information and the previously calculated first median value, the data is processed: in the non-stationary state, the median value of each data segment is used as the effective data output, which helps to improve the smoothness of the data; while in the stationary state, the difference between the new data and the median value of the previous data segment is compared to determine whether to set it to zero.

[0054] For example, in a mobile terminal device, when the device is stationary, the system first acquires the raw data to be processed from the gyroscope. Next, the system segments the data according to a preset standard of 5 data segments and calculates the first median value for the x, y, and z axes in each segment. Then, the system determines the device state based on the raw gyroscope data. If the device is determined to be stationary, the raw data is compared with the first median value. If the difference exceeds a preset value, the first median value is used as valid data; otherwise, the valid data for each axis is set to 0. If the device is determined to be non-stationary, the first median value of each data segment is directly used as valid data. This method effectively suppresses noise interference in a stationary state and improves the processing accuracy of the gyroscope data.

[0055] By applying the technical solution of this embodiment, the gyroscope data processing method effectively solves the problem in the prior art where it is difficult to balance smoothness and sensitivity in gyroscope data processing when the gyroscope is in a static state. This method first acquires the gyroscope data to be processed, then segments the data according to a preset standard data segment size, and calculates the median value of each data segment, which serves as a stable reference value representing the data segment. Next, the state of the gyroscope is identified through data analysis, i.e., whether it is in a static state. Finally, based on the gyroscope's state and the previously calculated first median value, the data is processed: in a non-static state, the median value of each data segment is used as the effective data output, which helps improve data smoothness; while in a static state, the difference between the median value of the new data and the previous data segment is compared to determine whether to set it to zero, thereby effectively suppressing noise interference and improving data accuracy in a static state. This method avoids the data abrupt change problem caused by switching between static and dynamic states, while reducing the impact of noise on gyroscope data and improving the stability and accuracy of device attitude detection.

[0056] Optionally, determining the current state of the gyroscope based on the data to be processed includes: if the difference between the data to be processed and the set value is less than a third set threshold, the state of the gyroscope is a stationary state; if the difference between the data to be processed and the set value is greater than or equal to the third set threshold, the state of the gyroscope is a non-stationary state.

[0057] In this embodiment, to distinguish between stationary and non-stationary states, a determination mechanism is introduced. By comparing the differences between the data of each axis of the gyroscope and zero, it decides whether to use the median of the previous data segment as the current valid data, or to set the data to zero, thus adapting to different situations of slight movement and complete stillness. This flexible data processing strategy not only significantly reduces the noise of the gyroscope data in the stationary state, but also enables a rapid response when the device enters a state of slight movement, maintaining high data accuracy and device attitude detection performance.

[0058] Furthermore, when determining the current gyroscope state information based on the data to be processed, if the difference between the data to be processed and the set value is less than a third set threshold, the gyroscope is determined to be in a stationary state; conversely, if the difference is greater than or equal to the third set threshold, the gyroscope is in a non-stationary state. This determination logic achieves accurate identification of the gyroscope state, providing an important basis for subsequent data processing. By reasonably setting the threshold, the system can effectively distinguish different motion scenarios, ensuring that accurate and reliable angular velocity data can be provided under any circumstances, thereby supporting high-precision attitude detection and motion analysis. This state determination mechanism, combined with the aforementioned data processing flow, forms a complete solution, significantly improving the system's robustness and applicability.

[0059] Optionally, processing the data to be processed based on the state and the first median value includes: when the gyroscope is in a non-stationary state, using the first median value as valid data for the data segment; when the gyroscope is in a stationary state, if the difference between the data to be processed in the data segment and the first median value of the previous data segment is greater than a fourth threshold, then using the first median value of the previous data segment as valid data for the data segment; if the difference between the data to be processed in the data segment and the first median value of the previous data segment is less than or equal to the fourth threshold, then setting the data to be processed in the data segment to zero.

[0060] In this embodiment, when the system is determined to be stationary, the currently calibrated data is compared with the median of the previous storage area. If the difference exceeds a fourth threshold, the current motion is considered slight, and the median of the previous data segment is used as the current valid data. Otherwise, the data for each axis is set to zero, ensuring the accuracy and reliability of the data in a stationary state. This method not only improves the accuracy of gyroscope data in a stationary state but also maintains the data sensitivity in a moving state, thereby improving the attitude detection performance of electronic devices.

[0061] Optionally, after determining the first median value of each data segment, the method further includes: storing the data to be processed and the first median value in a data storage area.

[0062] In this embodiment, after determining the first median value of each data segment, the gyroscope data to be processed is further stored together with the first median value in a designated sliding data storage area. This design enables real-time dynamic management of gyroscope data. By setting a fixed size for the storage area, the addition of new data automatically overwrites old data, ensuring the timeliness and representativeness of the data in the storage area. The data in the storage area is continuously updated, and after each update, the median of that data segment is recalculated as the basis for subsequent static state judgment and data calibration. This process not only optimizes the efficiency of data processing but also ensures that noise interference can be effectively suppressed when the device is stationary or undergoing slight movement, thus improving data accuracy. Simultaneously, in non-stationary states, the median in the storage area reflects the actual angular velocity change of the device, ensuring data sensitivity and accuracy, thereby improving the overall performance of attitude detection.

[0063] This embodiment also provides a gyroscope data processing device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0064] Figure 4 This is a schematic diagram of an optional gyroscope data processing device according to an embodiment of this application, such as... Figure 4 As shown, the device includes:

[0065] The data acquisition module 402 is used to acquire the data to be processed from the gyroscope;

[0066] The median value determination module 404 is used to segment the data to be processed according to a preset standard data segment size and determine the first median value of each data segment.

[0067] The state determination module 406 is used to determine the state of the gyroscope based on the data to be processed, wherein the state of the gyroscope includes a stationary state and a non-stationary state.

[0068] The data processing module 408 is used to process the data to be processed based on the state and the first median value.

[0069] Optionally, the median determination module 404 is also used for:

[0070] Obtain the raw data of the gyroscope in the static state;

[0071] The original data is segmented according to the preset initial data segment size, and the second median value of each data segment is determined.

[0072] Determine whether the difference between the second medians of each adjacent data segment satisfies the stability condition, wherein the stability condition is that the difference between the second medians is lower than a first preset threshold.

[0073] If the stability condition is met, then the size of the data segment is confirmed as the standard data segment size.

[0074] If the stability condition is not met, the initial data segment size is used as a benchmark, and the initial data segment size is increased sequentially with a set step size until a data segment size that meets the stability condition is found as the standard data segment size.

[0075] Optionally, the gyroscope data processing device may also include: a calibration module;

[0076] Determine the calibration data of the gyroscope;

[0077] The calibration data is obtained by subtracting the calibration data from the data to be processed.

[0078] Optionally, the calibration module is also used to place the gyroscope at rest and sample the gyroscope data according to a preset sampling frequency. When the difference between a set number of consecutive sampled data is lower than a second preset threshold, the last sampled data is used as the calibration data of the gyroscope.

[0079] Optionally, the status determination module 406 is also used for:

[0080] If the difference between the data to be processed and the set value is less than the third set threshold, then the gyroscope is in a stationary state.

[0081] If the difference between the data to be processed and the set value is greater than or equal to the third set threshold, then the gyroscope is in a non-stationary state.

[0082] Optionally, the status determination module 406 is also used for:

[0083] When the gyroscope is in a non-stationary state, the first median value is used as the valid data for that data segment.

[0084] When the gyroscope is in a stationary state, if the difference between the data to be processed in the current data segment and the first median value of the previous data segment is greater than the fourth threshold, then the first median value of the previous data segment is taken as the valid data of the current data segment. If the difference between the data to be processed in the current data segment and the first median value of the previous data segment is less than or equal to the fourth threshold, then the data to be processed in the current data segment is set to zero.

[0085] Optionally, the gyroscope data processing device may also include: a storage module;

[0086] Used to store the data to be processed and the first median value into the data storage area.

[0087] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0088] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the gyroscope data processing methods of the various embodiments of this application.

[0089] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0090] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0091] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0092] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0093] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0094] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0095] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.

Claims

1. A gyroscope data processing method, characterized in that, The method includes: Acquire the data to be processed from the gyroscope; The data to be processed is segmented according to a preset standard data segment size, and the first median value of each data segment is determined. The state of the gyroscope is determined based on the data to be processed, and the state of the gyroscope includes a stationary state and a non-stationary state. The data to be processed is processed based on the state and the first median value.

2. The method according to claim 1, characterized in that, The process of presetting the standard data segment size includes: Obtain the raw data of the gyroscope in the static state; The original data is segmented according to the preset initial data segment size, and the second median value of each data segment is determined. Determine whether the difference between the second medians of each adjacent data segment satisfies the stability condition, wherein the stability condition is that the difference between the second medians is lower than a first preset threshold. If the stability condition is met, then the size of the data segment is confirmed as the standard data segment size. If the stability condition is not met, the initial data segment size is used as a benchmark, and the initial data segment size is increased sequentially with a set step size until a data segment size that meets the stability condition is found as the standard data segment size.

3. The method according to claim 1, characterized in that, Before determining the current state of the gyroscope based on the data to be processed, the process also includes: Determine the calibration data of the gyroscope; The calibration data is obtained by subtracting the calibration data from the data to be processed.

4. The method according to claim 3, characterized in that, The calibration data of the gyroscope in a static state includes: The gyroscope is placed at rest, and its data is sampled at a preset sampling frequency. When the difference between a set number of consecutive sampled data is lower than a second preset threshold, the last sampled data is used as the calibration data of the gyroscope.

5. The method according to claim 1, characterized in that, Determining the current state of the gyroscope based on the data to be processed includes: If the difference between the data to be processed and the set value is less than the third set threshold, then the gyroscope is in a stationary state. If the difference between the data to be processed and the set value is greater than or equal to the third set threshold, then the gyroscope is in a non-stationary state.

6. The method according to claim 5, characterized in that, The processing of the data to be processed based on the state and the first median value includes: When the gyroscope is in a non-stationary state, the first median value is used as the valid data for that data segment. When the gyroscope is in a stationary state, if the difference between the data to be processed in the current data segment and the first median value of the previous data segment is greater than the fourth threshold, then the first median value of the previous data segment is taken as the valid data of the current data segment. If the difference between the data to be processed in the current data segment and the first median value of the previous data segment is less than or equal to the fourth threshold, then the data to be processed in the current data segment is set to zero.

7. The method according to claim 1, characterized in that, After determining the first median value for each data segment, the following is also included: The data to be processed and the first median value are stored in the data storage area.

8. A gyroscope data processing device, characterized in that, include: The data acquisition module is used to acquire the data to be processed from the gyroscope; The median value determination module is used to segment the data to be processed according to a preset standard data segment size and determine the first median value of each data segment; A state determination module is used to determine the state of the gyroscope based on the data to be processed, wherein the state of the gyroscope includes a stationary state and a non-stationary state. The data processing module is used to process the data to be processed based on the state and the first median value.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the method described in any one of claims 1 to 7.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 7.