Quick-response riding slope resolving algorithm and system

By combining accelerometer and gyroscope data filtering with GPS and barometric pressure data for self-iteration or fusion, the problem of low calculation frequency and accuracy of traditional cycling gradient calculation algorithms in low-speed and fast gradient change scenarios is solved, achieving fast response and high-precision gradient calculation.

CN121655467APending Publication Date: 2026-03-13QINGDAO MAGENE INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-05
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

Traditional cycling gradient calculation algorithms have too low a calculation frequency in low-speed cycling and rapid gradient change scenarios, resulting in deviations between the output results and the actual situation. Inertial sensors accumulate large errors when there are high-frequency changes, and existing technologies cannot achieve fast response and high-precision gradient calculation.

Method used

By combining accelerometer and gyroscope data filtering, and using GPS and barometric pressure data for self-iteration or fusion, a fast-response cycling gradient calculation algorithm is designed. High-pass and low-pass filtering is used to improve attitude calculation performance, and barometric pressure and mileage calculation results are used for timed correction and calibration.

Benefits of technology

It improves the attitude calculation performance of the inertial sensing unit at high and low frequencies, reduces the cumulative error, and achieves fast response and high accuracy in slope calculation. In particular, it significantly improves the calculation speed and accuracy in scenarios with rapid slope changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121655467A_ABST
    Figure CN121655467A_ABST
Patent Text Reader

Abstract

The invention discloses a quick-response riding slope resolving algorithm and system, and the method comprises the steps: obtaining riding data, initializing an attitude angle according to the riding data, and obtaining an initial quaternion; filtering the acceleration data and the gyroscope data, calculating corresponding attitude angles, and performing complementary combination on the attitude angles to obtain a fused attitude angle and a fused quaternion; calculating a real-time gradient according to GPS data and air pressure data, and performing self-iteration or fusion on the real-time gradient by using a relationship between the real-time gradient and the fusion attitude angle to obtain a target gradient; and outputting the target gradient, and correcting the fused quaternion according to the target gradient. According to the method, the high response speed of the inertial sensing unit is utilized, on the premise that initial gradient calibration exists, according to the resolving results of the gyroscope and the acceleration, rapid iterative updating is carried out, real-time fusion of the gradient and the attitude angle is achieved, and the gradient resolving speed and the resolving precision of a gradient rapid change scene can be greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of sports and health technology, specifically to a fast-response cycling gradient calculation algorithm and system. Background Technology

[0002] Gradient is a crucial parameter for cycling and one of the most fundamental reference data points for outdoor cycling. Traditional algorithms accumulate elevation data from barometers / navigation chips and mileage data from navigation chips / speedometers, then use the weighting of elevation and mileage over a recent period to represent real-time gradient. However, in low-speed cycling and scenarios with rapidly changing gradients, traditional algorithms suffer from infrequent calculations, leading to discrepancies between the output and the actual gradient.

[0003] When calculating slope, inertial sensors are fast, but they suffer from cumulative errors over time. While slope calculations based on barometric pressure and mileage do not have cumulative errors, their calculation frequencies are relatively low. For example, in a six-axis inertial measurement unit (IMU), gyroscopes can calculate attitude changes by measuring changes in angular velocity at every moment. Gyroscopes perform well when processing high-frequency angular velocity data; however, they perform poorly when processing low-frequency data, which is a significant cause of cumulative attitude errors. Accelerometers can also calculate partial attitude angles by measuring the gravitational acceleration components of each axis; however, in non-stationary states, motion generates high-frequency acceleration impacts that interfere with gravitational acceleration, causing accelerometer attitude calculations to fail.

[0004] In summary, there is a need to design a fast-response cycling gradient calculation algorithm and system to solve the above-mentioned problems in the existing technology. Summary of the Invention

[0005] This invention provides a fast-response cycling gradient calculation algorithm and system, which solves the problems of slow cycling gradient calculation and low calculation accuracy in the prior art.

[0006] To achieve the above objectives, the present invention adopts the following technical solution: A fast-response cycling gradient calculation algorithm includes the following steps: Acquire cycling data, including acceleration data, gyroscope data, GPS data, and air pressure data; initialize the attitude angles based on the cycling data to obtain initial quaternions; The acceleration data and gyroscope data are filtered and the corresponding attitude angles are calculated. The attitude angles are then combined complementaryly to obtain the fused attitude angles. The initial quaternion is then replaced and updated after the fused attitude angle is converted into a fused quaternion. The real-time slope is calculated based on GPS data and air pressure data. The target slope is obtained by iterating or fusing the real-time slope using the relationship between the real-time slope and the fused attitude angle. Output the target slope and correct the fused quaternion based on the target slope.

[0007] In some embodiments of the present invention, the acceleration data is read by an accelerometer, and the initialization of the attitude angle based on the cycling data includes: When the accelerometer is in a stationary state, the triaxial acceleration of multiple accelerometers is acquired, and the mean value of each acceleration axis is calculated. Calculate the initial attitude angle based on the mean and gravitational acceleration; When the accelerometer is not in a static state, the initial attitude angle is obtained after converting the real-time slope into radians.

[0008] In some embodiments of the present invention, calculating the corresponding attitude angle after filtering the acceleration data and the gyroscope data includes: After low-pass filtering the acceleration data, the acceleration attitude angle is calculated by combining it with gravitational acceleration. After high-pass filtering the gyroscope data, the rotation quaternion is calculated using the angular velocity data collected by the sliding window, and the gyroscope attitude angle is calculated based on the rotation quaternion.

[0009] In some embodiments of the present invention, the formula for calculating the fused attitude angle is: att com = (1-α)·att acc +α·att gyr ; Among them, att com To integrate attitude angles, att acc For acceleration attitude angle, att gyr α is the gyroscope attitude angle; α is the complementarity coefficient, which takes values ​​in the range [0, 1].

[0010] In some embodiments of the present invention, the step of using the relationship between the real-time slope and the fused attitude angle to perform self-iteration or fusion of the real-time slope includes: Extract the pitch angle from the fused attitude angles; When the difference between the tangent of the pitch angle and the real-time slope is within a threshold range, the tangent of the pitch angle and the real-time slope are fused to obtain the target slope. Otherwise, the target slope is obtained by iterating over the real-time slope.

[0011] In some embodiments of the present invention, the target slope is obtained by the following fusion formula: S f (i)= S f(i-1)+(i) ·[β·S(i)+(1-β) ·tan(θ)- S f (i-1)]; Among them, S f (i) represents the target slope at time i, S f (i-1) represents the target slope at time i-1, S(i) represents the real-time slope at time i, θ represents the pitch angle, β represents the adaptive coefficient, and the value range is [0, 1]; k(i) represents the filter gain value.

[0012] In some embodiments of the present invention, the target slope is obtained by the following iterative formula: S f (i) = β·S(i) + (1-β) ·S f (i-1); Among them, S f (i) represents the target slope at time i, S f (i-1) represents the target slope at time i-1, S(i) represents the real-time slope at time i, θ represents the pitch angle, and β represents the adaptive coefficient, which takes values ​​in the range [0, 1].

[0013] In some embodiments of the present invention, a fast-response cycling gradient calculation system is provided, comprising: The initial attitude calibration module is used to determine the initial quaternion based on the acceleration data; The attitude fusion module is used to filter acceleration data and gyroscope data, calculate the corresponding attitude angles, and fuse the attitude angles to obtain the fused attitude angles. The slope update module is used to calculate and output the target slope based on the fused attitude angle and real-time slope. The communication module is used to communicate with external devices.

[0014] In some embodiments of the present invention, an electronic device is provided, comprising: A processor, and a memory and a transceiver communicatively connected to the processor; The memory stores computer-executed instructions; the transceiver is used for sending and receiving data. The processor executes the computer execution instructions stored in the memory to implement the above-described solution algorithm.

[0015] In some embodiments of the present invention, a computer-readable storage medium is provided, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the above-described solution algorithm.

[0016] The technical solution of the present invention has the following technical effects compared with the prior art: This invention designs two types of filters, high-pass and low-pass, which are applied to gyroscope data and acceleration data respectively, and adaptively combine the two sensors to improve the attitude calculation performance of the inertial sensing unit at both high and low frequencies, thus reducing accumulated errors. Simultaneously, it uses the results of air pressure and odometer calculations to perform timed correction and calibration of the inertial sensing unit's calculations, fundamentally solving the problem of accumulated errors.

[0017] In addition, by utilizing the high response speed of the inertial sensing unit, and with the initial slope calibration, the slope and attitude angles can be rapidly iterated and updated based on the calculation results of the gyroscope and acceleration, thereby achieving real-time fusion of slope and attitude angles. This can greatly improve the slope calculation speed and accuracy in scenarios with rapidly changing slopes. Attached Figure Description

[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart illustrating the solution algorithm shown in Embodiment 1 of the present invention.

[0020] Figure 2 This is a schematic diagram comparing the target slope value with the level instrument slope and the slope output by the traditional algorithm in Embodiment 1 of the present invention.

[0021] Figure 3 This is a schematic diagram of the cycling gradient calculation system described in Embodiment 2 of the present invention.

[0022] Figure 4 This is a schematic diagram of the structure of the electronic device.

[0023] Reference numerals: 100, cycling gradient calculation system; 110, initial attitude calibration module; 120, attitude fusion module; 130, gradient update module; 140, communication module; 200, electronic device; 210, processor; 220, memory; 230, transceiver. Detailed Implementation

[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0025] In the description of this application, it should be understood that the terms "center", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application.

[0026] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more.

[0027] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0028] The following disclosure provides many different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the invention. Furthermore, reference numerals and / or letters may be repeated in different examples; such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed. In addition, examples of various specific processes and materials are provided in this invention, but those skilled in the art will recognize the application of other processes and / or the use of other materials.

[0029] Example 1: Refer to Figure 1 As shown, a fast-response cycling gradient calculation algorithm includes the following steps: Step S1: Obtain cycling data, which includes acceleration data, gyroscope data, GPS data, and air pressure data; Specifically, acceleration data can be acquired through an accelerometer; gyroscope data, i.e., angular velocity data, can be acquired through a gyroscope; the GPS data includes altitude, latitude and longitude, and ground velocity at different times, which can be acquired through a navigation chip; and the air pressure data is acquired through a barometer.

[0030] In other embodiments, the accelerometer, gyroscope, barometer, and navigation chip are all internal electronic components of the speedometer.

[0031] Step S2: Initialize the attitude angles based on the riding data to obtain the initial quaternion; The initial quaternion is obtained by calculating the initial attitude angle. The initial attitude angle can be determined in two ways.

[0032] Step S21: This step will describe the first method for calculating the initial attitude angle, which is based on the accelerometer being in a stationary state.

[0033] Before the ride begins, the acceleration data recorded during the few seconds of rest are captured and denoted as follows: ; Among them, acc x acc y acc z These represent the outputs of the accelerometer along the x, y, and z axes in a stationary state; i is the counting point, which has no special meaning; n represents the number of acceleration data points collected during the stationary time.

[0034] The acceleration data from the three axes can be used to construct an n×3 matrix. By averaging each column, the mean of the acceleration data for each acceleration axis is obtained, resulting in a 1×3 vector, denoted as the mean vector acc. m =[acc xm acc ym acc zm ].

[0035] Next, the initial pitch and roll angles are calculated based on the components of gravitational acceleration g along each axis. In this calculation step, the yaw angle is set to 0 by default, and the yaw angle does not affect the solution and iteration of the other two angles. ; Based on the gravitational acceleration g and the mean vector acc m Calculate the initial attitude angle att for the acceleration data: att=[a sin(acc ym / g), a tan(-1*acc xm / acc zm ), 0].

[0036] The initial attitude angle att is a 1×3 attitude angle vector, which represents the pitch angle, roll angle, and yaw angle from left to right.

[0037] After obtaining the initial attitude angles, convert the attitude angles into quaternions, which will be used as the initial quaternions:

[0038] Where qua represents a quaternion, a2qua is the attitude angle to quaternion equation, and the rest are calculation process data, which are only used to simplify the qua expression and have no other meaning.

[0039] Additionally, att(1) is the first element in the initial attitude angle att: a sin(acc) ym / g); att(2) is the second element in the initial attitude angle att: a tan(-1*acc) xm / acc zm ); att(3) is the third element in the initial attitude angle att: 0.

[0040] Step S22: This step will describe the second method for calculating the initial attitude angle, which is based on the accelerometer being in a non-static state.

[0041] The initial attitude angle is obtained after converting the real-time slope into radians.

[0042] The calculation process for real-time slope is as follows: The system acquires the latitude, longitude, and ground velocity at different time points from the GPS data, as well as the air pressure values ​​at different time points from the air pressure data; calculates the altitude difference over a specified time interval based on the air pressure values ​​at different time points; calculates the horizontal distance over a specified time interval based on the latitude, longitude, or ground velocity at different time points; and calculates the real-time slope based on the altitude difference and the horizontal distance.

[0043] The formula for calculating altitude based on air pressure is as follows: ; In the formula, P0 is the standard atmospheric pressure at zero degrees Celsius, which is equal to 101325 Pa, and A N For altitude, P N This is the air pressure value.

[0044] Step S3: Filter the acceleration data and the gyroscope data, calculate the corresponding attitude angles, and combine the attitude angles complementaryly to obtain the fused attitude angles; Continue to refer to Figure 1 As shown, acceleration data and gyroscope angular velocity are acquired in real time during the motion.

[0045] Step S31: After low-pass filtering the acceleration data, calculate the acceleration attitude angle by combining it with gravitational acceleration; use the calculation formula of the initial attitude angle att in step S21 to perform real-time attitude calculation on the acceleration data to obtain the corresponding acceleration attitude angle att. acc .

[0046] Step S32: After high-pass filtering the gyroscope data, calculate the rotation quaternion using the angular velocity data collected by the sliding window, and calculate the gyroscope attitude angle based on the rotation quaternion. An angular velocity data is collected by a sliding window with a length of 2 and a step size of 1. Each time the window data is updated, the quaternion is calculated and updated using the angular velocity data in the window, and the gyroscope attitude angle is updated accordingly.

[0047] Specifically, the data [gyr(i), gyr(i+1)] obtained from each sampling of the angular velocity sliding window are as follows: ; The quaternions are updated based on the above angular velocity data. The update process is as follows: ; The antisymmetric matrix required in the calculation of W1~W3, where gyr2W is the function for converting angular velocity into the antisymmetric matrix, is expressed as follows: ; Next, the quaternion will be updated: ; Where k1~k4 are intermediate computational quantities, which have no special meaning and are only used to simplify the final expression qua(i+1); qua(i) represents the quaternion at time i, and qua(i+1) represents the quaternion at time i+1; t represents the time interval between every two angular velocity samples.

[0048] Convert the quaternion at the current moment into the gyroscope attitude angle, denoted as att. gyr : ; Where qua(i) represents the quaternion at time i, and Cnb represents the attitude transformation matrix.

[0049] When |Cnb(3,2)|≤0.99999, the gyroscope attitude angle att gyr for: att gyr=[a sin(Cnb(3,2)), -a tan(Cnb(3,1) / Cnb(3,3)), -a tan(Cnb(1,2) / Cnb(2,2))].

[0050] Otherwise, the gyroscope attitude angle att gyr for: att gyr =[a sin(Cnb(3,2)), -a tan(Cnb(1,3) / Cnb(1,1)), 0].

[0051] Step S33: After obtaining the acceleration attitude angle and the gyroscope attitude angle, the two are combined complementaryly to obtain the fused attitude angle. The formula for calculating the fused attitude angle is: att com = (1-α)·att acc +α·att gyr ; Among them, att com To integrate attitude angles, att acc For acceleration attitude angle, att gyr α is the gyroscope attitude angle; α is the complementarity coefficient, which takes values ​​in the range [0, 1].

[0052] Step S4: After converting the fused attitude angle into a fused quaternion, replace and update the initial quaternion, and then proceed to the next iteration: The formula for calculating fused quaternions is: qua com =a2qua(qua com ); Among them, qua com The quaternion representing the attitude angle transformation after complementary combination is a2qua(·), and the function a2qua(·) is calculated using the same formula as the initial quaternion in step S21.

[0053] Step S5: Calculate the real-time slope based on GPS data and air pressure data, and use the relationship between the real-time slope and the fused attitude angle to perform self-iteration or fusion to obtain the target slope; After the complementary combination is completed, the real-time slope and the fused attitude angle are fused. If there is a slope update at that time, the tangent values ​​of the slope and pitch angle are fused.

[0054] Step S51: Obtain the real-time slope according to the calculation process in step S22. After performing arctangent calculation on the real-time slope, the real-time slope angle can be obtained. Step S52, according to Figure 1As described, the pitch angle in the real-time slope angle can be compared with the pitch angle in the fused attitude angle to determine whether the difference between the two exceeds the threshold, which is in the range of [-1, 1].

[0055] Alternatively, the tangent values ​​of the real-time slope and pitch angle can be compared. For example, it can be determined whether the tangent values ​​of the real-time slope and pitch angle satisfy the following formula: |tan(θ)-S(i)|≤0.02; In the formula, θ is the fused attitude angle att. com The pitch angle in the equation is S(i), which is the real-time slope at time i.

[0056] Step S53: When the difference between the tangent of the pitch angle and the real-time slope satisfies the above-mentioned judgment formula, the target slope is obtained by the following fusion formula: S f (i)= S f (i-1)+(i) ·[β·S(i)+(1-β) ·tan(θ)- S f (i-1)]; Among them, S f (i) represents the target slope at time i, S f (i-1) represents the target slope at time i-1, S(i) represents the real-time slope at time i, θ represents the pitch angle, β represents the adaptive coefficient, and the value range is [0, 1]; k(i) represents the filter gain value.

[0057] k(i) = p(i) / [p(i) + 1]; p(i) is the iterative cofactor, p(i) = p(i-1) + 2.

[0058] After calculating the target slope once, the iterative cofactor p(i) is updated: p(i) → [1-k(i)]·p(i). For example, p(i) on the left side of the arrow is used in the next iteration, i.e., it becomes p(i-1) in the next round of calculation.

[0059] Step S54: When the difference between the tangent of the pitch angle and the real-time slope does not satisfy the above judgment formula, the target slope is obtained through the following iterative formula: S f (i) = β·S(i) + (1-β) ·S f (i-1); Among them, S f (i) represents the target slope at time i, S f (i-1) represents the target slope at time i-1, S(i) represents the real-time slope at time i, θ represents the pitch angle, and β represents the adaptive coefficient, which takes values ​​in the range [0, 1].

[0060] After the target slope is calculated through self-iteration, the iterative cofactor p(i) and the filter gain value k(i) are reassigned: p(i)→0.5; k(i)→1.

[0061] Step S6: Output the target slope and correct the fused quaternion based on the target slope.

[0062] After calculating the arctangent of the target slope, the target slope angle can be obtained. The fused quaternion can be corrected based on the target slope and the target slope angle. The corrected fused quaternion can then be used in the next round of iterative calculation.

[0063] according to Figure 2 As shown, the slope output by the slope calculation method in this embodiment is closer to the slope output by the level instrument (comparison standard), while the slope output by the traditional algorithm has a large error compared with the slope output by the level instrument.

[0064] The technical solution of the present invention has the following technical effects compared with the prior art: This invention designs two types of filters, high-pass and low-pass, which are applied to gyroscope data and acceleration data respectively, and adaptively combine the two sensors to improve the attitude calculation performance of the inertial sensing unit at both high and low frequencies, thus reducing accumulated errors. Simultaneously, it uses the results of air pressure and odometer calculations to perform timed correction and calibration of the inertial sensing unit's calculations, fundamentally solving the problem of accumulated errors.

[0065] In addition, by utilizing the high response speed of the inertial sensing unit, and with the initial slope calibration, the slope and attitude angles can be rapidly iterated and updated based on the calculation results of the gyroscope and acceleration, thereby achieving real-time fusion of slope and attitude angles. This can greatly improve the slope calculation speed and accuracy in scenarios with rapidly changing slopes.

[0066] Example 2: This example will be based on Figure 3 and Figure 4 Describes a fast-response cycling gradient calculation system 100 and electronic device 200.

[0067] For cycling gradient calculation system 100, refer to... Figure 3 As shown, it includes: The initial attitude calibration module 110 is used to acquire cycling data and determine the initial quaternion based on the acceleration data. The attitude fusion module 120 is used to filter the acceleration data and gyroscope data, calculate the corresponding attitude angles, and fuse the attitude angles to obtain the fused attitude angles. The slope update module 130 is used to calculate and output the target slope angle based on the fused attitude angle and the real-time slope angle; Communication module 140 is used to communicate with external devices.

[0068] It should be understood that the cycling gradient calculation system 100 described here is embodied in the form of functional modules. The term "module" here can refer to application-specific integrated circuits (ASICs), electronic circuits, processors (e.g., shared processors, proprietary processors, or group processors, etc.) and memories for executing one or more software or firmware programs, integrated logic circuits, and / or other suitable components supporting the described functions. In an alternative example, those skilled in the art will understand that the computing system 100 may be specifically the electronic device 200 in the above embodiments, or the functions of the electronic device 200 in the above embodiments may be integrated into the cycling gradient calculation system 100. The cycling gradient calculation system 100 may be used to execute the various processes and / or steps corresponding to the electronic device 200 in the above method embodiments; to avoid repetition, these will not be described again here.

[0069] The cycling gradient calculation system 100 described above has the function of implementing the corresponding steps of the calculation algorithm in Embodiment 1 performed by the electronic device 200; the above functions can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. For example, the above acquisition module can be a communication interface, such as a transceiver interface.

[0070] In the embodiments of this application, Figure 3 The cycling gradient calculation system 100 in the text can also be a chip or a chip system, such as a system on chip (SoC).

[0071] Reference Figure 4 As shown, in this embodiment, an electronic device 200 is provided, including: Processor 210, and memory 220 and transceiver 230 communicatively connected to said processor; The memory 220 stores computer-executed instructions; the transceiver 230 is used for sending and receiving data. The processor 210 executes the computer execution instructions stored in the memory 220 to implement the solution algorithm in Embodiment 1.

[0072] It should be understood that the electronic device 200 can be used to perform the corresponding steps and / or processes in the above method embodiments. Optionally, the memory 220 may include read-only memory and random access memory, and provide instructions and data to the processor. A portion of the memory 220 may also include non-volatile random access memory. For example, the memory 220 may also store device type information. The processor 210 can be used to execute instructions stored in the memory 220, and when the processor 210 executes the instructions, the processor 210 can perform the corresponding steps and / or processes in the above method embodiments.

[0073] It should be understood that, in the embodiments of this application, the processor 210 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0074] In implementation, each step of the above method can be completed by the integrated logic circuitry of the hardware in the processor 210 or by instructions in software form. The steps of the method disclosed in the embodiments of this application can be directly embodied in the execution by the hardware processor, or by a combination of hardware and software modules in the processor 210. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor executes the instructions in the memory, combining them with its hardware to complete the steps of the above method. To avoid repetition, detailed descriptions are not provided here.

[0075] Example 3: In this example, a computer-readable storage medium is provided, which stores computer-executable instructions. When executed by a processor, the computer-executable instructions are used to implement the solution algorithm in Example 1.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0077] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0078] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0079] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0080] In the description of the above embodiments, specific features, structures, materials, or characteristics may be combined in any suitable manner in one or more embodiments or examples.

Claims

1. A fast-response cycling gradient calculation algorithm, characterized in that, Includes the following steps: Acquire cycling data, including acceleration data, gyroscope data, GPS data, and air pressure data; initialize the attitude angles based on the cycling data to obtain initial quaternions; The acceleration data and gyroscope data are filtered and the corresponding attitude angles are calculated. The attitude angles are then combined complementaryly to obtain the fused attitude angles. The initial quaternion is then replaced and updated after the fused attitude angle is converted into a fused quaternion. The real-time slope is calculated based on GPS data and air pressure data. The target slope is obtained by iterating or fusing the real-time slope using the relationship between the real-time slope and the fused attitude angle. Output the target slope and correct the fused quaternion based on the target slope.

2. The cycling gradient calculation algorithm according to claim 1, characterized in that, The acceleration data is read from an accelerometer, and the initialization of the attitude angle based on the cycling data includes: When the accelerometer is in a stationary state, the triaxial acceleration of multiple accelerometers is acquired, and the mean value of each acceleration axis is calculated. Calculate the initial attitude angle based on the mean and gravitational acceleration; When the accelerometer is not in a static state, the initial attitude angle is obtained after converting the real-time slope into radians.

3. The cycling gradient calculation algorithm according to claim 1, characterized in that, Calculating the corresponding attitude angle after filtering the acceleration data and the gyroscope data includes: After low-pass filtering the acceleration data, the acceleration attitude angle is calculated by combining it with gravitational acceleration. After high-pass filtering the gyroscope data, the rotation quaternion is calculated using the angular velocity data collected by the sliding window, and the gyroscope attitude angle is calculated based on the rotation quaternion.

4. The cycling gradient calculation algorithm according to claim 1, characterized in that, The formula for calculating the fused attitude angle is: to com = (1-α)·at acc +α·to gyr ; Among them, att com To integrate attitude angles, att acc For acceleration attitude angle, att gyr α is the gyroscope attitude angle; α is the complementarity coefficient, which takes values ​​in the range [0, 1].

5. The cycling gradient calculation algorithm according to claim 1, characterized in that, The step of using the relationship between the real-time slope and the fused attitude angle to perform self-iteration or fusion of the real-time slope includes: Extract the pitch angle from the fused attitude angles; When the difference between the tangent of the pitch angle and the real-time slope is within a threshold range, the tangent of the pitch angle and the real-time slope are fused to obtain the target slope. Otherwise, the target slope is obtained by iterating over the real-time slope.

6. The cycling gradient calculation algorithm according to claim 5, characterized in that, The target slope is obtained using the following fusion formula: S f (i)= S f (i-1)+(i) ·[β·S(i)+(1-β) ·tan(θ)- S f (i-1)]; Among them, S f (i) represents the target slope at time i, S f (i-1) represents the target slope at time i-1, S(i) represents the real-time slope at time i, θ represents the pitch angle, β represents the adaptive coefficient, and the value range is [0, 1]; k(i) represents the filter gain value.

7. The cycling gradient calculation algorithm according to claim 5, characterized in that, The target slope is obtained through the following iterative formula: S f (i)=β·S(i)+(1-β) ·S f (i-1); Among them, S f (i) represents the target slope at time i, S f (i-1) represents the target slope at time i-1, S(i) represents the real-time slope at time i, θ represents the pitch angle, and β represents the adaptive coefficient, which takes values ​​in the range [0, 1].

8. A fast-response cycling gradient calculation system, characterized in that, To implement the cycling gradient calculation algorithm as described in any one of claims 1-7; comprising: The initial attitude calibration module is used to determine the initial quaternion based on the acceleration data; The attitude fusion module is used to filter acceleration data and gyroscope data, calculate the corresponding attitude angles, and fuse the attitude angles to obtain the fused attitude angles. The slope update module is used to calculate and output the target slope based on the fused attitude angle and real-time slope. The communication module is used to communicate with external devices.

9. An electronic device, characterized in that, include: A processor, and a memory and a transceiver communicatively connected to the processor; The memory stores computer-executed instructions; the transceiver is used for sending and receiving data. The processor executes the computer execution instructions stored in the memory to implement the cycling gradient calculation algorithm as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the cycling gradient calculation algorithm as described in any one of claims 1-7.