Sampling rate adjustment method and device, computer equipment and storage medium

By adjusting the sampling rate of the inertial measurement unit sensor in the hardware abstraction layer, and using interpolation and filtering techniques, the low sampling rate problem under the limitations of the Android architecture was solved, achieving a higher sampling rate and more accurate display effect, and reducing user dizziness.

CN118984391AActive Publication Date: 2024-11-19LABPANO TECHNOLOGY (CHANGZHOU) CO LTD

Patent Information

Application Number
CN202411419340.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2024-11-19
Estimated Expiration
2044-10-12

AI Technical Summary

Technical Problem

In existing technologies, the Android architecture limits the sampling rate of the inertial measurement unit (IMU) to no more than 800Hz, which makes it impossible to acquire IMU data with a higher sampling rate, affecting the imaging effect of VR/panoramic cameras, resulting in poor display effects and user dizziness.

Method used

By determining and generating the first and second sampling logics for controlling the sensors in the hardware abstraction layer, adjusting the sensor sampling rate in the inertial measurement unit, and utilizing methods such as interpolation, Kalman filtering, and complementary filtering, a higher sampling rate and more accurate display effect can be achieved.

Benefits of technology

Under the limitations of the Android architecture, the sampling rate of the inertial measurement unit sensor exceeded 800Hz, which improved the accuracy of data acquisition and display effect, and reduced the user's dizziness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118984391A_ABST
    Figure CN118984391A_ABST
Patent Text Reader

Abstract

The invention relates to a sampling rate adjustment method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring a target sampling rate of each sensor included in an inertial measurement unit; in response to the existence of the target sampling rate greater than the preset sampling rate threshold, determining a first sensor matched with the target sampling rate greater than the preset sampling rate threshold; determining a first sampling logic for controlling the sampling rate of the first sensor in the hardware abstraction layer, and generating a second sampling logic for controlling the sampling rate of the first sensor in the hardware abstraction layer; determining a first sampling period based on a first sampling time and a first sampling rate of a target sampling rate greater than a preset sampling rate threshold; and adjusting the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic and the second sampling logic to obtain a target sampling result. By adopting the method, IMU data with a higher sampling rate can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a sampling rate adjustment method, device, computer equipment, and storage medium. Background Art

[0002] With the continuous development of cameras, in the field of VR / panoramic cameras, imaging effect is an important factor in judging the quality of VR / panoramic cameras, and image processing algorithms often affect the imaging effect. If the image processing algorithm does not meet the standard, the display effect will be poor when the panoramic image is synthesized and displayed on the terminal. For example, when users of the terminal watch the panoramic image, it will cause dizziness to the user, thereby reducing the sales of the product. In the image processing algorithm, IMU (Inertial Measurement Unit) is one of the hardware that the algorithm relies on. The more important indicator of IMU is the data output rate ODR (Output Data Rate).

[0003] Usually, IMU samples according to the preset sampling rate. After setting the sampling rate greater than 800Hz in the APP layer (application layer), due to the limitations of the HAL (Hardware Abstract Layer) layer and the Framework layer in Android, the sampling rate will be automatically modified to 1.25ms to sample the signal once, so that only the sampling rate of 800Hz can be used for data collection and output, and it is impossible to obtain the data of IMU with a higher sampling rate. Therefore, it is impossible to achieve a more accurate display effect. Summary of the invention

[0004] Based on this, it is necessary to provide a sampling rate adjustment method, device, computer equipment, and storage medium that can obtain IMU data with a higher sampling rate in order to address the above technical problems and thus achieve a more accurate display effect.

[0005] In a first aspect, the present disclosure provides a sampling rate adjustment method. The method comprises:

[0006] Acquire a target sampling rate of each sensor included in the inertial measurement unit, wherein the target sampling rate is determined based on a preset first sampling time and a first sampling rate;

[0007] In response to the presence of a target sampling rate greater than a preset sampling rate threshold, determining a first sensor that matches the target sampling rate greater than the preset sampling rate threshold;

[0008] Determining in a hardware abstraction layer a first sampling logic for controlling a sampling rate of the first sensor, and generating in the hardware abstraction layer a second sampling logic for controlling a sampling rate of the first sensor;

[0009] Determining a first sampling period based on a first sampling time and a first sampling rate of a target sampling rate greater than a preset sampling rate threshold;

[0010] According to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic, the first sensor is adjusted to obtain a target sampling result.

[0011] In one embodiment, the priority of the first sampling logic is higher than that of the second sampling logic; and adjusting the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain a target sampling result includes:

[0012] According to the target sampling rate and the sampling rate threshold difference, adjusting the sampling result of the first sensor obtained by using the first sampling logic to obtain a target sampling result;

[0013] Alternatively, the first sampling logic is shielded, the sampling rate of the first sensor is adjusted according to the first sampling period and the second sampling logic, and the target sampling result is obtained using the adjusted sampling rate of the first sensor.

[0014] In one embodiment, adjusting the sampling result of the first sensor obtained by using the first sampling logic according to the difference between the target sampling rate and the sampling rate threshold to obtain the target sampling result includes:

[0015] Calculating a sampling rate difference according to the target sampling rate and the sampling rate threshold;

[0016] Using the first sampling logic to control the first sensor to perform sampling, to obtain a first sampling result;

[0017] The first sampling result is adjusted by using the interpolation method and the sampling rate difference to obtain a target sampling result.

[0018] In one embodiment, the step of adjusting the first sampling result by using the interpolation method and the sampling rate difference to obtain a target sampling result includes:

[0019] Based on the interpolation method and the first sampling result, determining an interpolation sampling result that matches the sampling rate difference;

[0020] In response to the number of the interpolation sampling results being less than or equal to a preset interpolation threshold, correcting the interpolation sampling results based on Kalman filtering to obtain interpolation corrected sampling results;

[0021] In response to the number of the interpolation sampling results being greater than a preset interpolation threshold, correcting the interpolation sampling results based on complementary filtering to obtain interpolation corrected sampling results;

[0022] A target sampling result is obtained based on the interpolation corrected sampling result and the first sampling result.

[0023] In one of the embodiments, after determining the interpolation sampling result matching the sampling rate difference based on the interpolation method and the first sampling result, the method further comprises:

[0024] According to the number of the first sampling results, complementary filtering or Kalman filtering is selected to correct the first sampling results.

[0025] In one embodiment, the second sampling logic includes a plurality of sampling conditions and identification information corresponding to each sampling condition; the step of adjusting the sampling rate of the first sensor according to the first sampling period and the second sampling logic, and obtaining a target sampling result by using the adjusted sampling rate of the first sensor includes:

[0026] Determining a sampling condition that satisfies the first sampling period according to the first sampling period and the plurality of sampling conditions;

[0027] Determining identification information corresponding to the sampling condition that satisfies the first sampling period;

[0028] The identification information is sent to a driving module that drives the inertial measurement unit to instruct the driving module to determine a matching second sampling rate based on the identification information, and drive the first sensor using the second sampling rate to obtain a target sampling result, wherein the second sampling rate is greater than the sampling rate threshold.

[0029] In one embodiment, each sampling condition includes a second sampling period determined based on a second sampling time of a second sampling rate and a second sampling rate; and determining the sampling condition satisfying the first sampling period according to the first sampling period and the plurality of sampling conditions includes:

[0030] Determining a sampling condition satisfying the first sampling period according to a relationship between the first sampling period and the plurality of second sampling periods;

[0031] The determining, according to the relationship between the first sampling period and the plurality of second sampling periods, a sampling condition satisfying the first sampling period includes:

[0032] In response to the existence of a second sampling period that is the same as the first sampling period, determining a sampling condition that satisfies the first sampling period according to the second sampling period that is the same as the first sampling period;

[0033] In response to the absence of a second sampling period that is identical to the first sampling period, the second sampling period corresponding to the smallest difference between the first sampling period and each of the second sampling periods is determined, and the sampling condition that satisfies the first sampling period is determined based on the second sampling period corresponding to the smallest difference.

[0034] In a second aspect, the present disclosure further provides a sampling rate adjustment device. The device comprises:

[0035] A data acquisition module, configured to acquire a target sampling rate of each sensor included in the inertial measurement unit, wherein the target sampling rate is determined based on a preset first sampling time and a first sampling rate;

[0036] A sensor determination module, configured to determine a first sensor matching a target sampling rate greater than the preset sampling rate threshold in response to the target sampling rate having a sampling rate greater than the preset sampling rate threshold;

[0037] a sampling logic control module, configured to determine in a hardware abstraction layer a first sampling logic for controlling a sampling rate of the first sensor, and to generate in the hardware abstraction layer a second sampling logic for controlling a sampling rate of the first sensor;

[0038] A sampling period determination module, configured to determine a first sampling period based on a first sampling time and a first sampling rate of a target sampling rate greater than a preset sampling rate threshold;

[0039] The sampling rate adjustment module is used to adjust the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain a target sampling result.

[0040] The sampling rate adjustment module comprises:

[0041] A first adjustment module, configured to adjust the sampling result of the first sensor obtained by using the first sampling logic according to the target sampling rate and the sampling rate threshold difference, so as to obtain a target sampling result;

[0042] The second adjustment module is used to shield the first sampling logic, adjust the sampling rate of the first sensor according to the first sampling period and the second sampling logic, and obtain the target sampling result by using the adjusted sampling rate of the first sensor.

[0043] In a third aspect, the present disclosure further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in any of the above method embodiments are implemented.

[0044] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0045] In a fifth aspect, the present disclosure further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0046] In the above embodiments, due to the limitation of the hardware abstraction layer in the Android architecture, when the target sampling rate exceeds the preset sampling rate threshold, a first sensor that matches the target sampling rate greater than the preset sampling rate threshold can be determined. Usually, the code for controlling the sampling rate is in the hardware abstraction layer, so the first sampling logic and the second sampling logic can be determined in the hardware abstraction layer. According to different situations, those skilled in the art can flexibly select different sampling logics to adjust the sampling rate of the first sensor. Therefore, the first sensor can be adjusted according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain the target sampling result. By combining different data with the first sampling logic and the second sampling logic, the sampling rate of the first sensor is adjusted to obtain the target sampling result, and a sampling result with a higher sampling rate can be obtained to achieve a more accurate display effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0048] Figure 1 is a flow chart of a sampling rate adjustment method in one embodiment;

[0049] Figure 2 This is a schematic diagram of the process of step S110 in one embodiment;

[0050] Figure 3 Schematic diagram of the process of step S202 in one embodiment;

[0051] Figure 4 Schematic diagram of the process of step S306 in one embodiment;

[0052] Figure 5 Schematic diagram of the process of step S204 in one embodiment;

[0053] Figure 6 A schematic diagram of a flow chart for determining a sampling condition of a first sampling period in an embodiment;

[0054] Figure 7 is a schematic block diagram of the structure of a sampling rate adjustment device in one embodiment;

[0055] Figure 8 Schematic diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solution and advantages of the present disclosure more clear, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and are not used to limit the present disclosure.

[0057] It should be noted that the terms "first", "second", etc. in the specification and claims of this article and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of this article described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.

[0058] In this article, the term "and / or" is only a description of the association relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the related objects before and after are in an "or" relationship.

[0059] As described in the background technology, due to the limitations of the Android architecture, after the sampling rate is determined at the APP layer, it will be transmitted to the IMU driver module after passing through the Framework layer and the HAL layer. The IMU driver module receives the sampling rate, samples according to the preset sampling rate and transmits it to the APP layer. The APP layer receives the sampled data and processes it using an algorithm. However, after the APP layer determines the sampling rate, if the sampling rate determined by the APP layer is greater than 800Hz (1.25ms), for example, 900Hz (about 1.111ms), the APP layer will set sample_period_ns to 1.11ms, but when passing through the Framework layer and the HAL layer, the Framework layer and the HAL layer will automatically adjust sample_period_ns to 1.25ms. Therefore, the IMU driver module can only parse the sampling rate of 800Hz from the Request of the HAL layer, and then configure the corresponding registers for processing. Therefore, the current Android architecture cannot process data exceeding 800Hz ODR. Among them, sample_period_ns is usually a term used in the field of data acquisition or signal processing, which means the length of the sample period (Sample Period), which can be in nanoseconds, milliseconds or microseconds. It refers to the time interval for the data acquisition system or sensor to continuously collect data.

[0060] Therefore, to solve the above problems, in one embodiment, Figure 1 As shown, a sampling rate adjustment method is provided. This embodiment uses the method applied to a terminal as an example. The terminal may include: a panoramic camera, a personal computer, a laptop, a smart phone, a tablet computer, an Internet of Things device, and a portable wearable device. The Internet of Things device may be a smart speaker, a smart TV, a smart air conditioner, a smart car device, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. It should be noted that in some embodiments of the present disclosure, the terminal may generally be a device containing an inertial measurement unit. The method comprises the following steps:

[0061] S102: Acquire a target sampling rate of each sensor included in the inertial measurement unit, wherein the target sampling rate is determined based on a preset first sampling time and a first sampling rate.

[0062] Among them, the sensors may include: gyroscope sensor Gyro, acceleration sensor Acc, etc. A gyroscope (Gyro, or gyroscope sensor) is a device for measuring and maintaining direction. It can detect the angular velocity (rotation speed) of an object and judge the posture change of the object (such as rotation, tilt, etc.) through this information. An acceleration sensor (Acc, or accelerometer) is a device for measuring the linear acceleration of an object. The acceleration sensor can detect the rate of change of the speed of an object within a specific time period. The target sampling rate can be set according to actual conditions, and in some embodiments of the present disclosure, the target sampling rate is not limited. The first sampling rate can be the sampling speed, such as how many times to collect in 1s or how many times to collect in 10s.

[0063] Specifically, in some embodiments of the present disclosure, the inertial measurement unit may be installed in a panoramic camera. During the process of shooting a video or image with the panoramic camera, the user may set the target sampling rate of each sensor included in the inertial measurement unit in the panoramic camera, for example, the target sampling rate of the gyroscope sensor may be set to 3200 Hz, and the target sampling rate of the acceleration sensor may be set to 1600 Hz. The panoramic camera may obtain the preset target sampling rate of each sensor included in the inertial measurement unit.

[0064] S104 , in response to the existence of a target sampling rate greater than a preset sampling rate threshold, determining a first sensor that matches the target sampling rate greater than the preset sampling rate threshold.

[0065] The preset sampling rate threshold may generally be the maximum sampling rate specified in the HAL layer in the Android architecture, which is generally 800 Hz. In addition, the preset sampling rate threshold may generally be determined according to the first sampling logic specified in the HAL layer.

[0066] Specifically, when there is a target sampling rate greater than a preset sampling rate threshold among the target sampling rates of the sensor, due to the limitation of the HAL layer in the Android architecture, the target sampling rate greater than the preset sampling rate threshold cannot be transmitted to the sensor. A sensor corresponding to the target sampling rate greater than the preset sampling rate threshold can be determined, and the sensor can be the first sensor.

[0067] S106 , determining a first sampling logic for controlling a sampling rate of the first sensor in a hardware abstraction layer, and generating a second sampling logic for controlling a sampling rate of the first sensor in the hardware abstraction layer.

[0068] The first sampling logic and the second sampling logic may be codes for controlling the sampling rate, and the first sampling logic may generally be the default code for controlling the sampling rate in the hardware abstraction layer in the Android architecture. Typically, the first sampling logic and the second sampling logic are different. Typically, the first sampling logic can only set the maximum sampling rate of the sensor to be the same as the sampling rate threshold.

[0069] Specifically, the code for controlling the sampling rate of the first sensor can be determined from the code contained in the hardware abstraction layer, thereby determining the first sampling logic. Since the first sampling logic can only set the sampling rate of the sensor to the same as the sampling rate threshold at most, in order to set a higher sampling rate, a second sampling logic can be set in the hardware accelerator. The second sampling logic is used to achieve a higher sampling rate.

[0070] S108: Determine a first sampling period based on a first sampling time and a first sampling rate of a target sampling rate greater than a preset sampling rate threshold.

[0071] The sampling period refers to the time interval for sampling within a period, which is used to measure or record data. A smaller sampling period can provide more accurate data, but may increase the complexity of data processing and storage requirements. The choice of sampling period depends on the required accuracy and application requirements.

[0072] Specifically, a first sampling time and a first sampling rate that match a target sampling rate greater than a preset sampling rate threshold may be determined. The first sampling time is divided by the first sampling rate to obtain a first sampling period.

[0073] In some exemplary embodiments, if the target sampling rate is 1600 Hz, the first sampling time of the target sampling rate may be 1,000,000 microseconds, and the first sampling rate may be 1,600 times. Then the first sampling period may be 625 microseconds, that is, one sampling every 625 microseconds.

[0074] S110, adjusting the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain a target sampling result.

[0075] The adjusting of the first sensor may include adjusting a sampling result of the first sensor or adjusting a sampling rate of the first sensor.

[0076] Specifically, the first sampling logic can be used to control the first sensor to perform sampling, and then the target sampling rate and the sampling rate threshold can be used for adjustment to obtain the target sampling result. Alternatively, the first sampling cycle and the second sampling logic can be used to adjust the sampling rate of the first sensor to obtain the target sampling result.

[0077] In the above-mentioned sampling rate adjustment method, due to the limitation of the hardware abstraction layer in the Android architecture, when the target sampling rate exceeds the preset sampling rate threshold, a first sensor matching the target sampling rate greater than the preset sampling rate threshold can be determined. Usually, the code for controlling the sampling rate is in the hardware abstraction layer, so the first sampling logic and the second sampling logic can be determined in the hardware abstraction layer. According to different situations, those skilled in the art can flexibly select different sampling logics to adjust the sampling rate of the first sensor. Therefore, the first sensor can be adjusted according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain the target sampling result. By combining different data with the first sampling logic and the second sampling logic, the sampling rate of the first sensor is adjusted to obtain the target sampling result, and a sampling result with a higher sampling rate can be obtained to achieve a more accurate display effect.

[0078] In one embodiment, the priority of the first sampling logic is higher than that of the second sampling logic. In the hardware abstraction layer, if the first sampling logic and the second sampling logic exist at the same time, since the first sampling logic is the default sampling logic in the hardware abstraction layer and the second sampling logic is added later in the hardware abstraction layer, the priority of the first sampling logic is usually higher than that of the second sampling logic, and the first sampling logic will be executed. Figure 2 As shown, adjusting the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain a target sampling result includes:

[0079] S202: According to the difference between the target sampling rate and the sampling rate threshold, adjust the sampling result of the first sensor obtained by using the first sampling logic to obtain a target sampling result.

[0080] Specifically, the first sensor may be controlled to perform sampling according to the first sampling logic to obtain an initial sampling result that is the same as the sampling rate threshold, and then a difference is calculated according to the target sampling rate and the sampling rate threshold, and the initial sampling result is adjusted using the difference to obtain a target sampling result.

[0081] In some exemplary embodiments, the target sampling rate and the sampling rate threshold may be used to calculate the difference, and the initial sampling result may be adjusted according to the difference using interpolation, extrapolation, piecewise linear method, etc. to obtain the target sampling result.

[0082] Alternatively, S204 , shielding the first sampling logic, adjusting the sampling rate of the first sensor according to the first sampling period and the second sampling logic, and obtaining a target sampling result by using the adjusted sampling rate of the first sensor.

[0083] Specifically, since the priority of the first sampling logic is higher than that of the second sampling logic, in order to allow the first sensor to sample information exceeding the preset sampling rate threshold, the first sampling logic needs to be shielded. Then, according to the first sampling period, matching is performed from the second sampling logic, and the information in the second sampling logic that matches the first sampling period is determined. The first sensor is controlled to perform sampling using the information in the matched second sampling logic, thereby adjusting the sampling rate of the first sensor to obtain the target sampling result.

[0084] It should be noted that in some scenarios, when the second sampling logic is used to adjust the sampling rate, it will conflict with other logic in the hardware abstraction layer or other logic in the panoramic camera. In this case, the first sampling logic can be used for adjustment.

[0085] In this embodiment, the sampling rate of the first sensor is adjusted by using different sampling logics and in different ways, so that appropriate sampling logic can be selected according to different scenarios, thereby improving the success rate of adjusting the sampling rate and being applicable to different scenarios.

[0086] In one embodiment, Figure 3 As shown, adjusting the sampling result of the first sensor obtained by using the first sampling logic according to the difference between the target sampling rate and the sampling rate threshold to obtain the target sampling result includes:

[0087] S302: Calculate a sampling rate difference according to the target sampling rate and the sampling rate threshold.

[0088] S304: Use the first sampling logic to control the first sensor to perform sampling to obtain a first sampling result.

[0089] S306: Use the interpolation method and the sampling rate difference to adjust the first sampling result to obtain a target sampling result.

[0090] Among them, interpolation is a mathematical technique used to estimate the value between known data points. It uses the values ​​of known data points to infer or calculate the values ​​of unknown data points.

[0091] Specifically, the sampling rate threshold may be subtracted from the target sampling rate to obtain a sampling rate difference. Then, the first sampling logic is used to control the first sensor to perform sampling to obtain a first sampling result. The first sampling result is usually obtained by sampling at a sampling rate that is the same as the sampling rate threshold. Then, the number of sampling results that need to be added may be determined based on the sampling rate difference, and then an interpolation method may be used to interpolate the first sampling result, and the number of interpolations is the same as the number of sampling results that need to be added, and the target sampling result is obtained after interpolation.

[0092] In this embodiment, based on the interpolation method, the sampling rate difference, and the first sampling result, the target sampling result is obtained, and the data in the first sampling result can be enriched to obtain a richer target sampling result, so that a more accurate display effect can be achieved in subsequent adjustments.

[0093] In one embodiment, Figure 4 As shown, the method of adjusting the first sampling result by using the interpolation method and the sampling rate difference to obtain the target sampling result includes:

[0094] S402: Determine an interpolation sampling result that matches the sampling rate difference based on the interpolation method and the first sampling result.

[0095] Specifically, the interpolation method can be used to interpolate the first sampling result, and the number of interpolations usually needs to match the sampling rate difference. For example, if the sampling rate difference is 800 Hz and there are already 800 sampling points in the first sampling result, then 800 sampling points need to be interpolated again in the first sampling result.

[0096] S404: In response to the number of the interpolation sampling results being less than or equal to a preset interpolation threshold, correcting the interpolation sampling results based on Kalman filtering to obtain interpolation corrected sampling results.

[0097] Among them, Kalman filtering is a recursive filtering method based on state space model, which is suitable for linear dynamic systems. It uses statistical principles to reduce the estimation error by updating the state estimation. Kalman filtering mathematically models the signal and noise, and can make a more accurate estimate of the uncertainty of the system.

[0098] Specifically, when the number of interpolation sampling results is small and is less than or equal to a preset difference threshold, in order to improve the precision and accuracy of correction, Kalman filtering can be used to correct the interpolation sampling results, thereby obtaining interpolation correction sampling results.

[0099] S406 , in response to the number of the interpolation sampling results being greater than a preset interpolation threshold, correcting the interpolation sampling results based on complementary filtering to obtain interpolation corrected sampling results.

[0100] Among them, complementary filtering mainly balances steady-state signals and fast-changing signals by combining low-pass and high-pass filters. It is used in real-time applications (such as sensor data processing) to combine low-frequency signals and smooth high-frequency signals to reduce noise.

[0101] Specifically, when the number of interpolation sampling results is large and greater than a preset difference threshold, in order to ensure the speed of obtaining the target sampling results, complementary filtering can be used to correct the interpolation sampling results to obtain interpolation corrected sampling results.

[0102] S408: Obtain a target sampling result based on the interpolation correction sampling result and the first sampling result.

[0103] Specifically, the interpolation correction sampling result and the first sampling result may be combined to obtain the target sampling result.

[0104] In addition, in other embodiments, complementary filtering or Kalman filtering can be selected to correct the first sampling results based on the number of first sampling results, and the target sampling results can be obtained based on the corrected first sampling results and the difference correction sampling results. In this way, the precision or accuracy of the target sampling results obtained will be higher.

[0105] In this embodiment, different correction methods are selected according to the number of interpolation sampling results, which can improve the accuracy of the target sampling results or increase the speed of generating the target sampling results.

[0106] In one embodiment, the second sampling logic includes multiple sampling conditions and identification information corresponding to each sampling condition. The sampling conditions can be set according to actual needs, such as time conditions, digital conditions, etc., and the identification information can usually be a number or a code. Figure 5 As shown, adjusting the sampling rate of the first sensor according to the first sampling period and the second sampling logic, and obtaining a target sampling result by using the adjusted sampling rate of the first sensor, includes:

[0107] S502: Determine a sampling condition that satisfies the first sampling period according to the first sampling period and the multiple sampling conditions.

[0108] Specifically, when the sampling condition is a digital condition, the sampling condition that satisfies the first sampling period can be determined directly according to the first sampling period and multiple sampling conditions. When the sampling condition is a time condition, the sampling condition that satisfies the first sampling period can be determined according to the time that matches the first sampling period (e.g., the first sampling time).

[0109] S504: Determine identification information corresponding to the sampling condition that satisfies the first sampling period.

[0110] S506: Send the identification information to a driving module that drives the inertial measurement unit to instruct the driving module to determine a matching second sampling rate based on the identification information, and drive the first sensor using the second sampling rate to obtain a target sampling result, wherein the second sampling rate is greater than the sampling rate threshold.

[0111] Specifically, the driving module can store a second sampling rate that matches each identification information, that is, store the relationship between the identification information and the second sampling rate. The determined identification information can be sent to the driving module. When the driving module receives the identification information, it can determine the matching second sampling rate from the relationship between the identification information and the second sampling rate. Since the second sampling rate has been determined in the driving module, the driving module can directly adjust the first sensor according to the second sampling rate, so that the first sensor samples according to the second sampling rate, thereby obtaining the target sampling result. It should be noted that the identification information can be flexibly set according to demand, and the identification information is not restricted in some embodiments of the present disclosure.

[0112] In this embodiment, due to the limitation of the hardware abstraction layer, the sampling rate of the sensor set in the hardware abstraction layer will be limited to a maximum of 800 Hz. Therefore, the target sampling rate can be converted to match the sampling conditions to determine the identification information. The corresponding second sampling rate is determined by controlling the driving module through the identification information. There is no need to transmit a target sampling rate greater than the preset sampling rate threshold in the hardware abstraction layer, and the sampling rate exceeding the preset sampling rate threshold can be set.

[0113] In one embodiment, each of the sampling conditions includes a second sampling period determined based on a second sampling time of the second sampling rate and a second sampling rate. Determining the sampling conditions that satisfy the first sampling period according to the first sampling period and the plurality of sampling conditions includes:

[0114] A sampling condition satisfying the first sampling period is determined according to the relationship between the first sampling period and the plurality of second sampling periods.

[0115] Specifically, the sampling condition satisfying the first sampling period may be determined according to the size relationship between the first sampling period and the plurality of second sampling periods.

[0116] Furthermore, Figure 6 As shown, the determining, according to the relationship between the first sampling period and the plurality of second sampling periods, the sampling condition satisfying the first sampling period includes:

[0117] S602: In response to the existence of a second sampling period that is the same as the first sampling period, determine a sampling condition that satisfies the first sampling period according to the second sampling period that is the same as the first sampling period.

[0118] Specifically, when there is a second sampling period that is the same as the first sampling period, a sampling condition containing the second sampling period can be determined based on the second sampling period that is the same as the first sampling period, and the sampling condition can be determined as a sampling condition that satisfies the first sampling period.

[0119] S604, in response to the absence of a second sampling period that is identical to the first sampling period, determining, based on the difference between the first sampling period and each of the second sampling periods, a second sampling period corresponding to the smallest difference, and determining, based on the second sampling period corresponding to the smallest difference, a sampling condition that satisfies the first sampling period.

[0120] Specifically, when there is no second sampling period that is the same as the first sampling period, the second sampling period that is closest to the first sampling period can be determined. The sampling conditions that satisfy the first sampling period are determined by using the closest second sampling period. Furthermore, the difference between the first sampling period and each second sampling period can be calculated first, and the sampling conditions that satisfy the first sampling period can be determined based on the second sampling period corresponding to the smallest difference. If there are two second sampling periods corresponding to the smallest and identical differences, the sizes of the two second sampling periods can be compared, and the sampling conditions that satisfy the first sampling period can be determined based on the smaller second sampling period of the two second sampling periods. In addition, under normal circumstances, the smaller the second sampling period, the faster the sampling rate, and the faster the sampling rate, the higher the precision and accuracy of the data obtained.

[0121] In some exemplary embodiments, for example, the first sampling period samplingPeriodUs=625, and the second sampling period is 1000, 1500, and 2000, the APP layer can pass samplingPeriodUs=625 to the HAL layer through the batch interface. The batch interface generally refers to an interface that allows batch processing of requests or data in computing and data processing scenarios. This interface can accept a set of inputs and process these inputs at one time instead of processing them one by one, which improves efficiency and performance.

[0122] When the HAL layer detects that sensor_type (sensor_type refers to the sensor type) is the first sensor, the samplingPeriodUs in the batch is filled into params.sample_period_ns. Among them, params.sample_period_ns is a parameter with a specific setting, which usually appears in data acquisition, signal processing or control systems. It can represent the sample period. In the process of setting the sampling rate, the sensor identifier sensor suid can be detected first. When the sensor is determined to be the first sensor according to the detected sensor suid, special processing is performed separately; since the data in samplingPeriodUs has been filled in params.sample_period_ns, get_params().sample_period_ns can be used to call the parameters in params.sample_period_ns. get_params().sample_period_ns is usually a method call in programming or data acquisition systems, specifically used to obtain parameters related to the sample period in an object or class. get_params().sample_period_ns is 625<1000. Therefore, the closest second sampling period is 1000, and the sampling condition corresponding to 1000 is determined, and then the identification information corresponding to 1000 is determined. If the second sampling rate is determined to be 1600 Hz according to the identification information corresponding to 1000, the sample_rate (sampling rate) can be set to 1600 Hz.

[0123] In this embodiment, the sampling condition is determined by comparing the second sampling period with the first sampling period, and the second sampling period most relevant to the first sampling period can be found, thereby accurately determining the sampling condition and ensuring the accuracy of the sampling rate adjustment.

[0124] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0125] Based on the same inventive concept, the embodiment of the present disclosure also provides a sampling rate adjustment device for implementing the sampling rate adjustment method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more sampling rate adjustment device embodiments provided below can refer to the limitations of the sampling rate adjustment method above, and will not be repeated here.

[0126] In one embodiment, Figure 7 As shown, a sampling rate adjustment device 700 is provided, comprising: a data acquisition module 702, a sensor determination module 704, a sampling logic control module 706, a sampling period determination module 708 and a sampling rate adjustment module 710, wherein:

[0127] A data acquisition module 702 is used to acquire a target sampling rate of each sensor included in the inertial measurement unit, wherein the target sampling rate is determined based on a preset first sampling time and a first sampling rate;

[0128] A sensor determination module 704 is configured to determine a first sensor that matches a target sampling rate greater than a preset sampling rate threshold in response to the target sampling rate having a sampling rate greater than a preset sampling rate threshold;

[0129] A sampling logic control module 706, configured to determine a first sampling logic for controlling a sampling rate of the first sensor in a hardware abstraction layer, and to generate a second sampling logic for controlling a sampling rate of the first sensor in the hardware abstraction layer;

[0130] A sampling period determination module 708, configured to determine a first sampling period based on a first sampling time and a first sampling rate of a target sampling rate greater than a preset sampling rate threshold;

[0131] The sampling rate adjustment module 710 is used to adjust the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain a target sampling result.

[0132] In one embodiment of the device, the sampling rate adjustment module 710 includes:

[0133] The first adjustment module is used to adjust the sampling result of the first sensor obtained by using the first sampling logic according to the difference between the target sampling rate and the sampling rate threshold, so as to obtain the target sampling result.

[0134] The second adjustment module is used to shield the first sampling logic, adjust the sampling rate of the first sensor according to the first sampling period and the second sampling logic, and obtain the target sampling result by using the adjusted sampling rate of the first sensor.

[0135] In one embodiment of the device, the first adjustment module is further used to calculate the sampling rate difference based on the target sampling rate and the sampling rate threshold; use the first sampling logic to control the first sensor to perform sampling to obtain a first sampling result; use the interpolation method and the sampling rate difference to adjust the first sampling result to obtain the target sampling result.

[0136] In one embodiment of the device, the first adjustment module is further used to select complementary filtering or Kalman filtering to correct the first sampling results according to the number of the first sampling results.

[0137] In one embodiment of the device, the first adjustment module is further used to determine an interpolation sampling result that matches the sampling rate difference based on the interpolation method and the first sampling result; in response to the number of the interpolation sampling results being less than or equal to a preset interpolation threshold, correcting the interpolation sampling result based on Kalman filtering to obtain an interpolation corrected sampling result; in response to the number of the interpolation sampling results being greater than a preset interpolation threshold, correcting the interpolation sampling result based on complementary filtering to obtain an interpolation corrected sampling result; and obtaining a target sampling result based on the interpolation corrected sampling result and the first sampling result.

[0138] In one embodiment of the device, the second sampling logic includes multiple sampling conditions and identification information corresponding to each sampling condition; the second adjustment module is further used to determine the sampling conditions that satisfy the first sampling period based on the first sampling period and the multiple sampling conditions; determine the identification information corresponding to the sampling conditions that satisfy the first sampling period; send the identification information to a driving module that drives the inertial measurement unit to instruct the driving module to determine a matching second sampling rate based on the identification information, drive the first sensor using the second sampling rate, and obtain a target sampling result, wherein the second sampling rate is greater than the sampling rate threshold.

[0139] In one embodiment of the device, each sampling condition includes a second sampling period determined based on a second sampling time of a second sampling rate and a second sampling rate. The second adjustment module is further configured to determine a sampling condition satisfying the first sampling period according to a relationship between the first sampling period and the plurality of second sampling periods;

[0140] The method of determining the sampling condition that satisfies the first sampling period based on the relationship between the first sampling period and the multiple second sampling periods includes: in response to the existence of a second sampling period that is identical to the first sampling period, determining the sampling condition that satisfies the first sampling period based on the second sampling period that is identical to the first sampling period; in response to the absence of a second sampling period that is identical to the first sampling period, determining the second sampling period corresponding to the smallest difference between the first sampling period and each of the second sampling periods, and determining the sampling condition that satisfies the first sampling period based on the second sampling period that corresponds to the smallest difference.

[0141] Each module in the above sampling rate adjustment device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0142] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store target sampling rate data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a sampling rate adjustment method is implemented.

[0143] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the scheme of the present disclosure, and does not constitute a limitation on the computer device to which the scheme of the present disclosure is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0144] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0145] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0146] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0147] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided by the present disclosure can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided by the present disclosure may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided by the present disclosure may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, etc., but are not limited to this.

[0148] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0149] The above-described embodiments only express several implementation methods of the present disclosure, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present disclosure, and these all belong to the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the attached claims.

Claims

1. A sampling rate adjustment method, It is characterized in that The method comprises: Acquire a target sampling rate of each sensor included in the inertial measurement unit, wherein the target sampling rate is determined based on a preset first sampling time and a first sampling rate; In response to the presence of a target sampling rate greater than a preset sampling rate threshold, determining a first sensor that matches the target sampling rate greater than the preset sampling rate threshold; Determining in a hardware abstraction layer a first sampling logic for controlling a sampling rate of the first sensor, and generating in the hardware abstraction layer a second sampling logic for controlling a sampling rate of the first sensor; Determining a first sampling period based on a first sampling time and a first sampling rate of a target sampling rate greater than a preset sampling rate threshold; According to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic, the first sensor is adjusted to obtain a target sampling result; The priority of the first sampling logic is higher than that of the second sampling logic; and adjusting the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain a target sampling result includes: According to the difference between the target sampling rate and the sampling rate threshold, adjusting the sampling result of the first sensor obtained by using the first sampling logic to obtain a target sampling result; Alternatively, the first sampling logic is shielded, the sampling rate of the first sensor is adjusted according to the first sampling period and the second sampling logic, and the target sampling result is obtained using the adjusted sampling rate of the first sensor.

2. The method according to claim 1, It is characterized in that The step of adjusting the sampling result of the first sensor obtained by using the first sampling logic according to the difference between the target sampling rate and the sampling rate threshold to obtain the target sampling result includes: Calculating a sampling rate difference according to the target sampling rate and the sampling rate threshold; Using the first sampling logic to control the first sensor to perform sampling, to obtain a first sampling result; The first sampling result is adjusted by using the interpolation method and the sampling rate difference to obtain a target sampling result.

3. The method according to claim 2, It is characterized in that The step of adjusting the first sampling result by using the interpolation method and the sampling rate difference to obtain a target sampling result includes: Based on the interpolation method and the first sampling result, determining an interpolation sampling result that matches the sampling rate difference; In response to the number of the interpolation sampling results being less than or equal to a preset interpolation threshold, correcting the interpolation sampling results based on Kalman filtering to obtain interpolation corrected sampling results; In response to the number of the interpolation sampling results being greater than a preset interpolation threshold, correcting the interpolation sampling results based on complementary filtering to obtain interpolation corrected sampling results; A target sampling result is obtained based on the interpolation corrected sampling result and the first sampling result.

4. The method according to claim 3, It is characterized in that After determining the interpolation sampling result matching the sampling rate difference based on the interpolation method and the first sampling result, the method further includes: According to the number of the first sampling results, complementary filtering or Kalman filtering is selected to correct the first sampling results.

5. The method according to claim 1, It is characterized in that The second sampling logic includes a plurality of sampling conditions and identification information corresponding to each sampling condition; the step of adjusting the sampling rate of the first sensor according to the first sampling period and the second sampling logic, and obtaining a target sampling result by using the adjusted sampling rate of the first sensor includes: Determining a sampling condition that satisfies the first sampling period according to the first sampling period and the plurality of sampling conditions; Determining identification information corresponding to the sampling condition that satisfies the first sampling period; The identification information is sent to a driving module that drives the inertial measurement unit to instruct the driving module to determine a matching second sampling rate based on the identification information, and drive the first sensor using the second sampling rate to obtain a target sampling result, wherein the second sampling rate is greater than the sampling rate threshold.

6. The method according to claim 5, It is characterized in that Each sampling condition includes a second sampling time based on a second sampling rate and a second sampling period determined by a second sampling rate; and determining the sampling condition satisfying the first sampling period according to the first sampling period and the plurality of sampling conditions includes: Determining a sampling condition satisfying the first sampling period according to a relationship between the first sampling period and the plurality of second sampling periods; The determining, according to the relationship between the first sampling period and the plurality of second sampling periods, a sampling condition satisfying the first sampling period includes: In response to the existence of a second sampling period that is the same as the first sampling period, determining a sampling condition that satisfies the first sampling period according to the second sampling period that is the same as the first sampling period; In response to the absence of a second sampling period that is identical to the first sampling period, the second sampling period corresponding to the smallest difference between the first sampling period and each of the second sampling periods is determined, and the sampling condition that satisfies the first sampling period is determined based on the second sampling period corresponding to the smallest difference.

7. A sampling rate adjustment device, It is characterized in that The device comprises: A data acquisition module, configured to acquire a target sampling rate of each sensor included in the inertial measurement unit, wherein the target sampling rate is determined based on a preset first sampling time and a first sampling rate; A sensor determination module, configured to determine a first sensor matching a target sampling rate greater than the preset sampling rate threshold in response to the target sampling rate having a sampling rate greater than the preset sampling rate threshold; a sampling logic control module, configured to determine in a hardware abstraction layer a first sampling logic for controlling a sampling rate of the first sensor, and to generate in the hardware abstraction layer a second sampling logic for controlling a sampling rate of the first sensor; A sampling period determination module, configured to determine a first sampling period based on a first sampling time and a first sampling rate of a target sampling rate greater than a preset sampling rate threshold; A sampling rate adjustment module, configured to adjust the first sensor according to the target sampling rate, the sampling rate threshold, the first sampling period, the first sampling logic, and the second sampling logic to obtain a target sampling result; The sampling rate adjustment module comprises: A first adjustment module, configured to adjust the sampling result of the first sensor obtained by using the first sampling logic according to the target sampling rate and the sampling rate threshold difference, so as to obtain a target sampling result; The second adjustment module is used to shield the first sampling logic, adjust the sampling rate of the first sensor according to the first sampling period and the second sampling logic, and obtain the target sampling result by using the adjusted sampling rate of the first sensor.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Data acquisition device, system and method

    CN112904799A

  • Data sampling system, method, device and equipment and storage medium

    CN113553291A

  • Program, device and method for adjusting sampling rate of sensor event via os from sensor device

    JP2016156760A

  • Method of operating acceleration sensor and electronic device thereof

    US20150112633A1

  • Health wearable that automatically changes sensor reading timings

    US20180113498A1

Cited By

  • Data sampling method, storage medium, electronic equipment and program product

    CN120276943A

  • Data sampling method, storage medium, electronic device and program product

    CN120276943B