###### Abstract  
In complex terrain, such as uneven roads or irregular terrain, two-wheeled heavy-duty self-balancing vehicles are easily affected by external interference factors, causing rollover or rendering the vehicle unable to move, which poses a greater challenge to its stability control. Therefore, it is necessary to establish a kinematic model of a two-wheeled vehicle and design a control system to study its driving stability. This paper aims to study the stability control system of a two-wheeled self-balancing vehicle under complex terrain. First, a self-balancing vehicle modeling method based on complex terrain is designed. By analyzing the motion characteristics of the self-balancing vehicle, a kinematic model suitable for complex terrain is established, which provides a basis for subsequent control algorithms. Secondly, a precise control system is designed for different terrain conditions, and parameters such as vehicle attitude, speed and acceleration are adjusted through the Proportional-Integral-Derivative (PID) control algorithm to achieve the smooth operation of the self-balancing vehicle in complex terrain. In addition, a vehicle-mounted camera is used to capture terrain images in real time, and different terrains are accurately identified through the terrain recognition algorithm based on deep learning, thereby determining the friction coefficient and effectively improving the stability of the self-balancing vehicle on complex terrain. The experimental results show that the designed control system can enable the self-balancing two-wheeled vehicle to achieve stable balance control in different terrains, and has good applicability and stability. two-wheeled self-balancing vehicle; motion control; PID control; deep learning; terrain recognition +
Footnote †: journal: Medical  
Benmo Technology Company (Dongguan, China). Their own topological structures have their own merits, and the current research on this type of robot is still at a critical stage. Among them, there are many researchers of humanoid robots [3,4]. There are two very important criteria for the quality of humanoid robots. The first criterion is controllability, and the second criterion is maneuverability. When humanoid robots solve their mobility problems, they mainly use two methods: bipedal walking and wheeled. Bipedal walking is a method often used by humanoid robots. Many research institutions have adopted corresponding methods to realize the bipedal walking of robots. Both feet have superior performance on rough roads, going up and down stairs, and in complex outdoor environments. However, its maneuverability is slightly insufficient, and its traveling speed on flat roads cannot meet the ideal requirements. Moreover, the mechanical structure is complex, making it difficult to manufacture and design. Wheeled robots are also a solution for humanoid robot walking. The high mobility of wheeled vehicles on level ground and their flexibility in small spaces are what motivate researchers to study them. Wheeled robots require at least three wheels to achieve static stability, while common vehicles are generally equipped with four wheels to ensure stability at high speeds. However, in the case of non-flat roads, four-wheel vehicles need to design corresponding suspension systems to solve the over-constraint problem caused by the four wheels, resulting in an increase in the structural complexity of the system. The two-wheeled self-balancing robot has the characteristics of simple structure and flexible movement. Its left and right wheels are connected on the same axis. Two-wheeled self-balancing robots can complete complex movements and operations in a small space. Such superior performance is not available in multi-wheeled robots [5]. With the rapid development of computer vision, its applications in various fields are becoming more and more widespread. Terrain recognition, as one of the important research contents in the current field of robotics, has also made significant progress with the help of deep learning.