Balancing the car
Generally speaking, the balance principle is similar to that of a person. When your center of gravity is offset, you will move forward, back, right and left to maintain the balance of the center of gravity
But it is through the pid to the target Angle and the actual Angle of the proportional integral differential calculation, the control wave to control the balance car motor rotation.
However, the cascade pid used by most balancing vehicles, coupled with the diagonal speed control, makes the parameter setting more complex and the effect more stable.