Method for generating high-quality motion path of mechanical arm
Technical Field
The invention belongs to the technical field of modern intelligent manufacturing, and relates to a method for generating a high-quality motion path of a mechanical arm in the field of industrial robots.
Background
At present, an important development direction of the industrial mechanical arm is to use task level programming to replace a manual teaching mode to generate a mechanical arm working space path and perform subsequent speed planning. In task-level programming, the robot arm motion paths typically exist in the form of discrete pose points (workspace paths) and discrete angle values (joint space paths). In generating the robot arm workspace path using CAM software, the ideal workspace path is computed everywhere but without specific mathematical expressions. However, such ideal paths are difficult to process due to many algorithms of the robot arm, such as forward and inverse kinematics algorithms, path planning algorithms, etc. Before the ideal path is executed by the mechanical arm, discrete pose points are collected on the ideal path to form a working space path, the working space path is converted into a joint space path through an inverse kinematics algorithm, and then the discrete angle values are converted into a continuous joint space path through interpolation, so that each controller of the mechanical arm can select the angle values to be executed on the continuous path according to a control period. And due to the influence of factors such as the number of discrete angle values during interpolation, an interpolation method and the like, an error exists between a continuous joint space path obtained by interpolation and an ideal path, and the actual working precision requirement is difficult to meet.
The zhuge literature, "research on a six-axis industrial robot trajectory control method for multipoint high-speed assembly", university of zhejiang, 2013, teaches 9 interpolation points in an artificial teaching mode, performs NURBS interpolation, and calculates a position error between an interpolation result and an ideal trajectory, wherein the position error is 0.01mm in size. However, the error of 0.01mm level is still difficult to meet the actual working precision requirement. The technical scheme is that the technical scheme is characterized in that a technical scheme of industrial robots and a spline interpolation method research in Chin' S literature, 2018, a multi-joint speed plan is converted into a single-joint S-shaped speed plan at any moment, and the speed constraint of each axis is guaranteed to be met; then defining speed conversion points including an axis switching point and a curvature critical point, and segmenting the spline in a preprocessing stage and performing speed smoothing in an initial stage; further, in order to meet the acceleration of each axis of the multi-joint robot, acceleration constraint is added, and S-shaped speed planning is performed on sample sections of each axis exceeding a critical value sequentially according to a speed integral relation; and finally, iterative optimization is carried out through circulation until all the axes meet the motion constraint, so that the bang-bang control with optimal time and smoothness is realized. However, only 7 interpolation points are determined in the method, and a large error still exists between the interpolated working path and the ideal path, so that the requirement of the mechanical arm in actual working cannot be met.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, and provides a method for generating a high-quality motion path of a mechanical arm, which is used for acquiring the high-quality motion path of the mechanical arm with an error smaller than an expected value from an ideal motion path. Firstly, randomly selecting interpolation points twice based on a negative exponential relation between the number of the interpolation points and errors when a joint space path is interpolated by a B spline for 5 times, and calculating the errors between corresponding interpolation results and an ideal path, thereby determining parameter values in the negative exponential relation between the number of the interpolation points and the median of the error of the whole path, and further predicting the number of the interpolation points corresponding to an expected error; secondly, calculating the median of the errors on the path based on the obtained interpolation result errors, taking the areas with the errors larger than the median on the path as interpolation point encryption areas, and doubling the interpolation points in the areas; finally, reusing 5 times of B-spline interpolation for the angle values of the joint space dispersion after the interpolation points are encrypted in a partitioning mode to obtain the mechanical arm high-quality motion path with errors smaller than the expected errors on the whole path. The method summarizes that the negative exponential relationship exists between the number of interpolation points and the median of the error of the whole path when the joint space path is interpolated by the B spline for 5 times, so that the number of interpolation points corresponding to the expected error is predicted, and the number of interpolation points is locally encrypted in a region with a large error on the path, thereby effectively reducing the error between the interpolated joint space path and the ideal path, meeting the actual working requirement and providing convenience for the speed planning of the subsequent path. And the relationship between the number of interpolation points and the median of the full path error summarized in the invention can be used as a guide basis for solving the similar problems. The method is effective and simple and clear in process.
The technical scheme adopted by the invention is a method for generating a high-quality motion path of a mechanical arm, and the method comprises the steps of firstly, randomly selecting interpolation points twice based on a negative exponential relationship between the number of interpolation points and an error when a joint space path is interpolated by a B spline for 5 times, and calculating the error between a corresponding interpolation result and an ideal path, thereby determining a parameter value in the negative exponential relationship between the number of interpolation points and a median of a total path error, and further predicting the number of interpolation points corresponding to an expected error; secondly, calculating the median of the errors on the path based on the obtained interpolation result errors, taking the areas with the errors larger than the median on the path as interpolation point encryption areas, and doubling the interpolation points in the areas; finally, reusing 5 times of B-spline interpolation for the angle values of the joint space dispersion after the interpolation points are encrypted in a partitioning mode to obtain the mechanical arm high-quality motion path with errors smaller than the expected errors on the whole path. The method comprises the following specific steps:
step one, randomly selecting the number of interpolation points twice and calculating errors.
The CAM software is used for generating an ideal motion path of the mechanical arm, in order to facilitate mathematical expression and position calculation, the ideal path is assumed to be a plane path, and the mathematical expression of polar coordinates is as follows:
ρ=l(sin(7θ)+2) (1)
wherein l is a parameter and theta is an angle.
Converting an ideal plane geometric path into a mechanical arm working space path, wherein the path is expressed mathematically as:
wherein p isx,py,pzRepresenting the distance, r, over which the robot arm tip coordinate system translates along the x, y, z axesx,ry,rzAnd the rotation angle of the tail end coordinate system of the mechanical arm around the x, y and z axes is represented, l is a parameter, theta is an angle, and the number of values of theta in the interval is the number of interpolation points.
Randomly selecting path point n twiceiAnd i is 1 and 2, and two groups of mechanical arm working space paths are formed. And then, converting the working space path into a joint space path through an inverse kinematics algorithm, and interpolating discrete angle values in the joint space path by using a B spline for 5 times to obtain a joint space motion path which can be calculated everywhere. And finally, sampling the angle value of each joint on the joint space motion path obtained by interpolation, converting the angle value into a working space path point through positive kinematics, comparing the path point with the corresponding position on the mechanical arm ideal motion path generated by CAM software, and calculating the error and the error median on the whole path.
And step two, determining negative exponential relation parameters and predicting the number of interpolation points corresponding to the expected error.
Determining parameters in a negative exponential relation between the number of interpolation points and the median of the total path error by using the number of path points randomly selected in the step one and the error between the corresponding interpolation result and the ideal path, and further determining a mathematical expression of the negative exponential relation:
y=aebx (3)
wherein y is the median of the total path error, x is the number of interpolation points, and a and b are parameters.
And then substituting the expected error into a negative exponential relation to calculate the number of interpolation points corresponding to the expected error, so as to be used as a basis for selecting path points on the ideal motion path of the mechanical arm generated by the CAM software.
And step three, determining an area with larger error on the path and encrypting the interpolation point.
And calculating the median of the errors on the whole path according to the error between the joint space motion path obtained by interpolation in the step one and the ideal path generated by the CAM software. And then, determining the area with the error larger than the median of the error on the path as an interpolation point number encryption area. When the path points are reselected on the ideal path generated by the CAM software according to the number of the interpolation points corresponding to the predicted expected error, the number of the path points selected in the encryption area of the number of the interpolation points is doubled, and the local encryption of the interpolation points in the area where the large error is easy to appear on the path is realized.
And step four, carrying out re-interpolation on the interpolation points subjected to partition encryption by using a B spline for 5 times.
And converting the path points which are reselected and encrypted in a partitioning manner into joint space paths, and interpolating discrete angle values on the joint space paths by using the B splines for 5 times again to finally obtain the high-quality motion paths of the mechanical arm.
The method has the advantages that the negative exponential relationship between the number of interpolation points and the median of the error of the whole path is summarized when the joint space path is interpolated by the B splines for 5 times, so that the number of interpolation points corresponding to the expected error is predicted, the number of interpolation points is locally encrypted in a region with larger error on the path, the error between the interpolated joint space path and the ideal path is effectively reduced, the actual working requirement can be met, and convenience is provided for speed planning of the subsequent path. And the relationship between the number of interpolation points and the median of the full path error summarized in the invention can be used as a guide basis for solving the similar problems. The method is effective and simple and clear in process.
Description of the drawings:
FIG. 1 is a flow chart of a method for generating a high-quality motion path of a mechanical arm.
FIG. 2 is a schematic diagram of a typical PUMA560 robot arm. Wherein, 0-base coordinate, 1-joint 1, 2-joint 2, 3-joint 3, 4-joint 4, 5-joint 5, 6-joint 6; the determination of each coordinate system is performed by means of DH parameters, each joint being rotated about the z-axis of the joint coordinate system, in particular ziThe shaft being along the axis of the (i + 1) th joint, xiAlong ziAxis and zi-1Common perpendicular to the axes, directed away from zi-1Direction of axis, yiThe axis is determined by the right-hand rectangular coordinate system rule; initial position of first joint coordinate system and base coordinate system { x0,y0,z0The superposition, the base coordinate system is always kept unchanged; thetaiRepresents the rotation angle of the ith joint; coordinate system n, o, a represents the distal-most extended position and attitude of the end jaw.
Fig. 3-ideal path of motion for the robotic arm constructed in this embodiment, the path being generated by CAM software.
Fig. 4 shows the region of the encrypted interpolation point determined by the total path error and the median of the error in this embodiment, and 8 interpolation point encrypted regions are shown in fig. 1-8.
Fig. 5 shows the error of the high-quality motion path of the mechanical arm and the ideal path on the whole path, which is finally obtained in the embodiment. At any one position, the error is less than the expected error.
Detailed Description
The following detailed description of the embodiments of the invention refers to the accompanying drawings and claims.
FIG. 2 is a simplified structural diagram of a classic PUMA560 arm having link parameters determined by the DH parameters method shown in Table 1.
TABLE 1
Fig. 1 is a flow chart of a method for generating a high-quality motion path of a mechanical arm, which specifically includes the following steps:
step one, constructing an ideal path of the mechanical arm as shown in the attached figure 3 according to a formula (1), wherein the path is a plane path, l takes a value of 0.15, and a polar coordinate expression is as follows:
ρ=0.15(sin(7θ)+2)
converting the constructed plane geometric path into a mechanical arm working space path according to a formula (2), wherein the mathematical expression of the path is as follows:
and (3) selecting interpolation points on the ideal path of the mechanical arm twice at random to form two groups of mechanical arm working space paths, converting the two groups of mechanical arm working space paths into angle values with discrete joint space by using an inverse kinematics algorithm, then using 5 times of B-spline interpolation, and calculating interpolation result errors. In the first group, the number of selected interpolation points is 200, and the corresponding median of the full path error is 0.0144 um; in the second group, the number of selected interpolation points is 250, and the corresponding median of the full path error is 0.0034 um.
And step two, respectively substituting the two groups of data into a formula (3) for simultaneous operation, solving an equation set to obtain a-4.6344 and B-0.0289, and obtaining the relation between the number of interpolation points and the median of the total path error under the condition of 5 times of B spline interpolation joint space path:
y=4.6344e-0.0289x
the median expected error is set to: y is0And substituting 0.01um into the relation between the number of interpolation points and the error of the interpolation result, and predicting the number of interpolation points corresponding to the median of the expected error to be x-212.
212 path points are selected on an ideal path of the mechanical arm, the path points are converted into angle values of joint space dispersion by using an inverse kinematics algorithm, 5 times of B-spline interpolation is used, and the median of the total path error is calculated to be 0.0095um by using a formula (3).
And step three, determining an area with larger error on the path and encrypting the interpolation point.
And (3) taking the first group in the step one to select 200 path points and interpolation result errors thereof as partition basis, determining that the median of the total path errors is 0.0144um, and selecting 8 areas with errors larger than the median on the path as interpolation point encryption areas, wherein the partition results are shown in figure 4, and the total number of the interpolation point encryption areas is 8 in the figure. The error value represents the sum of absolute values of position errors of the interpolated path and the ideal path in three spatial directions. The path position represents the angle value selected by theta in [0 degree 360 degrees ], and the number of the selected angle values corresponds to the number of interpolation points.
And (3) reselecting path points on the ideal path according to the number of the interpolation points corresponding to the predicted expected error, and increasing the number of the selected path points in the 8 interpolation point number encryption areas by twice of the original number, thereby realizing local encryption of the interpolation points in the area where the large error is easy to appear on the path.
And step four, carrying out re-interpolation on the interpolation points subjected to partition encryption by using a B spline for 5 times.
And converting the path points which are reselected and encrypted in a partitioning manner into discrete angle values in the joint space, and interpolating the discrete angle values on the joint space path again by using the B splines for 5 times to finally obtain the high-quality motion path of the mechanical arm.
The total path error of the high-quality motion path of the mechanical arm is shown in figure 5, the error values on the same path positions with 8 interpolation point encryption areas in figure 4 on the path are obviously reduced, and the total path errors are all smaller than the expected error of 0.01 um.