A foot-type robot terrain perception method based on a virtual sensor belongs to the field of robot perception, and comprises the following steps: S1, establishing a ground contact detection neural network model and a soil classification machine learning model; S2, under the conditions of different terrains and different gaits, collecting the angle of a leg joint, the angular speed of the leg joint, the motor current and the contact force data of the leg and the ground of the foot-type robot as samples; S3, training a ground contact detection neural network model and a soil classification machine learning model by using the samples collected in the S2; and S4, taking the ground contact detection neural network model and the soil classification machine learning model trained in the S3 as aterrain perception system of the foot-type robot for terrain perception. According to the method, the walking stability and the movement capacity of the robot can be improved, and meanwhile the robustness of the robot and the reliability of behaviors of the robot are enhanced; in addition, hardware of the robot is simplified, and the design, machining and maintenance cost is reduced.