Adaptive gait planning is an important aspect in the development of control systems for multi-legged robots traversing on rough terrain. The problem of adaptive gait generation
can be viewed as one of finding a sequence of suitable foothold on rough terrain so that legged systems maintain static stability and motion continuity. Due to the limit of static stability, deadlock situation may occur in the process of searching for a suitable foothold, if terrain contains a large number of forbidden zones. In this paper, an improved method for adaptive gait planning is presented by active compensation of stability margin, through center of gravity (CG) adjustment in the longitudinal axis and/or body translation in the lateral direction. An algorithm for the proposed method is developed and embedded in a computer program. Simulation results show that the method provides legged machines with a much larger terrain adaptivity and better deadlock-avoidance ability.