Slope calculation method and device, storage medium and electronic equipment
By calculating the installation posture and rotation angle of the vehicle controller under static and dynamic conditions, and using a six-axis gyroscope to correct the data, the problem of large error and high accuracy requirements of existing slope estimation algorithms is solved, and accurate slope calculation is achieved under different sensor installation positions.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING JINGWEI HIRAIN TECH CO INC
- Filing Date
- 2025-06-09
- Publication Date
- 2026-08-04
AI Technical Summary
Existing slope estimation algorithms suffer from large errors in vehicle longitudinal dynamics and longitudinal kinematic equations, and have high requirements for sensor installation position and measurement accuracy. In particular, they cannot accurately estimate the slope when the installation position of the vehicle controller deviates or changes.
By collecting data on the vehicle under static and dynamic conditions, the installation attitude rotation matrix and rotation angle of the vehicle controller are calculated. A six-axis gyroscope is used to correct the real-time acceleration and angular velocity data, thereby achieving accurate calculation of the slope value.
Even when the installation location of the vehicle controller is uncertain or changed, it can accurately correct the gyroscope data, ensuring the accuracy and applicability of the slope calculation and compatibility with different sensor installation locations.
Smart Images

Figure CN120503799B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicles, and in particular to a slope calculation method, apparatus, storage medium, and electronic device. Background Technology
[0002] Real-time gradient is a crucial parameter for enabling functions such as vehicle gear shift adjustment, vehicle mass estimation, and vehicle power adjustment. Vehicles frequently operate on uneven roads, such as in mountainous areas, making real-time gradient data essential for adjusting system operating modes and improving vehicle control performance. Existing gradient estimation algorithms fall into two categories: those based on the vehicle's longitudinal dynamics equations and those based on the vehicle's longitudinal kinematics equations.
[0003] The slope estimation algorithm based on the vehicle's longitudinal dynamics equations is implemented according to the vehicle's driving balance equations. This method has high requirements for the accuracy of the vehicle dynamics model, the accuracy of key model parameters, and the precision of data acquisition. Lack of corresponding sensor measurements, inaccurate sensor measurements, or unknown vehicle mass can all lead to significant errors. Another method based on the vehicle's longitudinal kinematics equations calculates the longitudinal road slope by using the difference between the acceleration collected by sensors in the driving direction and the vehicle's acceleration, employing methods such as least squares with a forgetting factor or Kalman filtering. This method has high requirements for the installation location of the longitudinal acceleration sensor and the accuracy of the measurement values. High-frequency noise in the signal acquisition, the choice of forgetting factor, or the Kalman filter coefficient matrix all have a significant impact on the accuracy of the results.
[0004] During the prototype verification phase or vehicle maintenance, deviations or changes in the installation position of the vehicle controller are inevitable. In such cases, the existing technologies mentioned above cannot accurately estimate the slope parameters. Summary of the Invention
[0005] In view of the above problems, the present invention provides a slope calculation method, apparatus, storage medium and electronic device that overcomes or at least partially solves the above problems.
[0006] Firstly, a slope calculation method includes:
[0007] Collect static data of the vehicle under static conditions, and calculate the installation posture rotation matrix, first rotation angle and second rotation angle of the vehicle controller based on the static data. The first rotation angle is the rotation angle of the vehicle controller about its own coordinate system Y axis, and the second rotation angle is the rotation angle of the vehicle controller about its own coordinate system X axis.
[0008] The system collects dynamic data of the vehicle under dynamic driving conditions, and calculates a third rotation angle based on the dynamic data and the installation posture rotation matrix. The third rotation angle is the angular change between the installation direction of the vehicle controller and the driving direction of the vehicle.
[0009] Based on the first rotation angle, the second rotation angle, and the third rotation angle, the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope are corrected, and the corresponding slope value is calculated based on the corrected real-time acceleration data and real-time angular velocity data.
[0010] Optionally, in some optional embodiments, the step of collecting static data of the vehicle under static conditions and calculating the installation posture rotation matrix, the first rotation angle, and the second rotation angle of the vehicle controller based on the static data includes:
[0011] Collect static data of the vehicle under static conditions. The static data is obtained based on a six-axis gyroscope and includes: static X-axis acceleration, static Y-axis acceleration and static Z-axis acceleration. The static conditions are the conditions within the first time range from power-on to engine ignition when the slope is 0.
[0012] Calculate the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration, respectively;
[0013] The local gravitational acceleration is calculated based on the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration.
[0014] The first rotation angle is calculated based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration;
[0015] Based on the first rotation angle and the gravitational acceleration, the installation posture rotation matrix and the second rotation angle are calculated.
[0016] Optionally, in some optional embodiments, calculating the installation attitude rotation matrix and the second rotation angle based on the first rotation angle and the gravitational acceleration includes:
[0017] The first rotation matrix is calculated based on the first rotation angle;
[0018] The second rotation matrix is calculated based on the first rotation matrix;
[0019] The installation posture rotation matrix of the vehicle controller is calculated based on the first rotation matrix and the second rotation matrix.
[0020] The second rotation angle is calculated based on the installation posture rotation matrix and the gravitational acceleration.
[0021] Optionally, in some optional embodiments, the step of collecting dynamic data of the vehicle under dynamic driving conditions and calculating the third rotation angle based on the dynamic data and the installation posture rotation matrix includes:
[0022] The vehicle's dynamic data under dynamic driving conditions is collected. The dynamic data is obtained based on a six-axis gyroscope and includes dynamic acceleration and dynamic angular velocity. The dynamic driving conditions include acceleration, deceleration, steering, uphill and downhill.
[0023] Based on the installation posture rotation matrix, the third rotation matrix is obtained;
[0024] Within the range of the third rotation angle, the third rotation matrix is discretized to obtain a discretized third rotation matrix, wherein the range of the third rotation angle is from 0 degrees to 360 degrees.
[0025] Based on the discretized third rotation matrix, the dynamic data is corrected and calculated to obtain two minimum values of the sum of the absolute values of angular velocities;
[0026] The first minimum value is substituted into the discretized third rotation matrix to correct the dynamic X-axis acceleration in the dynamic acceleration, and the sum of the absolute values of the difference between the corrected dynamic X-axis acceleration and the vehicle speed differential is calculated.
[0027] The sum of the absolute values of the smallest difference is taken as the third rotation angle.
[0028] Optionally, in some optional embodiments, the step of correcting the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope according to the first rotation angle, the second rotation angle, and the third rotation angle, and calculating the corresponding slope value based on the corrected real-time acceleration data and real-time angular velocity data, includes:
[0029] The real-time acceleration data and real-time angular velocity data acquired by the six-axis gyroscope are preprocessed, wherein the preprocessing includes: outlier removal, five-point mean filtering, and low-pass filtering.
[0030] The data rotation correction matrix is calculated based on the first rotation angle, the second rotation angle, and the third rotation angle.
[0031] Based on the preprocessed real-time acceleration data and real-time angular velocity data, corresponding acceleration vectors and angular velocity vectors are constructed, wherein the real-time acceleration data corresponds to the acceleration vectors and the real-time angular velocity data corresponds to the angular velocity vectors;
[0032] Acceleration data in the vehicle coordinate system is calculated based on the acceleration vector and the data rotation correction matrix.
[0033] The angular velocity data in the vehicle coordinate system is calculated based on the angular velocity vector and the data rotation correction matrix.
[0034] The corresponding slope value is calculated based on the acceleration data and angular velocity data in the vehicle coordinate system.
[0035] Optionally, in some optional embodiments, calculating the corresponding slope value based on the acceleration data and angular velocity data in the vehicle coordinate system includes:
[0036] Based on the acceleration data in the vehicle coordinate system, a first slope estimate is calculated, and the first slope estimate is subjected to low-pass filtering.
[0037] The angular velocity data in the vehicle coordinate system is subjected to high-pass filtering to obtain high-frequency angular velocity data;
[0038] Based on the high-frequency angular velocity data and the previously calculated slope value, a second slope estimate is calculated.
[0039] The corresponding slope value is calculated based on the first slope estimate after low-pass filtering, the second slope value, and the preset complementary filter weight coefficient.
[0040] In a second aspect, a slope calculation device includes: a static data processing unit, a dynamic data processing unit, and a slope value calculation unit;
[0041] The static data processing unit is used to collect static data of the vehicle under static conditions, and calculate the installation posture rotation matrix, first rotation angle and second rotation angle of the vehicle controller based on the static data. The first rotation angle is the rotation angle of the vehicle controller around its own coordinate system Y-axis, and the second rotation angle is the rotation angle of the vehicle controller around its own coordinate system X-axis.
[0042] The dynamic data processing unit is used to collect dynamic data of the vehicle under dynamic driving conditions, and calculate a third rotation angle based on the dynamic data and the installation posture rotation matrix, wherein the third rotation angle is the angle change between the installation direction of the vehicle controller and the driving direction of the vehicle.
[0043] The slope calculation unit is used to correct the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope according to the first rotation angle, the second rotation angle and the third rotation angle, and to calculate the corresponding slope value according to the corrected real-time acceleration data and real-time angular velocity data.
[0044] Optionally, in some optional embodiments, the static data processing unit includes: a static data acquisition subunit, an arithmetic mean calculation subunit, a gravitational acceleration calculation subunit, a first rotation angle calculation subunit, and an angle matrix calculation subunit;
[0045] The static data acquisition subunit is used to acquire static data of the vehicle under static conditions. The static data is acquired based on a six-axis gyroscope and includes: static X-axis acceleration, static Y-axis acceleration and static Z-axis acceleration. The static conditions are the conditions within the first time range from the system being powered on to the engine ignition when the slope is 0.
[0046] The arithmetic mean calculation subunit is used to calculate the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration, respectively.
[0047] The gravity acceleration calculation subunit is used to calculate the local gravity acceleration based on the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration.
[0048] The first rotation angle calculation subunit is used to calculate the first rotation angle based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration;
[0049] The angle matrix calculation subunit is used to calculate the installation posture rotation matrix and the second rotation angle based on the first rotation angle and the gravitational acceleration.
[0050] Thirdly, a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the slope calculation method described in any of the preceding claims.
[0051] Fourthly, an electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the slope calculation method described in any of the preceding claims.
[0052] By employing the above technical solutions, the present invention provides a slope calculation method, device, storage medium, and electronic device that can collect static data of a vehicle under static conditions and calculate the installation posture rotation matrix, a first rotation angle, and a second rotation angle of the vehicle controller based on the static data. The first rotation angle is the rotation angle of the vehicle controller around its own Y-axis coordinate system, and the second rotation angle is the rotation angle of the vehicle controller around its own X-axis coordinate system. The invention also collects dynamic data of the vehicle under dynamic driving conditions and calculates a third rotation angle based on the dynamic data and the installation posture rotation matrix. The third rotation angle is the angular change between the installation direction of the vehicle controller and the driving direction of the vehicle. Furthermore, the invention corrects the real-time acceleration and angular velocity data collected by the six-axis gyroscope based on the first, second, and third rotation angles, and calculates the corresponding slope value based on the corrected real-time acceleration and angular velocity data. As can be seen, this invention can correct gyroscope data based on coordinate changes, achieve compatibility with different sensor installation positions, and correct gyroscope data based on static and dynamic data. This ensures that even if the installation position of the vehicle controller is not completely determined or changes after vehicle maintenance, the gyroscope data can still be accurately corrected, thus ensuring the accuracy and applicability of slope calculation.
[0053] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0054] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0055] Figure 1 A flowchart of the first slope calculation method provided by the present invention is shown;
[0056] Figure 2 This invention provides a data calibration flowchart for a six-axis gyroscope.
[0057] Figure 3 A schematic diagram of coordinate transformation of a six-axis gyroscope provided by the present invention is shown;
[0058] Figure 4A flowchart of the second slope calculation method provided by the present invention is shown;
[0059] Figure 5 A schematic diagram of the slope calculation device provided by the present invention is shown;
[0060] Figure 6 A schematic diagram of the structure of an electronic device provided by the present invention is shown. Detailed Implementation
[0061] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0062] like Figure 1 As shown, the present invention provides a slope calculation method, including: S100, S200 and S300;
[0063] S100. Collect static data of the vehicle under static conditions, and calculate the installation posture rotation matrix, first rotation angle and second rotation angle of the vehicle controller based on the static data, wherein the first rotation angle is the rotation angle of the vehicle controller around its own coordinate system Y axis, and the second rotation angle is the rotation angle of the vehicle controller around its own coordinate system X axis.
[0064] Optionally, the static operating condition referred to in this invention can be understood as: the operating condition of the vehicle in a standard test track with a slope of 0 and in a stationary state, during a period of time from power-on to engine ignition. That is, the invention can collect six-axis gyroscope acceleration data of the vehicle during the period of time from system power-on to engine ignition as the static data referred to in this invention, and this invention does not limit this.
[0065] For example, in some optional implementations, S100 includes: steps 1.1, 1.2, 1.3, 1.4, and 1.5;
[0066] Step 1.1: Collect static data of the vehicle under static conditions. The static data is collected based on a six-axis gyroscope and includes: static X-axis acceleration, static Y-axis acceleration and static Z-axis acceleration. The static conditions are the conditions within the first time range from power-on to engine ignition when the slope is 0.
[0067] Optionally, the six-axis gyroscope mentioned in this invention can be a gyroscope already installed in the vehicle, used to collect the vehicle's attitude changes (encoded roll angle, pitch angle, and yaw angle) along the X, Y, and Z axes. This invention can obtain static data by directly reading the data collected by the six-axis gyroscope. It should be noted that the X-axis data reflects changes in the vehicle's roll angle, the Y-axis data reflects changes in the vehicle's pitch angle, and the Z-axis data reflects changes in the vehicle's yaw angle; this invention does not impose limitations on these aspects.
[0068] Step 1.2: Calculate the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration, respectively;
[0069] Optionally, the arithmetic mean referred to in this invention is a well-known technical concept in the art. As mentioned above, this invention collects data over a period of time, including data from multiple moments for static X-axis acceleration, static Y-axis acceleration, and static Z-axis acceleration. Therefore, this invention can calculate the arithmetic mean based on data from multiple moments, as shown in Formula 1 below.
[0070] Formula 1: Where i represents the encoding at different times. For the number of moments, The arithmetic mean of the static X-axis acceleration. The arithmetic mean of the static Y-axis acceleration. It is the arithmetic mean of the static Z-axis acceleration.
[0071] Step 1.3: Calculate the local gravitational acceleration based on the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration;
[0072] Optionally, the gravitational acceleration can be calculated using data from the three-axis components, namely the X-axis, Y-axis, and Z-axis, as shown in Formula 2 below.
[0073] Formula 2: ,in, The present invention does not limit the force of gravity acceleration.
[0074] Step 1.4: Calculate the first rotation angle based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration;
[0075] Optionally, the coordinate system attitude corresponding to the vehicle controller's installation posture can be obtained from the geodetic coordinate system through two rotation transformations around its own coordinate axes. Therefore, based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration calculated earlier, the present invention can calculate the first rotation angle, that is, the rotation angle around its own coordinate system axis, as shown in Formula 3 below.
[0076] Formula 3: ,in, The first rotation angle is not limited in this invention.
[0077] Step 1.5: Calculate the installation posture rotation matrix and the second rotation angle based on the first rotation angle and the gravitational acceleration.
[0078] For example, in some alternative implementations, step 1.5 includes: steps 2.1, 2.2, 2.3, and 2.4;
[0079] Step 2.1: Calculate the first rotation matrix based on the first rotation angle;
[0080] Optionally, based on the first rotation angle shown in Formula 3, the present invention can obtain the first rotation angle shown in Formula 4, and the present invention does not limit this.
[0081] Formula 4: ,in, Let be the first rotation matrix, but this invention does not limit it.
[0082] Step 2.2: Calculate the second rotation matrix based on the first rotation matrix;
[0083] Optionally, based on the first rotation matrix shown in Formula 4, the present invention can transform to obtain a second rotation matrix as shown in Formula 5, and the present invention does not limit this.
[0084] Formula 5: ,in, Let be the first rotation matrix. This is the second rotation angle. It should be noted that in Formula 5... It is only used to represent the second rotation angle, and a specific value has not yet been obtained, that is, in Formula 5. Since these are unknown quantities, their specific values need to be calculated in subsequent steps. Please refer to the subsequent steps for details. This invention does not impose any restrictions on this.
[0085] Step 2.3: Calculate the installation posture rotation matrix of the vehicle controller based on the first rotation matrix and the second rotation matrix;
[0086] Optionally, based on the expressions in Formulas 4 and 5, the present invention can obtain the expression shown in Formula 6, which is used to express the installation posture rotation matrix of the vehicle controller. The present invention does not limit this expression.
[0087] Formula 6: ,in, The present invention does not limit the installation attitude rotation matrix of the controller to be calculated from static acquisition data.
[0088] Step 2.4: Calculate the second rotation angle based on the installation posture rotation matrix and the gravitational acceleration.
[0089] Optionally, after updating the matrix based on the installation attitude rotation matrix shown in Formula 6, the present invention can calculate the specific value of θ2 using the components of gravitational acceleration. That is, the present invention can calculate the specific value of θ2 based on the gravity vector in the rotated coordinate system. shaft and The second rotation angle is calculated from the components of the axis, but this invention does not impose any limitations on this calculation.
[0090] S200. Collect dynamic data of the vehicle under dynamic driving conditions, and calculate the third rotation angle based on the dynamic data and the installation posture rotation matrix, wherein the third rotation angle is the angle change between the installation direction of the vehicle controller and the driving direction of the vehicle.
[0091] For example, in some optional implementations, S200 includes: steps 3.1, 3.2, 3.3, 3.4, 3.5, and 3.6;
[0092] Step 3.1: Collect dynamic data of the vehicle under dynamic driving conditions. The dynamic data is collected based on a six-axis gyroscope and includes dynamic acceleration and dynamic angular velocity. The dynamic conditions include acceleration, deceleration, steering, uphill and downhill.
[0093] Optionally, the present invention can collect and record dynamic six-axis gyroscope acceleration data of a vehicle under specific driving conditions. Specific driving conditions include: acceleration, deceleration, steering, uphill and downhill scenarios. Of course, the present invention is not limited to these specific driving conditions. The present invention can also collect corresponding dynamic data under other feasible driving conditions. The present invention does not limit this.
[0094] Step 3.2: Obtain the third rotation matrix based on the installation posture rotation matrix;
[0095] Optionally, given that the installation posture of the vehicle controller is determined (i.e., the installation posture rotation matrix is determined), the angular variation range between the installation direction and the vehicle's driving direction is: At this point, calculate the third rotation angle. Third rotation matrix It can be represented as shown in Formula 7 below.
[0096] Formula 7:
[0097] Optionally, to further clarify the coordinate system transformation process of the present invention, the present invention provides, as follows: Figure 2 The diagram illustrates the coordinate transformation process. It should be noted that coordinate transformation is a well-known technique in the art; please refer to relevant descriptions in the field for the content shown in the diagram. This invention will not elaborate further on this aspect.
[0098] Optionally, the third rotation matrix is a rotation about the Z-axis of the geodetic coordinate system. Assuming the rotation angle is θ3, the third rotation matrix can be obtained through mathematical formulas.
[0099] Step 3.3: Discretize the third rotation matrix within the range of the third rotation angle to obtain a discretized third rotation matrix, wherein the range of the third rotation angle is from 0 degrees to 360 degrees.
[0100] Optionally, by combining the aforementioned first, second, and third rotation matrices, the present invention can obtain a rotation matrix from the vehicle coordinate system to the vehicle controller coordinate system. The specific formula is shown in Formula 8 below.
[0101] Formula 8:
[0102] Optionally, based on Formula 8, the present invention extends the third rotation angle variation range (i.e., Discretize the coordinates to obtain the rotation matrix from the vehicle coordinate system to the vehicle controller coordinate system after discretization. That is, in This invention does not impose any limitations on this.
[0103] Step 3.4: Based on the discretized third rotation matrix, the dynamic data is corrected and calculated to obtain the two minimum values of the sum of the absolute values of the angular velocities;
[0104] Optionally, under dynamic driving conditions, the present invention can be based on a rotation matrix. The collected acceleration and angular velocity data of the six-axis gyroscope are corrected to obtain the corrected acceleration of the six-axis gyroscope. and angular velocity The specific formula is shown in Formula 9 below.
[0105] Formula 9:
[0106] Optionally, after the correction shown in Formula 9, the angular velocity data around the X, Y, and Z axes collected by the six-axis gyroscope are consistent with the vehicle's roll, pitch, and yaw angular velocities. The pitch angular velocity changes more significantly when the vehicle is going uphill or downhill; the yaw angular velocity changes more significantly when the vehicle is turning. Therefore, under the specified vehicle dynamic driving conditions, the roll angular velocity change is minimal. Based on this vehicle driving characteristic, with a rotation matrix of... The collected six-axis gyroscope data is corrected, and the sum of the absolute values of the vehicle's roll angular velocity under the entire dynamic driving condition is calculated, as shown in Formula 10 below.
[0107] Formula 10:
[0108] Optionally, within the entire discrete interval, obtain the two minimum values of the sum of the absolute values of the angular velocities, corresponding to the third rotation angles respectively. and These correspond to two cases: the x-axis of the transformed vehicle controller coordinate system and the vehicle coordinate system are in the same direction and the x-axis is in opposite directions, respectively. This invention does not impose any restrictions on these cases.
[0109] Step 3.5: Substitute the first minimum value into the discretized third rotation matrix to correct the dynamic X-axis acceleration in the dynamic acceleration, and calculate the sum of the absolute values of the difference between the corrected dynamic X-axis acceleration and the vehicle X-axis acceleration obtained by the differential calculation of the vehicle speed;
[0110] Step 3.6: Take the sum of the smallest absolute values of the differences as the third rotation angle.
[0111] Optionally, the present invention can calculate separately when the third rotation angle is... and At that time, the six-axis gyroscope was calibrated. The sum of the absolute values of the difference between the shaft acceleration and the vehicle acceleration obtained by differentiating the vehicle speed, the smaller value of the sum of absolute values corresponds to the obtained third rotation angle. This invention does not impose any limitations on this.
[0112] Optionally, this invention can collect a set of data including data from multiple dynamic operating conditions, thereby avoiding inaccurate calculations due to a single operating condition. For example, if the vehicle is traveling at a constant speed on a flat road, it is impossible to collect the longitudinal acceleration of the vehicle and the influence of gravity components caused by the slope.
[0113] Optionally, a set of data may have two minimum values. The rotation angle θ3 ranges from 0 to 360°. The calculation of the third rotation angle utilizes the vehicle's driving characteristics. Under the above conditions, the sum of the absolute values of the angular velocities rotating around the vehicle's x-axis is minimized. After correction, if the controller's X-axis is in the same direction or opposite to the vehicle's X-axis, the condition of minimizing the sum of absolute values is satisfied, thus resulting in two minimum values. This invention does not impose any limitations on this.
[0114] Optionally, to further clarify the data correction process of the present invention, the present invention provides, as follows: Figure 3 The data correction flowchart shown is for reference only. Please refer to the foregoing explanation for the content in the flowchart. This invention will not elaborate further on this.
[0115] S300. Based on the first rotation angle, the second rotation angle, and the third rotation angle, the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope are corrected, and the corresponding slope value is calculated based on the corrected real-time acceleration data and real-time angular velocity data.
[0116] For example, in some optional implementations, S300 includes: steps 4.1, 4.2, 4.3, 4.4, 4.5, and 4.6;
[0117] Step 4.1: Preprocess the real-time acceleration data and real-time angular velocity data acquired by the six-axis gyroscope. The preprocessing includes: outlier removal, five-point mean filtering, and low-pass filtering.
[0118] Optionally, to improve the accuracy of the present invention, the acquired data may undergo certain preprocessing. For example, preprocessing of the acceleration and angular velocity signals acquired by the gyroscope may be performed, including outlier removal, five-point mean filtering, and low-pass filtering, etc. The present invention does not limit this process.
[0119] Step 4.2: Calculate the data rotation correction matrix based on the first rotation angle, the second rotation angle, and the third rotation angle;
[0120] Optionally, the present invention can utilize the first rotation angle calculated above. Second rotation angle and the third rotation angle The data rotation correction matrix of the six-axis gyroscope is calculated, but this invention does not limit the scope of the calculation.
[0121] Step 4.3: Based on the preprocessed real-time acceleration data and real-time angular velocity data, construct the corresponding acceleration vector and angular velocity vector, wherein the real-time acceleration data corresponds to the acceleration vector and the real-time angular velocity data corresponds to the angular velocity vector;
[0122] Optionally, the present invention can construct the acceleration vector and angular velocity vector of the six-axis gyroscope based on the preprocessed real-time acceleration data and real-time angular velocity data, and then perform operations with the aforementioned rotation correction matrix to obtain the acceleration data and angular velocity data of the six-axis gyroscope in the vehicle coordinate system. The present invention does not limit this.
[0123] Step 4.4: Calculate the acceleration data in the vehicle coordinate system based on the acceleration vector and the data rotation correction matrix;
[0124] Step 4.5: Calculate the angular velocity data in the vehicle coordinate system based on the angular velocity vector and the data rotation correction matrix;
[0125] Step 4.6: Calculate the corresponding slope value based on the acceleration data and angular velocity data in the vehicle coordinate system.
[0126] For example, in some alternative implementations, step 4.6 includes: steps 5.1, 5.2, 5.3, and 5.4;
[0127] Step 5.1: Calculate the first slope estimate based on the acceleration data in the vehicle coordinate system, and perform low-pass filtering on the first slope estimate.
[0128] Optionally, when a vehicle is traveling on a slope, the sensed and collected longitudinal acceleration is the sum of the component of gravitational acceleration along the slope and the actual longitudinal acceleration of the vehicle. Based on kinematic relationships, the road slope can be calculated as shown in Formula 11 below.
[0129] Formula 11: ,in, It is obtained from the vehicle speed through first-order differential calculation.
[0130] Optionally, after calculating the road slope using Formula 11, the calculated road slope can be low-pass filtered to obtain the first slope estimate.
[0131] Step 5.2: Perform high-pass filtering on the angular velocity data in the vehicle coordinate system to obtain high-frequency angular velocity data;
[0132] It should be noted that, based on the characteristics of data acquired by a six-axis gyroscope, acceleration data is more accurate over long periods, while gyroscope data is more accurate over short periods. Due to the influence of road conditions and the installation location of the vehicle controller, the acquired acceleration signals contain high-frequency interference signals. The initial slope estimate obtained by processing with a low-pass filter often fails to meet the requirements. When the filter time constant is small, it cannot effectively reduce the interference caused by high-frequency signals; while when the filter time constant is large, it will introduce a time delay in the estimation results, affecting the real-time performance of the calculation.
[0133] Therefore, the present invention can improve the accuracy of the final slope estimation result by extracting the high-frequency signal of the angular velocity data of the six-axis gyroscope, that is, by performing high-pass filtering, to compensate for the initial slope estimation value.
[0134] Furthermore, the angular velocity data from a six-axis gyroscope often suffers from zero-point drift or temperature drift, leading to significant deviations when directly integrating the data to calculate the slope. This invention can use the corrected angular velocity data... The axial angular velocity data, i.e. pitch angular velocity data, is processed by a high-pass filter to obtain a high-frequency signal of angular velocity data. This invention does not limit this process.
[0135] Step 5.3: Calculate the second slope estimate based on the high-frequency angular velocity data and the slope value obtained in the previous calculation;
[0136] Optionally, the present invention can be based on the final slope estimation result calculated at the previous moment, and the six-axis gyroscope rotation in the vehicle coordinate system. The second slope estimate is calculated from the angular velocity data of the shaft, as shown in Formula 12 below.
[0137] Formula 12:
[0138] Step 5.4: Calculate the corresponding slope value based on the first slope estimate after low-pass filtering, the second slope value, and the preset complementary filter weight coefficient.
[0139] Optionally, further, the present invention is based on complementary filter weight coefficients. The final slope estimate is calculated as shown in Formula 13 below.
[0140] Formula 13:
[0141] Optionally, to further clarify the slope estimation process of the present invention, the present invention provides, as follows: Figure 4 The flowchart of the slope estimation algorithm shown is provided below. Please refer to the foregoing explanation for the content in the diagram. This invention will not elaborate further on this.
[0142] This invention enables six-axis gyroscope data correction based on coordinate system transformation and employs complementary filtering for slope estimation. Compared to traditional slope estimation algorithms, this invention achieves compatibility with different sensor installation positions, improving the algorithm's applicability. Furthermore, this invention calculates key parameters for gyroscope data correction based on static and dynamic calibration, which is beneficial for correcting gyroscope data when the vehicle controller's installation position is not fully determined during prototype verification or when the controller's installation position changes after vehicle maintenance. This invention also uses complementary filtering for slope estimation, achieving complementary characteristics of acceleration and angular velocity data. This improves the smoothness of the slope estimation results without introducing time delay, and avoids the problem of difficult-to-define key parameters compared to Kalman filtering.
[0143] Although the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous.
[0144] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0145] like Figure 5 As shown, the present invention provides a slope calculation device, including: a static data processing unit 100, a dynamic data processing unit 200, and a slope value calculation unit 300;
[0146] The static data processing unit 100 is used to collect static data of the vehicle under static conditions, and calculate the installation posture rotation matrix, first rotation angle and second rotation angle of the vehicle controller based on the static data. The first rotation angle is the rotation angle of the vehicle controller around its own coordinate system Y-axis, and the second rotation angle is the rotation angle of the vehicle controller around its own coordinate system X-axis.
[0147] The dynamic data processing unit 200 is used to collect dynamic data of the vehicle under dynamic driving conditions, and calculate a third rotation angle based on the dynamic data and the installation posture rotation matrix, wherein the third rotation angle is the angle change between the installation direction of the vehicle controller and the driving direction of the vehicle.
[0148] The slope calculation unit 300 is used to correct the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope according to the first rotation angle, the second rotation angle and the third rotation angle, and to calculate the corresponding slope value according to the corrected real-time acceleration data and real-time angular velocity data.
[0149] Optionally, in some optional embodiments, the static data processing unit 100 includes: a static data acquisition subunit, an arithmetic mean calculation subunit, a gravitational acceleration calculation subunit, a first rotation angle calculation subunit, and an angle matrix calculation subunit;
[0150] The static data acquisition subunit is used to acquire static data of the vehicle under static conditions. The static data is acquired based on a six-axis gyroscope and includes: static X-axis acceleration, static Y-axis acceleration and static Z-axis acceleration. The static conditions are the conditions within the first time range from the system being powered on to the engine ignition when the slope is 0.
[0151] The arithmetic mean calculation subunit is used to calculate the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration, respectively.
[0152] The gravity acceleration calculation subunit is used to calculate the local gravity acceleration based on the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration.
[0153] The first rotation angle calculation subunit is used to calculate the first rotation angle based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration;
[0154] The angle matrix calculation subunit is used to calculate the installation posture rotation matrix and the second rotation angle based on the first rotation angle and the gravitational acceleration.
[0155] Optionally, in some optional embodiments, the angle matrix calculation subunit includes: a first matrix calculation subunit, a second matrix calculation subunit, an attitude rotation matrix calculation subunit, and a second rotation angle calculation subunit;
[0156] The first matrix calculation subunit is used to calculate the first rotation matrix based on the first rotation angle;
[0157] The second matrix calculation subunit is used to calculate the second rotation matrix based on the first rotation matrix;
[0158] The attitude rotation matrix calculation subunit is used to calculate the installation attitude rotation matrix of the vehicle controller based on the first rotation matrix and the second rotation matrix.
[0159] The second rotation angle calculation subunit is used to calculate the second rotation angle based on the installation posture rotation matrix and the gravitational acceleration.
[0160] Optionally, in some optional embodiments, the dynamic data processing unit 200 includes: a dynamic data acquisition subunit, a third matrix calculation subunit, a discretization subunit, a minimum value subunit, an absolute value summation subunit, and a third rotation angle calculation subunit;
[0161] The dynamic data acquisition subunit is used to acquire dynamic data of the vehicle under dynamic driving conditions. The dynamic data is acquired based on a six-axis gyroscope and includes dynamic acceleration and dynamic angular velocity. The dynamic conditions include acceleration, deceleration, steering, uphill and downhill.
[0162] The third matrix calculation subunit is used to obtain the third rotation matrix based on the installation posture rotation matrix;
[0163] The discretization subunit is used to discretize the third rotation matrix within the range of the third rotation angle to obtain a discretized third rotation matrix, wherein the range of the third rotation angle is from 0 degrees to 360 degrees.
[0164] The minimum value subunit is used to correct and calculate the dynamic data based on the discretized third rotation matrix to obtain two minimum values of the sum of the absolute values of angular velocity;
[0165] The absolute value summation subunit is used to substitute the first minimum value into the discretized third rotation matrix to correct the dynamic X-axis acceleration in the dynamic acceleration, and to calculate the sum of the absolute values of the difference between the corrected dynamic X-axis acceleration and the vehicle X-axis acceleration obtained by the differential calculation of the vehicle speed.
[0166] The third rotation angle calculation subunit is used to take the sum of the smallest absolute values of the differences as the third rotation angle.
[0167] Optionally, in some optional embodiments, the slope value calculation unit 300 includes: a preprocessing subunit, a rotation correction matrix calculation subunit, a vector construction subunit, an acceleration data calculation subunit, an angular velocity data calculation subunit, and a slope estimation subunit;
[0168] The preprocessing subunit is used to preprocess the real-time acceleration data and real-time angular velocity data acquired by the six-axis gyroscope. The preprocessing includes outlier removal, five-point mean filtering, and low-pass filtering.
[0169] The rotation correction matrix calculation subunit is used to calculate the data rotation correction matrix based on the first rotation angle, the second rotation angle, and the third rotation angle.
[0170] The vector construction subunit is used to construct corresponding acceleration vectors and angular velocity vectors based on the preprocessed real-time acceleration data and real-time angular velocity data, wherein the real-time acceleration data corresponds to the acceleration vector and the real-time angular velocity data corresponds to the angular velocity vector;
[0171] The acceleration data calculation subunit is used to calculate the acceleration data in the vehicle coordinate system based on the acceleration vector and the data rotation correction matrix.
[0172] The angular velocity data calculation subunit is used to calculate the angular velocity data in the vehicle coordinate system based on the angular velocity vector and the data rotation correction matrix.
[0173] The slope estimation subunit is used to calculate the corresponding slope value based on the acceleration data and angular velocity data in the vehicle coordinate system.
[0174] Optionally, in some optional embodiments, the slope estimation subunit includes: a low-pass filtering subunit, a high-pass filtering subunit, an estimation calculation subunit, and a slope value calculation subunit;
[0175] The low-pass filtering subunit is used to calculate a first slope estimate based on the acceleration data in the vehicle coordinate system, and to perform low-pass filtering on the first slope estimate.
[0176] The high-pass filtering subunit is used to perform high-pass filtering on the angular velocity data in the vehicle coordinate system to obtain high-frequency angular velocity data.
[0177] The estimation calculation subunit is used to calculate a second slope estimate based on the high-frequency angular velocity data and the slope value obtained in the previous calculation.
[0178] The slope value calculation subunit is used to calculate the corresponding slope value based on the first slope estimate after low-pass filtering, the second slope value, and the preset complementary filter weight coefficient.
[0179] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0180] The slope calculation device includes a processor and a memory. The static data processing unit 100, the dynamic data processing unit 200, and the slope value calculation unit 300 are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.
[0181] The processor contains a kernel that retrieves the corresponding program units from memory. One or more kernels can be configured, and gyroscope data correction based on coordinate changes is achieved by adjusting kernel parameters. This ensures compatibility with different sensor installation locations and allows for gyroscope data correction based on both static and dynamic data. Even if the vehicle controller's installation location is not fully determined or changes after vehicle maintenance, accurate gyroscope data correction remains possible, guaranteeing the accuracy and applicability of slope calculations.
[0182] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements the slope calculation method.
[0183] This invention provides a processor for running a program, wherein the program executes the slope calculation method during runtime.
[0184] like Figure 6 As shown, this embodiment of the invention provides an electronic device 700, which includes at least one processor 701, at least one memory 702 connected to the processor 701, and a bus 703. The processor 701 and the memory 702 communicate with each other via the bus 703. The processor 701 is used to call program instructions in the memory 702 to execute the aforementioned slope calculation method. The electronic device in this document can be a server, PC, PAD, mobile phone, etc.
[0185] The present invention also provides a computer program product, which, when executed on an electronic device, is suitable for executing an initialization program having the following method steps:
[0186] A slope calculation method, comprising:
[0187] Collect static data of the vehicle under static conditions, and calculate the installation posture rotation matrix, first rotation angle and second rotation angle of the vehicle controller based on the static data. The first rotation angle is the rotation angle of the vehicle controller about its own coordinate system Y axis, and the second rotation angle is the rotation angle of the vehicle controller about its own coordinate system X axis.
[0188] The system collects dynamic data of the vehicle under dynamic driving conditions, and calculates a third rotation angle based on the dynamic data and the installation posture rotation matrix. The third rotation angle is the angular change between the installation direction of the vehicle controller and the driving direction of the vehicle.
[0189] Based on the first rotation angle, the second rotation angle, and the third rotation angle, the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope are corrected, and the corresponding slope value is calculated based on the corrected real-time acceleration data and real-time angular velocity data.
[0190] Optionally, in some optional embodiments, the step of collecting static data of the vehicle under static conditions and calculating the installation posture rotation matrix, the first rotation angle, and the second rotation angle of the vehicle controller based on the static data includes:
[0191] Collect static data of the vehicle under static conditions. The static data is obtained based on a six-axis gyroscope and includes: static X-axis acceleration, static Y-axis acceleration and static Z-axis acceleration. The static conditions are the conditions within the first time range from power-on to engine ignition when the slope is 0.
[0192] Calculate the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration, respectively;
[0193] The local gravitational acceleration is calculated based on the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration.
[0194] The first rotation angle is calculated based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration;
[0195] Based on the first rotation angle and the gravitational acceleration, the installation posture rotation matrix and the second rotation angle are calculated.
[0196] Optionally, in some optional embodiments, calculating the installation attitude rotation matrix and the second rotation angle based on the first rotation angle and the gravitational acceleration includes:
[0197] The first rotation matrix is calculated based on the first rotation angle;
[0198] The second rotation matrix is calculated based on the first rotation matrix;
[0199] The installation posture rotation matrix of the vehicle controller is calculated based on the first rotation matrix and the second rotation matrix.
[0200] The second rotation angle is calculated based on the installation posture rotation matrix and the gravitational acceleration.
[0201] Optionally, in some optional embodiments, the step of collecting dynamic data of the vehicle under dynamic driving conditions and calculating the third rotation angle based on the dynamic data and the installation posture rotation matrix includes:
[0202] The vehicle's dynamic data under dynamic driving conditions is collected. The dynamic data is obtained based on a six-axis gyroscope and includes dynamic acceleration and dynamic angular velocity. The dynamic driving conditions include acceleration, deceleration, steering, uphill and downhill.
[0203] Based on the installation posture rotation matrix, the third rotation matrix is obtained;
[0204] Within the range of the third rotation angle, the third rotation matrix is discretized to obtain a discretized third rotation matrix, wherein the range of the third rotation angle is from 0 degrees to 360 degrees.
[0205] Based on the discretized third rotation matrix, the dynamic data is corrected and calculated to obtain two minimum values of the sum of the absolute values of angular velocities;
[0206] The first minimum value is substituted into the discretized third rotation matrix to correct the dynamic X-axis acceleration in the dynamic acceleration, and the sum of the absolute values of the difference between the corrected dynamic X-axis acceleration and the vehicle speed differential is calculated.
[0207] The sum of the absolute values of the smallest difference is taken as the third rotation angle.
[0208] Optionally, in some optional embodiments, the step of correcting the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope according to the first rotation angle, the second rotation angle, and the third rotation angle, and calculating the corresponding slope value based on the corrected real-time acceleration data and real-time angular velocity data, includes:
[0209] The real-time acceleration data and real-time angular velocity data acquired by the six-axis gyroscope are preprocessed, wherein the preprocessing includes: outlier removal, five-point mean filtering, and low-pass filtering.
[0210] The data rotation correction matrix is calculated based on the first rotation angle, the second rotation angle, and the third rotation angle.
[0211] Based on the preprocessed real-time acceleration data and real-time angular velocity data, corresponding acceleration vectors and angular velocity vectors are constructed, wherein the real-time acceleration data corresponds to the acceleration vectors and the real-time angular velocity data corresponds to the angular velocity vectors;
[0212] Acceleration data in the vehicle coordinate system is calculated based on the acceleration vector and the data rotation correction matrix.
[0213] The angular velocity data in the vehicle coordinate system is calculated based on the angular velocity vector and the data rotation correction matrix.
[0214] The corresponding slope value is calculated based on the acceleration data and angular velocity data in the vehicle coordinate system.
[0215] Optionally, in some optional embodiments, calculating the corresponding slope value based on the acceleration data and angular velocity data in the vehicle coordinate system includes:
[0216] Based on the acceleration data in the vehicle coordinate system, a first slope estimate is calculated, and the first slope estimate is subjected to low-pass filtering.
[0217] The angular velocity data in the vehicle coordinate system is subjected to high-pass filtering to obtain high-frequency angular velocity data;
[0218] Based on the high-frequency angular velocity data and the previously calculated slope value, a second slope estimate is calculated.
[0219] The corresponding slope value is calculated based on the first slope estimate after low-pass filtering, the second slope value, and the preset complementary filter weight coefficient.
[0220] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatuses, electronic devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0221] In a typical configuration, an electronic device includes one or more processors (CPUs), memory, and a bus. The electronic device may also include input / output interfaces, network interfaces, etc.
[0222] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM, and memory includes at least one memory chip. Memory is an example of computer-readable media.
[0223] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0224] In the description of this invention, it should be understood that if the terms "upper", "lower", "front", "rear", "left" and "right" are used to indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the position or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention.
[0225] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes the element.
[0226] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0227] The above are merely embodiments of the present invention and are not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principle of the present invention should be included within the scope of the claims of the present invention.
Claims
1. A method of slope calculation, characterized by, include: Collect static data of the vehicle under static conditions, and calculate the installation posture rotation matrix, first rotation angle and second rotation angle of the vehicle controller based on the static data. The first rotation angle is the rotation angle of the vehicle controller about its own coordinate system Y axis, and the second rotation angle is the rotation angle of the vehicle controller about its own coordinate system X axis. The system collects dynamic data of the vehicle under dynamic driving conditions, and calculates a third rotation angle based on the dynamic data and the installation posture rotation matrix. The third rotation angle is the angular change between the installation direction of the vehicle controller and the driving direction of the vehicle. The real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope are corrected based on the first rotation angle, the second rotation angle and the third rotation angle, and the corresponding slope value is calculated based on the corrected real-time acceleration data and real-time angular velocity data. The step of collecting dynamic data of the vehicle under dynamic driving conditions and calculating the third rotation angle based on the dynamic data and the installation posture rotation matrix includes: The vehicle's dynamic data under dynamic driving conditions is collected. The dynamic data is obtained based on a six-axis gyroscope and includes dynamic acceleration and dynamic angular velocity. The dynamic driving conditions include acceleration, deceleration, steering, uphill and downhill. Based on the installation posture rotation matrix, the third rotation matrix is obtained; Within the range of the third rotation angle, the third rotation matrix is discretized to obtain a discretized third rotation matrix, wherein the range of the third rotation angle is from 0 degrees to 360 degrees. Based on the discretized third rotation matrix, the dynamic data is corrected and calculated to obtain two minimum values of the sum of the absolute values of angular velocities; The first minimum value is substituted into the discretized third rotation matrix to correct the dynamic X-axis acceleration in the dynamic acceleration, and the sum of the absolute values of the difference between the corrected dynamic X-axis acceleration and the vehicle speed differential is calculated. The sum of the smallest absolute values of the differences is taken as the third rotation angle.
2. The method of claim 1, wherein, The process of collecting static data of the vehicle under static conditions and calculating the installation attitude rotation matrix, first rotation angle, and second rotation angle of the vehicle controller based on the static data includes: Collect static data of the vehicle under static conditions. The static data is obtained based on a six-axis gyroscope and includes: static X-axis acceleration, static Y-axis acceleration and static Z-axis acceleration. The static conditions are the conditions within the first time range from power-on to engine ignition when the slope is 0. Calculate the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration, respectively; The local gravitational acceleration is calculated based on the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration. The first rotation angle is calculated based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration; Based on the first rotation angle and the gravitational acceleration, the installation posture rotation matrix and the second rotation angle are calculated.
3. The method of claim 2, wherein, The step of calculating the installation attitude rotation matrix and the second rotation angle based on the first rotation angle and the gravitational acceleration includes: The first rotation matrix is calculated based on the first rotation angle; The second rotation matrix is calculated based on the first rotation matrix; The installation posture rotation matrix of the vehicle controller is calculated based on the first rotation matrix and the second rotation matrix. The second rotation angle is calculated based on the installation posture rotation matrix and the gravitational acceleration.
4. The method of claim 1, wherein, The process of correcting the real-time acceleration and angular velocity data collected by the six-axis gyroscope based on the first, second, and third rotation angles, and calculating the corresponding slope value based on the corrected real-time acceleration and angular velocity data, includes: The real-time acceleration data and real-time angular velocity data acquired by the six-axis gyroscope are preprocessed, wherein the preprocessing includes: outlier removal, five-point mean filtering, and low-pass filtering. The data rotation correction matrix is calculated based on the first rotation angle, the second rotation angle, and the third rotation angle. Based on the preprocessed real-time acceleration data and real-time angular velocity data, corresponding acceleration vectors and angular velocity vectors are constructed, wherein the real-time acceleration data corresponds to the acceleration vectors and the real-time angular velocity data corresponds to the angular velocity vectors; Acceleration data in the vehicle coordinate system is calculated based on the acceleration vector and the data rotation correction matrix. The angular velocity data in the vehicle coordinate system is calculated based on the angular velocity vector and the data rotation correction matrix. The corresponding slope value is calculated based on the acceleration data and angular velocity data in the vehicle coordinate system.
5. The method of claim 4, wherein, The step of calculating the corresponding slope value based on the acceleration data and angular velocity data in the vehicle coordinate system includes: Based on the acceleration data in the vehicle coordinate system, a first slope estimate is calculated, and the first slope estimate is subjected to low-pass filtering. The angular velocity data in the vehicle coordinate system is subjected to high-pass filtering to obtain high-frequency angular velocity data; Based on the high-frequency angular velocity data and the previously calculated slope value, a second slope estimate is calculated. The corresponding slope value is calculated based on the first slope estimate after low-pass filtering, the second slope value, and the preset complementary filter weight coefficient.
6. A slope calculating device characterized by comprising: include: Static data processing unit, dynamic data processing unit, and slope value calculation unit; The static data processing unit is used to collect static data of the vehicle under static conditions, and calculate the installation posture rotation matrix, first rotation angle and second rotation angle of the vehicle controller based on the static data. The first rotation angle is the rotation angle of the vehicle controller around its own coordinate system Y-axis, and the second rotation angle is the rotation angle of the vehicle controller around its own coordinate system X-axis. The dynamic data processing unit is used to collect dynamic data of the vehicle under dynamic driving conditions, and calculate a third rotation angle based on the dynamic data and the installation posture rotation matrix, wherein the third rotation angle is the angle change between the installation direction of the vehicle controller and the driving direction of the vehicle. The slope calculation unit is used to correct the real-time acceleration data and real-time angular velocity data collected by the six-axis gyroscope according to the first rotation angle, the second rotation angle and the third rotation angle, and to calculate the corresponding slope value according to the corrected real-time acceleration data and real-time angular velocity data. The dynamic data processing unit includes: a dynamic data acquisition subunit, a third matrix calculation subunit, a discretization subunit, a minimum value subunit, an absolute value summation subunit, and a third rotation angle calculation subunit. The dynamic data acquisition subunit is used to acquire dynamic data of the vehicle under dynamic driving conditions. The dynamic data is acquired based on a six-axis gyroscope and includes dynamic acceleration and dynamic angular velocity. The dynamic driving conditions include acceleration, deceleration, steering, uphill and downhill. The third matrix calculation subunit is used to obtain the third rotation matrix based on the installation posture rotation matrix; The discretization subunit is used to discretize the third rotation matrix within the range of the third rotation angle to obtain a discretized third rotation matrix, wherein the range of the third rotation angle is from 0 degrees to 360 degrees. The minimum value subunit is used to correct and calculate the dynamic data based on the discretized third rotation matrix to obtain two minimum values of the sum of the absolute values of angular velocity; The absolute value summation subunit is used to substitute the first minimum value into the discretized third rotation matrix to correct the dynamic X-axis acceleration in the dynamic acceleration, and to calculate the sum of the absolute values of the difference between the corrected dynamic X-axis acceleration and the vehicle X-axis acceleration obtained by the differential calculation of the vehicle speed. The third rotation angle calculation subunit is used to take the sum of the smallest absolute values of the differences as the third rotation angle.
7. The apparatus of claim 6, wherein, The static data processing unit includes: a static data acquisition subunit, an arithmetic mean calculation subunit, a gravitational acceleration calculation subunit, a first rotation angle calculation subunit, and an angle matrix calculation subunit; The static data acquisition subunit is used to acquire static data of the vehicle under static conditions. The static data is acquired based on a six-axis gyroscope and includes: static X-axis acceleration, static Y-axis acceleration and static Z-axis acceleration. The static conditions are the conditions within the first time range from the system being powered on to the engine ignition when the slope is 0. The arithmetic mean calculation subunit is used to calculate the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration, respectively. The gravity acceleration calculation subunit is used to calculate the local gravity acceleration based on the arithmetic mean of the static X-axis acceleration, the static Y-axis acceleration, and the static Z-axis acceleration. The first rotation angle calculation subunit is used to calculate the first rotation angle based on the arithmetic mean of the static X-axis acceleration and the gravitational acceleration; The angle matrix calculation subunit is used to calculate the installation posture rotation matrix and the second rotation angle based on the first rotation angle and the gravitational acceleration.
8. A computer-readable storage medium having stored thereon a program, characterized in that, When the program is executed by the processor, it implements the slope calculation method as described in any one of claims 1 to 5.
9. An electronic device, comprising: The electronic device includes at least one processor, at least one memory connected to the processor, and a bus; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the slope calculation method as described in any one of claims 1 to 5.