Bionic engineering has been a focus in the field of robotic researches. Inverse dynamic analysis is significant for the determination of dynamic parameters of bionic robots. The present paper uses a newly developed robot modular named Sambot to construct a caterpillar robotic mechanism, and designs a gait of trapezoidal wave locomotion for it. Two open-link models are put forth to simulate the dynamic behavior of such a locomotion. The inverse dynamic differential equations are derived by Kane's method and are then solved numerically by the Runge–Kutta method of the fourth order. Based on the numerical solutions of these differential equations, the applied joint torques required to produce the harmonic trapezoidal wave locomotion are determined finally, providing us important information on the gait control of the caterpillar robotic mechanism. Finally, the theoretical values of the joint torques are applied onto the present caterpillar mechanism to perform a locomotion experiment, which verifies the effectiveness of the present dynamics analysis.