A, the model of our car is essentially a simple pendulum inverted model. In order to balance, there must be a restoring force pointing to the balance point, and so does the balance car, except that the motor of the car needs to accelerate to maintain balance;
B, to balance, the model of the car is related to the speed and torque of the motor and the size of the wheel. Either the wheels are bigger or the motor turns faster. At the same time, the attitude sensor is best placed at the center of mass of the car.
C. In detail, the motor movement process of the automobile is divided into acceleration process and balance process, and the balance of the automobile must be completed in the acceleration stage; Firstly, attitude detection is needed to understand attitude information, and then the motor speed is adjusted and controlled by PD to maintain balance;
(2) Attitude detection is a very important part, which requires accelerometer (lag) and gyroscope (zero drift). There are fusion schemes in the above resources, of course, there are three Kalman filtering schemes, complementary filtering schemes, and perhaps others. Because accelerometer and gyroscope have their own shortcomings, data fusion is needed. I choose complementary filtering, and most of them may choose this scheme, which can meet the balance requirements and consume less time. In the book Handyman's Notes, there is an in-depth study on the first-order filter, which can be used for reference.
(3) In the debugging stage, we must first adhere to the zero deflection angle of gyroscope and accelerometer;
Secondly, it is necessary to observe the fused waveform to prevent overshoot and lag;
Secondly, when the motor is running, the dead zone of each wheel should be tested;
Finally, when adjusting the parameters, the P parameter should be adjusted first. When we feel the wheels swing back and forth, we can add the differential D appropriately for fine adjustment. P-sized motor swings back and forth very badly. If it is too large, the car will vibrate.
Step one is complete, stand up! ! But unbalanced.