Quadruped robots have the superiority to locomote on complicated terrains. However, in unknown environments, adaptive locomotion is still a great challenge. Considering the terrains including convex obstacles and forbidden areas, a novel motion planning algorithm is investigated for path planning, gait generation, gait transition and foothold searching. According to the terrain maps built by on-board stereo vision, the quadruped robot chooses the suitable gaits independently. Walk gait is selected on unstructured road segments for more stability while trot gait is employed on flat ground for higher speed. The motion trajectories are performed in the low level compliant control based on the kinematics and the couple dynamics which depends on stance phase and swing phase. The emphases of our inverse dynamics model are the analyses of the couple influences between four legs and the transition between different motion stages. The control architecture is applied on a real quadruped robot, and the experiment results demonstrate the availability of the system.