Disclosure of Invention
The present invention is directed to the foregoing problem, and an embodiment of the present invention provides a storage device, where the storage device stores a plurality of instructions, and the instructions are adapted to be loaded and executed by a processor:
collecting laser data by using a laser sensor, and converting the laser data into a laser point coordinate in a laser coordinate system;
setting a preset target area where an object to be detected is located in the laser coordinate system, and eliminating laser points outside the preset target area;
performing least square fitting on the laser points in the preset target area to fit out an intersection line of a plane representing the object to be measured facing the laser sensor and a laser scanning plane;
projecting laser points which are not on the intersection lines onto the intersection lines, and dividing the laser points into different line segments based on the distance between the projection points;
and if the shape of the object to be detected is determined to be matched with that of the target object based on the length and the distance of each line segment, identifying the object to be detected as the target object.
Optionally, the instructions adapted to be loaded and executed by the processor further comprise: and if the object to be detected is identified as the target object, taking the midpoint of the line segment connected by the line segments on the intersection line as the midpoint position of the object to be detected, and taking the normal direction of the intersection line of the plane of the object to be detected facing the laser sensor and the laser scanning plane as the angle of the object to be detected.
Optionally, the laser data is an angle θ and a distance d between the object to be measured and the laser sensor; the conversion formula for converting the laser data into the coordinates of the laser points in the laser coordinate system is as follows:
xi=di×cos(θi)
yi=di×sin(θi)
the laser coordinate system is a two-dimensional coordinate system established by taking the laser sensor as an origin, and i represents the ith laser point.
Optionally, the step of setting a preset target area where the object to be measured is located in the laser coordinate system includes the following steps: determining the position information of the area where the object to be detected is located in the physical space; and converting the position information into a preset target area where the object to be detected is located in the laser coordinate system.
Optionally, performing least square fitting on the laser points in the preset target region to fit an intersection line representing a plane of the object to be measured facing the laser sensor and a laser scanning plane, includes the following steps:
performing multiple least square fitting on the laser points in the preset target area;
removing laser points with the distance greater than 3 times of standard deviation from the fitted straight line after each least square fitting until no laser point needs to be removed;
and representing the fitted straight line as an intersection line of a plane of the object to be measured, which faces the laser sensor, and a laser scanning plane.
Optionally, the dividing into different line segments based on the distance between the projection points includes the following steps:
setting a spacing threshold;
and sequentially attributing the two projection points of which the distance between the two adjacent projection points on the intersection line is smaller than or equal to the distance threshold value to the same line segment, and attributing the two projection points of which the distance between the two adjacent projection points on the intersection line is larger than the distance threshold value to different two line segments.
Optionally, before performing least square fitting on the laser points in the preset target region to fit an intersection line representing a plane of the object to be measured facing the laser sensor and a laser scanning plane, the method further includes the following steps: and filtering the laser points in the preset target region by using a shadow filter to filter noise points generated by a shadow effect.
Optionally, the target object is a tray with a hole, the tray has an upper end face, and a plurality of support columns for supporting the upper end face, and the hole is arranged between the support columns.
The embodiment of the invention also provides a laser navigation forklift, which comprises:
the laser sensor is suitable for performing laser scanning on a physical space where the laser navigation forklift is located so as to acquire laser data;
a processor adapted to process various instructions stored by the storage device;
the storage device of any of the above.
Compared with the prior art, the technical scheme of the invention at least has the following beneficial effects:
when the instruction loaded and executed by the processor identifies and positions the object, the acquired laser data is utilized and converted into the laser point coordinates in the laser coordinate system, the preset target area is adjusted in the laser coordinate system according to the position change of the object to be detected, and the laser points outside the preset target area are removed, so that whether the object to be detected is the target object can be identified more accurately, and the object to be detected is positioned more accurately.
Furthermore, the laser points in the preset target area are filtered by utilizing a shadow filter according to the adjustment of the preset target area so as to filter noise points generated by shadow effect, so that the robustness of the identification and positioning of the object to be detected can be enhanced.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
Fig. 1 is a schematic flow chart illustrating instructions stored in a storage device and loaded and executed by a processor according to an embodiment of the present invention.
Referring to fig. 1, the execution flow of the instruction includes the following steps:
step S1: collecting laser data by using a laser sensor, and converting the laser data into a laser point coordinate in a laser coordinate system;
step S2: setting a preset target area where an object to be detected is located in the laser coordinate system, and eliminating laser points outside the preset target area;
step S3: performing least square fitting on the laser points in the preset target area to fit out an intersection line of a plane representing the object to be measured facing the laser sensor and a laser scanning plane;
step S4: projecting laser points which are not on the intersection lines onto the intersection lines, and dividing the laser points into different line segments based on the distance between the projection points;
step S5: and if the shape of the object to be detected is determined to be matched with that of the target object based on the length and the distance of each line segment, identifying the object to be detected as the target object.
In this embodiment, the target object is described as an example of a tray having a receptacle.
Shown in fig. 2 is a side view of a tray having receptacles. Referring to fig. 2, the tray has an upper end surface 11 (for placing items) with a plurality of support posts 12 for supporting the upper end surface with receptacles therebetween (e.g., R1 and R2 are the width of the receptacles).
The instructions loaded and executed by the processor and stored in the storage device according to this embodiment are used to identify and locate the tray with the insertion holes as shown in fig. 2, and may be applied to a laser navigation forklift, so that the laser navigation forklift can identify the tray and accurately locate the insertion holes.
Specifically, as stated in step S1, laser data is acquired by a laser sensor and converted into laser point coordinates in a laser coordinate system.
As known to those skilled in the art, a laser sensor scans an object in a physical space by emitting a laser beam (a two-dimensional laser scanning plane), and when the laser beam encounters an object and is reflected, the reflected laser beam is received by the laser sensor, and an angle θ and a distance d of the object from the laser sensor are calculated accordingly.
Then, the position of the point of the reflected laser light can be reflected in the laser coordinate system, called the laser spot, based on the angle θ and the distance d. In the present embodiment, the laser coordinate system is a coordinate system established by using the laser sensor as an origin, please refer to a coordinate system X ' O ' Y ' shown in fig. 3 as the laser coordinate system, and a coordinate system XOY as the physical space coordinate system.
The conversion formula for converting the laser data (i.e., the angle θ and the distance d) into the coordinates of the laser point in the laser coordinate system is:
xi=di×cos(θi)
yi=di×sin(θi)
wherein i represents the ith laser spot, (x)i,yi) Representing a two-dimensional coordinate point of the ith laser spot in the laser coordinate system.
In step S2, a preset target area where the object to be measured is located is set in the laser coordinate system, and laser points outside the preset target area are eliminated.
In order to make the identification and positioning of the object to be detected more accurate, in this embodiment, a preset target area is set in the laser coordinate system according to the approximate placement area of the object to be detected, so that laser points outside the preset target area can be removed to eliminate interference.
Specifically, the method comprises the following steps:
firstly, the position information of the area where the object to be measured is located is determined in the physical space.
And then, converting the position information into a preset target area where the object to be detected is located in the laser coordinate system.
For example, a coordinate point range of an area where the object to be measured is located may be determined in a coordinate system of the physical space, and then the coordinate point range may be converted into a preset target area in the laser coordinate system. The specific conversion mode can be realized by setting a conversion formula between the coordinate system of the physical space and the laser coordinate system.
In practice, after the object to be measured is moved, the placement position of the object to be measured changes, and the position information of the area where the object to be measured is located in the physical space can be reloaded through manual setting, and then the position information is converted into a preset target area where the object to be measured is located in the laser coordinate system.
Further, after a preset target area where the object to be detected is located is determined in the laser coordinate system, laser points outside the preset target area are removed, and interference on subsequent identification and positioning of the object to be detected is eliminated.
In step S3, performing least squares fitting on the laser points in the preset target region to fit an intersection line between a plane of the object to be measured facing the laser sensor and the laser scanning plane.
Specifically, the method comprises the following steps:
1) performing multiple least square fitting on the laser points in the preset target area;
2) removing laser points with the distance greater than 3 times of standard deviation from the fitted straight line after each least square fitting until no laser point needs to be removed;
3) and representing the fitted straight line as an intersection line of a plane of the object to be measured, which faces the laser sensor, and a laser scanning plane.
The skilled person knows that the least squares method is a mathematical optimization method. In this embodiment, the laser points are fitted multiple times by using a least square method to fit a line (i.e., the fitted straight line) represented as an intersection between a plane of the object to be measured facing the laser sensor and a laser scanning plane.
After the least square method is adopted for the laser points, the laser points with the distance greater than 3 times of the standard deviation from the fitting straight line are removed, so that the interfered laser points can be further eliminated, and the accuracy and the efficiency of identifying and positioning the object to be detected are improved. Until no laser point needs to be removed, and the obtained fitted straight line is represented as an intersection line of a plane of the object to be measured, which faces the laser sensor, and a laser scanning plane.
It should be noted that, in this embodiment, the number of times of fitting the laser points by the least square method is determined according to whether there are laser points to be removed after the current fitting is completed (i.e., whether there are laser points whose distance from the fitted straight line is greater than 3 times of the standard deviation).
Continuing to refer to the side view of the tray with receptacles shown in fig. 2. The side of the tray shown in this side view is the plane of the tray facing the laser sensor. The laser points are subjected to a plurality of least squares fitting to obtain a fitted straight line as shown in fig. 2.
In this embodiment, a laser beam generated by the laser sensor is rotated and scanned in a plane to obtain in-plane laser data, and the laser beam is a two-dimensional laser scanning plane. When the object in the physical space is scanned by laser, according to the shape of the object to be measured, the height of the laser scanning plane generated by the laser sensor should be greater than the height from the bottom of the object to be measured to the ground and smaller than the height of the upper end face of the object to be measured, so that the position of the object to be measured can be effectively scanned by the laser. That is, the range of the laser scan plane scan should be within the spatial range of the object to be measured. As shown in fig. 2, the scanning range of the laser scanning plane has a height range h within which the insertion hole position of the tray can be scanned.
Further, in this embodiment, before executing step S3, the method further includes: and filtering the laser points in the preset target region by using a shadow filter to filter noise points generated by a shadow effect. The shadow effect is caused by the fact that laser is scattered on the edge of an object to be measured, and therefore distance measurement is inaccurate. The shadow filter removes noise generated by the shadow effect by judging the position relationship of two adjacent laser points. Therefore, the robustness of the identification and the positioning of the object to be detected can be enhanced.
In step S4, laser points that are not on the intersection line are projected onto the intersection line, and are divided into different line segments based on the distance between the respective projected points.
In this step, laser points that are not on the intersection line (i.e., the fitted line) refer to laser points that are less than 3 standard deviations away from the fitted line, and these laser points are not removed during the fitting process using the least squares method.
Then, the segments are divided into different line segments based on the distances between the respective projection points.
In the present embodiment, the target object is described as a tray having a receptacle.
When the laser scans, the angular rates of rotation are consistent, and the spacing between the scanned points on the tray can be considered to be within a certain range, and when the jacks are scanned, no corresponding laser points exist, so that the spacing between the points on two sides of the jacks is necessarily very large. Therefore, the inventor considers that the line segments can be effectively distinguished by presetting a spacing threshold, and the line segments can be regarded as the jacks.
Specifically, a distance threshold is first set, and the distance threshold may be set according to different target objects, which is not limited herein.
Then, the two projection points with the distance between the two adjacent projection points on the intersection line being smaller than or equal to the distance threshold value are classified into the same line segment in sequence, and the two projection points with the distance between the two adjacent projection points on the intersection line being larger than the distance threshold value are classified into two different line segments.
Fig. 4 is a schematic diagram showing the projection of laser points onto a fitted straight line and the division of different line segments. Referring to fig. 4, the graph includes 12 laser points, i.e., a, b, c, d, e, f, g, h, i, j, k, and l, and the 12 laser points are projected onto a fitting straight line (i.e., a perpendicular line is drawn from each projection point to the fitting straight line, and a foot point obtained on the fitting straight line is a projection point).
According to the set spacing threshold, a, b, c and d are assigned to the same line segment L1, e, f, g and h are assigned to the same line segment L3, and i, j, k and L are assigned to the same line segment L5. That is, the threshold value of the two adjacent projection points (e.g., the projection points corresponding to the laser points a and b) is smaller than the pitch threshold value. And the distance R1 between d and e is greater than the separation threshold, so d and e are attributed to two different line segments, and similarly, the distance R2 between h and i is greater than the separation threshold, so h and i are attributed to two different line segments. Specifically, in the present embodiment, taking the target object as a tray having the insertion holes as an example, the distance R1 between d and e and the distance R2 between h and i are insertion hole positions.
If it is determined that the object to be measured matches the shape of the target object based on the lengths and the distances of the line segments, the object to be measured is identified as the target object, as in step S4.
Specifically, whether the shape of the object to be measured is matched with that of the target object can be judged according to the length and the distance of each line segment on the fitting straight line. And if the target object is matched with the target object, identifying the object to be detected as the target object. And if the two are not matched, re-identifying.
Further, in this embodiment, if the object to be measured is identified as the target object, the midpoint of the line segment connected by the line segments on the intersection line is taken as the midpoint position of the object to be measured. With continued reference to fig. 4, the midpoint of the line segment (i.e. the intersection point of the perpendicular bisector of the line segment al and the fitting straight line) connected by the line segments on the fitting straight line (i.e. the intersection point of the line segment al and the fitting straight line) is used as the midpoint position of the object to be measured. And the normal direction of the intersection line of the plane of the object to be detected facing the laser sensor and the laser scanning plane is the angle of the object to be detected.
By adopting the technical scheme of the embodiment, the collected laser data is converted into the laser point coordinates in the laser coordinate system, the preset target area is adjusted in the laser coordinate system according to the position change of the object to be detected, and the laser points outside the preset target area are removed, so that whether the object to be detected is the target object can be identified more accurately, and the object to be detected is positioned more accurately.
Furthermore, the laser points in the preset target area are filtered by utilizing a shadow filter according to the adjustment of the preset target area so as to filter noise points generated by shadow effect, so that the robustness of the identification and positioning of the object to be detected can be enhanced.
The embodiment of the invention also provides a laser navigation forklift which is provided with a laser sensor, can scan in a physical space (such as a warehouse), and obtains the angle and the distance (namely laser data) between each object and the laser sensor. The laser navigation forklift is further provided with a processor and a storage device, wherein the processor is suitable for processing various instructions, the storage device stores a plurality of instructions, and the instructions are suitable for being loaded and executed by the processor. The instructions are the various steps described in the embodiments of the storage device described above.
The embodiment provides a laser navigation forklift which can be applied to the following scenes: the goods have a plurality of trays in the inherent fixed position region in storehouse, have placed the goods on the tray, need laser navigation fork truck to transport through the jack that sets up on the tray when the goods need shift to another position, and the position of placing of tray also can change. Therefore, the position determination of the pallet jack is important for the laser navigation forklift to carry goods. The laser navigation forklift provided by the embodiment of the invention can effectively identify and position the pallet, and has better precision and robustness compared with the existing global laser positioning method.
Although the present invention has been described with reference to the preferred embodiments, it is not intended to limit the present invention, and those skilled in the art can make modifications and variations of the present invention without departing from the spirit and scope of the present invention.