AGV navigation method based on kinect vision
Technical Field
The invention relates to an AGV navigation method, in particular to an AGV navigation method based on kinect vision.
Background
Traditional manpower and semi-mechanized factory logistics mode are with high costs, efficient, can't satisfy production automation and intelligent requirement. AGV (automated Guided vehicle) AS a novel intelligent logistics device has the characteristics of high automation, high integration, high flexibility and the like, and can be organically combined with various RS/AS input/output ports, production lines, assembly lines, conveying lines, platforms, goods shelves, operation points and the like quickly; different functions can be realized in different combinations according to different requirements; the system can shorten the logistics turnover period to the maximum extent, reduce the turnover consumption of materials, realize the flexible connection of incoming materials and processing, logistics and production, finished products and sales and the like, improve the working efficiency of a production system to the maximum extent, and is widely applied to the industries such as the storage industry, the manufacturing industry and the like.
In recent years, the development of the e-commerce industry is not kept in pace, and logistics is an important part of the industry, and the efficiency of logistics sorting greatly influences the development speed of the industry. Traditional industry can be replaced gradually, can not keep pace with the development of trade, and the robot replaces artifical, improves efficiency and accuracy, and reduce cost is the inevitable trend of development. AGV commodity circulation letter sorting system loads, carries the express delivery parcel with a large amount of mobile robot, can greatly improve work efficiency.
The existing automatic logistics sorting in China mainly depends on large-scale logistics sorting equipment, although the logistics sorting equipment has higher logistics sorting efficiency, the large-scale logistics sorting equipment determines the large-scale work place, and thus the application range of the logistics sorting is greatly limited. The development of the automatic logistics sorting in China is still in the large-scale stage, and the automatic logistics sorting system is mainly suitable for large-scale warehouses and is used for carrying out automatic logistics sorting on large-scale packages. But nowadays, the application range of small-package and miniaturized logistics sorting is more and more extensive.
Only a few of the current logistics sorting in China realize automation, for example, some large enterprises or large logistics companies have large automatic logistics sorting warehouses. Only in these large automated logistics warehouses are specialized automated logistics sorting equipment available for automated sorting of logistics packages.
In most cases, the logistics sorting in China is still finished manually. Generally, after goods to be sorted arrive at a warehouse, logistics staff scan bar codes on express packages to record logistics information into a system, then the logistics packages are classified according to stacks according to logistics information, and when the number of the goods to be sorted is large, the goods to be sorted are conveyed to a corresponding warehouse area at one time. However, in such cases, the goods are often stacked in a mess or damaged due to misoperation or inattention of workers, which results in a great increase in the damage rate and error rate of goods sorted by logistics.
The traditional AGV navigation mode mainly adopts electromagnetic navigation and optical navigation. The navigation mode needs to lay a path on the ground, motion control is achieved according to deviation of the central axis of the AGV body and the path, flexibility is poor, and the path is difficult to change and expand.
The positioning function of the mobile robot is the most important function in multiple fields of navigation and is the most basic link for completing the navigation task of the robot. The accuracy and reliability of positioning directly determine whether the mobile robot can correctly complete the navigation function. There are generally two ways for AGV positioning — relative positioning and absolute positioning: in the case of relative positioning, namely, when the initial pose of the AGV is determined, the changes of the poses at the current time and the previous time are calculated by using internal sensors such as a photoelectric encoder and an accelerometer, so as to update the relative pose between the current state and the initial state. This is the most widely used way of AGV positioning. The method has higher positioning accuracy in short-distance movement, but because of the adoption of an incremental calculation method, the positioning error is continuously accumulated along with the increase of the movement distance and time, and an additional sensor is matched to eliminate the error. In contrast, absolute positioning refers to directly calculating the absolute position of the AGV by using an external sensor, so that no accumulated error exists, and the problem of 'kidnapping' of the AGV under non-autonomous movement can be solved.
Disclosure of Invention
The invention aims to overcome the defects in the prior art, and provides an AGV navigation method based on Kinect vision.
The purpose of the invention is realized by the following technical scheme: an AGV navigation method based on kinect vision comprises the following steps:
step S1, presetting a walking path for each AGV in the AGV moving range;
step S2, acquiring an image of the AGV moving range in real time through a kinect instrument placed above the AGV moving range;
step S3, constructing a two-dimensional map corresponding to the AGV moving range according to the current frame image of the AGV moving range acquired by the kinect instrument;
meanwhile, for a current frame image of the AGV moving range acquired by a kinect instrument, sequentially processing graying and binaryzation on the current frame image, extracting an object contour from the image after the graying and binaryzation processing, filtering the object contour to obtain the AGV contour, and acquiring the mass center coordinate of each AGV contour according to a two-dimensional map of the AGV moving range constructed under the frame image;
step S4, tracking each AGV contour according to the mass center coordinates of each AGV contour extracted from the current frame image and the previous frame image;
step S5, aiming at each AGV contour in the current frame image, acquiring the mass center coordinate of the AGV contour according to the two-dimensional map constructed under the previous frame image, then calculating the deviation slope of the AGV contour, judging whether the slope is greater than a certain value, and if so, controlling the AGV to correct the current walking track;
meanwhile, the mass center coordinates of all AGV contours in the current frame image are obtained according to a two-dimensional map constructed under the current frame image, whether multiple AGVs arrive at each position in the AGV moving range at the next moment or not is judged according to the mass center coordinates of all AGV contours and the walking paths of all the AGVs, and if yes, all the AGVs are sequentially controlled to pass through the positions; meanwhile, judging whether the distance between two adjacent AGV in the same walking direction is smaller than a certain value e according to the mass center coordinate of each AGV outline and the walking path of each AGV, and if so, controlling one AGV to stop walking firstly;
step S6, judging whether the current frame image of the AGV moving range acquired by the kinect instrument is the last frame image, if not, returning to the step S3 when the kinect instrument acquires the next frame image of the AGV moving range; if yes, the process is ended.
Preferably, in step S3, for the current frame image of the AGV moving range acquired by the kinect instrument, a specific process of constructing a two-dimensional map corresponding to the AGV moving range according to the frame image is as follows:
firstly, aiming at a current frame image of an AGV moving range, constructing image coordinates (u, v) according to the frame image, and then converting the image coordinates into actual coordinates (x, y):
x=au;
y=bv;
wherein:
wherein, width is the width of the current frame image of the AGV moving range, hight is the length of the current frame image of the AGV moving range, and dimension _ x is the actual width of the ground of the AGV moving range, and dimension _ y is the actual length of the ground of the AGV moving range.
Preferably, in step S3, for the current frame image of the AGV moving range acquired by the kinect instrument, the process of performing the graying and binarization processing on the frame image is as follows:
after a current frame image of the AGV moving range is acquired by a kinect instrument, a mat-form picture src is newly built for the frame image, and then the image is grayed and stored in the newly built mat picture src through a cvtColor () function; finally, selecting a proper Threshold value through a Threshold () function, and setting the gray value of the pixel point of the image src which is grayed to be 0 or 255;
wherein the formula of the cvtColor () function is as follows:
Gray=0.299R+0.587G+0.114B;
wherein Gray is the Gray value of the image after graying.
Preferably, in step S3, after extracting the object contour from the image after the graying and binarization processing, the process of filtering the object contour to obtain the AGV contour is as follows:
for each object contour extracted from the image, judging whether the object contour meets the following conditions: the length is greater than a first threshold value g, and the width is greater than a second threshold value h;
if yes, determining that the object contour is an AGV contour in the image;
if not, judging that the object contour is not the AGV contour in the image, and removing the object contour.
Preferably, in step S4, the process of tracking each AGV contour according to the coordinates of the center of mass of each AGV contour extracted from the current frame image and the previous frame image is specifically as follows:
firstly, presetting the distance traveled by each AGV between two frames of images as S;
when the kinect instrument acquires a current image of the AGV moving range, regarding each AGV contour in the current frame image, regarding the AGV contour of which the distance between the previous frame image and the AGV contour is smaller than S as the AGV contour; if the distance between the last frame of image and the AGV outline is not smaller than the AGV outline of S, taking the AGV outline as a new AGV appearing in the AGV moving range;
wherein the distance between the AGV outline in the previous frame image and the AGV outline in the current frame image is s:
wherein (x ", y") is the coordinate of the center of mass of an AGV contour in the two-dimensional map constructed under the previous image, and (x ', y') is the coordinate of the center of mass of the AGV contour in the two-dimensional map constructed under the current image.
Further, S is 6 cm.
Preferably, in step S5, the slope k of the deviation of the AGV profile is calculated as:
where (x2, y2) is the coordinates of the center of mass of an AGV profile in the two-dimensional map constructed under the current frame image, and (x1, y1) is the coordinates of the center of mass of the AGV profile in the two-dimensional map constructed under the previous frame image.
Furthermore, when the slope k of the deviation of the AGV outline is judged to be larger than a certain value of 0.17, the AGV is controlled to automatically correct the traveling track.
Preferably, the predetermined value e is 10 cm.
Preferably, in step S1, the upper computer presets a travel path of each AGV within the AGV activity range, where the travel path of each AGV includes a start point, corner points, and target points, and each AGV returns to the start point after reaching the target point from the start point; wherein the starting points of all the AGVs in the same AGV moving range are the same; when the AGV at the starting point receives the traveling path information preset by the upper computer and the goods information is successfully received, the AGV moves to the target point according to the preset traveling path, and after the goods information reaches the target point and is unloaded, the AGV returns to the starting point from the target point according to the preset traveling path.
Compared with the prior art, the invention has the following advantages and effects:
(1) the invention relates to an AGV navigation method based on kinect vision, which comprises the steps of firstly presetting a walking path for each AGV in an AGV moving range; when the AGV in the AGV moving range starts sorting work, acquiring an image of the AGV moving range in real time through a kinect instrument placed above the AGV moving range, and constructing a two-dimensional map of the AGV moving range in real time according to the acquired image of the AGV moving range; and tracking each AGV through the AGV outline of each frame image of the AGV moving range acquired by the kinect instrument. When the kinect instrument acquires a current frame image of the AGV moving range, calculating the slope of deviation of each AGV contour through the current frame image and a previous frame image, and determining whether to correct the current walking track of the AGV or not through the slope of deviation; in addition, when the kinect instrument acquires the current frame image of the AGV moving range, whether the AGV needs to be controlled to walk is determined by calculating the distance between two adjacent AGVs in the same walking direction, and meanwhile, whether a plurality of AGVs reach each other at the next moment in the AGV moving range or not is judged; therefore, the method carries out global positioning through Kinect vision, knows the surrounding environment information of each AGV, and can carry out reasonable and effective intelligent obstacle avoidance compared with the traditional method for carrying out obstacle avoidance by installing a sensor (such as an infrared sensor) on the AGV.
(2) According to the AGV navigation method based on kinect vision, aiming at each frame of image of an AGV moving range acquired by a kinect instrument, firstly, carrying out gray level and binarization sequential processing on the frame of image, and then extracting an object contour from the image after the gray level and binarization processing; according to the method, the object contour is extracted through the image after the graying and binarization processing, the AGV and the surrounding environment can be effectively and obviously distinguished, and the characteristic extraction of the AGV contour is convenient to perform in the next step.
Drawings
FIG. 1 is a flowchart of an AGV navigation method based on kinect vision according to the present invention.
FIG. 2 is a flow chart of the travel of each AGV in the method of the present invention.
FIG. 3 is a schematic diagram of the method of the present invention with the kinect instrument positioned above the reach of the AGV.
FIG. 4 is a schematic diagram of the travel path of each AGV in the two-dimensional map according to the method of the present invention.
Detailed Description
The present invention will be described in further detail with reference to examples and drawings, but the present invention is not limited thereto.
The embodiment of the invention discloses an AGV navigation method based on kinect vision, which comprises the following steps as shown in FIG. 1:
step S1, presetting a walking path for each AGV in the AGV moving range; in the embodiment, the upper computer presets the traveling path of each AGV in the AGV moving range, wherein the traveling path of the AGV comprises a starting point, corner points and a target point; as shown in fig. 2, each AGV reaches the target point from the starting point and then returns to the starting point, where the starting points of the AGVs within the same AGV activity range are the same; when the AGV at the starting point receives the preset walking path information sent by the upper computer and the goods information is successfully received, the AGV moves to the target point according to the preset walking path, and after the goods information reaches the target point and is unloaded, the AGV returns to the starting point from the target point according to the preset walking path. Wherein AGV can receive walking path information and the goods information of host computer through wifi communication module.
Step S2, when the AGV in the AGV moving range starts sorting work, acquiring an image of the AGV moving range in real time through a kinect instrument placed above the AGV moving range, and transmitting the image to an upper computer; FIG. 3 is a schematic diagram of a kinect instrument placed over the active range of an AGV, where in this embodiment, the kinect placement height is related to its visual coverage, and preferably just covers the active range of the AGV.
Step S3, constructing a two-dimensional map corresponding to the AGV moving range according to the current frame image of the AGV moving range acquired by the kinect instrument; in this embodiment, after receiving the current frame image of the AGV range of motion sent by the kinect instrument, the upper computer constructs a two-dimensional map of the AGV range of motion according to the frame image, specifically: firstly, aiming at a current frame RGB image of an AGV moving range, constructing image coordinates (u, v) according to the frame RGB image, and then converting the image coordinates into actual coordinates (x, y):
x=au;
y=bv;
wherein:
wherein, width is the width of the current frame image of the AGV moving range, hight is the length of the current frame image of the AGV moving range, and dimension _ x is the actual width of the ground of the AGV moving range, and dimension _ y is the actual length of the ground of the AGV moving range. Fig. 4 is a schematic diagram of preset traveling paths of 6 AGVs in a two-dimensional map, where the 6 AGVs are a first AGV, a second AGV, a third AGV, a fourth AGV, a fifth AGV and a sixth AGV, respectively, and each arrow direction is a traveling direction of each AGV, where the first AGV starts to travel from a starting point 1 to a first target point 2-1, and then returns from the first target point 2-1 to the starting point 1; the second AGV starts to travel from the start point 1 to the second target point 2-2, and then returns from the second target point 2-1 to the start point 1, the third AGV starts to travel from the start point 1 to the third target point 2-3, and then returns from the third target point 2-3 to the start point 1, the fourth AGV starts to travel from the start point 1 to the fourth target point 2-4, and then returns from the fourth target point 2-4 to the start point 1, the fifth AGV starts to travel from the start point 1 to the fifth target point 2-5, and then returns from the fifth target point 2-5 to the start point 1, the sixth AGV starts to travel from the start point 1 to the sixth target point 2-6, and then returns from the sixth target point 2-6 to the start point 1.
Meanwhile, for a current frame image of the AGV moving range acquired by a kinect instrument, sequentially processing graying and binaryzation on the current frame image, extracting an object contour from the image after the graying and binaryzation processing, filtering the object contour to obtain the AGV contour, and acquiring the mass center coordinate of each AGV contour according to a two-dimensional map of the AGV moving range constructed under the frame image;
in this embodiment, for a current frame image of the AGV activity range acquired by the kinect instrument, the graying and binarization processing of the frame image is as follows:
after a current frame RGB image of an AGV moving range is acquired by a kinect instrument, a mat-form picture src is newly built for the frame RGB image, and then the RGB image is grayed and stored in the newly built mat picture src through a cvtColor () function; finally, selecting a proper Threshold value through a Threshold () function, and setting the gray value of the pixel point of the image src which is grayed to be 0 or 255; wherein the formula of the cvtColor () function is as follows:
Gray=0.299R+0.587G+0.114B;
wherein Gray is a Gray value of the RGB image after graying.
In this embodiment, in the above steps, after extracting the object contour from the image after the graying and binarization processing, the process of filtering the object contour to obtain the AGV contour is as follows: for each object contour extracted from the image, judging whether the object contour meets the following conditions: the length is greater than a first threshold value g, and the width is greater than a second threshold value h; if yes, determining that the object contour is an AGV contour in the image; if not, judging that the object contour is not the AGV contour in the image, and removing the object contour. The values of the first threshold value g and the second threshold value h are set according to the length and the width of the actual AGV.
Step S4, tracking each AGV contour according to the mass center coordinates of each AGV contour extracted from the current frame image and the previous frame image; the method specifically comprises the following steps:
firstly, presetting the distance traveled by each AGV between two frames of images as S; in this example, S is 6 cm. When the kinect instrument acquires a current frame image of an AGV moving range, regarding each AGV contour in the current frame image, regarding the AGV contour of which the distance between the previous frame image and the AGV contour is smaller than S as the AGV contour; if the current frame image is the first frame image of the AGV moving range acquired by the kinect instrument, directly marking each AGV outline;
wherein the distance between the AGV outline in the previous frame image and the AGV outline in the current frame image is s:
wherein (x ", y") is the coordinate of the center of mass of an AGV contour in the two-dimensional map constructed under the previous image, and (x ', y') is the coordinate of the center of mass of the AGV contour in the two-dimensional map constructed under the current image.
In this step, if there is no AGV contour having a distance smaller than S from the AGV contour in the previous image, the AGV contour is determined as a new AGV appearing in the AGV range.
Step S5, aiming at each AGV contour in the current frame image, acquiring the mass center coordinate of the AGV contour according to the two-dimensional map constructed under the previous frame image, then calculating the deviation slope of the AGV contour, judging whether the deviation slope of the AGV contour is larger than a certain value, if so, controlling the AGV to correct the current walking track, and if not, not correcting the walking track of the AGV; in this embodiment, during the traveling process of each AGV in the AGV moving range as shown in fig. 2, the traveling track needs to be corrected according to the above method.
In this embodiment, the slope k of the deviation of the AGV profile is:
where (x2, y2) is the coordinates of the center of mass of an AGV profile in the two-dimensional map constructed under the current frame image, and (x1, y1) is the coordinates of the center of mass of the AGV profile in the two-dimensional map constructed under the previous frame image. In this embodiment, it is determined whether the gradient of the deviation of the AGV profile is greater than a predetermined value 0.17, and if so, the AGV is controlled to correct the current travel track.
Meanwhile, the mass center coordinates of all AGV contours in the current frame image are obtained according to a two-dimensional map constructed under the current frame image, whether multiple AGVs arrive at each position in the AGV moving range at the next moment or not is judged according to the mass center coordinates of all AGV contours and the walking paths of all the AGVs, and if yes, all the AGVs are sequentially controlled to pass through the positions; meanwhile, judging whether the distance between two adjacent AGVs in the same walking direction is smaller than a certain value e or not according to the mass center coordinate of each AGV profile and the walking path of each AGV, if so, controlling one of the AGVs to stop walking first until the distance between the two AGVs is larger than the certain value e; the constant value e may be set to 10cm in the embodiment. In this embodiment, each AGV in the AGV activity range needs to be executed according to the above method in the process of traveling as shown in fig. 2, so as to realize cooperation and obstacle avoidance of multiple AGVs.
Step S6, judging whether the current frame image of the AGV moving range acquired by the kinect instrument is the last frame image, if not, returning to the step S3 when the kinect instrument acquires the next frame image of the AGV moving range; if yes, the process is ended.
The above embodiments are preferred embodiments of the present invention, but the present invention is not limited to the above embodiments, and any other changes, modifications, substitutions, combinations, and simplifications which do not depart from the spirit and principle of the present invention should be construed as equivalents thereof, and all such changes, modifications, substitutions, combinations, and simplifications are intended to be included in the scope of the present invention.