A positioning method for a photovoltaic robot, characterized in that the photovoltaic robot is used to install a photovoltaic panel on a photovoltaic bracket, and the positioning method is used to determine position information of the photovoltaic robot during an installation process of the photovoltaic panel, and the positioning method comprises:
- obtaining three-dimensional point cloud data of the photovoltaic bracket, wherein the three-dimensional point cloud data is obtained through a sensing device;
- determining a target straight line based on the three-dimensional point cloud data, wherein the target straight line comprises a straight line where a target structure of the photovoltaic bracket is located, the target straight line is located in a plane where the photovoltaic bracket is located and the target structure is used to locate the installation position of the photovoltaic panel on the photovoltaic bracket;
- determining the position information based on a first rotation matrix between a first coordinate system of the sensing device and a second coordinate system of the photovoltaic robot, as well as the target straight line;
- wherein the position information is used to indicate a relative position relationship between the photovoltaic robot and the target structure;
- said determining a target straight line based on the three-dimensional point cloud data comprises:
- extracting edge point cloud data from the three-dimensional point cloud data;
- wherein the three-dimensional point cloud data comprises three-dimensional position coordinates of multiple spatial points, and the edge point cloud data comprises three-dimensional position coordinates of multiple edge points;
- the multiple edge points constitute point cloud of a geometric shape boundary of the photovoltaic bracket;
- performing two-dimensional processing on the edge point cloud data to get two-dimensional data of the multiple edge points;
- determining the target straight line based on the two-dimensional data of the multiple edge points;
- said determining the target straight line based on the two-dimensional data of the multiple edge points comprises:
- selecting a first edge point and a second edge point from the multiple edge points;
- determining a first planar straight line based on two-dimensional data of the first edge point and the second edge point;
- determining the first planar straight line as a first candidate straight line when a number of inner points of the first planar straight line is greater than or equal to a first preset number;
- traversing the multiple edge points, when there are multiple first candidate straight lines, determining a candidate straight line with a largest number of inner points among the multiple first candidate straight lines as an initial target candidate straight line;
- selecting a third edge point and a fourth edge point from an initial edge point set;
- determining a second planar straight line based on two-dimensional data of the third edge point and the fourth edge point;
- determining the second planar straight line as a current target candidate straight line when a number of inner points of the second planar straight line is greater than or equal to a second preset number;
- wherein the initial edge point set comprises the remaining edge points after removing the inner points of the initial target candidate straight line from the multiple edge points;
- repeating the following iterative process until a number of the target candidate straight lines is greater than or equal to a third preset number;
- selecting a fifth edge point and a sixth edge point from a current edge point set;
- determining a third planar straight line based on two-dimensional data of the fifth edge point and the sixth edge point;
- determining a new current target candidate straight line based on the third planar straight line when the number of inner points of the third planar straight line is greater than or equal to a fourth preset number;
- wherein the current edge point set comprises the remaining edge points after removing the inner points of the current target candidate straight line from the initial edge point set;
- determining the target candidate straight line with a largest number of inner points as the target straight line when a number of target candidate lines is greater than or equal to the third preset number.