A method for reference edge detection by a robot, comprising the following steps: a robot rotating in place, and determining position coordinates of detection points according to distance values detected by a distance sensor of the robot and angle values detected by an angle sensor of the robot, determining the coordinates of adjacent two of the detection points as (Xi, Yi) and (X(i-1), Y(i-1)), and a slope of the two detection points as Ki = (Yi - Y(i-1))/(Xi - X(i-1)); and determining whether a difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is less than or equal to a preset error value, when the difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is less than or equal to the preset error value, determining that edge corresponding to the adjacent two of the detection points is a straight edge, and when the difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is not less than or equal to the preset error value, determining that edge corresponding to the adjacent two of the detection points is not the straight edge, characterized in that the method, after determining that the edge corresponding to the adjacent two of the detection points is the straight edge, further comprising the following steps: analyzing images captured by a vision sensor of the robot during rotation, and parsing the images to obtain multiple straight edges in the images, which be based on the principle of straight line detection by Hough transform; and taking one of the multiple straight edges corresponding to a longest straight edge in the images as a reference edge, wherein the multiple straight edges are detected based on the detection points, wherein the detection points satisfy that the difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is less than or equal to the preset error value. a robot rotating in place, and determining position coordinates of detection points according to distance values detected by a distance sensor of the robot and angle values detected by an angle sensor of the robot, determining the coordinates of adjacent two of the detection points as (Xi, Yi) and (X(i-1), Y(i-1)), and a slope of the two detection points as Ki = (Yi - Y(i-1))/(Xi - X(i-1)); and determining whether a difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is less than or equal to a preset error value, when the difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is less than or equal to the preset error value, determining that edge corresponding to the adjacent two of the detection points is a straight edge, and when the difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is not less than or equal to the preset error value, determining that edge corresponding to the adjacent two of the detection points is not the straight edge, characterized in that the method, after determining that the edge corresponding to the adjacent two of the detection points is the straight edge, further comprising the following steps: analyzing images captured by a vision sensor of the robot during rotation, and parsing the images to obtain multiple straight edges in the images, which be based on the principle of straight line detection by Hough transform; and taking one of the multiple straight edges corresponding to a longest straight edge in the images as a reference edge, wherein the multiple straight edges are detected based on the detection points, wherein the detection points satisfy that the difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is less than or equal to the preset error value. analyzing images captured by a vision sensor of the robot during rotation, and parsing the images to obtain multiple straight edges in the images, which be based on the principle of straight line detection by Hough transform; and taking one of the multiple straight edges corresponding to a longest straight edge in the images as a reference edge, wherein the multiple straight edges are detected based on the detection points, wherein the detection points satisfy that the difference between the arc tangent value of Ki and the arc tangent value of K(i-1) is less than or equal to the preset error value.