The stable four-foot walking in mixed surroundings is hard, because gait rhythm, body keeping steady, and collision avoiding are usually dealt with at different controlling layers. This paper carries out the construction of a collaborative Central Pattern Generator–Model Predictive Control–Dynamic Window Approach (CPG–MPC–DWA) framework for the optimization of locomotion under multiple scenarios. The CPG module produces phase-uniform diagonal-trot schemas and modulates step length, frequency, duty ratio, and swinging-foot elevation in accordance with terrain and speed requirements. MPC carries out regulation on body posture, height of center-of-mass, and contact feasibility within a finite forecasting horizon, hence DWA carries out search in the allowable velocity space and hence transmits safe reference instructions to the gait and body-control layers. A MATLAB/Simulink experiment platform has been constructed for flat ground, mixed terrain that includes steps, one inclined plane and one ditch, and the dynamic avoiding of obstacles. This identical logging flow pipeline records height changing, speed following, energy consumption, terrain passing through, safe distance, route efficiency, and response time. The outcomes demonstrate that on flat ground, the center-of-mass fluctuation proportion decreases from 6.70% to 6.64%, specific energy falls from 12.19 J/m to 11.75 J/m, and average velocity increases from 0.88 m/s to 0.92 m/s. On the complicated topographical area, all barrier sections are finished by 100 percent passing rate, and the maximum climbing height is 15.0 centimeter. In the situation of dynamic obstacles, the robot keeps the distance to the nearest obstacle above the 0.25 m safety threshold, attains 97.7% path efficiency, and obtains an average response time of 1.03 ms. The outcomes show that the put-forward frame gives a tight and expandable path for cooperative four-foot moving through different kinds of surroundings.