Mechanical arm intelligent sorting method and sorting system based on machine vision
Through machine vision technology and visual servo control, combined with depth cameras and target detection algorithms, intelligent sorting of robotic arms is realized, solving the flexibility and real-time response problems of traditional robotic arms in multi-category workpiece processing, and improving sorting efficiency. and accuracy, reducing labor costs and safety risks.
Patent Information
- Application Number
- CN202410989112.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-09-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional robotic arms lack flexibility and intelligent processing capabilities when handling multi-category workpieces, making it difficult to achieve efficient and accurate sorting. In particular, they have limited real-time response capabilities when the location of workpieces changes, leading to misidentification and grasping failures.
The robot arm intelligent sorting method based on machine vision is used to obtain environmental point cloud information through a depth camera. It combines the target detection algorithm and machine vision technology to establish a real-time three-dimensional environment model, predict the target position and attitude, and use visual servo control to realize the robot arm. Precise grab and release.
It achieves efficient and accurate object recognition and sorting, improves sorting efficiency and accuracy, reduces manpower dependence, and enhances production safety.
Smart Images

Figure CN118698910A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of object recognition and sorting, and in particular to an intelligent sorting system based on a robotic arm. Background Art
[0002] At present, robotic arms are widely used in the field of industrial sorting due to their high efficiency and low cost. How to achieve high-speed and high-precision mechanical motion for different application scenarios and task objectives is an important challenge. Traditional industrial robotic arms mainly use the point model of preset fixed-position workpieces to plan the motion trajectory. When the robotic arm needs to perform sorting tasks for multiple types of workpieces with changing positions, it needs to rebuild the complex point model, which lacks flexibility and intelligent processing capabilities.
[0003] In order to achieve efficient sorting of multiple categories of workpieces in non-fixed positions by the robot arm, intelligent and autonomous control is the focus of research. At present, computer vision and sensor technology are evolving towards human cognition. At the same time, with the development of machine learning and deep learning technology, they are applied to the field of robot arm sorting, such as using a two-dimensional camera to capture the plane image of the workpiece, and using image processing technology to identify the shape, color and logo of the workpiece. This approach can be used for simple sorting tasks to identify and locate the workpiece in the plane, but the depth information of the workpiece cannot be obtained, causing the robot arm to misestimate the distance. When processing workpieces of different shapes, sizes, and materials, the adaptability is still insufficient, and it is easy to misidentify and grasp failure. At the same time, when the position of the workpiece changes, the real-time response capability of the robot arm is limited, which affects the sorting efficiency. Summary of the invention
[0004] In response to the above technical problems, the present invention provides a machine vision-based robotic arm intelligent sorting method and sorting system, which achieves efficient and accurate target recognition and object sorting by combining machine vision technology and robotic arm operation, so as to improve sorting efficiency and sorting accuracy, reduce dependence on manpower, save labor costs, and improve production safety.
[0005] The present invention provides a robot arm intelligent sorting method based on machine vision, and the adopted technical solution comprises the following steps:
[0006] Step 1: Obtain environmental point cloud information through a depth camera and build a real-time three-dimensional environment model;
[0007] Step 2: Use the target detection algorithm to detect the three-dimensional environment model, calibrate the specified target, and obtain the position and size of the specified target;
[0008] Step 3: Establish a prediction model for the specified target location, predict the target's future location by integrating machine vision and position calculation, and lock the target;
[0009] Step 4: Establish a robot arm motion model, solve the rotation angle of each joint of the robot arm according to the position of the locked target, and select the delay time to obtain the grasping time and posture of the robot arm;
[0010] Step 5: Use visual servo control methods to control and guide the robotic arm to complete the target gripping and releasing tasks.
[0011] In step 2, the YOLOv8 model is used to detect the target. The specific steps are as follows:
[0012] First, image segmentation: According to the YOLOv8 model, the pixels of the input target environment image are set to 640×640, and then the image is divided into 8×8 cells of equal size. Two prediction boxes are set for each cell. The position of the prediction box is determined according to the center point of the cell. The size of the prediction box is the size of the outer border of all cells of the target. Each prediction box has four corner coordinates and one confidence, a total of five parameters. The number of categories of the predicted image is set to N, and the final prediction result is a vector with a length of 8×8×(2×5+N).
[0013] Then, design the network model: select the GoogLeNet network model, the convolution layer is used for visual element feature extraction, and the fully connected layer is used for target category probability and coordinate prediction; replace the convolution operation of the Inception module in the GoogleNet network model, use 1x1 convolution to reduce the channel dimension, and then use 3x3 convolution to extract spatial features, and set 24 convolution layers, 4 maximum pooling layers and 2 fully connected layers in the GoogleNet network model;
[0014] Next, a loss function is designed, and the coordinate prediction error, confidence loss, and prediction category error are added together to obtain the loss function. The coordinate prediction error is the coordinate difference between the predicted box and the true target. The confidence loss uses the binary cross entropy loss to calculate the difference between the true confidence and the predicted confidence. The prediction category error uses the multivariate cross entropy loss to calculate the difference between the predicted category and the true category.
[0015] Finally, the GoogleNet network model is trained and the loss function is optimized to improve the performance of the GoogleNet network model in target detection. In the loss function, the coordinate prediction error is divided into the prediction box center coordinate error Loss center And the size error Loss of the predicted box size , the confidence loss is Loss when the cell contains the target obj , Loss without target no_obj , the prediction category error is Loss class , the optimized loss function is as follows:
[0016] Loss=Loss center +Loss size +Loss obj +Loss no_obj +Loss class
[0017]
[0018]
[0019] Among them, x i ,y i 、w i 、h i They are the x-coordinate, y-coordinate, width and height of the center point of the prediction box, respectively. is the x-coordinate, y-coordinate, width and height of the center point of the real target bounding box, It means that the value is 1 when the i-th detection box contains the j-th target and 0 when it does not. Indicates that when the i-th detection box contains any target, it takes 1, and when it does not, it takes 0. i is the confidence of the prediction, is the true confidence, p i (n) is the predicted class probability, is the true class probability, λ coord and λ no_obj are the balance factors, which are 5 and 0.5 respectively after optimization;
[0020] In step 3, the target position prediction model adopts a statistical model based on the Singer model, and the Singer model sets the target acceleration as Gaussian white noise w c (t), w c (t) is a zero-mean random noise that follows a normal distribution N(0,σ 2 ), let X(t) be the target motion path, then the target acceleration is the second-order derivative of X(t) but:
[0021] Based on the Singer model, the average value of the target acceleration is set to a non-zero value and will As the predicted value of the current target acceleration And the target acceleration is still affected by w c (t) Impact, and target acceleration associated;
[0022] For the target position prediction model, Kalman filtering is used to predict the target state;
[0023] In step 4, the robotic arm is a six-degree-of-freedom robotic arm; for the robotic arm motion model, a world coordinate system (a) and a base coordinate system (b) are established; the robotic arm motion model uses the DH method to establish a joint coordinate system for the six joints of the robotic arm; the coordinate axis of the base coordinate system is denoted as x 0 ,y 0 、z 0 ;x i 、z i are the x-axis and z-axis of the joint coordinate system of the i-th joint respectively; the y-axis of each joint coordinate system is obtained by rotating the x-axis by 90° along the right-hand rule direction, and the z-axis is the direction in which the thumb points according to the right-hand rule;
[0024] Taking the base coordinate system as the reference, determine the coordinate axes of each joint coordinate system. The specific process is as follows:
[0025] According to the rotation direction of the first joint, the right-hand rule can be used to obtain z 1 Direction, z 0 With z 1 There is a unique common perpendicular line between them and the direction of the common perpendicular line is x 1 Direction: Same as the first joint, z at the second joint 2 According to the rotation direction of the second joint, use the right-hand rule to determine, x 2 For z 1 、z 2 public vertical line;
[0026] Same as the 1st and 2nd joints, the 3rd, 4th and 5th joints 3 、z 4 、z 5 can be determined by the rotation direction of the corresponding joint. The sixth joint is fixed on the end effector, so z 6 Determined by the movement direction of the end effector; x 3 、x 4 、x 5 and x 6 Respectively by z 2 and z 3 、z 3 and z 4 、z 4 With z 5 、z 5 With z 6 Determined by the direction of the common perpendicular line between them;
[0027] The transformation matrix T between two adjacent joints is obtained by multiplying the four motion matrices. (n+1)n :
[0028] T (n+1)n =A n+1 =Rot(z,θ n+1 )T(0,0,dn+1 )T(a n+1 ,0,0)Rot(x,α n+1 )
[0029] The four motion matrices are Rot(z,θ n+1 ), T(0,0,d n+1 ), T(a n+1 ,0,0),Rot(z,θ n+1 );A n+1 is the transformation matrix of the n+1th joint; Rot(z,θ n+1 ) represents the rotation θ around the z-axis n+1 degree, T(0,0,d n+1 ) represents the direction along the vector (0,0,d n+1 ) T Do a translation transformation, T(a n+1 ,0,0) means along the vector (a n+1 ,0,0) T Do translation transformation, Rot(x,α n+1 ) represents a rotation α around the x-axis n+1 degrees; θ is the rotation angle of the joint, d is the offset along the Z axis, a is the length of the connecting rod between the two joints, and α represents the connecting rod torsion angle; n+1 is the number of joints, and the value of n+1 is 1, 2, 3, 4, 5, 6;
[0030] The transformation matrix T of two non-adjacent joint coordinate systems is obtained through multiple matrix transformations mn :
[0031] T mn =A n+1 A n+2 …A m-1 A m (m≥n+1), m and n+1 are any two non-adjacent joints;
[0032] T 60 Represents the transformation matrix from the base coordinate system to the sixth joint coordinate system, and defines the transformation formula T from the base coordinate system to the sixth joint coordinate system 60 =A 1 A 2 A 3 A 4 A 5 A 6 is the positive kinematics equation, and the positive solution of the six-degree-of-freedom robot kinematics model is obtained through the positive kinematics equation:
[0033]
[0034] Where:
[0035]
[0036] turn_x represents the X-direction vector of the end effector of the robot arm, turn_y represents the Y-direction vector of the end effector of the robot arm, turn_z represents the Z-direction vector of the end effector of the robot arm, and p represents the position of the end effector in the base coordinate system;
[0037] After the robotic arm motion model is established, when the target is fixed, in order to control the robotic arm to reach the desired position and posture, the inverse kinematics equations are obtained by inverting the matrices of the forward kinematics equations, and the inverse kinematics equations are solved to obtain the motion values of each joint. The inverse kinematics equations include the following inverse kinematics equations:
[0038] Inverse kinematics equations In the equation, both sides are matrix operations, and the calculation results on both sides are matrices. Assume that the elements in the 3rd row and 4th column of the matrix on the left side of the equal sign are equal to the elements in the 3rd row and 4th column of the matrix on the right side of the equal sign, and we get:
[0039]
[0040] In the formula, θ 1 is a positive number; if θ 1 When θ is negative, 1 The value of is θ 1 ′,θ 1 ′=θ 1 +180°;
[0041] Assume the inverse kinematics equation In the equation, the elements in the first row and second column of the matrix on both sides of the equal sign are equal, and the elements in the second row and fourth column of the matrix on both sides of the equal sign are equal, and the equation system is as follows:
[0042]
[0043] Add the squares of both sides of the two equations to get the value of the third joint angle as follows:
[0044]
[0045] in,
[0046] Simplifying the equations yields the new system:
[0047]
[0048] Assume the inverse kinematics equation In the equation, the elements in the 1st row and 4th column of the matrix on both sides of the equal sign are equal, and the elements in the 2nd row and 4th column of the matrix on both sides of the equal sign are equal. The obtained system of equations and the obtained θ 2as follows:
[0049]
[0050] Assume the inverse kinematics equation In the equation, the elements in the first row and third column of the matrix on both sides of the equal sign are equal, and the elements in the second row and third column of the matrix on both sides of the equal sign are equal. The result is as follows:
[0051]
[0052] The obtained θ 4 for:
[0053]
[0054] Assume the inverse kinematics equation In the equation, the elements in the first row and third column of the matrix on both sides of the equal sign are equal, and the elements in the second row and third column of the matrix on both sides of the equal sign are equal, so we get:
[0055]
[0056] Find θ 5 Solution:
[0057] Assume the inverse kinematics equation In the equation, the elements in the 2nd row and 1st column of the matrix on both sides of the equal sign are equal, and the elements in the 2nd row and 2nd column of the matrix on both sides of the equal sign are equal, so we get:
[0058]
[0059] Find θ 6 The solution is:
[0060] From the obtained inverse kinematics equation, we know that we only need to know the expected position and posture of the robot arm to solve the inverse kinematics equation of the robot arm to find out the movement amount of each joint, and then control the movement of the joint to move the robot arm to the expected position and posture.
[0061] In step 5, the position-based visual servo grasping system performs robot arm motion trajectory planning according to the motion state of the mobile target, including joint space trajectory planning and Cartesian space trajectory planning;
[0062] The joint space trajectory planning adopts the quintic interpolation method, and the motion angle is obtained according to the quintic interpolation formula:
[0063] θ(t)=Q 0 +Q 1 t+Q 2 t 2 +Q3 t 3 +Q 4 t 4 +Q 5 t 5
[0064] Among them, Q 0 , Q 1 , Q 2 , Q 3 , Q 4 , Q 5 is the correlation coefficient, t is the running time of the robot, and the angular velocity at the joint of the robot is obtained by taking the first-order derivative of the joint rotation angle θ(t):
[0065] θ′(t)=Q 1 +2Q 2 t+3Q 3 t 2 +4Q 4 t 3 +5Q 5 t 4
[0066] The second-order derivative of the joint rotation angle θ(t) is used to obtain the angular acceleration formula at the joint of the robotic arm:
[0067] θ″(t)=2Q 2 +6Q 3 t+12Q 4 t 2 +20Q 5 t 3
[0068] The starting position of the robot joint θ 0 and the joint end position θ f Given the conditions, let t 0 is the starting time of the robot arm operation, t 0 =0,t f is the final moment of the robot's operation. Substitute the velocity and acceleration formulas into the starting position velocity θ′(t 0 ) and the final velocity θ′(t f ) is 0, we get:
[0069]
[0070] Find Q 0 , Q 1 , Q 2 , Q 3 , Q 4 , Q 5 Six unknown quantities, Q 0 , Q 1 , Q2 , Q 3 , Q 4 , Q 5 Substitute the motion angle formula into θ(t) = Q 0 +Q 1 t+Q 2 t 2 +Q 3 t 3 +Q 4 t 4 +Q 5 t 5 In the above equation, the motion angle θ(t) of each joint of the robot arm during operation is obtained;
[0071] Q 1 , Q 2 , Q 3 , Q 4 , Q 5 Substitute the angular velocity formula into θ′(t) = Q 1 +2Q 2 t+3Q 3 t 2 +4Q 4 t 3 +5Q 5 t 4 In the equation, the angular velocity θ′(t) of each joint of the robot arm during operation is obtained;
[0072] Q 2 , Q 3 , Q 4 , Q 5 Substitute the angular acceleration formula into θ″(t)=2Q 2 +6Q 3 t+12Q 4 t 2 +20Q 5 t 3 In the above equation, the angular acceleration θ″(t) of each joint of the robot arm during operation is obtained.
[0073] The present invention also provides a sorting system formed by using the above sorting method. The sorting system architecture is as follows Figure 1 As shown, it includes a camera, a controller, a robotic arm and a target. The camera is installed above the working area of the robotic arm, collects images of the sorting area in real time, transmits the collected data to the controller in real time, and the controller issues instructions to control the movement of the robotic arm to grab the target.
[0074] The beneficial effects of the present invention are as follows:
[0075] The present invention integrates real-time image recognition and visual servo control, high-precision robot arm motion algorithm and DH parameter method standardized modeling technology, which can quickly respond to and accurately track the target position and realize flexible and changeable sorting tasks;
[0076] The present invention uses a closed-loop control mechanism to continuously optimize and adjust the system, thereby ensuring the accuracy and stability of the operation;
[0077] The present invention not only significantly improves sorting efficiency and accuracy, but also reduces labor costs, enhances workplace safety, and brings intelligent and efficient production solutions to enterprises.
[0078] The present invention can perceive the three-dimensional structure of the surrounding environment and the distance information of objects in real time through real-time data collection of the depth camera, and can capture the depth information of the objects. Combined with the RGB image, an accurate three-dimensional point cloud model can be generated to facilitate the next step of image processing;
[0079] The present invention can accurately control the timing and posture of the robot arm's grasping by selecting a reasonable delay time, ensuring that the robot arm operates at the optimal time, thereby improving the grasping success rate and efficiency; combining the robot arm motion model and the solution of the inverse kinematics equation, it can accurately calculate the motion values of each joint of the robot arm, so that the robot arm can reach the desired posture and achieve high-precision operation; precise motion control can reduce vibration and jitter during the operation of the robot arm, and enhance the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] Figure 1 This is a schematic diagram of the composition of the robotic arm intelligent sorting system based on machine vision;
[0081] Figure 2 This is the workflow diagram of the robot arm intelligent sorting system based on machine vision;
[0082] Figure 3 It is the principle of binocular imaging of the camera;
[0083] Figure 4 This is a schematic diagram of the YOLOv8 algorithm;
[0084] Figure 4 In the figure, Figure A is the segmentation of the image, Figure B is the predicted box of the detected target allocation, and Figure C is the image detection result;
[0085] Figure 5 Schematic diagram of the coordinate system constructed for the DH modeling method;
[0086] Where: L is the left camera, R is the right camera, P is the position of the object in the world coordinate system (x, y, z), P l and P rRespectively represent the imaging position of the object in the left camera and right camera coordinate system (x l ,y l ) and (x r ,y r ); DETAILED DESCRIPTION
[0087] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0088] This embodiment provides a robot arm intelligent sorting system based on machine vision. The system architecture is as follows: Figure 1 As shown in the figure, it includes a camera, a controller, a robotic arm and a target. The camera is installed above the working area of the robotic arm, collects images of the sorting area in real time, transmits the collected data to the controller in real time, and the controller issues instructions to control the movement of the robotic arm to grab the target. The overall workflow of the system is shown in the figure Figure 2 As shown:
[0089] The technical solution adopted by the present invention comprises the following steps:
[0090] Step 1: Obtain environmental point cloud information through a depth camera and build a real-time three-dimensional environment model;
[0091] Step 2: Use the target detection algorithm to detect the three-dimensional environment model, calibrate the specified target, and obtain the position and size of the specified target;
[0092] Step 3: Establish a prediction model for the specified target position, predict the target's future position and posture through the fusion of machine vision and position calculation, and lock the target;
[0093] Step 4: Establish a robot arm motion model, solve the rotation angle of each joint of the robot arm according to the position and posture of the locked target, and select a reasonable delay time to obtain the grasping time and posture of the robot arm;
[0094] Step 5: Use visual servo control methods to control and guide the robotic arm to complete the target gripping and releasing tasks.
[0095] In step 1, the depth camera uses binocular vision imaging principle:
[0096] The depth camera contains two cameras, such as Figure 3 As shown in the figure, the left camera L and the right camera R are used to capture the plane image of the target. The main optical axes (Z axes) of the left camera L and the right camera R are parallel to each other, and the distance between the main optical axes is b. The straight line connecting the two camera lenses is used as the reference line. The x-axes of the coordinate systems of the two cameras are specified to be parallel to the reference line. Then the position image point P of the same target in the left camera coordinate system is l is (x l ′,y l′), the position image point P in the right camera coordinate system r is (x r ′,y r ′); establish a new coordinate system with the midpoint of the reference line as the origin - the camera coordinate system, then the three-dimensional position of the target in the camera coordinate system (x, y, z), the position of the target on the camera image plane can be converted to the position of the target in the camera coordinate system through the geometric formula, the geometric formula is:
[0097]
[0098] Where f is the focal length, that is, the distance from the center of the lens to the image plane; x l ′-x r ′ is the horizontal disparity; y l ′-y r ′ is the vertical disparity; x l ′+x r ′ is the horizontal coordinate and is used to calculate the horizontal horizontal position of the target point in the left and right camera coordinate systems; l ′+y r ′ is the vertical coordinate and is used to calculate the average vertical position of the target point in the left and right camera coordinate systems;
[0099] In stereo vision, the position of the image point (x l ′,y l ′) and position image point (x r ′,y r ′) is a pair of corresponding image points, which are the imaging positions of the same target point in the left and right camera images. The three-dimensional position of the target in the camera coordinate system is obtained through the corresponding image points, realizing the reconstruction from the two-dimensional image to the three-dimensional space.
[0100] In step 2, the specific steps of the YOLOv8 model to detect the target are as follows:
[0101] First, image segmentation: According to the YOLOv8 model, the pixels of the input target environment image are set to 640×640, and then the image is divided into 8×8 equal-sized cells, such as Figure 4 As shown in the figure, the YOLOv8 model sets two prediction boxes for each cell and customizes the size of the prediction box according to the center point of the cell; each prediction box has four corner coordinates and one confidence, a total of 5 parameters; the number of categories of the predicted image is set to N, and the final prediction result is a vector of length 8×8×(2×5+N);
[0102] Then, design the network model: select the GoogLeNet network model, the convolution layer is used for visual element feature extraction, and the fully connected layer is used for target category probability and coordinate prediction; replace the convolution operation of the Inception module in the GoogleNet network model, use 1x1 convolution to reduce the channel dimension, and then use 3x3 convolution to extract spatial features, and set 24 convolution layers, 4 maximum pooling layers and 2 fully connected layers in the GoogleNet network model;
[0103] Next, a loss function is designed, and the coordinate prediction error, confidence loss, and prediction category error are added together to obtain the loss function. The coordinate prediction error is the coordinate difference between the predicted box and the true target. The confidence loss uses the binary cross entropy loss to calculate the difference between the true confidence and the predicted confidence. The prediction category error uses the multivariate cross entropy loss to calculate the difference between the predicted category and the true category.
[0104] Finally, the GoogleNet network model is trained and the loss function is optimized to improve the performance of the GoogleNet network model in target detection. In the optimized loss function, the coordinate prediction error is divided into the prediction box center coordinate error Loss center And the size error Loss of the predicted box size , the confidence loss is Loss when the cell contains the target obj , Loss without target no_obj , the prediction category error is Loss class , the optimized loss function is as follows:
[0105] Loss=Loss center +Loss size +Loss obj +Loss no_obj +Loss class
[0106]
[0107] Among them, x i ,y i 、w i 、h i They are the x-coordinate, y-coordinate, width and height of the center point of the prediction box respectively. are the center point x coordinate, center point y coordinate, width and height of the real target bounding box, It means that the value is 1 when the i-th detection box contains the j-th target and 0 when it does not. Indicates that when the i-th detection box contains any target, it takes 1, and when it does not, it takes 0. i is the confidence of the prediction, is the true confidence, p i (n) is the predicted class probability, is the true class probability, λ coord and λ no_obj are the balance factors, which are 5 and 0.5 respectively after optimization;
[0108] In step 3, the target position prediction model adopts a statistical model based on the Singer model, and the Singer model sets the target acceleration as Gaussian white noise w c (t), w c (t) is a zero-mean random noise that follows a normal distribution N(0,σ 2 ), let X(t) be the target motion path, then the target acceleration is the second-order derivative of X(t) but:
[0109] Based on the Singer model, the average value of the target acceleration is set to a non-zero value and will As the predicted value of the current target acceleration And the target acceleration is still affected by w c (t) Impact, and target acceleration associated;
[0110] For the target position prediction model, Kalman filtering is used to predict the target state;
[0111] In step 4, the robotic arm is a six-degree-of-freedom robotic arm; for the robotic arm motion model, a world coordinate system (a) and a base coordinate system (b) are established. The robotic arm motion model uses the DH method to establish a joint coordinate system for the six joints of the robotic arm, such as Figure 5 As shown; the coordinate axis of the base coordinate system is denoted by x 0 ,y 0 、z 0 ;x i 、z i are the x-axis and z-axis of the joint coordinate system of the i-th joint respectively; the y-axis of each joint coordinate system is obtained by rotating the x-axis 90° along the right-hand rule direction, and the z-axis is the direction in which the thumb points according to the right-hand rule. Figure 5 The semicircular arrows in the figure show the rotation direction of each joint, which is the rotation direction of the right-hand rule.
[0112] Taking the base coordinate system as the reference, determine the coordinate axes of each joint coordinate system. The specific process is as follows:
[0113] According to the rotation direction of the first joint, the right-hand rule can be used to obtain z 1 Direction, z 0 With z 1There is a unique common perpendicular line between them and the direction of the common perpendicular line is x 1 Direction. Same as the first joint, z at the second joint 2 According to the rotation direction of the second joint, use the right-hand rule to determine, x 2 For z 1 、z 2 public vertical line;
[0114] Same as the 1st and 2nd joints, the 3rd, 4th and 5th joints 3 、z 4 、z 5 can be determined by the rotation direction of the corresponding joint. The sixth joint is fixed on the end effector, so z 6 Determined by the movement direction of the end effector; x 3 、x 4 、x 5 and x 6 Respectively by z 2 and z 3 、z 3 and z 4 、z 4 With z 5 、z 5 With z 6 Determined by the direction of the common perpendicular line between them;
[0115] The parameters for modeling the robot arm are determined according to the order of the coordinate axis motion transformation of the joint coordinate system. The specific parameters are shown in Table 1.
[0116] Table 1 Robot arm modeling parameters
[0117]
[0118] Among them, θ is the rotation angle of the joint, d is the offset along the Z axis, a is the length of the connecting rod between the two joints, α represents the torsion angle of the connecting rod, the positive limit of the joint is the maximum limit of the rotation angle of the joint in the positive direction, and the negative limit of the joint is the minimum limit of the rotation angle of the joint in the negative direction;
[0119] The transformation matrix T between two adjacent joints is obtained by multiplying the four motion matrices. (n+1)n :
[0120] T (n+1)n =A n+1 =Rot(z,θ n+1 )T(0,0,d n+1 )T(a n+1 ,0,0)Rot(x,α n+1 )
[0121] The four motion matrices are Rot(z,θ n+1 ), T(0,0,dn+1 ), T(a n+1 ,0,0),Rot(z,θ n+1 );A n+1 is the transformation matrix of the n+1th joint; Rot(z,θ n+1 ) represents the rotation θ around the z-axis n+1 degree, T(0,0,d n+1 ) represents the direction along the vector (0,0,d n+1 ) T Do a translation transformation, T(a n+1 ,0,0) means along the vector (a n+1 ,0,0) T Do translation transformation, Rot(x,α n+1 ) represents a rotation α around the x-axis n+1 degree; n+1 is the number of joints, and the value of n+1 is 1, 2, 3, 4, 5, 6;
[0122] The transformation matrix T of two non-adjacent joint coordinate systems is obtained through multiple matrix transformations mn :
[0123] T mn =A n+1 A n+2 …A m-1 A m (m≥n+1), m and n+1 are any two non-adjacent joints;
[0124] Then T 60 It can represent the transformation matrix from the base coordinate system to the sixth joint coordinate system, and define the transformation formula T from the base coordinate system to the sixth joint coordinate system 60 =A 1 A 2 A 3 A 4 A 5 A 6 is the positive kinematics equation, and the positive solution of the six-degree-of-freedom robot kinematics model is obtained through the positive kinematics equation:
[0125]
[0126] Where:
[0127]
[0128] turn_x represents the X-direction vector of the end effector of the robot arm, turn_y represents the Y-direction vector of the end effector of the robot arm, turn_z represents the Z-direction vector of the end effector of the robot arm, and p represents the position of the end effector in the world coordinate system.
[0129] After the robotic arm motion model is established, when the target is fixed, in order to control the robotic arm to reach the desired position and posture, the inverse kinematics equations are obtained by inverting the matrices of the forward kinematics equations, and the inverse kinematics equations are solved to obtain the motion values of each joint. The inverse kinematics equations include the following inverse kinematics equations:
[0130] Inverse kinematics equations In the equation, both sides are matrix operations, and the calculation results on both sides are matrices. Assume that the elements in the 3rd row and 4th column of the matrix on the left side of the equal sign are equal to the elements in the 3rd row and 4th column of the matrix on the right side of the equal sign, and we get:
[0131]
[0132] In the formula, θ 1 is a positive number; if θ 1 When θ is negative, 1 The value of is θ 1 ′,θ 1 ′=θ 1 +180°;
[0133] Assume the inverse kinematics equation In the equation, the elements in the first row and second column of the matrix on both sides of the equal sign are equal, and the elements in the second row and fourth column of the matrix on both sides of the equal sign are equal, and the equation system is as follows:
[0134]
[0135] Add the squares of both sides of the two equations to get the value of the third joint angle as follows:
[0136]
[0137] in,
[0138] Simplifying the equations yields the new system:
[0139]
[0140] Assume the inverse kinematics equation In the equation, the elements in the 1st row and 4th column of the matrix on both sides of the equal sign are equal, and the elements in the 2nd row and 4th column of the matrix on both sides of the equal sign are equal. The obtained system of equations and the obtained θ 2 as follows:
[0141]
[0142] Assume the inverse kinematics equation In the equation, the elements in the first row and third column of the matrix on both sides of the equal sign are equal, and the elements in the second row and third column of the matrix on both sides of the equal sign are equal. The result is as follows:
[0143]
[0144] The obtained θ 4 for:
[0145]
[0146] Assume the inverse kinematics equation In the equation, the elements in the first row and third column of the matrix on both sides of the equal sign are equal, and the elements in the second row and third column of the matrix on both sides of the equal sign are equal, so we get:
[0147]
[0148] Find θ 5 Solution:
[0149] Assume the inverse kinematics equation In the equation, the elements in the 2nd row and 1st column of the matrix on both sides of the equal sign are equal, and the elements in the 2nd row and 2nd column of the matrix on both sides of the equal sign are equal, so we get:
[0150]
[0151] Find θ 6 The solution is:
[0152] From the obtained inverse kinematics equation, it can be known that only the expected posture of the robot arm is needed to solve the inverse kinematics equation of the robot arm to find the movement amount of each joint, and then the robot arm can be moved to the expected posture by controlling the movement amount of the joint.
[0153] In step 5, the position-based visual servo grasping system performs robot arm motion trajectory planning according to the motion state of the mobile target, including joint space trajectory planning and Cartesian space trajectory planning;
[0154] The joint space trajectory planning adopts the quintic interpolation method, and the motion angle is obtained according to the quintic interpolation formula:
[0155] θ(t)=Q 0 +Q 1 t+Q 2 t 2 +Q 3 t 3 +Q 4 t 4 +Q 5 t 5
[0156] Among them, Q 0 , Q 1 , Q2 , Q 3 , Q 4 , Q 5 is the correlation coefficient, t is the running time of the robot, and the angular velocity at the joint of the robot is obtained by taking the first-order derivative of the joint rotation angle θ(t):
[0157] θ′(t)=Q 1 +2Q 2 t+3Q 3 t 2 +4Q 4 t 3 +5Q 5 t 4
[0158] The second-order derivative of the joint rotation angle θ(t) is used to obtain the angular acceleration formula at the joint of the robotic arm:
[0159] θ″(t)=2Q 2 +6Q 3 t+12Q 4 t 2 +20Q 5 t 3
[0160] The starting position of the robot joint θ 0 and the joint end position θ f Given the conditions, let t 0 is the starting time of the robot arm operation, t 0 =0,t f is the final moment of the robot's operation. Substitute the velocity and acceleration formulas into the starting position velocity θ′(t 0 ) and the final velocity θ′(t f ) is 0, we get:
[0161]
[0162] Find Q 0 , Q 1 , Q 2 , Q 3 , Q 4 , Q 5 Six unknown quantities, Q 0 , Q 1 , Q 2 , Q 3 , Q 4 , Q 5 Substitute the motion angle formula into θ(t) = Q 0 +Q 1 t+Q 2 t 2 +Q 3 t3 +Q 4 t 4 +Q 5 t 5 In the above equation, the motion angle θ(t) of each joint of the robot arm during operation is obtained;
[0163] Q 1 , Q 2 , Q 3 , Q 4 , Q 5 Substitute the angular velocity formula into θ′(t) = Q 1 +2Q 2 t+3Q 3 t 2 +4Q 4 t 3 +5Q 5 t 4 In the equation, the angular velocity θ′(t) of each joint of the robot arm during operation is obtained;
[0164] Q 2 , Q 3 , Q 4 , Q 5 Substitute the angular acceleration formula into θ″(t)=2Q 2 +6Q 3 t+12Q 4 t 2 +20Q 5 t 3 In the above equation, the angular acceleration θ″(t) of each joint of the robot arm during operation is obtained.
[0165] The Cartesian space trajectory planning is directly defined in the task space in the form of Cartesian coordinates. The basic principle is: combining the known target geometry model and the camera model to estimate the target pose in the three-dimensional Cartesian coordinate system, and then the control system performs trajectory planning and control quantity calculation based on the current pose of the robot arm and the estimated target pose differential information.
[0166] The present invention also provides a sorting system formed by using the above sorting method. The sorting system architecture is as follows Figure 1 As shown, it includes a camera, a controller, a robotic arm and a target. The camera is installed above the working area of the robotic arm, collects images of the sorting area in real time, transmits the collected data to the controller in real time, and the controller issues instructions to control the movement of the robotic arm to grab the target.
Claims
1. A robot arm intelligent sorting method based on machine vision, characterized by the following steps: Step 1: Obtain environmental point cloud information through a depth camera and build a real-time three-dimensional environment model; Step 2: Use the target detection algorithm to detect the three-dimensional environment model, calibrate the specified target, and obtain the position and size of the specified target; Step 3: Establish a prediction model for the specified target position, predict the target's future position and posture through the fusion of machine vision and position calculation, and lock the target; Step 4: Establish a robot arm motion model, solve the rotation angle of each joint of the robot arm according to the position and posture of the locked target, and select the delay time to obtain the grasping time and posture of the robot arm; Step five: Use visual servo control methods to control and guide the robotic arm to complete the target gripping and releasing tasks.
2. According to claim 1, a robot arm intelligent sorting method based on machine vision is characterized in that: In step 2, the YOLOv8 model is used to detect the target. The specific steps are as follows: First, image segmentation: According to the YOLOv8 model, the pixels of the input target environment image are set to 640×640, and then the image is divided into 8×8 cells of equal size. Two prediction boxes are set for each cell. The position of the prediction box is determined according to the center point of the cell. The size of the prediction box is the size of the outer border of all cells of the target. Each prediction box has four corner coordinates and one confidence, a total of five parameters. The number of categories of the predicted image is set to N, and the final prediction result is a vector with a length of 8×8×(2×5+N). Then, design the network model: select the GoogLeNet network model, the convolution layer is used for visual element feature extraction, and the fully connected layer is used for target category probability and coordinate prediction; replace the convolution operation of the Inception module in the GoogleNet network model, use 1x1 convolution to reduce the channel dimension, and then use 3x3 convolution to extract spatial features, and set 24 convolution layers, 4 maximum pooling layers and 2 fully connected layers in the GoogleNet network model; Next, a loss function is designed, and the coordinate prediction error, confidence loss, and prediction category error are added together to obtain the loss function. The coordinate prediction error is the coordinate difference between the predicted box and the true target. The confidence loss uses the binary cross entropy loss to calculate the difference between the true confidence and the predicted confidence. The prediction category error uses the multivariate cross entropy loss to calculate the difference between the predicted category and the true category. Finally, the GoogleNet network model is trained and the loss function is optimized to improve the performance of the GoogleNet network model in target detection. In the loss function, the coordinate prediction error is divided into the prediction box center coordinate error Loss center And the size error Loss of the predicted box size , the confidence loss is Loss when the cell contains the target obj , Loss without target no_obj , the prediction category error is Loss class , the optimized loss function is as follows: Loss=Loss center +Loss size +Loss obj +Loss no_obj +Loss class Among them, x i ,y i 、w i 、h i They are the x-coordinate, y-coordinate, width and height of the center point of the prediction box, respectively. is the x-coordinate, y-coordinate, width and height of the center point of the real target bounding box, It means that the value is 1 when the i-th detection box contains the j-th target and 0 when it does not. Indicates that when the i-th detection box contains any target, it takes 1, and when it does not, it takes 0. i is the confidence of the prediction, is the true confidence, p i (n) is the predicted class probability, is the true class probability, λ coord and λ no_obj are the balancing factors, which are 5 and 0.5 respectively after optimization.
3. The method for intelligent sorting by a robotic arm based on machine vision according to claim 1, characterized in that: In step 3, the target position prediction model adopts a statistical model based on the Singer model, and the Singer model sets the target acceleration as Gaussian white noise w c (t), w c (t) is a zero-mean random noise that follows a normal distribution N(0,σ 2 ), let X(t) be the target motion path, then the target acceleration is the second-order derivative of X(t) but: Based on the Singer model, the average value of the target acceleration is set to a non-zero value and will As the predicted value of the current target acceleration And the target acceleration is still affected by w c (t) Impact, and target acceleration associated; For the target position prediction model, an extended Kalman filter is used to predict the target state.
4. The method for intelligent sorting by a robotic arm based on machine vision according to claim 1, characterized in that: In the step 4, the robotic arm is a six-degree-of-freedom robotic arm; for the robotic arm motion model, a world coordinate system (a) and a base coordinate system (b) are established; the robotic arm motion model uses the DH method to establish a joint coordinate system for the six joints of the robotic arm; the coordinate axes of the base coordinate system are recorded as x0, y0, z0; x i 、z i are the x-axis and z-axis of the joint coordinate system of the i-th joint respectively; the y-axis of each joint coordinate system is obtained by rotating the x-axis by 90° along the right-hand rule direction, and the z-axis is the direction in which the thumb points according to the right-hand rule; Taking the base coordinate system as the reference, determine the coordinate axes of each joint coordinate system. The specific process is as follows: According to the rotation direction of the first joint, the right-hand rule can be used to obtain the direction of z1. There is a unique common perpendicular line between z0 and z1, and the direction of the common perpendicular line is the direction of x1. Similar to the first joint, z2 at the second joint is determined according to the rotation direction of the second joint using the right-hand rule. x2 is the common perpendicular line between z1 and z2. As with the first and second joints, z3, z4, and z5 of the third, fourth, and fifth joints can be determined by the rotation direction of the corresponding joints. The sixth joint is fixed on the end effector, so z6 is determined by the movement direction of the end effector; x3, x4, x5, and x6 are determined by the directions of the common perpendiculars between z2 and z3, z3 and z4, z4 and z5, and z5 and z6, respectively; The transformation matrix T between two adjacent joints is obtained by multiplying the four motion matrices. (n+1)n : T (n+1)n =A n+1 =Rot(z,θ n+1 )T(0,0,d n+1 )T(a n+1 ,0,0)Rot(x,α n+1 ) The four motion matrices are Rot(z,θ n+1 ), T(0,0,d n+1 ), T(a n+1 ,0,0),Rot(z,θ n+1 );A n+1 is the transformation matrix of the n+1th joint; Rot(z,θ n+1 ) represents the rotation θ around the z-axis n+1 degree, T(0,0,d n+1 ) represents the direction along the vector (0,0,d n+1 ) T Do a translation transformation, T(a n+1 ,0,0) means along the vector (a n+1 ,0,0) T Do translation transformation, Rot(x,α n+1 ) represents a rotation α around the x-axis n+1 degrees; θ is the rotation angle of the joint, d is the offset along the Z axis, a is the length of the connecting rod between the two joints, and α represents the connecting rod torsion angle; n+1 is the number of joints, and the value of n+1 is 1, 2, 3, 4, 5, 6; The transformation matrix T of two non-adjacent joint coordinate systems is obtained through multiple matrix transformations mn : T mn =A n+1 A n+2 …A m-1 A m (m≥n+1), m and n+1 are any two non-adjacent joints; T 60 Represents the transformation matrix from the base coordinate system to the sixth joint coordinate system, and defines the transformation formula T from the base coordinate system to the sixth joint coordinate system 60 =A1A2A3A4A5A6 is the positive kinematics equation, and the positive solution of the six-degree-of-freedom robot kinematics model is obtained through the positive kinematics equation: Where: turn_x represents the X-direction vector of the end effector of the robot arm, turn_y represents the Y-direction vector of the end effector of the robot arm, turn_z represents the Z-direction vector of the end effector of the robot arm, and p represents the position of the end effector in the world coordinate system; After the robotic arm motion model is established, when the target is fixed, in order to control the robotic arm to reach the desired position and posture, the inverse kinematics equations are obtained by inverting the matrices of the forward kinematics equations, and the inverse kinematics equations are solved to obtain the motion values of each joint. The inverse kinematics equations include the following inverse kinematics equations: Inverse kinematics equations In the equation, both sides are matrix operations, and the calculation results on both sides are matrices. Assume that the elements in the 3rd row and 4th column of the matrix on the left side of the equal sign are equal to the elements in the 3rd row and 4th column of the matrix on the right side of the equal sign, and we get: Wherein, θ1 is a positive number; if θ1 is a negative number, the value of θ1 is θ1′, θ1′=θ1+180°; Assume the inverse kinematics equation In the equation, the elements in the first row and second column of the matrix on both sides of the equal sign are equal, and the elements in the second row and fourth column of the matrix on both sides of the equal sign are equal, and the equation system is as follows: Add the squares of both sides of the two equations to get the value of the third joint angle as follows: in, Simplifying the equations yields the new system: Assume the inverse kinematics equation In the equation, the elements in the 1st row and 4th column of the matrix on both sides of the equal sign are equal, and the elements in the 2nd row and 4th column of the matrix on both sides of the equal sign are equal. The resulting system of equations and the obtained θ2 are as follows: Assume the inverse kinematics equation In the equation, the elements in the first row and third column of the matrix on both sides of the equal sign are equal, and the elements in the second row and third column of the matrix on both sides of the equal sign are equal. The result is as follows: The obtained θ4 is: Assume the inverse kinematics equation In the equation, the elements in the first row and third column of the matrix on both sides of the equal sign are equal, and the elements in the second row and third column of the matrix on both sides of the equal sign are equal, so we get: Find the solution for θ5: Assume the inverse kinematics equation In the equation, the elements in the 2nd row and 1st column of the matrix on both sides of the equal sign are equal, and the elements in the 2nd row and 2nd column of the matrix on both sides of the equal sign are equal, so we get: The solution of θ6 is: From the obtained inverse kinematics equation, we know that we only need to know the expected position and posture of the robot arm to solve the inverse kinematics equation of the robot arm to find out the movement amount of each joint, and then control the movement of the joint to move the robot arm to the expected position and posture.
5. The method for intelligent sorting by a robotic arm based on machine vision according to claim 1, characterized in that: In the step 5, the position-based visual servo grasping system performs robot arm motion trajectory planning according to the motion state of the mobile target, including joint space trajectory planning and Cartesian space trajectory planning; The joint space trajectory planning adopts the quintic interpolation method, and the motion angle is obtained according to the quintic interpolation formula: θ(t)Q0+Q1t+Q2t 2 +Q3t 3 +Q4t 4 +Q5t 5 Among them, Q0, Q1, Q2, Q3, Q4, and Q5 are correlation coefficients, t is the running time of the robot, and the angular velocity at the joint of the robot is obtained by taking the first-order derivative of the joint rotation angle θ(t): θ′(t)=Q1+2Q2t+3Q3t 2 +4Q4t 3 +5Q5t 4 The second-order derivative of the joint rotation angle θ(t) is used to obtain the angular acceleration formula at the joint of the robotic arm: θ″(t)=2Q2+6Q3t+12Q4t 2 +20Q5t 3 For the starting position θ0 of the robot arm joint and the end position θ of the joint f Conditions are given, assuming t0 is the start time of the robot arm operation, t0 = 0, t f is the final moment of the robot's operation. Substitute the velocity and acceleration formulas into the starting position velocity θ′(t0) and the final moment velocity θ′(t f ) is 0, we get: Find the six unknown quantities Q0, Q1, Q2, Q3, Q4, Q5, and substitute Q0, Q1, Q2, Q3, Q4, Q5 into the motion angle formula θ(t) = Q0 + Q1t + Q2t 2 +Q3t 3 +Q4t 4 +Q5t 5 In the above equation, the motion angle θ(t) of each joint of the robot arm during operation is obtained; Substitute Q1, Q2, Q3, Q4, Q5 into the angular velocity formula θ′(t) = Q1+2Q2t+3Q3t 2 +4Q4t 3 +5Q5t 4 In the equation, the angular velocity θ′(t) of each joint of the robot arm during operation is obtained; Substitute Q2, Q3, Q4, Q5 into the angular acceleration formula θ″(t)=2Q2+6Q3t+12Q4t 2 +20Q5t 3 In the above equation, the angular acceleration θ″(t) of each joint of the robot arm during operation is obtained.
6. A robot arm intelligent sorting system based on machine vision, characterized in that: A sorting system obtained by the machine vision-based robotic arm intelligent sorting method according to claims 1-5.
Citation Information
Patent Citations
Control method, system and device of mechanical arm vision positioning sorting grabbing
CN111515945A
Mechanical arm real-time tracking method based on binocular vision guidance
CN112132894A
Agricultural product sorting method and system based on visual servo
CN112588621A
Mechanical arm grabbing system and method based on visual servo
CN116749233A
Mechanical arm autonomous grabbing method and system based on neural network
CN118106970A
