Disclosure of Invention
In order to solve at least one of the technical problems existing in the prior art to a certain extent, the invention aims to provide a grabbing method, a grabbing system, a grabbing device and a storage medium for an obstacle avoidance mechanical arm.
The technical scheme adopted by the invention is as follows:
a grabbing method of an obstacle avoidance mechanical arm comprises the following steps:
establishing a signed distance field model of the mechanical arm and a mechanical clamping jaw mounted at the tail end of the mechanical arm;
acquiring a color image and a depth image of a depth camera and the gesture of a mechanical clamping jaw, and calibrating the space conversion relation between the camera and a mechanical arm base;
acquiring a three-dimensional model of an object to be grabbed, matching the three-dimensional model with the point cloud acquired by the depth camera, and solving the gesture of the object to be grabbed in an actual scene;
acquiring a mechanical arm grabbing gesture avoiding collision according to the signed distance field model and the point cloud acquired by the depth camera;
and establishing a collision function according to the signed distance field model, designing an obstacle avoidance kinematics planning solver according to the collision function and the grabbing gesture of the mechanical arm, and solving a grabbing path to bypass a scene obstacle to grab an object.
Further, the establishing a signed distance field model of the mechanical arm and the mechanical clamping jaw mounted at the tail end of the mechanical arm comprises the following steps:
and acquiring model files of the mechanical arm and the mechanical clamping jaw, performing collision modeling on the mechanical arm and the mechanical clamping jaw, removing internal structures of the mechanical arm and the mechanical clamping jaw, acquiring a collision structure of the outermost layer of the mechanical arm clamping jaw, and acquiring a signed distance field model.
Further, obtain the model file of arm and mechanical clamping jaw, bump the modeling to arm and mechanical clamping jaw, remove the inner structure of arm and mechanical clamping jaw, obtain the collision structure of arm clamping jaw outermost, obtain signed distance field model, include:
importing model files of the mechanical arm and the mechanical clamping jaw, and acquiring physical models of the mechanical arm and the mechanical clamping jaw;
the mechanical links for each of the robotic arms are processed as follows:
establishing a cuboid bounding box for each mechanical connecting rod, and dividing a preset number of square voxels in the cuboid bounding box;
calculating the distance from the center point of each voxel to the surface of the mechanical connecting rod, and establishing an unsigned distance field of each mechanical connecting rod according to the distance;
subtracting a specific value a from the unsigned distance field to enable the value stored on part of voxels to be smaller than 0, and extracting an isosurface by using a marking cube method to extract a plurality of isosurfaces which are mutually disjoint;
establishing bounding boxes of all isosurfaces, selecting all isosurfaces which are not surrounded by other isosurface bounding boxes, discarding the rest isosurfaces, and expressing the structure of the outermost layer of the mechanical connecting rod by the non-surrounded isosurfaces;
performing s-shaped traversal on the vertexes of the square voxels, and if the vertexes pass through the outermost equivalent surface in the traversal process, inverting the distance values stored in the voxels to obtain a signed distance field;
and (3) recalculating the distance value stored in the internal voxel according to the outermost equivalent surface to obtain a final signed distance field model.
Further, the obtaining the color map and the depth map of the depth camera, and the gesture of the mechanical clamping jaw, calibrating the spatial conversion relationship between the camera and the mechanical arm base, includes:
placing an asymmetric dot calibration plate at a preset fixed position, and hanging a depth camera at the tail end of the mechanical arm;
moving the tail end of the mechanical arm for multiple times, and recording the color image, the depth image and the gesture of an end effector of the mechanical arm of a plurality of groups of calibration plates shot by the depth camera at the same moment;
matching by using an iterative nearest point algorithm according to a color image and a depth image obtained by shooting by a depth camera to obtain the gesture of the calibration plate at a corresponding moment;
and solving an equation to obtain a coordinate conversion relation between the depth camera and the mechanical arm end effector.
Further, the matching the three-dimensional model with the point cloud acquired by the depth camera, and solving the gesture of the object to be grabbed in the actual scene includes:
acquiring a point cloud of an object to be grabbed;
matching a three-dimensional model of an object to be grabbed with a point cloud acquired by a depth camera by using a plane-to-point iterative nearest point algorithm, and solving the gesture of the object to be grabbed in an actual scene; wherein, the optimization formula of single iteration is as follows:
wherein,,
and x= [ r ]
T ,t
T ]
T Including three-dimensional rotation and three-dimensional translation, expressing a three-dimensional gesture; q
i For points of the upper surface of the three-dimensional model of the object to be grasped, p
i For capturing a point cloud in a scene, +.>
And m is the number of corresponding point pairs, which is the normal vector of the point cloud on the surface of the three-dimensional model of the object to be grabbed.
Further, according to the signed distance field model and the point cloud acquired by the depth camera, acquiring the mechanical arm grabbing gesture for avoiding collision includes:
solving the optimal grabbing gesture according to the signed distance field model, the object near point cloud acquired by the depth camera and the point cloud of the object to be grabbed after the object gesture transformation is applied; wherein, the optimization formula of single iteration is as follows:
wherein x= [ r ] T ,t T ] T R is a rotation vector of the mechanical clamping jaw gesture, and t is a translation vector of the mechanical clamping jaw gesture;
the three parts comprise a collision avoidance part, a matching part and a normal vector fitting part;
the collision avoidance portion is:
wherein f
ci K points and g are points in the point cloud on the inner side of the mechanical clamping jaw, wherein the points collide with a scene
ci At point f for mechanical jaw collision model
ci A gradient is provided at the point of the gradient,
is f
ci Normal vector of the mechanical clamping jaw surface;
the matching part is as follows:
wherein f
i For the point inside the mechanical jaw nearer to the object, there are a total of l, p
fi For the point on the corresponding object that is nearer to the inside of the jaws,
is f
i Normal vector of the mechanical clamping jaw surface;
the normal vector fitting part is as follows:
wherein,,
for the object surface p
fi Normal vector at (a).
Further, the step of establishing a collision function according to the signed distance field model, and designing an obstacle avoidance kinematics planning solver according to the collision function and the grabbing gesture of the mechanical arm to solve the grabbing path comprises the following steps:
acquiring a kinematic model of the mechanical arm;
establishing a forward kinematic function and a reverse kinematic function by using a kinematic model of the mechanical arm;
utilizing a forward kinematics function and a signed distance field model to establish a collision judgment function of the mechanical arm;
inputting the obtained mechanical arm grabbing gesture by using a reverse kinematics function to obtain a target mechanical arm joint gesture;
and according to the collision judging function and the joint gesture of the target mechanical arm, carrying out obstacle avoidance path planning in a joint gesture space, driving the mechanical arm to bypass a collision object in a scene, reaching the joint gesture of the target mechanical arm and carrying out grabbing.
The invention adopts another technical scheme that:
an obstacle avoidance robotic grasping system, comprising:
the model building module is used for building a signed distance field model of the mechanical arm and the mechanical clamping jaw mounted at the tail end of the mechanical arm;
the hand-eye calibration module is used for acquiring a color image and a depth image of the depth camera and the gesture of the mechanical clamping jaw, and calibrating the space conversion relation between the camera and the mechanical arm base;
the point cloud matching module is used for acquiring a three-dimensional model of the object to be grabbed, matching the three-dimensional model with the point cloud acquired by the depth camera, and solving the gesture of the object to be grabbed in an actual scene;
the gesture acquisition module is used for acquiring a robot arm grabbing gesture avoiding collision according to the signed distance field model and the point cloud acquired by the depth camera;
and the path planning module is used for establishing a collision function according to the signed distance field model, designing an obstacle avoidance kinematics planning solver according to the collision function and the grabbing gesture of the mechanical arm, and solving a grabbing path so as to bypass a scene obstacle to grab an object.
The invention adopts another technical scheme that:
an obstacle avoidance robot arm gripping device, comprising:
at least one processor;
at least one memory for storing at least one program;
the at least one program, when executed by the at least one processor, causes the at least one processor to implement the method described above.
The invention adopts another technical scheme that:
a computer readable storage medium, in which a processor executable program is stored, which when executed by a processor is adapted to carry out the method as described above.
The beneficial effects of the invention are as follows: the invention can utilize the whole scene information and the signed distance field model shot by the upper camera in the grabbing process, thereby obtaining a grabbing gesture with higher robustness and stronger external environment interference force resistance after grabbing objects in a complex actual scene, and the invention has higher and more accurate calculation speed in collision judgment and good application prospect in the fields of logistics and intelligent manufacturing.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative only and are not to be construed as limiting the invention. The step numbers in the following embodiments are set for convenience of illustration only, and the order between the steps is not limited in any way, and the execution order of the steps in the embodiments may be adaptively adjusted according to the understanding of those skilled in the art.
In the description of the present invention, it should be understood that references to orientation descriptions such as upper, lower, front, rear, left, right, etc. are based on the orientation or positional relationship shown in the drawings, are merely for convenience of description of the present invention and to simplify the description, and do not indicate or imply that the apparatus or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus should not be construed as limiting the present invention.
In the description of the present invention, a number means one or more, a number means two or more, and greater than, less than, exceeding, etc. are understood to not include the present number, and above, below, within, etc. are understood to include the present number. The description of the first and second is for the purpose of distinguishing between technical features only and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
In the description of the present invention, unless explicitly defined otherwise, terms such as arrangement, installation, connection, etc. should be construed broadly and the specific meaning of the terms in the present invention can be reasonably determined by a person skilled in the art in combination with the specific contents of the technical scheme.
As shown in fig. 1, the embodiment provides a three-dimensional vision obstacle avoidance mechanical arm grabbing method, which specifically includes the following steps:
s1, establishing a signed distance field model of the mechanical arm and a mechanical clamping jaw mounted at the tail end of the mechanical arm.
And importing a mechanical arm and mechanical clamping jaw model file, performing collision modeling on the mechanical arm and the mechanical clamping jaw, removing the internal structures of the mechanical arm and the mechanical clamping jaw, focusing on only the collision structure of the outermost layer, and calculating a signed distance field model.
Specifically, a physical model of the mechanical arm and the mechanical jaw is imported, and the following treatment is performed for the mechanical link of each of them:
for each mechanical link, a cuboid bounding box slightly larger than the mechanical link is established, and square voxels with the number not smaller than 32 x 32 are divided in the cuboid bounding box. The length of the cuboid enclosure is usually about 1.2 times of the size of the cuboid enclosure, so that the memory space is wasted to reduce the speed, and the reconstruction surface is broken when the length of the cuboid enclosure is too small.
The distance of the center point of each voxel to the surface of the mechanical link is calculated to establish an unsigned distance field for each mechanical link. The distance calculation is accelerated by using a k-dimensional tree during calculation, otherwise, the speed is slower.
Subtracting a specific value a from the unsigned distance field to enable the value stored on part of voxels to be smaller than 0, and performing iso-surface extraction by using a marking samples method. The value of a is 10% of the cuboid enclosure. By using the method, a plurality of mutually disjoint isosurfaces can be extracted, and the isosurfaces are self-closing.
Establishing bounding boxes of all the isosurfaces, selecting all the isosurfaces which are not surrounded by other isosurfaces bounding boxes, and discarding the rest isosurfaces. These non-enclosed isosurfaces represent the structure of the outermost layer of the mechanical link. Since the isosurfaces do not intersect each other, these non-enclosed isosurface levels represent the structure of the outermost layer.
Performing s-shaped traversal on the vertexes of the square voxels, and if the vertexes pass through the outermost equivalent surface in the traversal process, inverting the distance values stored in the voxels to obtain a signed distance field; ultimately the operation will result in a negative sign for the distance value stored in the voxel inside the object and a positive sign for the distance value stored in the voxel outside the object. This step creates a signed distance field.
The distance value stored by the voxels inside the object is recalculated. Since the internal iso-surface is removed, the distance values stored by the internal voxels need to be recalculated using the outermost iso-surface.
Compensating the previously subtracted specific value a requires that the final signed distance field be added to the specific value a.
An original model of the mechanical clamping jaw is shown in fig. 2, and a signed distance field reconstruction visualization result of the mechanical clamping jaw model of fig. 2 is shown in fig. 3. The signed distance field reconstruction visualization results for each mechanical link of the whole mechanical arm model are shown in fig. 4. It can be seen that the established collision model encloses some small holes and pits, ensuring that the overall collision is as simple as possible, while ensuring substantial accuracy.
S2, acquiring a color image and a depth image of the depth camera and the gesture of the mechanical clamping jaw, and calibrating the space conversion relation between the camera and the mechanical arm base.
And placing the asymmetric dot calibration plate at a fixed position, and mounting the depth camera on the tail end of the mechanical arm.
And (3) moving the tail end of the mechanical arm for a plurality of times, and recording the color image, the depth image and the gesture of the tail end actuator of the mechanical arm of the calibration plate shot by the depth camera at the same moment. In this embodiment, at least 5 sets of data are acquired.
And matching the color map and the depth map obtained by shooting by using the depth camera by using an iterative nearest point algorithm to obtain the posture of the calibration plate at the moment.
By using the data, an overdetermined equation in the form of ax=xb can be constructed and solved, and a coordinate conversion relation between the depth camera and the mechanical arm end effector is obtained.
S3, acquiring a three-dimensional model of the object to be grabbed, matching the three-dimensional model with the point cloud acquired by the depth camera, and solving the gesture of the object to be grabbed in the actual scene.
And acquiring an object in the shooting scene.
The bounding box is built in the form of a three-dimensional rotation, ensuring that objects are within the bounding box, and subsequent algorithms focus only on these point clouds within the bounding box.
And matching the three-dimensional model of the object to be grabbed with the point cloud acquired by the depth camera by using a plane-to-point iterative nearest point algorithm, and solving the gesture of the object to be grabbed in an actual scene. The optimization formula for a single iteration is as follows:
wherein,,
and x= [ r ]
T ,t
T ]
T ,r∈R
3 Is the rotation vector of the mechanical clamping jaw gesture, t epsilon R
3 Is a translation vector of the mechanical clamping jaw gesture. q
i For points of the upper surface of the three-dimensional model of the object to be grasped, p
i For capturing a point cloud in a scene, +.>
And m is the number of corresponding point pairs, which is the normal vector of the point cloud on the surface of the three-dimensional model of the object to be grabbed.
The above formula can be solved using least squares method, each time x= (a) T A) -1 A T b. And repeating the iteration for a plurality of times, and finally converging to a stable result.
S4, acquiring a grabbing gesture of the mechanical arm for avoiding collision according to the signed distance field model and the point cloud acquired by the depth camera.
And grabbing the attitude estimation. And (3) optimizing a color image and a depth image acquired by using the signed distance field of the mechanical clamping jaw obtained in the step (S1) and the depth image acquired by the depth camera to obtain a robust and collision-avoiding mechanical arm grabbing gesture:
and (3) solving an optimal grabbing gesture by utilizing the mechanical clamping jaw collision model in the step (S1), the object nearby point cloud acquired by the depth camera and the point cloud on the object model to be grabbed after the object gesture transformation is applied. The optimization formula for a single iteration is as follows:
wherein x= [ r ]
T ,t
T ]
T 。
Respectively consists of three parts
The three parts comprise a collision avoidance part, a matching part and a normal vector fitting part.
The collision avoidance portion is:
wherein f
ci K points and g are points in the point cloud on the inner side of the mechanical clamping jaw, wherein the points collide with a scene
ci For the mechanical jaw collision model (signed distance field) at point f
ci A gradient is provided at the point of the gradient,
is f
ci Is the normal vector of the mechanical jaw surface. And (3) obtaining the result of tri-linear interpolation of the coordinates of the object point cloud in the signed distance field of the mechanical clamping jaw, and obtaining which object points collide with the mechanical clamping jaw.
The matching part is as follows:
wherein f
i For the point inside the mechanical jaw nearer to the object, there are a total of l, p
fi Is the point on the corresponding object that is nearer to the inside of the jaws.
Is f
i Is the normal vector of the mechanical jaw surface.
The normal vector fitting part is as follows:
wherein,,
for the object surface p
fi Normal vector at (a).
The above formula can be solved using least squares method, each time
Repeated iteration is carried out for a plurality of times, so that the robot arm grabbing gesture which is robust and avoids collision can be finally converged.
S5, establishing a collision function according to the signed distance field model, and designing an obstacle avoidance kinematics planning solver according to the collision function and the grabbing gesture of the mechanical arm to solve a grabbing path so as to bypass a scene obstacle to grab an object.
Wherein, step S5 specifically includes steps S51-S55:
s51, acquiring an overall kinematic model of the mechanical arm and performing collision modeling in the step S1.
S52, a mechanical arm kinematic model is utilized to establish a forward kinematic function and a reverse kinematic function.
S53, establishing a collision judgment function of the mechanical arm by utilizing a forward kinematics function and collision modeling.
S54, inputting the grabbing gesture finally obtained by optimization in the step S4 by utilizing a reverse kinematics function, and obtaining the joint gesture of the target mechanical arm
S55, performing obstacle avoidance path planning in a joint gesture space by using an improved rapid expansion random tree algorithm, driving the mechanical arm to bypass other collision objects in the scene, and reaching the joint gesture of the target mechanical arm to grasp.
In summary, the embodiment provides a three-dimensional vision-based obstacle avoidance mechanical arm grabbing method, which uses a signed distance field with an internal structure removed to perform collision modeling, so that compared with the traditional collision modeling such as convex hull segmentation, the accuracy is greatly improved, and compared with the convex polygon segmentation method, the collision judgment speed is also improved; the information such as gradient of a signed distance field and point cloud matched with an object can be directly optimized to obtain a robust mechanical clamping jaw grabbing gesture capable of avoiding collision, so that manual teaching is omitted, grabbing stability is improved, and automation level of a production line is also improved.
The embodiment also provides an obstacle avoidance mechanical arm grabbing system, which comprises:
the model building module is used for building a signed distance field model of the mechanical arm and the mechanical clamping jaw mounted at the tail end of the mechanical arm;
the hand-eye calibration module is used for acquiring a color image and a depth image of the depth camera and the gesture of the mechanical clamping jaw, and calibrating the space conversion relation between the camera and the mechanical arm base;
the point cloud matching module is used for acquiring a three-dimensional model of the object to be grabbed, matching the three-dimensional model with the point cloud acquired by the depth camera, and solving the gesture of the object to be grabbed in an actual scene;
the gesture acquisition module is used for acquiring a robot arm grabbing gesture avoiding collision according to the signed distance field model and the point cloud acquired by the depth camera;
and the path planning module is used for establishing a collision function according to the signed distance field model, designing an obstacle avoidance kinematics planning solver according to the collision function and the grabbing gesture of the mechanical arm, and solving a grabbing path so as to bypass a scene obstacle to grab an object.
The obstacle avoidance mechanical arm grabbing system provided by the embodiment of the invention can be used for executing the method for grabbing the obstacle avoidance mechanical arm, and the steps can be implemented by any combination of the embodiments of the method, so that the method has corresponding functions and beneficial effects.
The embodiment also provides an obstacle avoidance mechanical arm grabbing device, which comprises:
at least one processor;
at least one memory for storing at least one program;
the at least one program, when executed by the at least one processor, causes the at least one processor to implement the method illustrated in fig. 1.
The obstacle avoidance mechanical arm grabbing device provided by the embodiment of the invention can be used for executing the method for grabbing the obstacle avoidance mechanical arm, and any combination implementation steps of the method embodiment can be executed, so that the method has corresponding functions and beneficial effects.
The present application also discloses a computer program product or a computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions may be read from a computer-readable storage medium by a processor of a computer device, and executed by the processor, to cause the computer device to perform the method shown in fig. 1.
The embodiment also provides a storage medium which stores instructions or programs for executing the method for grabbing the obstacle avoidance mechanical arm, which is provided by the embodiment of the method, and when the instructions or programs are run, the steps can be implemented by any combination of the embodiment of the executable method, so that the method has corresponding functions and beneficial effects.
In some alternative embodiments, the functions/acts noted in the block diagrams may occur out of the order noted in the operational illustrations. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved. Furthermore, the embodiments presented and described in the flowcharts of the present invention are provided by way of example in order to provide a more thorough understanding of the technology. The disclosed methods are not limited to the operations and logic flows presented herein. Alternative embodiments are contemplated in which the order of various operations is changed, and in which sub-operations described as part of a larger operation are performed independently.
Furthermore, while the invention is described in the context of functional modules, it should be appreciated that, unless otherwise indicated, one or more of the described functions and/or features may be integrated in a single physical device and/or software module or one or more functions and/or features may be implemented in separate physical devices or software modules. It will also be appreciated that a detailed discussion of the actual implementation of each module is not necessary to an understanding of the present invention. Rather, the actual implementation of the various functional modules in the apparatus disclosed herein will be apparent to those skilled in the art from consideration of their attributes, functions and internal relationships. Accordingly, one of ordinary skill in the art can implement the invention as set forth in the claims without undue experimentation. It is also to be understood that the specific concepts disclosed are merely illustrative and are not intended to be limiting upon the scope of the invention, which is to be defined in the appended claims and their full scope of equivalents.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
In the foregoing description of the present specification, reference has been made to the terms "one embodiment/example", "another embodiment/example", "certain embodiments/examples", and the like, means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiments or examples. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
While embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that: many changes, modifications, substitutions and variations may be made to the embodiments without departing from the spirit and principles of the invention, the scope of which is defined by the claims and their equivalents.
While the preferred embodiment of the present invention has been described in detail, the present invention is not limited to the above embodiments, and various equivalent modifications and substitutions can be made by those skilled in the art without departing from the spirit of the present invention, and these equivalent modifications and substitutions are intended to be included in the scope of the present invention as defined in the appended claims.