Two-wheel balance vehicle attitude angle measurement based on complementary filter

Abstract: Micro-Electro-Mechanical Systems (MEMS) gyroscopes and MEMS accelerometers have disturbances and noises in the attitude measurement of two-wheel balance vehicles, causing attitude angle measurement errors. The sliding deduction averaging method is used to suppress the DC component of the gyroscope and accelerometer input signals, the sliding filter algorithm is used to suppress the high frequency noise of the accelerometer, and the complementary filtering algorithm is introduced to fuse the preprocessed gyroscope and accelerometer signals to obtain more Accurate and stable angle measurements, the relationship between weighting factors and filter frequency characteristics in the fusion algorithm is analyzed. The method is applied to the running attitude angle control of the two-wheel balance car, and the accuracy of the attitude angle measurement is improved.

This article refers to the address: http://

The two-wheeled balance car has broad application prospects, making it a hot spot of current research. Among them, the attitude angle measurement of the two-wheeled balance car is one of the key issues in the research. Attitude angle measurement is the prerequisite for the realization of two-wheel balance car operation and control. The accuracy and speed of the attitude angle measurement will directly affect the stability and reliability of the two-wheel balance vehicle control algorithm. With the miniaturization of inertial measurement components and the improvement of microprocessor computing power, two-wheel balance vehicle attitude measurement generally uses low-cost Inertal Measurement Uint (IMU), combined with microprocessor data processing algorithms to achieve high precision. Gesture measurement. The IMU consists primarily of low cost MEMS gyroscopes and three-axis accelerometers. MEMS gyroscopes have the advantages of good autonomy, low power consumption, and easy integration of electromechanical performance. However, MEMS gyroscopes have temperature drift characteristics, and their measurement errors accumulate over time, which affects measurement accuracy. The accelerometer is affected by the vibration of the balance car, and the extra vibration of the alias interferes. Therefore, it is difficult to obtain a precise attitude angle from a single sensor measurement. A multi-sensor signal fusion method is needed to obtain an accurate amount of attitude angle.

Multi-sensor data fusion methods include neural network, wavelet analysis, Kalman filter and other attitude solving algorithms. However, these methods establish stable and reliable update equations, which usually have higher order and large computational complexity, which is not suitable for low computing power. Real-time calculation of the system. Compared with the above methods, the complementary filtering algorithm has low requirements on the processing speed of the processor, and is simple and reliable. Based on the complementary filtering algorithm, the two-wheel balance vehicle attitude angle measurement circuit and data processing algorithm are designed. The signal filtering preprocessing is designed. The complementary filter algorithm is used to fuse the two sensor data, and the calculation method of key parameters in the complementary filtering algorithm is analyzed. The method was applied to the two-wheel balance car angle measurement, and the verification test was carried out. The experimental test data was given.

1 attitude angle measurement principle

Along the three body axes of the balance car, that is, the front, the right, and the upper direction are defined as the x, y, and z three-axis reference coordinate systems. The three-axis gravitational acceleration components received are defined as gx, gy, gz. Assume that the two-wheel balance car is in a state of stationary or constant speed operation. The relationship between the gravitational acceleration and the attitude angle of the balance car is as shown in Equation 1:

Two-wheel balance vehicle attitude angle measurement based on complementary filter among them, Two-wheel balance vehicle attitude angle measurement based on complementary filter The transformation matrix from the inertial coordinate system to the carrier coordinate system: θ is the elevation angle; φ is the roll angle; g is the gravitational acceleration; the balance car pitch angle θ1 and the roll can be calculated by measuring the gravitational acceleration components gx, gy, gz Angle φ1. estimated value
Two-wheel balance vehicle attitude angle measurement based on complementary filter

If the gyroscope is used to measure the attitude angle of the balance vehicle, the x-axis rotational angular velocities of the gyroscope measurement carrier relative to the inertial coordinate system are respectively ωx, ωy, ωz. And define the O moment balance car standing upright. The relationship between the estimated value of the pitch angle θ2 and the roll angle φ2 and ωx, ωy can be obtained as shown in Equation 3:

Two-wheel balance vehicle attitude angle measurement based on complementary filter

In practical applications, due to the influence of factors such as motion acceleration, measurement noise, and drift of the gyroscope during operation, the attitude angle measurement methods of equations (2) and (3) are invalid, in order to accurately obtain the attitude angle. The attitude angle information obtained by the above two attitude angle measurements can be combined.

2 inertial combination measurement circuit

The inertial combination measurement circuit in the system is shown in Figure 1. It consists of an accelerometer MMA7361, a gyroscope ENC-03 and an amplifying circuit. Amplify the signals measured by accelerometers and gyroscopes. The accelerometer and gyroscope signals are amplified and output by the angle pin and the gyro pin respectively. The signal is converted into a digital signal by AD sampling, transmitted to the microcontroller, and then the complementary filtering algorithm is used to obtain the attitude angle.

Two-wheel balance vehicle attitude angle measurement based on complementary filter

3 Pretreatment of gyroscope drift and acceleration sensor data

The drift error of MEMS gyroscope consists of constant value drift and random drift. The drift signal does not conform to the time series characteristics of stationary, normal and zero mean. Figure 2 shows a piece of data collected by the gyroscope. The pitch angle θ2 obtained by integrating it shows that the error is continuously increasing and gradually increasing. The mean subtraction is performed by the algorithm shown in the formula (4).

Two-wheel balance vehicle attitude angle measurement based on complementary filter

Where ωgy(n) is the nth gyro angular velocity value; ω(n) is the angular velocity value after the nth removal mean; N is the number of buffered data.

Two-wheel balance vehicle attitude angle measurement based on complementary filter

After removing the mean value (ie, the constant component) of the gyroscope signal, the drift of the gyroscope only contains random drift, and the gyroscope signal at this time will serve as the input of the complementary filter fusion.

The accelerometer is affected by the vibration of the body, and the raw data of the acceleration sensor is processed by the method of sliding mean filtering. The filtering principle is as shown in equation (5):

Two-wheel balance vehicle attitude angle measurement based on complementary filter

Where θocc(n) is the angle value measured by the nth time of the accelerometer; θ1(n) is the angle value after the nth sliding filter: N is the sliding window order. Figure 3 shows the angle values ​​measured by the accelerometer before and after the sliding filter. As can be seen from Figure 3, the sliding filter algorithm has a filtering effect on the high frequency disturbance.

Two-wheel balance vehicle attitude angle measurement based on complementary filter

4 Design of attitude angle measurement based on complementary filter

The dynamic response characteristics of the gyroscope are excellent. When the attitude angle is solved, due to the influence of the low frequency drift of the gyroscope, the low frequency disturbance will generate a large error after the integration; the attitude angle calculated by the accelerometer will be affected by the high frequency vibration of the body during the operation of the balance car. , the high-frequency interference carrying a large component in the output angle. The two have complementary characteristics in the frequency domain, and the complementary filter is used to fuse the data of the two sensors, which can improve the accuracy of the attitude angle measurement and the performance of the dynamic response.

The basic schematic diagram of the complementary filter is shown in Figure 4.

Two-wheel balance vehicle attitude angle measurement based on complementary filter

Where θ is the actual angle value, ω is the angular velocity measured by the gyroscope, θ is the estimated angle value after the complementary filtering algorithm, the high frequency noise n1 introduced in the accelerometer measurement, and the low frequency noise n2 introduced in the gyroscope measurement is low The pass filter G1(s) eliminates the high frequency noise n1 in the accelerometer, and the high pass filter G2(s) eliminates the low frequency noise n2 in the gyroscope. The transfer functions of the two filters are designed as (6) and (7), and the structure of Fig. 4 can be reduced to the structure of Fig. 5.

Two-wheel balance vehicle attitude angle measurement based on complementary filter
Two-wheel balance vehicle attitude angle measurement based on complementary filter

The selected filter transfer function needs to satisfy G1(s)+G2(s)=1, and the data obtained by the accelerometer is obtained by the low-pass filter and the gyroscope and the data fusion of θ2 through the high-pass filter is used as the angle estimation value. Two-wheel balance vehicle attitude angle measurement based on complementary filter The appropriate selection of the weighting factor K value can make the high and low pass filters in the system have a suitable cutoff rate. Get a stable attitude angle.

Two-wheel balance vehicle attitude angle measurement based on complementary filter

It can be seen from equation (8) that in the low frequency band less than the cutoff frequency, the accelerometer plays a major role in the attitude calculation result; in the high frequency band greater than the cutoff frequency, the gyroscope plays a major role in the attitude calculation result. The gyroscope and accelerometer weights are adjusted by adjusting the time constant and changing the cutoff frequency Ï„ of the filter.

5 Experimental verification

In order to verify the feasibility of the above design, an upright two-wheeled trolley was used as an experimental verification platform. In this experiment, the inertial sensors in the inertial measurement combined component (IMU) were selected as ENC-03 (measuring range: ±300 (deg/s)) gyroscope with sampling frequency of 1.25 kHz and MMA7361 accelerometer (measurement range: ±1.5) g). The angle update frequency is 1.25 kHz. The complementary filter cutoff frequency is 138 Hz. The pitch angle (θ) was taken as an example and tested.

5.1 Analysis of angular velocity and angle fusion using complementary filtering algorithm

The angular velocity data measured by the gyroscope and the angle data measured by the accelerometer are fused by the equation (10) as shown in Fig. 6. As can be seen from Fig. 6, the angle is eliminated by the fusion of the complementary filtering algorithm. The drift of the gyroscope and the high frequency disturbance of the accelerometer can be concluded as follows:

Two-wheel balance vehicle attitude angle measurement based on complementary filter

1) The angle obtained by integrating the angular velocity obtained from the gyroscope is not correct. The angle between the angle measured by the accelerometer and the angle obtained by measuring the angular velocity of the gyroscope is combined with the complementary filtering algorithm to improve the angular precision.

2) The random drift of the gyroscope after complementary filtering is obviously suppressed, showing the effectiveness and superiority of this complementary filtering algorithm.

5. 2 Comparison of angles after complementary filtering and angles without treatment

The angle after the complementary filtering process is compared with the angle time domain directly measured by the accelerometer, and the spectrum of the signal before and after the complementary filtering process is FFT transformed as shown in Fig. 7. The complementary filtering algorithm can reduce the interference of random noise. Can make the waveform of the measured angle smoother.

Two-wheel balance vehicle attitude angle measurement based on complementary filter

6 Conclusion

In this paper, the effects of gyro drift and accelerometer high-frequency disturbance on the two-wheel balance vehicle attitude angle calculation are analyzed. Complementary filter fusion accelerometer and gyroscope signal are used for gyro drift and accelerometer high frequency disturbance. Complementary filtering can effectively eliminate the drift of the gyroscope, suppress the high frequency disturbance of the accelerometer, reduce the dynamic error of the output attitude angle, improve the angle measurement accuracy, and can meet the attitude control needs of the two-wheel balance car. Experimental results show that the method is effective

Sexuality can be applied to the attitude angle measurement system of car navigation, two-wheel balance car, and micro-miniature robot.

Dish-Washing Machine

Multi-Faction Dishwashing Machine,Household Dishwashing Machine,Dishwashing Machine,Electric Dishwashing Machine

JOYOUNG COMPANY LIMITED , https://www.globaljoyoung.com