A NURBS curve interpolation method based on elliptical arc fitting
Through the NURBS curve interpolation method based on elliptical arc fitting, the problems of low spline fitting accuracy and large calculation amount are solved, efficient and accurate interpolation are achieved, and velocity fluctuations and calculation complexity are reduced.
Patent Information
- Application Number
- CN202210954999.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-08-10
AI Technical Summary
The existing CNC machining methods have low fitting accuracy for spline curves, and the calculation amount is large during interpolation, resulting in low efficiency and difficult to effectively control speed fluctuations.
The NURBS curve interpolation method based on elliptic arc fitting is adopted. By segmenting the spline curves and fitting each segment, the velocity planning is performed using the long and short shafts of the elliptic arc to achieve interpolation.
It improves the fitting accuracy and interpolation efficiency, reduces the calculation amount, reduces the vibration of the machine tool, can better approach the desired speed, and has a small error in shape with the original curve.
Smart Images

Figure CN115202291B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of interpolation of numerical control systems, and in particular relates to a NURBS curve interpolation method based on elliptical arc fitting. Background Art
[0002] With the continuous development of the manufacturing industry, the traditional CNC machining method of approximating complex curves with tiny straight or circular segments can no longer meet the requirements of workpiece machining accuracy and machining efficiency at this stage. In addition, the traditional linear interpolation and circular interpolation have frequent acceleration and deceleration changes, sudden changes in direction, low accuracy, and poor surface smoothness. They can no longer achieve the contour accuracy of most workpieces, and even cannot meet the requirements of complex curved surface workpiece contour formation. In view of the shortcomings of traditional interpolation algorithms, non-uniform rational B-spline (NURBS) curves were introduced. NURBS curve interpolation has the characteristics of small data transmission volume and fast transmission speed, and is easy to realize multi-axis linkage, high-speed and high-precision machining. At the same time, NURBS curves provide a universal mathematical form for the accurate representation of standard analytical shapes and free-form curves and surfaces, and are easier to calculate than curves without fixed forms. How to complete the trajectory and speed requirements of curve setting in CNC systems has become the core content of current research, and it also determines the quality of the machined parts. At present, the most commonly used methods for NURBS curve interpolation are divided into two categories: one is direct interpolation method, and the other is fitting curve. As for the direct interpolation method, it will be affected by the bow height error and the constant feed speed, resulting in the accuracy failing to meet the requirements; the fitting curve divides the curve and uses other line types such as arcs and straight lines to fit small curve segments. However, at present, most of the fitting curve interpolation methods use high-order equations to iteratively calculate the interpolation parameters, which is too complicated.
[0003] At present, many scholars have conducted a series of studies on controlling feed speed to improve precision. With the increase of curve complexity, the method of fitting the curve into a straight line segment or arc has the disadvantages of large amount of fitting data calculation, high communication transmission load and low processing efficiency. Faux ID et al. regarded the bow height error as the one-way Hausdorff distance from the actual NURBS curve to the processing path, and approximated the bow height error by constructing a nonlinear optimization problem. This method is very complicated and cannot be obtained by analytical methods, so it is difficult to apply to actual processing occasions. Wei Fan et al. used the osculating circle (OC) approximation method and the one-way Hausdorff distance approximation method to subsequently compensate for the bow height error, and proposed a continuous acceleration S model speed planning method using trapezoids and sine curves to describe the change law of acceleration to improve the processing accuracy and efficiency. Although the OC method can effectively smooth the bow height error of the trajectory, the evaluation accuracy of the bow height error will decrease for higher curvature radius changes. Since the fitting degree of the curve will decrease during the processing of complex surfaces, the tool trajectory will be not smooth, and the tangent will be discontinuous at the micro-segment connection, which greatly reduces the processing efficiency and surface quality. In order to solve this problem, direct interpolation technology of spline curves came into being. At present, there are many different NURBS curve interpolation methods, such as the earliest Taylor first-order and second-order expansion methods, feedback interpolation methods, "estimation-correction" interpolation methods and function fitting interpolation methods. These interpolation methods involve multiple curve evaluation and derivative calculations, and even require repeated iterative calculations with huge data. However, since the B-spline basis function adopts a recursive definition, its evaluation and derivative process is very complicated and time-consuming, so the above methods require a lot of computing resources. Liu Yu et al. analyzed the relationship between speed fluctuation and curve curvature in the Taylor expansion method, and pointed out that the Taylor expansion method is an open-loop method for error control. Yeh and Hsu analyzed the high-order truncation error based on the first-order Taylor expansion method and proposed a compensation algorithm to improve the speed accuracy, but this method can only maintain a constant feed speed and cannot adapt to speed changes during processing. Farouki and Tsai also used the first-order Taylor expansion and made corrections, with high speed accuracy, but the complexity of solving the correction term limited the scope of application. Li Chuanjun et al. proposed a fast direct interpolation method based on cubic B-spline curves. It uses B-spline node insertion technology and differential recursive evaluation technology to perform cubic spline interpolation. Although it saves running calculation time, it does not perform forward speed planning. Liu Qiang, Liu Huan et al. proposed a quartic equation interpolation method with low feed rate fluctuation. Although it completely eliminates the feed rate fluctuation of any second-degree derivative curve and improves the accuracy, the solution of the quartic equation is complex and the efficiency is not high enough.
[0004] As a common quadratic curve in CNC machining, the control method of elliptic curve in CNC machining is relatively less studied. There are mainly two methods. One is the macro program method, which is considered from the perspective of engineering application. At present, the macro program function provided by the CNC system itself is mainly used to discretize the elliptic arc into straight lines or circular arcs, and then the CNC system performs speed planning and interpolation on the discretized line type. Gu Liya and others used macro function programming to obtain elliptic curve interpolation. According to the principle of "data densification" and the curve formula, the macro program can be used to produce elliptic interpolation. The result of this is that the fitting accuracy is often controlled by the programmer himself, the amount of discrete data is not uniform, and if the amount of discrete data is not infinite, its discrete accuracy is not limited, and the task pressure on the subsequent CNC system is also relatively large. At the same time, the fixed cycle function of the machine tool cannot be used when using the macro function, which has certain limitations. Another method is to study the speed planning and interpolation algorithm for the elliptic curve itself. For example, Wang Kunqi et al. proposed an elliptical arc interpolation using the comparison integral method, which combines the advantages of the comparison method and the integral method. However, each time a pulse is fed, the size of the pulse interval of each coordinate feed must be compared to determine the reference axis of each specific feed. Each time a pulse is output, deviation judgment, coordinate feeding and new deviation calculation must be performed. In addition, quadrant processing is required, and the calculation is relatively cumbersome. Some scholars proposed an elliptical arc interpolation algorithm that divides the center angle of a circle based on the principle of time division, and improved the algorithm in terms of operation time. The interpolation accuracy of this improved algorithm can reach the interpolation accuracy of similar algorithms in the past, but the formula calculation of this algorithm is relatively complex and may cause program data accumulation. Some researchers use circles to map ellipses, which is called the mapping method. The interpolation speed is fast. The interpolation recursive algorithm combines the deviation calculation and deviation comparison of each possible interpolation direction. The algorithm is simple and the calculation is fast. The interpolation formula is derived from the circular arc interpolation formula of the mapping circle. The existing mature and reliable arc interpolation program can be directly applied, but this method is not accurate enough. It only infers the ellipse from the circle, and there is no accurate specific ellipse line expression. Some scholars also use the ellipse arc smooth compression interpolation algorithm for high-speed and high-precision machining. Although this method is simple and feasible, it has the problem of uncontrollable contour error and speed fluctuation. The researchers then proposed the equal error method. Although it improves the machining accuracy of the ellipse, it still cannot effectively control the speed fluctuation. Therefore, a large number of scholars have studied numerical methods, and effectively reduced the speed fluctuation by more accurately deriving the relationship between the interpolation point and the arc length, such as the semi-parametric and dual-parameter conversion method proposed by Toshio, the empirical parameter iteration method proposed by John, and the inverse elliptic integral method proposed by Toshio. These methods involve multiple iterations and complex numerical calculations, and have poor real-time performance, so they cannot be applied to CNC systems.
[0005] In summary, the existing methods for direct speed planning and interpolation of spline curves generally have the problems of large amount of calculation, complex forward processing, and inability to predict the clamping speed well; there is no good line type in the discrete processing method, and the fitting accuracy cannot be met with a small amount of data, and the highest fitting accuracy that can be achieved is low. There are generally too many fitting data and the overall calculation amount is large. In addition, more high-order equations are used, etc., without considering fitting and interpolation processing from the perspective of actual quadratic curves. Summary of the invention
[0006] The purpose of the present invention is to solve the problems of low fitting accuracy of spline curves in existing CNC machining methods and large amount of calculation required for spline curve interpolation resulting in low interpolation efficiency, and to propose a NURBS curve interpolation method based on elliptical arc fitting.
[0007] The technical solution adopted by the present invention to solve the above technical problems is: a NURBS curve interpolation method based on elliptical arc fitting, the method specifically comprising the following steps:
[0008] Step 1: After the spline curve for CNC machining is segmented, elliptical arc fitting is performed on each segment of the curve in turn to obtain the elliptical arc fitting results corresponding to each segment of the curve;
[0009] In step 1, the specific process of performing elliptical arc fitting on each segment of the curve is as follows:
[0010] Step 1: The segmentation points of the spline curve of CNC machining are represented as u0, u1, ..., u k+1 , where the starting point u of the spline curve is s =u0, the end point u of the spline curve e =u k+1 , calculate the intermediate variable Δu:
[0011]
[0012] Then u1=u0+Δu, u2=u1+Δu,...,u e =u k+1 =u k +Δu;
[0013] Step 1 and 2: Place the entire spline curve into the Cartesian coordinate system to obtain the coordinates of each segment point in the Cartesian coordinate system;
[0014] For any curve, let the two endpoints of the curve be u n and u n+1 , will u n The coordinate in the Cartesian coordinate system is labeled A′, and u n+1The coordinate in the Cartesian coordinate system is marked as B', the intersection of the tangent line through point A' and the tangent line through point B' is marked as D', and the intersection of the normal line through point A' and the normal line through point B' is marked as C';
[0015] In the Cartesian coordinate system, the curve segment is rotated by an angle α to obtain the curve segment after rotation in the Cartesian coordinate system. The endpoint u of the rotated curve segment is n The position in the Cartesian coordinate system is denoted by A(x A ,y A ), the endpoint u of the rotated curve segment n+1 The position in the Cartesian coordinate system is denoted as B(x B ,y B ), the intersection of the tangent line through point A and the tangent line through point B in the Cartesian coordinate system is recorded as D(x D ,y D ), the intersection of the normal line through the tangent line at point A and the normal line through the tangent line at point B in the Cartesian coordinate system is recorded as C(x C ,y C );
[0016] According to the formula:
[0017]
[0018] After finishing, we get:
[0019]
[0020] Find C(x C ,y C ) and D(x D ,y D ), select the length of the longest side among AD, DB, BC and AC as the major semi-axis a of the elliptical arc, and the length of the shortest side as the minor semi-axis b of the elliptical arc;
[0021] Step 13: Point A(x A ,y A ) as the initial coordinates of the elliptical arc, and point B(x B ,y B ) as the end coordinates of the elliptical arc, perform elliptical arc fitting on the rotated curve segment according to the determined major semi-axis a and minor semi-axis b, obtain a preliminary fitting curve corresponding to the rotated curve segment, that is, solve the elliptical arc, and then execute step 14;
[0022] Step 14: Mark the midpoint coordinates of the fitting curve, i.e. the elliptical arc, as coordinate points The midpoint of the rotated curve segment in the Cartesian coordinate system is denoted as F, and the midpoint F is The distance between them is taken as the fitting error ε;
[0023] If the fitting error ε is less than or equal to the set threshold, execute step 16;
[0024] If the fitting error ε is greater than the set threshold, execute step 15;
[0025] Step 15: Perform secondary segmentation on the rotated curve segment, that is, As the two endpoints of the curve, use the method of steps 12 to 14 to get the endpoints u n and The curve is fitted;
[0026] Step 16: Use the elliptical arc obtained by preliminary calculation as the fitting curve of the rotated curve segment, and use the method of steps 12 to 14 to fit the next curve segment;
[0027] Step 2: Plan the elliptical arc speed according to the length of the major semi-axis, the minor semi-axis, the expected speed and the maximum acceleration allowed by each coordinate axis of the fitted ellipse;
[0028] Step 3: According to the speed planning, the starting point and the end point of the elliptical arc to be completed in each interpolation cycle are obtained, and then the interpolation processing of the elliptical arc is performed.
[0029] The beneficial effects of the present invention are:
[0030] Compared with the direct processing algorithm of NURBS curve, the method of the present invention utilizes the original curve after segmentation by fitting the elliptical arc. The feeding speed of the elliptical fitting interpolation is smooth, which can greatly reduce the vibration of the machine tool; at the same time, the curvature radius of the elliptical arc is variable, which can meet different bending forms; the advantages of the method of the present invention are high elliptical fitting accuracy, short interpolation time, high efficiency, small amount of calculation required, low calculation complexity, and the maximum possible approach to the expected speed, while the error with the shape of the original curve is very small. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 is a flow chart of the method of the present invention;
[0032] Figure 2 A schematic diagram of segmenting a spline curve;
[0033] Figure 3 Flow chart for elliptical arc fitting;
[0034] Figure 4 It is a schematic diagram of a spline curve in a plane rectangular coordinate system;
[0035] Figure 5 It is a schematic diagram of a curve in a plane rectangular coordinate system;
[0036] Figure 6 for Figure 5 Schematic diagram of the curve after rotation by angle α;
[0037] Figure 7 This is the preliminary elliptical arc fitting result diagram;
[0038] Figure 8 It is a schematic diagram of fitting error judgment;
[0039] Fig. 9 is a flowchart of the interpolation algorithm;
[0040] Fig.10 It is a schematic diagram of dividing the interval;
[0041] Fig.11 Flowchart for speed planning;
[0042] Fig.12 It is a schematic diagram of using quadrant angle to divide the interval;
[0043] Fig.13 It is a schematic diagram of the rotation of an elliptical arc;
[0044] Fig.14 Schematic diagram of the tangent vector and normal vector of any point of an ellipse;
[0045] Fig.15 It is a schematic diagram of obtaining L according to the Pythagorean theorem;
[0046] Fig.16 It is a schematic diagram of the change of velocity direction in centripetal motion;
[0047] Fig.17 It is the speed curve diagram of pure acceleration motion and pure deceleration motion;
[0048] Fig.18 is the speed curve diagram to reach the desired speed;
[0049] Fig.19 Speed curve diagram for reaching maximum speed;
[0050] Fig. 20 A speed curve diagram showing a speed exceeding the expected speed. DETAILED DESCRIPTION
[0051] Specific implementation method 1. Combination Figure 1 The present embodiment describes a NURBS curve interpolation method based on elliptical arc fitting, and the method specifically comprises the following steps:
[0052] Step 1: Figure 2 As shown, after the spline curve of CNC machining is segmented, the elliptical arc fitting is performed on each segment of the curve in turn, and the elliptical arc fitting results corresponding to each segment of the curve are obtained respectively;
[0053] Step 2: Plan the elliptical arc speed according to the length of the major semi-axis, the minor semi-axis, the expected speed and the maximum acceleration allowed by each coordinate axis of the fitted ellipse;
[0054] Step 3: According to the speed planning, the starting point and the end point of the elliptical arc to be completed in each interpolation cycle are obtained, and then the interpolation processing of the elliptical arc is performed.
[0055] The principle of the elliptical arc fitting curve algorithm is to select an arbitrary segment of the original curve, use the initial coordinates and end coordinates of the selected curve segment, and use these two point coordinates through the elliptical arc solving method in the algorithm to obtain an elliptical arc curve segment that is consistent with the original curve segment's first and last coordinates. Solve the difference between the midpoints of the variables of the original curve and the fitting curve to obtain the fitting error. If the requirements are met, the next segment of the curve is fitted. If the requirements are not met, the midpoint coordinates and the initial coordinates need to be used as a new curve segment and the elliptical arc fitting curve is used again. Iterate according to the above method until the fitting error meets the requirements. The method of the present invention can obtain better fitting accuracy with a smaller number of segments.
[0056] In terms of speed planning, the present invention uses the tangent vector on the elliptical arc to synthesize the acceleration to obtain the maximum acceleration at any point on the elliptical arc for integration, obtains the time-speed curve, and then obtains faster operating efficiency under the premise of satisfying various clamping speeds. The present invention uses the plane where the elliptical arc is located to map and transform into the X and Y axes of the rectangular coordinate system, and calculates the angle of quadrant division according to the maximum acceleration allowed by the X and Y axes of the plane rectangular coordinate system. Following the principle that the decomposed acceleration of the synthetic acceleration decomposed into each axis cannot exceed the maximum calculated speed value allowed by each axis, the synthetic acceleration of any angle on the elliptical arc is solved, and the maximum allowable terminal speed is solved according to the three clamping requirements of the terminal speed, and then the initial speed of the elliptical arc segment is solved. According to the speed-time formula, the speed change in any interpolation cycle is solved and the corresponding speed planning diagram is drawn. The initial speed, initial angle, terminal speed, terminal angle and other related data information of the corresponding elliptical arc are solved by different speed categories, providing data for the next step of elliptical arc interpolation.
[0057] In the interpolation stage, the present invention interpolates the elliptical arc by obtaining an angle change Δθ through the longest number of pulses completed in the interpolation cycle and the difference between the first and last angles of the elliptical arc, and then uses the elliptical arc formula to calculate the next interpolation coordinate, and uses this method to perform iterative calculations in turn to complete the interpolation of the elliptical arc. Different from the current mainstream processing method, the present invention adopts a method based on angle increment to determine the pulse sent to each axis each time. The calculation process is simpler and more efficient, reducing the conventional classification processing of the eight quadrants, and normalizing them to the same processing model. Finally, the high efficiency and high precision of the entire processing method are verified through simulation. At the same time, this processing method can also be used in the processing methods of other types of curves, and has a certain versatility.
[0058] Specific implementation method 2: Combination Figure 3 The present embodiment is different from the first embodiment in that, in step 1, the specific process of fitting the elliptical arc to each segment of the curve is as follows:
[0059] Step 1: The segmentation points of the spline curve of CNC machining are represented as u0, u1, ..., u k+1 , where the starting point u of the spline curve is s =u0, the end point u of the spline curve e =u k+1 , calculate the intermediate variable Δu:
[0060]
[0061] Then u1=u0+Δu, u2=u1+Δu,...,u e =u k+1 =u k +Δu;
[0062] Step 1 and 2: Figure 4 As shown, put the entire spline curve into the Cartesian coordinate system to obtain the coordinates of each segment point in the Cartesian coordinate system;
[0063] For any curve, let the two endpoints of the curve be u n and u n+1 ,like Figure 5 As shown, u n The coordinate in the Cartesian coordinate system is labeled A′, and u n+1 The coordinate in the Cartesian coordinate system is marked as B', the intersection of the tangent line through point A' and the tangent line through point B' is marked as D', and the intersection of the normal line through point A' and the normal line through point B' is marked as C';
[0064] like Figure 6As shown, in the Cartesian coordinate system, the curve segment is rotated by an angle α to obtain the curve segment after the curve segment is rotated in the Cartesian coordinate system. The endpoint u of the rotated curve segment is n The position in the Cartesian coordinate system is denoted by A(x A ,y A ), the endpoint u of the rotated curve segment n+1 The position in the Cartesian coordinate system is denoted as B(x B ,y B ), the intersection of the tangent line through point A and the tangent line through point B in the Cartesian coordinate system is recorded as D(x D ,y D ), the intersection of the normal line through the tangent line at point A and the normal line through the tangent line at point B in the Cartesian coordinate system is recorded as C(x C ,y C );
[0065] According to the formula:
[0066]
[0067] After finishing, we get:
[0068]
[0069] Find C(x C ,y C ) and D(x D ,y D ), select the length of the longest side among AD, DB, BC and AC as the major semi-axis a of the elliptical arc, and the length of the shortest side as the minor semi-axis b of the elliptical arc;
[0070] Step 13: Point A(x A ,y A ) as the initial coordinates of the elliptical arc, and point B(x B ,y B ) as the end coordinates of the elliptical arc, perform elliptical arc fitting on the rotated curve segment according to the determined major semi-axis a and minor semi-axis b, obtain a preliminary fitting curve corresponding to the rotated curve segment, that is, solve the elliptical arc, and then execute step 14;
[0071] Step 14: Figure 7 As shown, the coordinates of the midpoint of the fitting curve, i.e. the elliptical arc, are marked as coordinate points The midpoint of the rotated curve segment in the Cartesian coordinate system is denoted as F, and the midpoint F is The distance between them is taken as the fitting error ε;
[0072] Fitting error analysis between the fitting curve (i.e. elliptical arc) and the original curve
[0073] like Figure 7 As shown, there is a fitting error ε between the fitting curve (ie, the elliptical arc) and the original curve, and it is determined whether the fitting error meets the requirements.
[0074] The current mainstream method for judging the fitting error is to take the midpoint of the fitting curve and the midpoint of the original curve, and the distance between the two points is the fitting error. Figure 7 As shown, the coordinates of point F are the coordinates corresponding to the median of the first and last u values of the original curve. The midpoint F of the spline curve segment is the same as the midpoint of the fitting curve segment. The distance between is the fitting error ε. Figure 8 As shown,
[0075] (I) When the fitting error is within the fitting accuracy, we proceed to the next stage of spline curve fitting and interpolation.
[0076] (II) When the fitting error is beyond the fitting accuracy, we divide the previous segmentation points into two segments, that is, Repeat the above steps to perform fitting and interpolation until the fitting accuracy is met.
[0077] If the fitting error ε is less than or equal to the set threshold, execute step 16;
[0078] If the fitting error ε is greater than the set threshold, execute step 15;
[0079] Step 15: Perform secondary segmentation on the rotated curve segment, that is, u n and As the two endpoints of the curve, use the method from step 12 to step 14 to get the endpoints un and The curve is fitted;
[0080] Step 16: Use the elliptical arc obtained by preliminary calculation as the fitting curve of the rotated curve segment, and use the methods of steps 12 to 14 to fit the next curve segment.
[0081] According to the known data x B =CE,x C =0, Δy=y A -y B ,y B =b-Δy to obtain the following formula:
[0082]
[0083] according to y A -y B =Δy=b-bsinθ, we get
[0084]
[0085] Substituting the above equation into Δy=b-bsinθ, we get the following equation:
[0086]
[0087] The value of sinθ is obtained from the root formula of the sinθ quadratic function:
[0088]
[0089] cosθ can also be determined by Determines the numerical size of the semimajor axis of the ellipse.
[0090] The other steps and parameters are the same as those in the first embodiment.
[0091] Specific implementation method three: Combination Fig.10 This embodiment is different from the first or second embodiment in that the specific process of step three is as follows:
[0092] Step 31. In the coordinate system with the major axis of the ellipse as the X' axis and the minor axis as the Y' axis, calculate the segmentation angle θ' on the ellipse as:
[0093]
[0094] Among them, β represents the angle of rotation of the ellipse during the ellipse fitting process, and θ is the longest pulse axis of the ellipse arc vector in the coordinate system after rotating by β (each time a pulse is sent for interpolation in this area, this axis must participate in sending the pulse, that is, the longest pulse axis) to distinguish the angle;
[0095] Then, four angle regions are solved according to the segmentation angle θ′:
[0096]
[0097] That is, the elliptical interpolation area is divided into four intervals: (θ′1, θ′2], (θ′2, θ′3], (θ′3, θ′4], and (θ′4, θ′1]; the longest pulse axis in the intervals (θ′2, θ′3] and (θ′4, θ′1] is the Y axis, and the longest pulse axis in the intervals (θ′1, θ′2] and (θ′3, θ′4] is the X axis;
[0098] Step 32: The coordinates of the center of the ellipse are expressed as O(x0, y0), the coordinates of the interpolation starting point are expressed as (x1, y1), and the coordinates of the interpolation end point are expressed as (x n ,y n ), θ s is the angle between the vector from the interpolation starting point to the center of the ellipse and the positive semi-axis of the X-axis, that is, θ eis the angle between the vector from the interpolation end point to the center of the ellipse and the positive semi-axis of the X-axis, that is,
[0099] Then the initial angle θ′ after rotating by angle β s =θ s -β, end angle θ′ e =θ e -β;
[0100] If at least one of the four angles θ′1, θ′2, θ′3, θ′4 exists in θ′ s and θ′ e Between, according to the system of equations:
[0101]
[0102] Solve the two points that satisfy the equations, and then determine the uniqueness of the image to get the point P(x θ′ ,y θ′ ), and according to the point P(x θ′ ,y θ′ ) Calculate the number of pulses in the part where the longest pulse axis is the X axis:
[0103]
[0104] Among them, pulunit y is the pulse equivalent of the Y axis, pulunit x is the pulse equivalent of the X axis (the unit of pulse equivalent is pulse / mm, that is, the number of pulses per unit length of 1 mm), (x′ n , y′ n ) is the coordinate of the interpolation end point after rotation angle β;
[0105] When |x θ′ -x′ n | and |y θ′ -y′ n |If there is a decimal part, if the decimal part is greater than 0.5, directly increase it by 1, otherwise, only keep the integer part;
[0106] Then the number of pulses n1 where the longest pulse axis is the X-axis is: n1 = n x1 ;
[0107]
[0108] Among them, (x′1, y′1) is the coordinate of the interpolation starting point after rotation angle β;
[0109] When |x θ′ -x′1| and|y θ′-y′1| If there is a decimal part, if the decimal part is greater than 0.5, it is directly increased by 1, otherwise, only the integer part is retained;
[0110] The number of pulses n2 where the longest pulse axis is the Y axis is: n2 = n y2 ;The total number of pulses is n=n1+n2;
[0111] If the four angles θ′1, θ′2, θ′3, and θ′4 do not exist in θ′ s and θ′ e Between, then:
[0112]
[0113] When |x′ n -x′1| and|y′ n -y′1| If there is a decimal part, if the decimal part is greater than 0.5, it is directly increased by 1, otherwise, only the integer part is retained;
[0114] The total number of pulses is: n = max{n x , n y};
[0115] Calculate the angle of each segment of the ellipse according to the total number of pulses n The included angle has positive and negative signs, which means that the end angle of the ellipse can be reached by simply adding the initial angle of the ellipse n times.
[0116] The default range of the initial and final angles is 0-360°. When interpolating clockwise, we stipulate that the initial and final angle differences are negative, and the angles are decreasing. If θ e >θ s The angle is increasing, let θ e =θ e -360, then the initial end angle difference is θ e -θ s .
[0117] When interpolating counterclockwise, we stipulate that the initial and final angle differences are positive. Then the angle is increasing. If θ e <θ s The angle is decreasing, let: θ e =θ e +360, then the initial end angle difference is θ e -θ s .
[0118] Step 3: According to the expression of the ellipse, the coordinates of the interpolation starting point are expressed as x1 = a × cosθ s , y1=b×sinθ s , considering the influence of the rotation angle β, solve the interpolation starting point coordinates in the X′OY′ coordinate system;
[0119] The distance len1 from the interpolation starting point coordinate to the center of the ellipse is:
[0120]
[0121] The trigonometric function of the angle between the vector from the interpolation starting point coordinates to the ellipse center coordinates and the positive semi-axis of the X-axis is:
[0122]
[0123] According to the above solution, the initial angle θ′ after the rotation angle β s =θ s -β, the next step is to solve the interpolation starting point coordinates (x′1, y′1) in the X′OY′ coordinate system:
[0124]
[0125] Next, according to the equation of the ellipse in the X′OY′ coordinate system:
[0126]
[0127] The angle between the interpolated coordinates (x′2, y′2) of the next point of the ellipse and the vector from the center of the ellipse and the positive semi-axis of X′ is θ′ 2_se =θ′ s +Δθ, according to θ′ 2_se Get the interpolation coordinates of the next point:
[0128]
[0129] The distance len′2 from (x′2, y′2) to the center of the ellipse is:
[0130]
[0131] The trigonometric function of the angle between the vector from (x'2, y'2) to the center of the ellipse and the positive semi-axis of the X' axis is:
[0132]
[0133] After the rotation angle θ 2_se =θ′ 2_se +β, the coordinates of the coordinate point (x′2, y′2) in the Cartesian coordinate system are:
[0134]
[0135] Step 34: Set the pulse remainder in the X-axis direction to repulse _x , the pulse remainder in the Y-axis direction is repulse _y, according to (x1, y1) and (x2, y2), we can get the coordinate increment Δx1 in the X-axis direction and the coordinate increment Δy1 in the Y-axis direction:
[0136] Δx1=x2-x1
[0137] Δy1=y2-y1
[0138] Then the pulse remainder in the X-axis direction is repulse _x =Δx1×pulunit x , the pulse remainder in the Y-axis direction is repulse _y =Δy1×pulunit y ;
[0139] Then according to repulse _x and repulse _y Determine pulse coordinates;
[0140] Step 35: Obtain the coordinates of all interpolation points on the interpolation segment through the method of step 33 to step 34, that is, the coordinates of any interpolation point (x i ,y i ) and any pulse coordinate (x i_r ,y i_r ).
[0141] The coordinates of any interpolation point are in (x′ i , y′ i ) are the coordinates of the ellipse in the X′OY′ coordinate system.
[0142] Among them, the four variables cosβ, sinβ, cosΔθ, and sinΔθ can be obtained before the interpolation begins, and can be directly brought in as constant values when the interpolation is subsequently performed. Therefore, the above formula only involves addition, subtraction, multiplication, and division operations, and does not involve trigonometric function operations, which reduces the calculation complexity and improves the calculation accuracy. The pulse is sent according to the relationship between the interpolation point and the pulse margin until the coordinates of the interpolation point reach the interpolation end point.
[0143] In order to prevent the occurrence of a full circle, a marking quantity needs to be added. When interpolation is performed for the first time, there is no need to judge the end point coordinates. If the end point coordinates need to be compared and judged from the second time, if the error with the end point coordinates is within 0.5 pulses, it can be said that the elliptical arc interpolation of this section of the curve is completed, and the next section of interpolation is performed until the entire curve fitting is completed.
[0144] The other steps and parameters are the same as those in the first or second embodiment.
[0145] Specific implementation method four: Combination Fig. 9This embodiment is different from the first to third embodiments in that the repulse _x and repulse _y Determine the pulse coordinates, the specific process is:
[0146] I. When | repulse _x |≥|repulse _y |, the coordinates of the pulse sent to the X-axis are determined as follows:
[0147] If repulse _x > 0, then the X-axis coordinate x of the ith pulse i_r For: x i_r =x (i-1)_ r+1 / pulunit x , i≥2, i is the i-th pulse, x (i-1)_r is the X-axis coordinate of the i-1th pulse;
[0148] If repulse _x ≤0, then the X-axis coordinate x of the i-th pulse i_r For: x i_r =x (i-1)_r -1 / pulunit x ;
[0149] When | repulse _x |≥|repulse _y |, the coordinates of the pulse sent to the Y axis are determined as follows:
[0150] Step 1: If repulse _y > 0, when the Y axis does not send a pulse, record the Y axis coordinate y of the i-th pulse i_r_1 =y (i-1)_r ,y (i-1)_r is the Y-axis coordinate of the i-1th pulse. When the Y-axis sends a pulse, the Y-axis coordinate y of the i-th pulse is recorded. i_r_2 =y (i-1)_r +1 / pulunit y ;
[0151] If repulse _y ≤0, when the Y axis does not send a pulse, record the Y axis coordinate y of the i-th pulse i_r_1 =y (i-1)_r , when the Y axis sends a pulse, record the Y axis coordinate y of the i-th pulse i_r_2 =y (i-1)_r -1 / pulunit y ;
[0152] Step 2: According to the pulse coordinates (xi_r ,y i_r_1 ) determines the feedback value ret1, according to the pulse coordinate (x i_r ,y i_r_2 ) Determine the feedback value ret2;
[0153] Find the pulse coordinates (x i_r ,y i_r_1 ) to the center of the ellipse len i_r_1 :
[0154] Pulse coordinates (x i_r ,y i_r_1 ) to the center of the ellipse and the angle θ′ between the positive semi-axis X′ i_r_1 The trigonometric functions are:
[0155]
[0156] Let θ″ i_r_1 =θ′ i_r1 -β, according to θ″ i_r_1 Solve the pulse coordinates (x′ i_r , y′ i_r_1 ):
[0157]
[0158] According to the converted pulse coordinates (x′ i_r , y′ i_r_1 ) Solve for the feedback value ret1:
[0159]
[0160] Similarly, for the pulse coordinates (x i_r ,y i_r_2 ) is processed to solve the feedback value ret2;
[0161] Step 3: If ret1>ret2, the Y axis sends a pulse, and the pulse coordinate in the Y axis direction is y i_r =y i_r_2 If ret1≤ret2, the Y axis does not send a pulse, and the pulse coordinate y in the Y axis direction i_r =y i_r_1 , and then get the pulse coordinates of the i-th pulse (x i_r ,y i_r );
[0162] II.when|repulse _x |<|repulse _y |, the coordinates of the pulse sent to the Y axis are determined as follows:
[0163] If repulse _y > 0, then the Y-axis coordinate y of the i-th pulse i_r is: y i_r =y (i-1)_r +1 / pulunit y , i≥2, i is the i-th pulse, y (i-1)_r is the Y-axis coordinate of the i-1th pulse;
[0164] If repulse _y ≤0, then the Y-axis coordinate y of the i-th pulse i_r is: y i_r =y (i-1)_r -1 / pulunit y ;
[0165] When | repulse _x |<|repulse _y |, the coordinates of the pulse sent to the X-axis are determined as follows:
[0166] Step (1): If repulse _x > 0, when the X-axis does not send a pulse, record the X-axis coordinate x of the ith pulse i_r_1 =x (i-1)_r , x (i-1)_r is the X-axis coordinate of the i-1th pulse. When the X-axis sends a pulse, the X-axis coordinate of the i-th pulse is recorded as x i_r_2 =x (i-1)_r +1 / pulunit x ;
[0167] If repulse _x ≤0, when the X-axis does not send a pulse, record the X-axis coordinate x of the i-th pulse i_r_1 =x (i-1)_r , when the X-axis sends a pulse, record the X-axis coordinate x of the i-th pulse i_r_2 =x (i-1)_r -1 / pulunit x ;
[0168] Step (2): According to the pulse coordinates (x i_r_1 ,y i_r ) determines the feedback value ret3, according to the pulse coordinate (x i_r_2 ,y i_r ) Determine the feedback value ret4;
[0169] Solve for the pulse coordinates (x i_r_1 ,y i_r ) to the center of the ellipse len i_r_2 :
[0170] Pulse coordinates (x i_r_1 ,y i_r ) to the center of the ellipse and the angle θ′ between the positive semi-axis X′ i_r_2 The trigonometric functions are:
[0171]
[0172] Let θ″ i_r_2 =θ′ i_r_2 -β, according to θ″ i_r_2 Solve the pulse coordinates (x′ i_r_1 , y′ i_r ):
[0173]
[0174] Simplify the above formula to:
[0175] According to the converted pulse coordinates (x′ i_r_1 , y′ i_r ) Solve for the feedback value ret3:
[0176]
[0177] Similarly, for (x i_r_2 ,y i_r ) is processed to obtain ret4;
[0178] Step (3): If ret3>ret4, the X-axis sends a pulse, and the pulse coordinate in the X-axis direction is x i_r =x i_r_2 If ret3≤ret4, the X-axis does not send a pulse, and the pulse coordinate x in the X-axis direction i_r =x i_r_1 , and then get the pulse coordinates of the i-th pulse (x i_r ,y i_r ).
[0179] Specific implementation method 5: This implementation method is different from the specific implementation methods 1 to 4 in that the angle θ is calculated as follows:
[0180]
[0181] Among them, pulunit x is the pulse equivalent of the X axis, pulunit y It is the pulse equivalent of Y axis.
[0182] The other steps and parameters are the same as those in Specific Embodiments 1 to 3.
[0183] Specific implementation method six: Combination Fig.11 This embodiment is different from the first to fifth embodiments in that the specific process of the elliptical arc velocity planning is as follows:
[0184] According to the known maximum acceleration allowed by each coordinate axis, the angle θdiv is calculated for quadrant division, and four quadrants are divided by θdiv, such as Fig.12 As shown, the four quadrants are 0°~θdiv, θdiv~180°-θdiv, 180°-θdiv~180°+θdiv, 180°+θdiv~360°-θdiv;
[0185]
[0186] When the curve fitting method is used for speed planning, the ellipse will rotate at a certain angle, such as Fig.13 As shown:
[0187] according to Fig.13 It can be concluded that β = ∠BO2P1-∠P1O2C. (Follow the principle of positive and negative angles)
[0188] like Fig.14 As shown, the normal vector of the tangent line at any point on the ellipse can be set to:
[0189]
[0190] Then the tangent vector of any point on the ellipse can be set as:
[0191]
[0192] The angle of the tangent at any point of the ellipse before rotation is θ, so the angle of the tangent after rotation is α=θ+β, and tanα can be changed to the following formula:
[0193]
[0194] according to Fig.15 The proportional relationship between the three sides of the triangle shown is known. Let the opposite side of angle α be: -bcosθ′cosβ+asinθ′sinβ, and the adjacent side be:asinθ′cosβ+bcosθ′sinβ. In the right triangle, use the Pythagorean theorem to get L:
[0195]
[0196] The calculation formula of the split angle after rotating a certain angle is as follows:
[0197]
[0198] At the same time, the maximum synthetic acceleration a under different split quadrants is obtained max According to the principle that the acceleration components of the composite acceleration decomposed into the XY axes cannot exceed the maximum acceleration allowed by the XY axes, the calculation formula and interval division are as follows:
[0199]
[0200] where a max_x It represents the maximum allowable acceleration value of the X-axis, a max_y Indicates the maximum allowed acceleration value on the Y axis.
[0201] The maximum allowable end velocity of an elliptical arc segment is constrained by four clamped velocities, as follows:
[0202] ① Clamping of reverse acceleration
[0203] According to the formula The speed at the end of the last elliptical arc segment is 0, and the maximum speed reached by reverse acceleration is v e_1 .
[0204] ② Clamping of maximum permissible centripetal acceleration
[0205] When the acceleration moves on the elliptical arc, a centripetal acceleration will be generated and constrained by the centripetal acceleration. According to the formula Simplify the formula (a n The value is the proportional coefficient η of the maximum synthetic acceleration, r is the curvature radius of the end. If the end of the current ellipse is connected to the next ellipse, the curvature radius r at this time is taken as the curvature radius r of the end of the current ellipse arc. e_now and the initial radius of curvature of the next ellipse r ns_now The minimum value of the two, that is, r = min (r e_now , r ns_now )) Get the terminal velocity v under the centripetal acceleration clamp e_2 .
[0206] ③Speed clamping when the direction of speed movement changes
[0207] In centripetal motion, turning means that the speed does not change, only the direction, e.g. Fig.16 As shown:
[0208]
[0209] Where φ is the angle at which the velocity direction changes, i.e. the maximum allowable terminal velocity v of the elliptical arc segment. e =min{v e_1 , v e_2, v e_3 , v r},v r is the expected speed. That is, the minimum value of the four speeds is taken as the maximum running end speed of this elliptical arc segment.
[0210] Because the formula for the length of any arc of an ellipse is: Then the arc length radius for any angle on the elliptical arc is approximately: From the initial angle θ s Angle θ to the end e Integrate to get the velocity change Δv over distance S 2 ,as follows:
[0211]
[0212]
[0213]
[0214] In the formula,
[0215] (1) When At this time, the motion in the elliptical arc segment is pure acceleration or pure deceleration, as shown in the schematic diagram. Fig.17 As shown:
[0216] The initial synthetic acceleration a of the current interpolation cycle T1 The acceleration within approximate T is positive or negative depending on whether it is pure acceleration or pure deceleration. If it is pure acceleration, it is positive, and if it is pure deceleration, it is negative. Solve S using the distance acceleration formula T1 ,as follows:
[0217]
[0218] v s_T1 is the initial speed of the interpolation cycle, and is also the terminal speed of the previous interpolation cycle. Therefore, the arc length radius corresponding to the initial angle of the interpolation cycle is The angle change dθ of the interpolation cycle is solved as follows:
[0219] S T1 =r T1 ×dθ
[0220] By using the above formula dθ and the initial angle θ of the interpolation cycle s_T1 Solve for the end angle θ e_T1 ,as follows:
[0221] dθ=θ s_T1 -θ e_T1
[0222] According to the initial angle and the final angle, the velocity change of the interpolation cycle is solved using equations (1) and (2): The terminal velocity is solved using the velocity change as follows:
[0223] Pure acceleration motion process:
[0224] Pure deceleration motion process:
[0225] However, the terminal velocity at this time is still clamped by the centripetal acceleration. According to the second case of the clamped velocity, we can get At this time, the end speed of the interpolation cycle is v′ e_T1 =min(v n , v e_T1 ), and then |v′ e_T1 -v e |The angle θ at the end of this interpolation cycle e_T1 Angle θ to the end of this elliptical arc segment e The maximum velocity change Δv′ to be solved is solved by referring to equations (1) and (2), where the initial angle and the final angle are: the final angle of this interpolation cycle θ e_T1 and the angle θ at the end of this elliptical arc segment e ;|v′ e_T1 -v e |, Δv′ are compared to obtain the terminal velocity at the end of the interpolation cycle, as follows:
[0226]
[0227] (2) When (can reach the maximum permissible speed v e ), the time-speed curve in this case is divided into three cases.
[0228] ①v s ≤v r , and v m >v r (v m is the maximum speed, with the speed v at the end of the elliptical arc e is the initial velocity, and the angle at the end of the elliptical arc is the initial angle θ e , with the initial position of the elliptical arc as the end angle θ s , use formula 2 to integrate the speed and solve the maximum speed change Then use formula 1 to solve for the maximum speed By v s Accelerate to the desired speed v r , maintain the desired speed v r for a period of time, then decelerates to reach the maximum permissible speed ve ,like Fig.18 As shown:
[0229] ②v s ≤v r , and v m ≤v r (v m is the maximum speed): by v s Accelerate to maximum speed v m , and then decelerate to the maximum permissible speed v e ,like Fig.19 As shown:
[0230] ③v s >v r : For deceleration, v s Slow down to the desired speed v r , maintain for a while, and then decelerate to the maximum permissible speed v e ,like Fig. 20 As shown:
[0231] for In this case, the interpolation cycle first passes through the acceleration required to reach the desired speed. The positive and negative value of the resultant acceleration is taken as the basis for the positive and negative value of the resultant acceleration. s-r > 0, then the resultant acceleration a T1 >0, otherwise if Δa s-r <0, then the resultant acceleration a T1 <0, where T is the interpolation period, and then compare the absolute values of the two, and then process them according to the situation:
[0232] (1) If |Δa s-r |≤|a T1 |, which means that the expected speed can be reached within this interpolation cycle, and the distance is solved according to the acceleration required to reach the expected speed The angle θ at the end of the interpolation cycle can be solved e_T1 , the speed at the end of the interpolation cycle time is v r The end point of the interpolation cycle can be determined based on the angle at which the interpolation cycle ends.
[0233] (2) If |Δa s-r |>|a T1 |, which means that the expected speed cannot be reached, and the deceleration or acceleration state is always maintained to end the interpolation cycle, and the angle θ at the end of the interpolation cycle is calculated. e_T1 , the speed at the end of the interpolation cycle time is v e_T1 , and the angle θ at the end of the interpolation cycle e_T1 The method is the same as The motion within the elliptical arc segment is consistent with the pure acceleration or pure deceleration method described above.
[0234] Because when In this case, the end speed of the elliptical arc segment can be achieved. In order to prevent the calculation from failing to determine the deceleration point position, it is necessary to add another check in each interpolation cycle, that is, to use the end speed v of the elliptical arc as the e is the initial velocity, and the angle at the end of the elliptical arc is the initial angle θ e , with the end angle θ of the current interpolation cycle of the elliptical arc e_T1 is the end angle, and the maximum velocity change is obtained by velocity integration using formula (2): Then use formula (1) to solve the maximum speed When v e_T1 ≥v m_e_e_T1 This means that the speed v m_e_e_T1 The end speed of this interpolation cycle is v e_T1 =v m_e_e_T1 , and the mark enters the pure deceleration stage, and the subsequent processing is carried out according to the pure deceleration processing method; if v e_T1 <v m_e_e_T1 , it means that it has not yet reached the pure deceleration stage and can continue to proceed according to the previous calculation method.
[0235] The speed, distance and angle of the interpolation cycle are solved and the processed spline curve is fitted by using elliptical arc interpolation, so as to provide data for realizing the interpolation method of the present invention and solve the problem of unstable feeding speed of the previous interpolation algorithm.
[0236] The other steps and parameters are the same as those in Specific Implementation Methods 1 to 5.
[0237] The above calculation examples of the present invention are only used to explain the calculation model and calculation process of the present invention in detail, and are not intended to limit the implementation methods of the present invention. For ordinary technicians in the relevant field, other different forms of changes or modifications can be made based on the above description. It is impossible to list all the implementation methods here. All obvious changes or modifications derived from the technical solution of the present invention are still within the scope of protection of the present invention.
Claims
1. A NURBS curve interpolation method based on elliptical arc fitting, characterized in that: The method specifically comprises the following steps: Step 1: After the spline curve for CNC machining is segmented, elliptical arc fitting is performed on each segment of the curve in turn to obtain the elliptical arc fitting results corresponding to each segment of the curve; In step 1, the specific process of performing elliptical arc fitting on each segment of the curve is as follows: Step 1: Denote each segment point of the spline curve processed by CNC as u0, u1, ..., u k+1 , where the starting point u of the spline curve is s =u0, the end point u of the spline curve e =u k+1 , calculate the intermediate variable Δu: If u1=u0+Δu, u2=u1+Δu,…, u e =u k+1 =u k +Δu; Step 1 and 2: Place the entire spline curve into the Cartesian coordinate system to obtain the coordinates of each segment point in the Cartesian coordinate system; For any segment of a curve, let the two endpoints of the segment be u n and u n+1 , will u n The coordinate in the Cartesian coordinate system is labeled A′, and u n+1 The coordinate in the Cartesian coordinate system is marked as B', the intersection of the tangent line through point A' and the tangent line through point B' is marked as D', and the intersection of the normal line through point A' and the normal line through point B' is marked as C'; In the Cartesian coordinate system, the curve is rotated by an angle α to obtain the arc segment of the curve after rotation in the Cartesian coordinate system. The endpoint u of the rotated arc segment is n The position in the Cartesian coordinate system is denoted by A(x A ,y A ), the endpoint u of the rotated arc segment n+1 The position in the Cartesian coordinate system is denoted as B(x B ,y B ), the intersection of the tangent line through point A and the tangent line through point B in the Cartesian coordinate system is recorded as D(x D ,y D ), the intersection of the normal line through the tangent line at point A and the normal line through the tangent line at point B in the Cartesian coordinate system is recorded as C(x C ,y C ); According to the formula: After finishing, we get: Find C(x C ,y C ) and d(x D ,y D ), select the length of the longest side among AD, DB, BC and AC as the major semi-axis a of the elliptical arc, and the length of the shortest side as the minor semi-axis b of the elliptical arc; Step 13: Point A(x A ,y A ) as the initial coordinates of the elliptical arc, and point B(x B ,y B ) as the end coordinates of the elliptical arc, perform elliptical arc fitting on the rotated arc segment according to the determined major semi-axis a and minor semi-axis b, obtain a preliminary fitting curve corresponding to the rotated arc segment, and then execute step 14; Step 14: The time required to complete the journey on AD is recorded as T, and the initial fitting curve is The coordinate point corresponding to the time is recorded as The midpoint of the rotated arc segment in the Cartesian coordinate system is denoted as F, and the midpoint F is The distance between them is taken as the fitting error ε; If the fitting error ε is less than or equal to the set threshold, execute step 16; If the fitting error ε is greater than the set threshold, execute step 15; Step 15: Perform secondary segmentation on the rotated arc segment, and divide u n and As the two endpoints of the curve, use the method of steps 1 and 2 to 1 and 3 to get the endpoints u n and The curve is fitted; Step 16: Use the preliminary fitting curve as the elliptical arc fitting result of the rotated arc segment, and use the method of steps 12 to 13 to fit the next curve segment; Step 2: Plan the elliptical arc speed according to the starting point coordinates, the ending point coordinates, the length of the major semi-axis, the length of the minor semi-axis, the expected speed and the maximum acceleration allowed by each coordinate axis of each curve segment; Step 3: According to the speed planning, the starting point and the end point of the elliptical arc to be completed in each interpolation cycle are obtained, and then the interpolation processing of the elliptical arc is performed; The specific process of step three is: Step 31. In the coordinate system with the major axis of the ellipse as the X' axis and the minor axis as the Y' axis, calculate the segmentation angle θ' on the ellipse as: Among them, β represents the angle of rotation of the ellipse during the ellipse fitting process, and θ is the angle of distinction of the longest pulse axis of the ellipse arc vector in the Cartesian coordinate system; Then, four angle regions are solved according to the segmentation angle θ': The elliptical interpolation area is divided into four intervals: (θ'1, θ'2], (θ'2, θ'3], (θ'3, θ'4], and (θ'4, θ'1]; the longest pulse axis in the intervals (θ'2, θ'3] and (θ'4, θ'1] is the Y axis, and the longest pulse axis in the intervals (θ'1, θ'2] and (θ'3, θ'4] is the X axis; Step 32: The coordinates of the center of the ellipse are expressed as O(x0, y0), the coordinates of the interpolation starting point are expressed as (x1, y1), and the coordinates of the interpolation end point are expressed as (x n ,y n ), θ s is the angle between the vector from the interpolation starting point to the center of the ellipse and the positive semi-axis of the X-axis, θ e is the angle between the vector from the interpolation end point to the center of the ellipse and the positive semi-axis of the X-axis, Then the initial angle θ' after rotating by angle β s =θ s -β, end angle θ' e =θ e -β; If at least one of the four angles θ'1, θ'2, θ'3, θ'4 exists in θ' s and θ' e Between, according to the system of equations: Solve the two points that satisfy the equations, and then determine the uniqueness of the image to get the point P(x θ' ,y θ' ), and according to the point P(x θ' ,y θ' ) Calculate the number of pulses in the part where the longest pulse axis is the X axis: Among them, pulunit y is the pulse equivalent of the Y axis, pulunit x is the pulse equivalent of the X axis, (x' n ,y' n ) is the coordinate of the interpolation end point after rotation angle β; Then the number of pulses n1 where the longest pulse axis is the X-axis is: n1 = n x1 ; Among them, (x'1, y'1) is the coordinate of the interpolation starting point after rotation angle β; The number of pulses n2 where the longest pulse axis is the Y axis is: n2 = n y2 ;The total number of pulses is n=n1+n2; If the four angles θ'1, θ'2, θ'3, and θ'4 do not exist in θ' s and θ' e Between, then: The total number of pulses is: n = max{n x ,n y }; Calculate the angle of each segment of the ellipse according to the total number of pulses n Step 3: According to the expression of the ellipse, the coordinates of the interpolation starting point are expressed as x1 = a × cosθ s , y1=b×sinθ s ; The distance len1 from the interpolation starting point coordinate to the center of the ellipse is: The trigonometric function of the angle between the vector from the interpolation starting point to the center of the ellipse and the positive semi-axis of the X-axis is: Solve the interpolation starting point coordinates (x'1, y'1) in the X'OY' coordinate system: According to the equation of the ellipse in the X'OY' coordinate system: The angle between the interpolated coordinates (x'2, y'2) of the next point of the ellipse and the vector from the center of the ellipse and the positive semi-axis of X' is θ' 2_se =θ' s +Δθ, according to θ' 2_se Get the interpolation coordinates of the next point: The distance len'2 from (x'2,y'2) to the center of the ellipse is: The trigonometric function of the angle between the vector from (x'2, y'2) to the center of the ellipse and the positive semi-axis of the X' axis is: After the rotation angle θ 2_se =θ' 2_se +β, the coordinates of the coordinate point (x'2, y'2) in the Cartesian coordinate system are: Step 34: Set the pulse remainder in the X-axis direction to repulse _x , the pulse remainder in the Y-axis direction is repulse _y , according to (x1, y1) and (x2, y2), we can get the coordinate increment Δx1 in the X-axis direction and the coordinate increment Δy1 in the Y-axis direction: Δx1=x2-x1 Δy1=y2-y1 Then the pulse remainder in the X-axis direction is repulse _x =Δx1×pulunit x , the pulse remainder in the Y-axis direction is repulse _y =Δy1×pulunit y ; Then according to repulse _x and repulse _y Determine pulse coordinates; Step 35: Obtain the coordinates of all interpolation points on the interpolation segment through the method of step 33 to step 34. The coordinates of any interpolation point (x i ,y i ) and any pulse coordinate (x i_r ,y i_r ).
2. A NURBS curve interpolation method based on elliptical arc fitting according to claim 1, characterized in that: According to the repulse _x and repulse _y Determine the pulse coordinates, the specific process is: Ⅰ. When | repulse _x |≥|repulse _y |, the coordinates of the pulse sent to the X-axis are determined as follows: If repulse _x >0, then the X-axis coordinate x of the ith pulse i_r For: x i_r =x (i-1)_r +1 / pulunit x , i≥2, i is the i-th pulse, x (i-1)_r is the X-axis coordinate of the i-1th pulse; If repulse _x ≤0, then the X-axis coordinate x of the i-th pulse i_r For: x i_r =x (i-1)_r -1 / pulunit x ; When | repulse _x |≥|repulse _y |, the coordinates of the pulse sent to the Y axis are determined as follows: Step 1: If repulse _y >0, when the Y axis does not send a pulse, record the Y axis coordinate y of the i-th pulse i_r_1 =y (i-1)_r ,y (i-1)_r is the Y-axis coordinate of the i-1th pulse. When the Y-axis sends a pulse, the Y-axis coordinate y of the i-th pulse is recorded. i_r_2 =y (i-1)_r +1 / pulunit y ; If repulse _y ≤0, when the Y axis does not send a pulse, record the Y axis coordinate y of the i-th pulse i_r_1 =y (i-1)_r , when the Y axis sends a pulse, record the Y axis coordinate y of the i-th pulse i_r_2 =y (i-1)_r -1 / pulunit y ; Step 2: According to the pulse coordinates (x i_r ,y i_r_1 ) determines the feedback value ret1, according to the pulse coordinate (x i_r ,y i_r_2 ) Determine the feedback value ret2; Find the pulse coordinates (x i_r ,y i_r_1 ) to the center of the ellipse len i_r_1 : Pulse coordinates (x i_r ,y i_r_1 ) to the center of the ellipse and the angle θ' between the positive semi-axis X' i_r_1 The trigonometric functions are: Let θ” i_r_1 =θ' i_r_1 -β, according to θ" i_r_1 Solve the pulse coordinates (x' i_r , y' i_r_1 ): According to the converted pulse coordinates (x' i_r , y' i_r_1 ) Solve for the feedback value ret1: Similarly, for the pulse coordinates (x i_r ,y i_r_2 ) is processed to solve the feedback value ret2; Step 3: If ret1>ret2, the Y axis sends a pulse, and the pulse coordinate in the Y axis direction is y i_r =y i_r_2 If ret1≤ret2, the Y axis does not send a pulse, and the pulse coordinate y in the Y axis direction i_r =y i_r_1 , and then get the pulse coordinates of the i-th pulse (x i_r ,y i_r ); Ⅱ. When | repulse _x |<|repulse _y |, the coordinates of the pulse sent to the Y axis are determined as follows: If repulse _y >0, then the Y-axis coordinate y of the i-th pulse i_r is: y i_r =y (i-1)_r +1 / pulunit y , i≥2, i is the i-th pulse, y (i-1)_r is the Y-axis coordinate of the i-1th pulse; If repulse _y ≤0, then the Y-axis coordinate y of the i-th pulse i_r is: y i_r =y (i-1)_r -1 / pulunit y ; When | repulse _x |<|repulse _y |, the coordinates of the pulse sent to the X-axis are determined as follows: Step (1): If repulse _x >0, when the X-axis does not send a pulse, record the X-axis coordinate x of the i-th pulse i_r_1 =x (i-1)_r , x (i-1)_r is the X-axis coordinate of the i-1th pulse. When the X-axis sends a pulse, the X-axis coordinate of the i-th pulse is recorded as x i_r_2 =x (i-1)_r +1 / pulunit x ; If repulse _x ≤0, when the X-axis does not send a pulse, record the X-axis coordinate x of the i-th pulse i_r_1 =x (i-1)_r , when the X-axis sends a pulse, record the X-axis coordinate x of the i-th pulse i_r_2 =x (i-1)_r -1 / pulunit x ; Step (2): According to the pulse coordinates (x i_r_1 ,y i_r ) determines the feedback value ret3, according to the pulse coordinate (x i_r_2 ,y i_r ) Determine the feedback value ret4; Solve for the pulse coordinates (x i_r_1 ,y i_r ) to the center of the ellipse len i_r_2 : Pulse coordinates (x i_r_1 ,y i_r ) to the center of the ellipse and the angle θ' between the positive semi-axis of X' i_r_2 The trigonometric functions are: Let θ' i ' _r_2 =θ' i_r_2 -β, according to θ' i ' _r_2 Solve the pulse coordinates (x' i_r_1 , y' i_r ): Simplify the above formula to: According to the converted pulse coordinates (x' i_r_1 , y' i_r ) Solve for the feedback value ret3: Similarly, for (x i_r_2 ,y i_r ) is processed to obtain ret4; Step (3): If ret3>ret4, the X-axis sends a pulse, and the pulse coordinate in the X-axis direction is x i_r =x i_r_2 If ret3≤ret4, the X-axis does not send a pulse, and the pulse coordinate x in the X-axis direction i_r =x i_r_1 , and then get the pulse coordinates of the i-th pulse (x i_r ,y i_r ).
3. A NURBS curve interpolation method based on elliptical arc fitting according to claim 2, characterized in that: The angle θ is calculated as follows: Among them, pulunit x is the pulse equivalent of the X axis, pulunit y It is the pulse equivalent of Y axis.
Citation Information
Patent Citations
High-precision space elliptic curve real-time interpolation method
CN107102617A
Elliptical arc smooth compression interpolation algorithm suitable for high-speed and high-precision processing
CN108073138A