Rational foot-end trajectory planning and control are of great significance for stable-legged walking of heavy-duty multi-legged robots. To achieve a fast, active, and compliant response of the leg actuator to disturbances for improvement of the stability and flexibility of the heavy-duty legged robot system during continuous walking on rough roads, a legged consensus control method (LCC) is proposed. Firstly, the LCC includes a foot-end trajectory planner model for designing the trajectory during the swing phase to ensure that the robot’s feet are always in a safe workspace during legged motion with continuously variable direction. Secondly, LCC constructs a consensus control method for encoding foot-end position and velocity consensus error based on variable topology networks. Six legs are treated as six intelligent agents and divided into two fully connected networks: the swing phase and stance phase, to achieve smooth and consistent motion that satisfies the geometric constraints of the robot. The foot-end agent can switch between swing and stance groups according to the state of the contact with the environment accompanied by the amendment topology, to enhance the robustness of the robot system through fast compliance control of the foot-end kinematics state. Then, the sliding mode control method based on consensus velocity and position error is deduced in LCC. The sliding mode surface is designed to make the three control variables realize stable movement with a consistent state of foot-end in three X,Y,Z-axis respectively, thereby enhancing the stability of foot-end state and fuselage posture. Finally, simulation and experiments have verified that the proposed LCC can assist legged-robot perform relatively steady legged motion with continuously variable direction on various rugged roads. The body attitude Root Mean Square Error (RMSE) is quickly reduced by 81.0% compared with independent PI control. The LCC algorithm code is publicly available at https://github.com/bjmyX/LCC_code.