1. Principle of acceleration and gyroscope
Of course, before you start, at least know what is accelerometer What is a gyroscope, otherwise what is said in the back is meaningless. Simply put, the accelerometer mainly measures the acceleration of the movement of the object, and the gyroscope mainly measures the angular speed of the rotation of the object. I won't say much about these theories, they can be found on the Internet. Here I recommend a more detailed article "AGuide To Use IMU (Accelerometer and Gyroscope Devices) inEmbeddedApplications", which can be searched directly on the Internet.
2. Acceleration measurement
Before we start, do you remember that acceleration has a composition theorem? If you don't remember, just to get a sense of it, a simple example is that the acceleration of gravity can be understood as the result of the combined effects of the acceleration in the x,y, and z directions. The flip side is that the acceleration of gravity can be broken down into acceleration in the x,y, and z directions.
The accelerometer can measure the acceleration value in x,y, and z directions at a certain time. The self-balancing car uses the accelerometer to measure the components of the gravitational acceleration in x,y, and z axes, and then uses the ratio of the components in each direction to the gravitational acceleration to calculate the approximate inclination Angle of the car. In fact, when the self-balancing car is not stationary, the results measured by the accelerometer are not very accurate. Because we all learned in high school physics, the object will always be affected by the earth's gravitational force to produce a downward acceleration of gravity, and the car in dynamic, by the motor must have a forward or backward direction of the force, and the accelerometer measured the result is, The acceleration of gravity and the acceleration of trolley motion are combined to obtain a total acceleration component in three directions.
However, we do not consider the effect of motor motion acceleration on the measurement results. Because we have to first break down complex things into simple things to analyze, so that we can see the results and have confidence to continue.