Robot motion control method for numerical control machine tool
Through image processing and feature point detection technology, combined with the data of force sensors, high-precision motion control of CNC machine tools and robots and risk and deformation detection of workpiece slippage are solved, and the problems of slow response speed, insufficient accuracy and complex programming in the existing technology are solved, and production efficiency and operation quality are improved.
Patent Information
- Application Number
- CN202510241721.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-06-06
AI Technical Summary
The existing motion control systems of CNC machine tools and robots have problems such as slow response speed, insufficient accuracy and complex programming, which are difficult to effectively apply in high-precision requirements, and lack the mechanism for slip risk and deformation detection.
Image acquisition equipment is used to capture the workpiece image, obtain the workpiece feature points through Harris corner point detection and SIFT algorithm, calculate the minimum external rectangle and rotation matrix, set the area threshold to distinguish the workpiece categories, control the robot's grasping method, and judge the slip risk and deformation through the comparison of the distance between the force sensor and the feature point.
It improves the response speed and accuracy of robot motion control, simplifies the programming process, realizes real-time detection and control of workpiece slip risks and deformation, and improves production efficiency and operation quality.
Smart Images

Figure CN120095809A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of robot control, and in particular relates to a robot motion control method for a numerically controlled machine tool. Background Art
[0002] In modern manufacturing, CNC machine tools are widely used in various precision machining operations. With the improvement of industrial automation level, more and more production lines use robots to assist or replace manual operation to improve production efficiency and quality. To this end, a robot motion control method for CNC machine tools has emerged. According to the calculated area of the workpiece, the robot adjusts its grasping method. Through pre-classification, the robot can identify and grasp the target workpiece faster, thereby improving the overall efficiency of the production line. In the grasping process, the force and displacement values before and after grasping the workpiece are calculated and compared with the corresponding preset thresholds, and different instructions are issued to the robot according to the comparison results.
[0003] Although the existing motion control systems of CNC machine tools and robots have achieved motion control to a certain extent, the existing motion control systems often have problems such as slow response speed, insufficient accuracy and complex programming, which limit their application in situations requiring high precision. It is difficult to classify the workpieces by drawing the minimum circumscribed rectangle of the workpiece and setting different area thresholds to control the way the robot grasps the workpiece. There is a lack of judging whether there is a risk of slipping of the grasped workpiece by comparing the difference between the actual grasping force value and the theoretical grasping force value with the preset threshold value, and judging whether the robot checks whether the grasped workpiece is deformed by comparing the distance between the feature points of the workpiece before and after grasping with the preset threshold value. There is a lack of issuing different motion controls to the robot based on the results of the two comparisons. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a robot motion control method for a CNC machine tool, which is used to solve the following technical problems:
[0005] Although the existing motion control systems of CNC machine tools and robots have achieved motion control to a certain extent, the existing motion control systems often have problems such as slow response speed, insufficient accuracy and complex programming, which limit their application in situations requiring high precision. It is difficult to classify the workpieces by drawing the minimum circumscribed rectangle of the workpiece and setting different area thresholds to control the way the robot grasps the workpiece. There is a lack of judging whether there is a risk of slipping of the grasped workpiece by comparing the difference between the actual grasping force value and the theoretical grasping force value with the preset threshold value, and judging whether the robot checks whether the grasped workpiece is deformed by comparing the distance between the feature points of the workpiece before and after grasping with the preset threshold value. There is a lack of issuing different motion controls to the robot based on the results of the two comparisons.
[0006] To solve the above problems, a first aspect of the present invention provides a robot motion control method for a numerically controlled machine tool, comprising the following steps:
[0007] S1: Use image acquisition equipment to capture the image information of the workpiece, perform preprocessing operations on the image, combine Harris corner detection and Shi-Tomasi corner detection to obtain the feature points of the workpiece, and use the SIFT algorithm to match the same feature points in different images;
[0008] S2: The least squares straight line fitting method is used to obtain the initial principal axis of the workpiece area. The center of gravity principle is used to determine the initial position and rotation center of the horizontal and vertical principal axes. The principal axes are rotated under the constraints of the rotation termination conditions, and the minimum circumscribed rectangle is drawn. Different area thresholds are set to distinguish workpieces of different sizes. According to the obtained area category, the robot's way of grasping the workpiece is controlled.
[0009] S3: By calculating the rotation matrix and translation vector of the workpiece coordinate system relative to the base coordinate system, the points in the workpiece coordinate system are converted to points in the base coordinate system, a search tree is constructed to plan the robot grasping path, and the end effector is used to perform the grasping operation according to the information provided by the vision system;
[0010] S4: After the grasping operation is completed, the robot determines whether there is a risk of the grasped workpiece slipping by comparing the difference between the actual grasping force value and the theoretical grasping force value with a preset threshold value. The robot checks whether the grasped workpiece is deformed by calculating the distance between the feature points of the workpiece before and after grasping and comparing it with a preset threshold value. After determining that there is no risk of the workpiece slipping and no deformation has occurred, the robot places the grasped workpiece at the specified position.
[0011] As a specific technical solution, step S1 includes the following steps:
[0012] Use image acquisition equipment to capture the image information of the workpiece, perform preprocessing operations on the image, including noise removal and image enhancement processing, use the Canny algorithm to extract edge information in the image, and enhance the feature points in the image through dilation operations;
[0013] Use the cv2.cornerHarris() function in OpenCV for Harris corner detection, and use the cv2.goodFeaturesToTrack() function in OpenCV for Shi-Tomasi corner detection. After using the corner coordinates obtained by Shi-Tomasi corner detection as seed points, search for the point with the largest Harris corner response value in the neighborhood of the seed point as the final corner coordinates, and perform non-maximum suppression to remove duplicate corner points; use two 3*3 pixel matrices to convolve with the image, calculate the gradient amplitude of each pixel, compare the gradient amplitude with the preset threshold, and pixels greater than the threshold are considered to be edges. Use the cv2.findContours() function to find contours in the image, traverse the list contours, use the cv2.drawContours() function to draw the contours on the image, and use the SIFT algorithm to match the same feature points in different images.
[0014] As a specific technical solution, step S1 includes the following steps:
[0015] The least squares straight line fitting method is used to obtain the initial principal axis of the workpiece area. The initial position and rotation center of the horizontal and vertical principal axes are determined by the principle of center of gravity. The principal axes are rotated under the restriction of the rotation termination conditions. The input image is preprocessed, including grayscale conversion and binarization. The findContours function in OpenCV is used to detect the contours in the image. For each contour, the minAreaRect function is used to calculate its minimum enclosing rectangle. The boxPoints function is used to convert the rotated rectangle into four vertex coordinates, and then the polylines function is used to draw the enclosing rectangle. The center point coordinates, length and width information, rotation angle and area features are extracted from the minimum enclosing rectangle. Different area thresholds are set to distinguish workpieces of different sizes. According to the set classification criteria, the workpieces are divided into different categories, including large-area workpieces, medium-area workpieces and small-area workpieces, and different colors are used on the image for marking and recording.
[0016] Based on the acquired area category, the robot's way of grasping the workpiece is controlled.
[0017] As a specific technical solution, the method of converting a point in the workpiece coordinate system into a point in the base coordinate system by calculating a rotation matrix and a translation vector of the workpiece coordinate system relative to the base coordinate system includes the following steps:
[0018] The base coordinate system is fixed on the robot base, and the origin of the base coordinate system and the directions of the three orthogonal coordinate axes are determined. During the machining process, the center point of the workpiece is selected as the reference point, and the three-dimensional coordinate data of the reference point is obtained using the visual system. Based on the obtained reference point coordinate data, a workpiece coordinate system fixed to the workpiece is established. By calculating the rotation matrix and translation vector of the workpiece coordinate system relative to the base coordinate system, the points in the workpiece coordinate system are converted to points in the base coordinate system.
[0019] Conversion calculation formula:
[0020] P ′ =R*P+T
[0021] Among them, P ′ To convert to the corresponding point in the base coordinate system, R is the rotation matrix, T is the translation vector, and P is the point in the workpiece coordinate system.
[0022] As a specific technical solution, the construction of a search tree to plan a robot grasping path and using an end effector to perform a grasping operation according to information provided by a visual system includes the following steps:
[0023] Determine the starting position, target position and obstacles in the robot workspace for grasping the workpiece. Starting from the starting point, build a search tree by random sampling. Sample a new configuration point each time and check whether the point collides with the known tree node. If there is no collision, add it to the tree and find a feasible path connecting the starting point and the target point in the tree. Use the RPT algorithm to optimize the path. According to the planned path, use the end effector to perform the grasping operation based on the information provided by the vision system.
[0024] As a specific technical solution, the use of the end effector to perform a grasping operation according to information provided by the visual system includes the following steps:
[0025] The workpiece image is collected through the visual system, and the edge contour of the workpiece is extracted using the Canny operator edge detection algorithm. The corner points in the image are identified as feature points in combination with Harris corner detection and Shi-Tomasi corner detection. The workpiece image is skeletonized, and the center line, edge and connection point are extracted. The cv2.contourArea() and cv2.arcLength() functions in OpenCV are used to calculate the area and perimeter of the workpiece contour, the center distance of the workpiece contour is calculated, and the rotating caliper algorithm is used to calculate the minimum convex polygon surrounding the workpiece, and its area and perimeter are extracted. The circularity and rectangularity shape factors are used to describe the circularity or degree of closeness to a rectangle of the workpiece shape. According to the calculated geometric features, the center of gravity of the workpiece is calculated, and the grasping operation is performed.
[0026] As a specific technical solution, the robot determines whether there is a risk of slipping of the grasped workpiece by comparing the difference between the actual grasping force value and the theoretical grasping force value with a preset threshold value, including the following steps:
[0027] Install force sensors on the robot gripper to monitor the force feedback information during the grasping process in real time;
[0028] Determine the mass, friction coefficient and gravitational acceleration of the workpiece to obtain the theoretical value of the workpiece grasping force, and compare the theoretical value of the grasping force with the actual value of the grasping force obtained by real-time monitoring of the force sensor installed on the robot gripper. If the difference between the two is greater than a preset threshold, it is considered that the force change is abnormal, indicating that the workpiece is at risk of slipping; if the difference between the two is less than or equal to the preset threshold, it is considered normal;
[0029] Force change calculation formula:
[0030] ΔS=|S acutal -μmg|
[0031] Where ΔS is the force change, S acutal is the actual value of the grasping force, μ is the friction coefficient, which is a constant in the calculation formula, m is the mass of the workpiece, and g is the acceleration due to gravity.
[0032] As a specific technical solution, the method of determining whether the robot checks the grasped workpiece for deformation by comparing the calculated distance between the feature points of the workpiece before and after grasping with a preset threshold value comprises the following steps:
[0033] Use 3D modeling software to create a 3D model of the workpiece according to the design drawings of the workpiece. Before and after the robot grabs the workpiece, use an industrial camera to collect images of the workpiece and perform preprocessing operations, including denoising, contrast enhancement and brightness adjustment. Use image processing algorithms to extract feature points from the collected images and match the feature points with the corresponding feature points in the pre-established 3D model. By comparing the position changes of the feature points of the workpiece before and after grabbing, the displacement of each feature point is calculated using the Euclidean distance.
[0034] The set of feature points extracted by the robot before and after grasping the workpiece is A = {A 1 , A 2 , A 3 , ...A N} and B={B 1 , B 2 , B 3 , ... B M}, for each feature point A i ∈A, find its nearest corresponding feature point B in B j , calculate the Euclidean distance between two points;
[0035] Calculation formula:
[0036]
[0037] Among them, D(A i , B j ) is the feature point A i and B j The distance between them, D is the dimension of the feature point, A ik and B jk They are feature points A i and B j Coordinate values in the kth dimension;
[0038] A preset threshold is set and the calculated distance is compared with the preset threshold. If the distance value is greater than the preset threshold, it is considered that the workpiece has been displaced and deformed, and the robot removes the workpiece; otherwise, it is considered that no deformation has occurred and the robot retains the workpiece.
[0039] The present invention provides a robot motion control method for a numerically controlled machine tool, which has the following beneficial effects:
[0040] The present invention can quickly identify the size and position of a workpiece by extracting the center point coordinates, length and width information, rotation angle and area features from the minimum circumscribed rectangle, thereby reducing the computational complexity and time consumption. Different area thresholds are set to distinguish workpieces of different sizes. Workpieces are classified into different categories according to the set classification standards, and workpieces of different sizes can be accurately distinguished, providing a reliable basis for subsequent grasping operations. According to the acquired area category, the grasping mode of the robot can be flexibly adjusted. Through automated classification and grasping control, the use efficiency of the robot is optimized, and energy consumption and equipment wear are reduced.
[0041] The present invention obtains a theoretical value of the grasping force by calculating the value through Newton's second law and the friction formula, and judges whether there is a risk of the grasped workpiece slipping by comparing the difference between the actual value and the theoretical value of the grasping force with a preset threshold value. The stability of the workpiece during the grasping process can be monitored in real time, and the displacement of each feature point can be calculated by Euclidean distance. The result of comparing the distance between the feature points of the workpiece before and after grasping and the preset threshold value can accurately judge whether the workpiece is deformed during the grasping process. Through automated grasping force control and deformation detection, manual intervention is reduced, and production efficiency and work quality are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 The present invention is a flowchart of the method of the present invention. DETAILED DESCRIPTION
[0044] The following is combined with Figure 1 The specific implementation mode of the present invention is further described:
[0045] See also Figure 1 As shown, the present invention is a robot motion control method for a numerically controlled machine tool, comprising the following steps:
[0046] S1: Use image acquisition equipment to capture the image information of the workpiece, perform preprocessing operations on the image, combine Harris corner detection and Shi-Tomasi corner detection to obtain the feature points of the workpiece, and use the SIFT algorithm to match the same feature points in different images;
[0047] S2: The least squares straight line fitting method is used to obtain the initial principal axis of the workpiece area. The center of gravity principle is used to determine the initial position and rotation center of the horizontal and vertical principal axes. The principal axes are rotated under the constraints of the rotation termination conditions, and the minimum circumscribed rectangle is drawn. Different area thresholds are set to distinguish workpieces of different sizes. According to the obtained area category, the robot's way of grasping the workpiece is controlled.
[0048] S3: By calculating the rotation matrix and translation vector of the workpiece coordinate system relative to the base coordinate system, the points in the workpiece coordinate system are converted to points in the base coordinate system, a search tree is constructed to plan the robot grasping path, and the end effector is used to perform the grasping operation according to the information provided by the vision system;
[0049] S4: After the grasping operation is completed, the robot determines whether there is a risk of the grasped workpiece slipping by comparing the difference between the actual grasping force value and the theoretical grasping force value with a preset threshold value. The robot checks whether the grasped workpiece is deformed by calculating the distance between the feature points of the workpiece before and after grasping and comparing it with a preset threshold value. After determining that there is no risk of the workpiece slipping and no deformation has occurred, the robot places the grasped workpiece at the specified position.
[0050] Specifically, an image acquisition device is used to capture the image information of the workpiece, and the collected image is preprocessed, including denoising and contrast enhancement. Harris corner detection and Shi-Tomasi corner detection are used to obtain feature points in the image. The same feature points in different images are matched using the SIFT algorithm to determine the posture of the workpiece. The least squares method is used to perform straight line fitting on the feature points of the workpiece area to obtain the initial principal axis of the workpiece area. The center of gravity principle is used to determine the initial position and rotation center of the horizontal and vertical principal axes. According to the optimized principal axis direction and position, the minimum circumscribed rectangle of the workpiece is drawn, and different area thresholds are set to distinguish different workpiece sizes. According to the category of the acquired area , control the robot's grasping method; by calculating the rotation matrix and translation variables of the workpiece coordinate system relative to the base coordinate system, convert the points in the workpiece coordinate system into points in the base coordinate system, build a search tree to plan the robot's grasping path, and use the end effector to perform grasping operations based on the information provided by the vision system; after the grasping operation, the robot compares the difference between the actual value and the theoretical value of the grasping force, and compares it with the preset threshold to determine whether the workpiece has a risk of slipping, and by calculating the change in the distance of the feature points before and after grasping, and comparing it with the preset threshold, it determines whether the workpiece has been deformed. After determining that the workpiece has no risk of slipping and has not been deformed, the robot moves the workpiece to the specified position and puts it down.
[0051] In one embodiment of the present invention, the step S1 comprises the following steps:
[0052] Use image acquisition equipment to capture the image information of the workpiece, perform preprocessing operations on the image, including noise removal and image enhancement processing, use the Canny algorithm to extract edge information in the image, and enhance the feature points in the image through dilation operations;
[0053] Use the cv2.cornerHarris() function in OpenCV for Harris corner detection, and use the cv2.goodFeaturesToTrack() function in OpenCV for Shi-Tomasi corner detection. After using the corner coordinates obtained by Shi-Tomasi corner detection as seed points, search for the point with the largest Harris corner response value in the neighborhood of the seed point as the final corner coordinates, and perform non-maximum suppression to remove duplicate corner points; use two 3*3 pixel matrices to convolve with the image, calculate the gradient amplitude of each pixel, compare the gradient amplitude with the preset threshold, and pixels greater than the threshold are considered to be edges. Use the cv2.findContours() function in OPenCV to find contours in the image, traverse the list contours, use the cv2.drawContours() function to draw the contours on the image, and use the SIFT algorithm to match the same feature points in different images.
[0054] Specifically, the cv2.cornerHarris() function in OpenCV is used for Harris corner detection, which returns a matrix of the same size as the input image. The cv2.goodFeaturesToTrack() function in OpenCV is used for Shi-Tomasi corner detection, which returns a list of several corner point coordinates. The corner point coordinates obtained by Shi-Tomasi corner point detection are used as seed points, and the point with the largest Harris corner point response value is searched in the neighborhood of the seed point as the final corner point coordinates. By comparing the response of each corner point Value, and retain the corner point with the largest response value, use two 3*3 pixel matrices, one for the horizontal direction and the other for the vertical direction, convolve with the image, calculate the gradient amplitude of each pixel, compare the gradient amplitude with the preset threshold, and the pixels greater than the threshold are considered to be edges. Use the cv2.findContours() function in OPenCV to find the contours in the image. The function returns a list containing contour information, traverse the list contours, use the cv2.drawContours() function to draw the contours on the image, and use the SIFT algorithm to match the same feature points in different images.
[0055] In one embodiment of the present invention, the step S2 comprises the following steps:
[0056] The least squares straight line fitting method is used to obtain the initial principal axis of the workpiece area. The initial position and rotation center of the horizontal and vertical principal axes are determined by the principle of center of gravity. The principal axes are rotated under the restriction of the rotation termination conditions. The input image is preprocessed, including grayscale conversion and binarization. The findContours function in OpenCV is used to detect the contours in the image. For each contour, the minAreaRect function is used to calculate its minimum enclosing rectangle. The boxPoints function is used to convert the rotated rectangle into four vertex coordinates, and then the polylines function is used to draw the enclosing rectangle. The center point coordinates, length and width information, rotation angle and area features are extracted from the minimum enclosing rectangle. Different area thresholds are set to distinguish workpieces of different sizes. According to the set classification criteria, the workpieces are divided into different categories, including large-area workpieces, medium-area workpieces and small-area workpieces, and different colors are used on the image for marking and recording.
[0057] Based on the acquired area category, the robot's way of grasping the workpiece is controlled.
[0058] Specifically, the best fitting straight line is determined by minimizing the sum of squares of distances from the point set to the straight line, thereby finding the initial principal axis of the workpiece, determining the initial enclosing rectangle of the target based on the horizontal principal axis, rotating the enclosing rectangle within the acute angle region formed by the horizontal principal axis and the vertical principal axis, finding the enclosing rectangle with the smallest area, rotating the principal axis under the restriction of the rotation termination condition, and realizing the rapid determination of the deflection angle of the workpiece and its minimum enclosing rectangle. The purpose of the rotation is to minimize the area of the enclosing rectangle, which corresponds to the minimum enclosing rectangle. The rotation angle usually ranges from -90 degrees to 0 degrees. When the rectangle is horizontal or vertical, it returns -90 degrees. The input image is preprocessed, including grayscale conversion and binarization. The findContours function in OpenCV is used to detect the contours in the image, and minAreaR is used. The ect function calculates its minimum enclosing rectangle, uses the boxPoints function to convert the rotated rectangle into four vertex coordinates, and then uses the polylines function to draw the enclosing rectangle. In order to ensure that the coordinates drawn are integer pixel coordinates, the vertex coordinates need to be rounded off. The center point coordinates, length and width information, rotation angle and area features are extracted from the minimum enclosing rectangle, and different area thresholds are set. The three area thresholds are set as small, medium and large. The small is defined as less than 50 square centimeters, the medium is defined as between 50 and 150 square centimeters, and the large is defined as greater than 150 square centimeters. Different sizes of workpieces are distinguished. According to the set classification criteria, the workpieces are divided into different categories and marked with different colors on the image. According to the obtained area category, the robot's way of grasping the workpiece is controlled;
[0059] For large-area workpieces, choose the multi-point grasping method; for medium-area workpieces, choose the two-point grasping method; for small-area workpieces, choose to grasp using environmental constraints.
[0060] In one embodiment of the present invention, the step of converting a point in the workpiece coordinate system to a point in the base coordinate system by calculating a rotation matrix and a translation vector of the workpiece coordinate system relative to the base coordinate system comprises the following steps:
[0061] The base coordinate system is fixed on the robot base, and the origin of the base coordinate system and the directions of the three orthogonal coordinate axes are determined. During the machining process, the center point of the workpiece is selected as the reference point, and the three-dimensional coordinate data of the reference point is obtained using the visual system. Based on the obtained reference point coordinate data, a workpiece coordinate system fixed to the workpiece is established. By calculating the rotation matrix and translation vector of the workpiece coordinate system relative to the base coordinate system, the points in the workpiece coordinate system are converted to points in the base coordinate system.
[0062] Conversion calculation formula:
[0063] P ′ =R*P+T
[0064] Among them, P ′ To convert to the corresponding point in the base coordinate system, R is the rotation matrix, T is the translation vector, and P is the point in the workpiece coordinate system.
[0065] Specifically, the robot manufacturer determines the origin of the base coordinate system and the directions of the three orthogonal coordinate axes according to the system specified by international standards, extracts the feature quantities of the reference points, including area, center of gravity, length and position, through the visual system, and calculates their two-dimensional coordinates in the image, which are converted into three-dimensional coordinates in combination with the internal and external parameter data of the camera. Based on the acquired reference point coordinate data, a workpiece coordinate system fixed to the workpiece is established. The origin of this coordinate system is set at a reference point of the workpiece, and the direction of the coordinate axis is determined according to the shape of the workpiece and the processing requirements. The points in the workpiece coordinate system are converted into points in the base coordinate system by calculating the rotation matrix and translation vector of the workpiece coordinate system relative to the base coordinate system.
[0066] In one embodiment of the present invention, the step of constructing a search tree to plan a robot grasping path and using an end effector to perform a grasping operation according to information provided by a visual system includes the following steps:
[0067] Determine the starting position, target position and obstacles in the robot workspace for grasping the workpiece. Starting from the starting point, build a search tree by random sampling. Sample a new configuration point each time and check whether the point collides with the known tree node. If there is no collision, add it to the tree and find a feasible path connecting the starting point and the target point in the tree. Use the RPT algorithm to optimize the path. According to the planned path, use the end effector to perform the grasping operation based on the information provided by the vision system.
[0068] Specifically, the starting position, target position and obstacles of the grasped workpiece in the robot workspace are determined. Starting from the starting point, a point is randomly sampled from the space, and the algorithm calculates the connection between it and the nearest point in the current tree. If the connection is feasible, that is, it does not collide with obstacles, the new point is added to the tree to build a search tree. A new configuration point is sampled each time, and it is checked whether the point collides with the known tree nodes. If there is no collision, it is added to the tree. The algorithm continuously repeats the steps of random sampling and local planning, and gradually builds a path from the starting point to the end point. The RPT algorithm is used to reduce the path cost by reselecting the parent node and rewiring the random tree, making the path smoother and closer to the optimal. According to the planned path, the end effector is used to perform the grasping operation according to the information provided by the vision system.
[0069] Among them, the obstacles in the workspace are defined by determining the coordinates of the four vertices of a rectangular area, generating random points in the rectangular area as obstacle points, using MATLAB's plot function to draw the obstacle points into the graph, and checking whether a given point is within the rectangular obstacle through the written function.
[0070] In one embodiment of the present invention, the method of performing a grasping operation using an end effector according to information provided by a visual system comprises the following steps:
[0071] The workpiece image is collected through the visual system, and the edge contour of the workpiece is extracted using the Canny operator edge detection algorithm. The corner points in the image are identified as feature points in combination with Harris corner detection and Shi-Tomasi corner detection. The workpiece image is skeletonized, and the center line, edge and connection point are extracted. The cv2.contourArea() and cv2.arcLength() functions in OpenCV are used to calculate the area and perimeter of the workpiece contour, the center distance of the workpiece contour is calculated, and the rotating caliper algorithm is used to calculate the minimum convex polygon surrounding the workpiece, and its area and perimeter are extracted. The circularity and rectangularity shape factors are used to describe the circularity or degree of closeness to a rectangle of the workpiece shape. According to the calculated geometric features, the center of gravity of the workpiece is calculated, and the grasping operation is performed.
[0072] Specifically, the workpiece image is collected through the visual system, and the edge contour of the workpiece is extracted from the image using the Canny operator edge detection algorithm. The corner points in the workpiece image are identified as feature points through Harris corner detection and Shi-Tomasi corner detection. The workpiece image is skeletonized to extract the main structure of the workpiece, including the center line, edge and connection point. According to the extracted contour, the geometric features of the workpiece, including area and perimeter, are calculated through cv.2contourArea and cv2.arcLength in OpenCV; the center distance of the workpiece contour is calculated, and the area and perimeter of the minimum convex polygon surrounding the workpiece are extracted by calculating the minimum convex polygon; the circularity and rectangularity shape factors are used to describe the circularity or degree of closeness to a rectangle of the workpiece shape, and the posture estimation algorithm is used to calculate the posture of the camera relative to the known three-dimensional point in combination with the extracted feature points and geometric features; after calculating all relevant geometric features, the center of gravity position of the workpiece is calculated and it is grasped.
[0073] In one embodiment of the present invention, the robot determines whether there is a risk of slipping of the grasped workpiece by comparing the difference between the actual grasping force value and the theoretical grasping force value with a preset threshold value, including the following steps:
[0074] Install force sensors on the robot gripper to monitor the force feedback information during the grasping process in real time;
[0075] Determine the mass, friction coefficient and gravitational acceleration of the workpiece to obtain the theoretical value of the workpiece grasping force, and compare the theoretical value of the grasping force with the actual value of the grasping force obtained by real-time monitoring of the force sensor installed on the robot gripper. If the difference between the two is greater than a preset threshold, it is considered that the force change is abnormal, indicating that the workpiece is at risk of slipping; if the difference between the two is less than or equal to the preset threshold, it is considered normal;
[0076] Force change calculation formula:
[0077] ΔS=|S acutal -μmg|
[0078] Where ΔS is the force change, S acutal is the actual value of the grasping force, μ is the friction coefficient, which is a constant in the calculation formula, m is the mass of the workpiece, and g is the acceleration due to gravity.
[0079] Specifically, the mass of the workpiece is measured by a weighing device, and the friction coefficient is obtained by consulting the properties of related materials. g is the acceleration due to gravity, and its value is 9.8 m / s 2 According to Newton's second law and the friction formula, the minimum grasping force required to keep the workpiece stationary in the absence of external force can be calculated. This force is equal to the product of the gravity on the workpiece and its friction coefficient, that is, μmg. A force sensor is installed on the robot gripper to monitor the actual value of the grasping force. The theoretical value of the grasping force is compared with the actual value monitored by the force sensor. If the difference between the two is greater than the preset threshold, it is considered that the force change is abnormal, which may indicate that the workpiece is at risk of slipping. If the difference is less than or equal to the preset threshold, it is considered that the grasping force is normal and the workpiece is stable. Based on the comparison results, the robot adjusts the grasping strategy, such as by increasing the grasping force or changing the grasping method.
[0080] In one embodiment of the present invention, the step of determining whether the grasped workpiece is deformed by the robot by comparing the calculated distance between the feature points of the workpiece before and after grasping with a preset threshold comprises the following steps:
[0081] Use 3D modeling software to create a 3D model of the workpiece according to the design drawings of the workpiece. Before and after the robot grabs the workpiece, use an industrial camera to collect images of the workpiece and perform preprocessing operations, including denoising, contrast enhancement and brightness adjustment. Use image processing algorithms to extract feature points from the collected images and match the feature points with the corresponding feature points in the pre-established 3D model. By comparing the position changes of the feature points of the workpiece before and after grabbing, the displacement of each feature point is calculated using the Euclidean distance.
[0082] The set of feature points extracted by the robot before and after grasping the workpiece is A = {A1 , A 2 , A 3 , ...A N} and B={B 1 , B 2 , B 3 , ... B M}, for each feature point A i ∈A, find its nearest corresponding feature point B in B j , calculate the Euclidean distance between two points;
[0083] Calculation formula:
[0084]
[0085] Among them, D(A i , B j ) is the feature point A i and B j The distance between them, D is the dimension of the feature point, A ik and B jk They are feature points A i and B j Coordinate values in the kth dimension;
[0086] A preset threshold is set and the calculated distance is compared with the preset threshold. If the distance value is greater than the preset threshold, it is considered that the workpiece has been displaced and deformed, and the robot removes the workpiece; otherwise, it is considered that no deformation has occurred and the robot retains the workpiece.
[0087] Specifically, a 3D modeling software is used to create a 3D model of the workpiece according to the design drawings of the workpiece. Before and after the robot grasps the workpiece, an industrial camera is used to capture images of the workpiece. Preprocessing operations such as denoising, contrast enhancement and brightness adjustment are performed on the captured images to improve image quality. Feature points are extracted from the preprocessed images through a combination of Harris corner detection and Sh i-Tomas i corner detection. The extracted feature points are matched with corresponding feature points in a pre-established 3D model. By comparing the position changes of the feature points of the workpiece before and after grasping, the Euclidean distance is used to calculate the displacement of each feature point. A preset threshold is determined based on historical data and experience. According to the calculated displacement, when the distance value of a feature point is greater than the preset threshold, it is determined that the workpiece is deformed and the robot removes the workpiece; otherwise, it is determined that no deformation occurs and the robot retains the workpiece.
[0088] The above embodiments are only used to illustrate the technical method of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A robot motion control method for a numerically controlled machine tool, characterized in that: The following steps are involved: S1: Use image acquisition equipment to capture the image information of the workpiece, perform preprocessing operations on the image, combine Harris corner detection and Shi-Tomasi corner detection to obtain the feature points of the workpiece, and use the SIFT algorithm to match the same feature points in different images; S2: The least squares straight line fitting method is used to obtain the initial principal axis of the workpiece area. The center of gravity principle is used to determine the initial position and rotation center of the horizontal and vertical principal axes. The principal axes are rotated under the constraints of the rotation termination conditions, and the minimum circumscribed rectangle is drawn. Different area thresholds are set to distinguish workpieces of different sizes. According to the obtained area category, the robot's way of grasping the workpiece is controlled. S3: By calculating the rotation matrix and translation vector of the workpiece coordinate system relative to the base coordinate system, the points in the workpiece coordinate system are converted to points in the base coordinate system, a search tree is constructed to plan the robot grasping path, and the end effector is used to perform the grasping operation according to the information provided by the vision system; S4: After the grasping operation is completed, the robot determines whether there is a risk of the grasped workpiece slipping by comparing the difference between the actual grasping force value and the theoretical grasping force value with a preset threshold value. The robot checks whether the grasped workpiece is deformed by calculating the distance between the feature points of the workpiece before and after grasping and comparing it with a preset threshold value. After determining that there is no risk of the workpiece slipping and no deformation has occurred, the robot places the grasped workpiece at the specified position.
2. A robot motion control method for a CNC machine tool according to claim 1, characterized in that: The step S1 comprises the following steps: Use image acquisition equipment to capture the image information of the workpiece, perform preprocessing operations on the image, including noise removal and image enhancement processing, use the Canny algorithm to extract edge information in the image, and enhance the feature points in the image through dilation operations; Use the cv2.cornerHarris() function in OpenCV for Harris corner detection, and use the cv2.goodFeaturesToTrack() function in OpenCV for Shi-Tomasi corner detection. After using the corner coordinates obtained by Shi-Tomasi corner detection as seed points, search for the point with the largest Harris corner response value in the neighborhood of the seed point as the final corner coordinates, and perform non-maximum suppression to remove duplicate corner points; use two 3*3 pixel matrices to convolve with the image, calculate the gradient amplitude of each pixel, compare the gradient amplitude with the preset threshold, and pixels greater than the threshold are considered to be edges. Use the cv2.findContours() function in OPenCV to find contours in the image, traverse the list contours, use the cv2.drawContours() function to draw the contours on the image, and use the SIFT algorithm to match the same feature points in different images.
3. The method for controlling robot motion for a numerically controlled machine tool according to claim 1, characterized in that: The step S2 comprises the following steps: The least squares straight line fitting method is used to obtain the initial principal axis of the workpiece area. The initial position and rotation center of the horizontal and vertical principal axes are determined by the principle of center of gravity. The principal axes are rotated under the restriction of the rotation termination conditions. The input image is preprocessed, including grayscale conversion and binarization. The findContours function in OpenCV is used to detect the contours in the image. For each contour, the minAreaRect function is used to calculate its minimum enclosing rectangle. The boxPoints function is used to convert the rotated rectangle into four vertex coordinates, and then the polylines function is used to draw the enclosing rectangle. The center point coordinates, length and width information, rotation angle and area features are extracted from the minimum enclosing rectangle. Different area thresholds are set to distinguish workpieces of different sizes. According to the set classification criteria, the workpieces are divided into different categories, including large-area workpieces, medium-area workpieces and small-area workpieces, and different colors are used on the image for marking and recording. Based on the acquired area category, the robot's way of grasping the workpiece is controlled.
4. The method for controlling robot motion for a numerically controlled machine tool according to claim 1, characterized in that: The method of converting a point in the workpiece coordinate system into a point in the base coordinate system by calculating a rotation matrix and a translation vector of the workpiece coordinate system relative to the base coordinate system comprises the following steps: The base coordinate system is fixed on the robot base, and the origin of the base coordinate system and the directions of the three orthogonal coordinate axes are determined. During the machining process, the center point of the workpiece is selected as the reference point, and the three-dimensional coordinate data of the reference point is obtained using the visual system. Based on the obtained reference point coordinate data, a workpiece coordinate system fixed to the workpiece is established. By calculating the rotation matrix and translation vector of the workpiece coordinate system relative to the base coordinate system, the points in the workpiece coordinate system are converted to points in the base coordinate system. Conversion calculation formula: P ′ =R*P+T Among them, P ′ To convert to the corresponding point in the base coordinate system, R is the rotation matrix, T is the translation vector, and P is the point in the workpiece coordinate system.
5. The method for controlling robot motion for a numerically controlled machine tool according to claim 1, characterized in that: The method of constructing a search tree to plan a robot grasping path and using an end effector to perform a grasping operation according to information provided by a visual system includes the following steps: Determine the starting position, target position and obstacles in the robot workspace for grasping the workpiece. Starting from the starting point, build a search tree by random sampling. Sample a new configuration point each time and check whether the point collides with the known tree node. If there is no collision, add it to the tree and find a feasible path connecting the starting point and the target point in the tree. Use the RPT algorithm to optimize the path. According to the planned path, use the end effector to perform the grasping operation based on the information provided by the vision system.
6. A robot motion control method for a CNC machine tool according to claim 5, characterized in that: The method of using the end effector to perform a grasping operation according to information provided by the visual system includes the following steps: The workpiece image is collected through the visual system, and the edge contour of the workpiece is extracted using the Canny operator edge detection algorithm. The corner points in the image are identified as feature points in combination with Harris corner detection and Shi-Tomasi corner detection. The workpiece image is skeletonized, and the center line, edge and connection point are extracted. The cv2.contourArea() and cv2.arcLength() functions in OpenCV are used to calculate the area and perimeter of the workpiece contour, the center distance of the workpiece contour is calculated, and the rotating caliper algorithm is used to calculate the minimum convex polygon surrounding the workpiece, and its area and perimeter are extracted. The circularity and rectangularity shape factors are used to describe the circularity or degree of closeness to a rectangle of the workpiece shape. According to the calculated geometric features, the center of gravity of the workpiece is calculated, and the grasping operation is performed.
7. The method for controlling robot motion for a numerically controlled machine tool according to claim 1, characterized in that: The robot determines whether there is a risk of slipping of the grasped workpiece by comparing the difference between the actual grasping force value and the theoretical grasping force value with a preset threshold value, including the following steps: Install force sensors on the robot gripper to monitor the force feedback information during the grasping process in real time; Determine the mass, friction coefficient and gravitational acceleration of the workpiece to obtain the theoretical value of the workpiece grasping force, and compare the theoretical value of the grasping force with the actual value of the grasping force obtained by real-time monitoring of the force sensor installed on the robot gripper. If the difference between the two is greater than a preset threshold, it is considered that the force change is abnormal, indicating that the workpiece is at risk of slipping; if the difference between the two is less than or equal to the preset threshold, it is considered normal; Force change calculation formula: ΔS=|S acutal -μmg| Where ΔS is the force change, S acutal is the actual value of the grasping force, μ is the friction coefficient, which is a constant in the calculation formula, m is the mass of the workpiece, and g is the acceleration due to gravity.
8. The method for controlling robot motion for a numerically controlled machine tool according to claim 1, characterized in that: The method of comparing the distance between the feature points of the workpiece before and after grasping and a preset threshold value to determine whether the grasped workpiece is deformed by the robot includes the following steps: Use 3D modeling software to create a 3D model of the workpiece according to the design drawings of the workpiece. Before and after the robot grabs the workpiece, use an industrial camera to collect images of the workpiece and perform preprocessing operations, including denoising, contrast enhancement and brightness adjustment. Use image processing algorithms to extract feature points from the collected images and match the feature points with the corresponding feature points in the pre-established 3D model. By comparing the position changes of the feature points of the workpiece before and after grabbing, the displacement of each feature point is calculated using the Euclidean distance. The set of feature points extracted by the robot before and after grasping the workpiece is A = {A1, A2, A3, ...A N } and B = {B1, B2, B3, ... B M }, for each feature point A i ∈A, find its nearest corresponding feature point B in B j , calculate the Euclidean distance between two points; Calculation formula: Among them, D(A i , B j ) is the feature point A i and B j The distance between them, D is the dimension of the feature point, A ik and B jk They are feature points A i and B j Coordinate values in the kth dimension; A preset threshold is set and the calculated distance is compared with the preset threshold. If the distance value is greater than the preset threshold, it is considered that the workpiece has been displaced and deformed, and the robot removes the workpiece; otherwise, it is considered that no deformation has occurred and the robot retains the workpiece.
Citation Information
Cited By
Automatic machining control method and system for shaft parts
CN121696962A