Curve fitting method based on numerical control machining system, electronic equipment and storage medium

文档序号:1963300 发布日期:2021-12-14 浏览:12次 中文

阅读说明:本技术 基于数控加工系统的曲线拟合方法、电子设备和存储介质 (Curve fitting method based on numerical control machining system, electronic equipment and storage medium ) 是由 贺跃帮 王瑞超 冯均鹏 林铭杰 李兴春 于 2021-08-19 设计创作,主要内容包括:本发明公开了一种基于数控加工系统的曲线拟合方法、电子设备和存储介质,其中,所述基于数控加工系统的曲线拟合方法,包括:获取待拟合线段,所述待拟合线段包括多条依次连接的直线线段;对于每一对相邻的所述直线线段,基于最小二乘法生成第一螺旋线和第二螺旋线,所述第一螺旋线和所述第二螺旋线存在部分重叠曲线;对所述部分重叠曲线进行平滑过渡处理,得到拟合后的曲线线段。根据本发明实施例提供的技术方案,能够在速度和加速度均过渡平滑的情况下,实现曲线的快速拟合。(The invention discloses a curve fitting method based on a numerical control machining system, electronic equipment and a storage medium, wherein the curve fitting method based on the numerical control machining system comprises the following steps: acquiring a line segment to be fitted, wherein the line segment to be fitted comprises a plurality of straight line segments which are connected in sequence; for each pair of adjacent straight line segments, generating a first spiral line and a second spiral line based on a least square method, wherein the first spiral line and the second spiral line have partially overlapped curves; and carrying out smooth transition processing on the partially overlapped curve to obtain a fitted curve line segment. According to the technical scheme provided by the embodiment of the invention, the rapid fitting of the curve can be realized under the condition that the speed and the acceleration are both in smooth transition.)

1. A curve fitting method based on a numerical control machining system is characterized by comprising the following steps:

acquiring a line segment to be fitted, wherein the line segment to be fitted comprises a plurality of straight line segments which are connected in sequence;

for each pair of adjacent straight line segments, generating a first spiral line and a second spiral line based on a least square method, wherein the first spiral line and the second spiral line have partially overlapped curves;

and carrying out smooth transition processing on the partially overlapped curve to obtain a fitted curve line segment.

2. The method of claim 1, wherein the adjacent straight line segments comprise a first adjacent segment and a second adjacent segment, the first adjacent segment partially overlapping the second adjacent segment, and wherein generating a first helix and a second helix based on least squares comprises:

acquiring a first current endpoint, a first starting endpoint and a first tail endpoint of the first adjacent line segment, and acquiring a second current endpoint, a second starting endpoint and a second tail endpoint of the second adjacent line segment;

obtaining a first rotation direction and a first rotation center according to the first current endpoint, the first starting endpoint and the first tail endpoint, and obtaining a second rotation direction and a second rotation center according to the second current endpoint, the second starting endpoint and the second tail endpoint;

and obtaining the first spiral line according to the first starting endpoint, the first current endpoint, the first rotation direction and the first rotation center, and obtaining the second spiral line according to the second starting endpoint, the second current endpoint, the second rotation direction and the second rotation center.

3. The method of claim 2, wherein the first rotational direction and the second rotational direction are obtained by the following formula:

wherein, the V0Representing the first and second directions of rotation, p0Represents the first timeA front end point and the second current end point, the p-1Representing the first and second starting end points, p1Representing the first end endpoint and the second end endpoint, the x representing a three-dimensional vector cross product, the | | p0-p-1I represents a three-dimensional vector p-1And p0The Euclidean distance of | | | p1-p0I represents a three-dimensional vector p0And p1The euclidean distance of (c).

4. The method of claim 3, wherein the first center of rotation and the second center of rotation are obtained by the following equation:

wherein C represents the first and second centers of rotation, and V0Representing the first and second directions of rotation, p0Representing the first and second current endpoints, p-1And representing the first starting end point and the second starting end point, wherein n represents a preset constant and n is more than or equal to 1, i represents a maximum constant which satisfies 1 and less than or equal to i and less than or equal to n, and j represents a maximum constant which satisfies 2 and less than or equal to j and less than or equal to n.

5. The method of claim 3, further comprising, after obtaining a first rotation direction and a first rotation center according to the first current endpoint, the first starting endpoint, and the first end endpoint, and obtaining a second rotation direction and a second rotation center according to the second current endpoint, the second starting endpoint, and the second end endpoint:

determining whether the first adjacent line segment can be fitted according to a preset error value, the first rotation direction, the first current endpoint, the first starting endpoint and the first ending endpoint, and determining whether the second adjacent line segment can be fitted according to the preset error value, the second rotation direction, the second current endpoint, the second starting endpoint and the second ending endpoint.

6. The method of claim 5, wherein determining whether the first neighboring line segment can be fit based on a preset error value, the first rotation direction, the first current end point, the first start end point, and the first end point, and determining whether the second neighboring line segment can be fit based on the preset error value, the second rotation direction, the second current end point, the second start end point, and the second end point comprises:

judging whether the preset error value, the first rotation direction, the first current end point, the first starting end point and the first tail end point meet a preset fitting judgment formula or not, and if so, fitting the first adjacent line segment;

judging whether the preset error value, the second rotation direction, the second current end point, the second starting end point and the second tail end point meet the preset fitting judgment formula or not, and if so, fitting the second adjacent line segment; wherein the preset fitting decision formula is as follows:

the epsilonmaxRepresenting said preset error value, said V0Representing the first and second directions of rotation, p0Representing the first and second current endpoints, p-1Representing the first and second starting end points, p1Representing the first end endpoint and the second end endpoint, the | | | p1-p-1I represents a three-dimensional vector p-1And p1The Euclidean distance of | | | p0-p-1I represents a three-dimensional vector p-1And p0The Euclidean distance of | | | p1-p0I represents a three-dimensional vector p0And p1The euclidean distance of (c).

7. The method of claim 2, wherein the performing a smooth transition process on the partially overlapping curve to obtain a fitted curve segment comprises:

under the condition that the first spiral line and the second spiral line are at the same preset rotation angle, taking a first three-dimensional position of the first spiral line and a second three-dimensional position of the second spiral line;

generating a smooth curve corresponding to the partially overlapping curve according to the first three-dimensional position and the second three-dimensional position;

replacing the partially overlapping curve with the smooth curve.

8. The method of claim 7, wherein the smoothing curve is obtained by the following formula:

wherein f (u) represents the smooth curve, theRepresenting a three-dimensional position of the first spiral line at the preset rotation angle theta, theAnd u is more than or equal to 0 and less than or equal to 1, and represents the three-dimensional position of the second spiral line when the preset rotation angle is theta.

9. An electronic device, comprising: a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the curve fitting method based on a numerical control machining system according to any one of claims 1 to 8 when executing the computer program.

10. A computer-readable storage medium characterized by: computer-executable instructions are stored for performing the curve fitting method based on a numerically controlled machining system according to any one of claims 1 to 8.

Technical Field

The invention relates to the technical field of numerical control machining, in particular to a curve fitting method based on a numerical control machining system, electronic equipment and a computer readable storage medium.

Background

The numerical control system is a special computer system which executes part or all of numerical control functions according to a control program stored in a computer memory and is provided with an interface circuit and a servo drive device. Generally, a numerical control system and related automatic products are mainly matched with a numerical control machine. The existing numerical control machine tool can be divided into three-axis, four-axis and five-axis machining centers according to the number of control axes, wherein the input data of a three-axis numerical control system is mostly straight lines and circular arcs, and the input data of the four-axis and five-axis numerical control systems are straight lines. However, when a large number of continuous small straight lines exist in input data, frequent acceleration and deceleration occur when the conventional straight line processing method is directly applied, which affects both processing efficiency and processing effect.

In the related art, for such a large number of continuous small straight lines, a curve fitting manner is generally adopted to improve the processing efficiency and the processing effect. The existing curve fitting technology mainly adopts an A spline, a B spline, a C spline and a NURBS spline, but the A spline cannot realize smooth acceleration, and the B, C, NURBS spline has the defects of unsmooth fitting curve transition, large time consumption of real-time calculation and high hardware requirement, thereby bringing inconvenience to users.

Disclosure of Invention

The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a curve fitting method based on a numerical control machining system, electronic equipment and a computer readable storage medium, which can realize rapid curve fitting under the condition of smooth transition of speed and acceleration.

In a first aspect, an embodiment of the present invention provides a curve fitting method based on a numerical control machining system, including:

acquiring a line segment to be fitted, wherein the line segment to be fitted comprises a plurality of straight line segments which are connected in sequence;

for each pair of adjacent straight line segments, generating a first spiral line and a second spiral line based on a least square method, wherein the first spiral line and the second spiral line have partially overlapped curves;

and carrying out smooth transition processing on the partially overlapped curve to obtain a fitted curve line segment.

According to some embodiments of the first aspect of the present invention, the adjacent straight line segments include a first adjacent line segment and a second adjacent line segment, the first adjacent line segment partially overlaps with the second adjacent line segment, and the generating a first spiral line and a second spiral line based on a least square method includes:

acquiring a first current endpoint, a first starting endpoint and a first tail endpoint of the first adjacent line segment, and acquiring a second current endpoint, a second starting endpoint and a second tail endpoint of the second adjacent line segment;

obtaining a first rotation direction and a first rotation center according to the first current endpoint, the first starting endpoint and the first tail endpoint, and obtaining a second rotation direction and a second rotation center according to the second current endpoint, the second starting endpoint and the second tail endpoint;

and obtaining the first spiral line according to the first starting endpoint, the first current endpoint, the first rotation direction and the first rotation center, and obtaining the second spiral line according to the second starting endpoint, the second current endpoint, the second rotation direction and the second rotation center.

According to some embodiments of the first aspect of the present invention, the first and second directions of rotation are obtained by:

wherein, the V0Representing the first and second directions of rotation, p0Representing the first and second current endpoints, p-1Representing the first and second starting end points, p1Representing the first end endpoint and the second end endpoint, the x representing a three-dimensional vector cross product, the | | p0-p-1I represents a three-dimensional vector p-1And p0The Euclidean distance of | | | p1-p0I represents a three-dimensional vector p0And p1The euclidean distance of (c).

According to some embodiments of the first aspect of the present invention, the first and second rotation centers are obtained by the following formulas:

wherein C represents the first and second centers of rotation, and V0Representing the first and second directions of rotation, p0Representing the first and second current endpoints, p-1And representing the first starting end point and the second starting end point, wherein n represents a preset constant and n is more than or equal to 1, i represents a maximum constant which satisfies 1 and less than or equal to i and less than or equal to n, and j represents a maximum constant which satisfies 2 and less than or equal to j and less than or equal to n.

According to some embodiments of the first aspect of the present invention, after obtaining a first rotation direction and a first rotation center according to the first current endpoint, the first starting endpoint and the first end endpoint, and obtaining a second rotation direction and a second rotation center according to the second current endpoint, the second starting endpoint and the second end endpoint, the method further comprises:

determining whether the first adjacent line segment can be fitted according to a preset error value, the first rotation direction, the first current endpoint, the first starting endpoint and the first ending endpoint, and determining whether the second adjacent line segment can be fitted according to the preset error value, the second rotation direction, the second current endpoint, the second starting endpoint and the second ending endpoint.

According to some embodiments of the first aspect of the present invention, the determining whether the first neighboring line segment can be fitted according to a preset error value, the first rotation direction, the first current end point, the first start end point and the first end point, and the determining whether the second neighboring line segment can be fitted according to the preset error value, the second rotation direction, the second current end point, the second start end point and the second end point comprises:

judging whether the preset error value, the first rotation direction, the first current end point, the first starting end point and the first tail end point meet a preset fitting judgment formula or not, and if so, fitting the first adjacent line segment;

judging whether the preset error value, the second rotation direction, the second current end point, the second starting end point and the second tail end point meet the preset fitting judgment formula or not, and if so, fitting the second adjacent line segment;

wherein the preset fitting decision formula is as follows:

the epsilonmaxRepresenting said preset error value, said V0Representing the first and second directions of rotation, p0Representing the first and second current endpoints, p-1Representing the first and second starting end points, p1Representing the first end endpoint and the second end endpoint, the | | | p1-p-1I represents a three-dimensional vector p-1And p1The Euclidean distance of | | | p0-p-1I represents a three-dimensional vector p-1And p0The Euclidean distance of | | | p1-p0I represents a three-dimensional vector p0And p1The euclidean distance of (c).

According to some embodiments of the first aspect of the present invention, the performing a smooth transition process on the partially overlapping curve to obtain a fitted curve segment includes:

under the condition that the first spiral line and the second spiral line are at the same preset rotation angle, taking a first three-dimensional position of the first spiral line and a second three-dimensional position of the second spiral line;

generating a smooth curve corresponding to the partially overlapping curve according to the first three-dimensional position and the second three-dimensional position;

replacing the partially overlapping curve with the smooth curve.

According to some embodiments of the first aspect of the present invention, the smoothing curve is obtained by the following formula:

wherein f (u) represents the smooth curve, theRepresenting a three-dimensional position of the first spiral line at the preset rotation angle theta, theAnd u is more than or equal to 0 and less than or equal to 1, and represents the three-dimensional position of the second spiral line when the preset rotation angle is theta.

In a second aspect, an embodiment of the present invention provides an electronic device, where the electronic device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor, when executing the computer program, implements the curve fitting method based on the nc processing system according to any one of the embodiments of the first aspect.

In a third aspect, the present invention further provides a computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, where the computer-executable instructions are configured to enable a computer to execute the curve fitting method based on the nc machining system as described in any one of the embodiments of the first aspect.

One or more technical schemes provided in the embodiment of the application have at least the following beneficial effects: the line segment to be fitted is obtained by obtaining the line segments to be fitted, wherein the line segments comprise a plurality of line segments which are connected in sequence, then for each pair of adjacent line segments, a first spiral line and a second spiral line which have partial overlapped curves are generated based on a least square method, and then the partial overlapped curves are subjected to smooth transition processing, so that the fitted line segment can be obtained according to the first spiral line, the partial overlapped curves after the smooth transition processing and the second spiral lines. According to the technical scheme of the embodiment of the invention, the line segments to be fitted can be fitted into the first spiral line and the second spiral line, and the part of the overlapped curve of the first spiral line after smooth transition treatment is smoothly transited to the second spiral line, so that the curve can be quickly fitted under the condition that the speed and the acceleration are smoothly transited.

Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by the practice of the application. The objectives and other advantages of the application may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.

Drawings

Additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:

FIG. 1 is a flow chart illustrating the steps of a curve fitting method based on a numerical control machining system according to an embodiment of the present invention;

FIG. 2 is a flow chart illustrating steps of a curve fitting method based on a numerical control machining system according to another embodiment of the present invention;

FIG. 3 is a flow chart illustrating steps of a curve fitting method based on a numerical control machining system according to another embodiment of the present invention;

FIG. 4 is a flow chart illustrating steps of a curve fitting method based on a numerical control machining system according to another embodiment of the present invention;

FIG. 5 is a flow chart illustrating steps of a curve fitting method based on a CNC machining system according to another embodiment of the present invention;

fig. 6 is a block diagram of an electronic device according to an embodiment of the invention.

Detailed Description

Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.

In the description of the present invention, the meaning of a plurality of means is one or more, the meaning of a plurality of means is two or more, and larger, smaller, larger, etc. are understood as excluding the number, and larger, smaller, inner, etc. are understood as including the number. If the first and second are described for the purpose of distinguishing technical features, they are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.

In the description of the present invention, it should be understood that the orientation or positional relationship referred to in the description of the orientation, such as the upper, lower, front, rear, left, right, etc., is based on the orientation or positional relationship shown in the drawings, and is only for convenience of description and simplification of description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus, should not be construed as limiting the present invention.

In the description of the present invention, if there are first and second described only for the purpose of distinguishing technical features, it is not understood that relative importance is indicated or implied or that the number of indicated technical features or the precedence of the indicated technical features is implicitly indicated or implied.

In the description of the present invention, unless otherwise explicitly defined, terms such as arrangement, installation, connection and the like should be broadly construed, and those skilled in the art can reasonably determine the specific meanings of the above terms in the present invention in combination with the detailed contents of the technical solutions.

In the description of embodiments of the invention, reference to the description of the term "one embodiment/implementation," "another embodiment/implementation," or "some embodiments/implementations," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least two embodiments or implementations of the disclosure, and the schematic representation of the term above does not necessarily refer to the same example embodiment or implementation. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or implementations.

In addition, the technical features involved in the embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.

The embodiments of the present invention will be further explained with reference to the drawings.

In a first aspect, an embodiment of the present invention provides a curve fitting method based on a numerical control machining system.

Referring to fig. 1, the curve fitting method based on the numerical control machining system specifically includes, but is not limited to, the following steps S100, S200, and S300.

Step S100: acquiring a line segment to be fitted, wherein the line segment to be fitted comprises a plurality of straight line segments which are connected in sequence;

it should be noted that, in general, the line segment to be fitted includes a large number of continuous small straight lines, and it should be understood that the number and length of the straight line segments are not limited in this embodiment.

Step S200: for each pair of adjacent straight line segments, generating a first spiral line and a second spiral line based on a least square method, wherein the first spiral line and the second spiral line have partially overlapped curves;

it should be noted that the part of the overlapping curve is a transition portion between the first spiral and the second spiral, and therefore, the part of the overlapping curve can be represented by either the first spiral or the second spiral.

Step S300: and carrying out smooth transition processing on the partially overlapped curve to obtain a fitted curve line segment.

It should be noted that, because the first spiral line and the second spiral line are both smooth line segments, and the part of the overlapped curve is the transition part of the first spiral line and the second spiral line, after the part of the overlapped curve is subjected to smoothing processing, a smooth curve line segment after fitting can be obtained.

It can be understood that, through the above steps S100, S200, and S300, a line segment to be fitted including a plurality of sequentially connected straight line segments is obtained, then for each pair of adjacent straight line segments, a first spiral line and a second spiral line having a partial overlapping curve are generated based on a least square method, and then the smooth transition processing is performed on the partial overlapping curve, so that a fitted curve segment can be obtained according to the first spiral line, the partial overlapping curve after the smooth transition processing, and the second spiral line. According to the technical scheme of the embodiment of the invention, the line segments to be fitted can be fitted into the first spiral line and the second spiral line, and the part of the overlapped curve of the first spiral line after smooth transition treatment is smoothly transited to the second spiral line, so that the curve can be quickly fitted under the condition that the speed and the acceleration are smoothly transited.

Referring to fig. 2, the adjacent straight line segments exemplarily include a first adjacent line segment and a second adjacent line segment, and the first adjacent line segment and the second adjacent line segment partially overlap with each other, and the above step S200 may specifically include, but is not limited to, the following steps S210, S220, and S230.

Step S210: acquiring a first current endpoint, a first starting endpoint and a first tail endpoint of a first adjacent line segment, and acquiring a second current endpoint, a second starting endpoint and a second tail endpoint of a second adjacent line segment;

step S220: obtaining a first rotation direction and a first rotation center according to the first current endpoint, the first starting endpoint and the first tail endpoint, and obtaining a second rotation direction and a second rotation center according to the second current endpoint, the second starting endpoint and the second tail endpoint;

step S230: and obtaining a first spiral line according to the first starting endpoint, the first current endpoint, the first rotation direction and the first rotation center, and obtaining a second spiral line according to the second starting endpoint, the second current endpoint, the second rotation direction and the second rotation center.

Specifically, a first current endpoint, a first starting endpoint and a first ending endpoint of the first adjacent line segment can be calculated to obtain a first rotation direction and a first rotation center, and then the first starting endpoint, the first current endpoint, the first rotation direction and the first rotation center can be calculated to obtain a first spiral line corresponding to the first adjacent line segment; and calculating a second rotation direction and a second rotation center according to a second current endpoint, a second starting endpoint and a second tail endpoint of the second adjacent line segment, and calculating a second spiral line corresponding to the second adjacent line segment according to the second starting endpoint, the second current endpoint, the second rotation direction and the second rotation center.

Illustratively, the first rotational direction and the second rotational direction are obtained by the following equations:

wherein, V0Representing a first and a second direction of rotation, p0Representing a first current endpoint and a second current endpoint, p-1Representing a first starting endpoint and a second starting endpoint, p1Representing a first end endpoint and a second end endpoint, x represents a three-dimensional vector cross product, | | p0-p-1I represents a three-dimensional vector p-1And p0Euclidean distance of, | | p1-p0I represents a three-dimensional vector p0And p1The euclidean distance of (c).

Specifically, a first current endpoint, a first starting endpoint and a first ending endpoint of a first adjacent line segment are substituted into the formula to obtain a first rotating direction; similarly, the second current end point, the second starting end point and the second ending end point of the second adjacent line segment are substituted into the formula to obtain the second rotation direction.

Illustratively, the first rotation center and the second rotation center are obtained by the following formulas:

wherein C denotes a first rotation center and a second rotation center, V0Representing a first and a second direction of rotation, p0Representing a first current endpoint and a second current endpoint, p-1Representing a first starting endpoint and a secondAnd two starting end points, n represents a preset constant, n is more than or equal to 1, i represents a maximum constant which satisfies 1 and less than or equal to i and less than or equal to n, and j represents a maximum constant which satisfies 2 and less than or equal to j and less than or equal to n.

Specifically, a first current endpoint, a first starting endpoint and a first rotation direction of a first adjacent line segment are substituted into the formula to obtain a first rotation center; similarly, the second current end point, the second starting end point and the second rotation direction of the second adjacent line segment are substituted into the above formula to obtain the second rotation center.

Illustratively, specifically, the largest i, j is found first, satisfying 1 ≦ i ≦ n, 2 ≦ j ≦ n, n ≧ 1 is a given constant, and p-i、p-i+1、……,p-1Is p0Of the forward query in turn, p1、p2、……,pjAre endpoints that query backwards in sequence.

Then, the rotation center C is solved as follows.

Then, for all the end points searched, the distance between each end point and the rotation center is obtained according to the following formula.

Lt=||pt-C||,t∈(-i,j)

Then, the average distance is obtained as follows.

Then, the absolute value of the error of all end points from the average distance is given as follows.

et=|Lt-L|

Then, define the endpoint fitting error ε if all etIf < epsilon, then point p is indicated-i,p-i+1,…,p-1,p0,p1,p2,…,pjAll the components meet the fitting requirement, C is the rotation center of the solution, and otherwise, e is solvedtIf t < 0, p is indicated0Forward endpoint p-i,p-i+1,…,p-1Error of fit greater than p1,p2,…,pjAt this time, if i>1, i-1, if i-1, j-1; if t is>0, if j>1, j is j-1, if j is 1, i is i-1; if t is 0, if i>j, i equals i-1, otherwise j equals j-1.

Finally, the steps are repeated until the end points p-i, p-i +1, …, p meeting the fitting requirements are found-1,p0,p1,p2,…,pjAnd a center of rotation C.

It is understood that the first rotation center and the second rotation center are calculated by substituting the above steps, respectively.

Referring to fig. 3, after the above step S220, the method further includes, but is not limited to, the following step S240.

Step S240: and determining whether the first adjacent line segment can be fitted or not according to the preset error value, the first rotation direction, the first current endpoint, the first starting endpoint and the first tail endpoint, and determining whether the second adjacent line segment can be fitted or not according to the preset error value, the second rotation direction, the second current endpoint, the second starting endpoint and the second tail endpoint.

Specifically, before fitting the first adjacent line segments into a first spiral line, whether the first adjacent line segments can be fitted is judged, so that the fitting property of the fitted first spiral line and the first adjacent line segments is ensured; similarly, before the second adjacent line segments are fitted into the second spiral line, whether the second adjacent line segments can be fitted is judged, so that the fitting property of the fitted second spiral line and the second adjacent line segments is ensured.

Referring to fig. 4, as for example, regarding the step S240, the following steps S241 and S242 may be specifically included, but not limited.

Step S241: judging whether a preset error value, a first rotation direction, a first current endpoint, a first starting endpoint and a first tail endpoint meet a preset fitting judgment formula or not, and fitting a first adjacent line segment if the preset error value, the first rotation direction, the first current endpoint, the first starting endpoint and the first tail endpoint meet the preset fitting judgment formula;

step S242: judging whether the preset error value, the second rotation direction, the second current end point, the second starting end point and the second tail end point meet a preset fitting judgment formula or not, and fitting the second adjacent line segment if the preset error value, the second rotation direction, the second current end point, the second starting end point and the second tail end point meet the preset fitting judgment formula;

it should be noted that the preset fitting determination formula is as follows:

εmaxrepresenting a predetermined error value, V0Representing a first and a second direction of rotation, p0Representing a first current endpoint and a second current endpoint, p-1Representing a first starting endpoint and a second starting endpoint, p1Representing a first end endpoint and a second end endpoint, | | p1-p-1I represents a three-dimensional vector p-1And p1Euclidean distance of, | | p0-p-1I represents a three-dimensional vector p-1And p0Euclidean distance of, | | p1-p0I represents a three-dimensional vector p0And p1The euclidean distance of (c).

Referring to fig. 5, as an example, regarding the step S300, the following steps S310, S320, and S330 may be specifically included, but not limited to.

Step S310: under the condition that the first spiral line and the second spiral line are at the same preset rotation angle, taking a first three-dimensional position of the first spiral line and a second three-dimensional position of the second spiral line;

step S320: generating a smooth curve corresponding to the partially overlapped curve according to the first three-dimensional position and the second three-dimensional position;

step S330: a smooth curve is used instead of a partially overlapping curve.

In particular, let p be0The points may form a first helixp1Dots can also be formedTo form a second spiral lineThen p is0Point of direction p1The line segment of (a) may be constituted by any one of the two spirals. Due to the fact thatAndhaving different C, V0And the transition between them cannot be made smooth, for which reason, definitionRespectively represent a first spiralAnd the second spiral lineAt a three-dimensional position at a rotation angle θ, p is0Point of direction p1The current three-dimensional position of the double spiral line can be obtained by calculation according to a formula, so that a smooth curve is generated.

Illustratively, the smoothing curve is obtained by the following formula:

wherein f (u) represents a smooth curve,representing the three-dimensional position of the first helix at a preset rotation angle theta,and u is more than or equal to 0 and less than or equal to 1, and represents the three-dimensional position of the second spiral line when the preset rotation angle is theta.

Note that, when u is changed from 0To 1, the first helix is smoothed fromTransition to a second helix

For example, the relative speed values for machining the first spiral and the second spiral can be obtained as follows, thereby further facilitating the use of the numerical control system.

Let the centripetal maximum acceleration of the smooth curve be amaxMaximum speed is F, then p0Point of direction p1The start point, end point, and maximum speed of the fitted smooth curve of (1) are obtained by the following equations, respectively.

vmax=max(vp0,vp1,F)

The electronic device according to various embodiments of the second aspect of the present invention is provided based on the curve fitting method based on the numerical control machining system according to the embodiment of the first aspect.

Referring to fig. 6, the electronic device includes a memory 100, a processor 200, and a computer program stored on the memory 100 and executable on the processor 200; the computer program, when executed by the processor 200, implements the method of curve fitting based on a numerically controlled machining system as described in any of the embodiments of the first aspect above.

It should be noted that the electronic device may be a router, a switch, a server, or other data processing transmission device.

It will be appreciated that the processor 200 and memory 100 may be connected by a bus or other means.

It should be noted that the non-transitory software program and instructions required for implementing the curve fitting method based on the nc machining system of the above embodiment are stored in the memory 100, and when being executed by the processor 200, the curve fitting method based on the nc machining system of the above embodiment is executed, for example, the method steps S100 to S300 in fig. 1, the method steps S210 to S230 in fig. 2, the method step S240 in fig. 3, the method steps S241 to S242 in fig. 4, and the method steps S310 to S330 in fig. 5 are executed.

It can be understood that, since the data monitoring device of the internet of things according to the embodiment of the second aspect of the present invention executes the curve fitting method based on the numerical control processing system according to any one of the embodiments of the first aspect, specific implementation manners and technical effects of the electronic device according to the embodiment of the second aspect of the present invention may refer to the specific implementation manners and technical effects of the curve fitting method based on the numerical control processing system according to any one of the embodiments of the first aspect, and are not described herein again.

The above described embodiments of the electronic device are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.

Based on the curve fitting method based on the nc machining system according to the first aspect, a computer-readable storage medium according to various embodiments of the third aspect of the present invention is provided, where the computer-readable storage medium stores computer-executable instructions, which are executed by a processor 200 or a controller, for example, by a processor 200 according to the above-mentioned electronic device embodiment, and can enable the processor 200 to execute the curve fitting method based on the nc machining system according to the above-mentioned embodiments, for example, execute the method steps S100 to S300 shown in fig. 1, the method steps S210 to S230 shown in fig. 2, the method step S240 shown in fig. 3, the method steps S241 to S242 shown in fig. 4, and the method steps S310 to S330 shown in fig. 5.

One of ordinary skill in the art will appreciate that all or some of the steps, systems, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components may be implemented as software executed by a processor 200, such as a central processing unit 200, digital signal processor 200, or microprocessor 200, or as hardware, or as integrated circuits, such as application specific integrated circuits. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as is well known to those of ordinary skill in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory 100 technology, CD-ROM, Digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by the computer. In addition, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media as known to those skilled in the art.

The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于数控加工系统的轨迹滤波方法、装置和电子设备

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类