An interpolation method, apparatus, device and storage medium thereof
Patent Information
- Application Number
- CN202311268198.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-27
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2043-09-27
AI Technical Summary
[0003]因此,当伺服系统的位置环刷新周期的频率与上位NC系统发送的脉冲位置指令频率不匹配时,会导致伺服系统在获取脉冲位置指令容易出现接收和响应的位置指令不均匀,指令速度波动的情况,使得伺服系统的控制效果下降,设备出现爬行和振动的情况,影响设备的加工性能
[0015]上述方案,每次位置环刷新时,检测上位机发送的脉冲位置指令是否发生变化,如果检测到上位机发送的脉冲位置指令发生了变化,则根据变化之前脉冲位置指令所携带的第一位置值、脉冲位置指令当前时刻携带的第二位置值以及脉冲位置指令携带的位置值从第一位置值变化为第二位置值之间位置环的刷新次数,计算得到位置增量,再利用第一位置值以及位置增量,计算得到第一位置值变化为第二位置值之间每次位置环被刷新时的执行位置值,从而使得第一位置值变化为第二位置值之间的过渡较为平滑,具备连续性,能够有效提升位置指令的平滑度,也能够降低设别的振动。
Smart Images

Figure CN117389213B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of instruction processing, and in particular to an interpolation method, apparatus, device and storage medium thereof. Background Technology
[0002] In the prior art, the servo system in high-precision machining equipment is connected to the upper NC system (Numerical Control System) via an axis. It receives pulse position commands from the upper NC system to perform closed-loop position control. During low-speed machining, due to the resolution problem of the control system, when the upper NC system wants the servo system to run at a low or ultra-low speed, the interval period of the pulse position commands sent from the upper NC system will be large.
[0003] Therefore, when the frequency of the position loop refresh cycle of the servo system does not match the frequency of the pulse position command sent by the host NC system, the servo system is prone to uneven reception and response to the pulse position command, and fluctuations in command speed. This leads to a decrease in the control effect of the servo system, crawling and vibration of the equipment, and affects the processing performance of the equipment. Summary of the Invention
[0004] This application provides at least one interpolation method, apparatus, device, and storage medium, which can effectively improve the smoothness of position commands.
[0005] The first aspect of this application provides an interpolation method, which includes: in response to a position ring being refreshed, determining whether a pulse position command sent by a host computer has changed; in response to a change in the pulse position command, determining a position increment based on a first position value carried by the pulse position command before the change, a second position value carried by the pulse position command at the current moment, and a target refresh count, wherein the target refresh count is the number of times the position ring is refreshed between the change in the position value carried by the pulse position command from the first position value to the second position value; and determining the execution position value each time the position ring is refreshed between the change in the pulse position command from the first position value to the second position value based on the first position value and the position increment.
[0006] The step of determining the position increment based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the target refresh count includes: calculating the difference between the second position value and the first position value; and calculating the ratio of the difference to the target refresh count to obtain the position increment.
[0007] The step of determining the execution position value each time the position ring is refreshed between the change of the pulse position command from the first position value to the second position value, based on the first position value and the position increment, includes: determining the sum of the execution position value and the position increment at the time the position ring is refreshed each time the pulse position command changes from the first position value to the second position value, to obtain the execution position value at the time the current position ring is refreshed.
[0008] After obtaining the execution position value when the current position ring is refreshed, the method further includes: determining whether the execution position value when the current position ring is refreshed exceeds the second position value; in response to exceeding the second position value, updating the execution position value when the current position ring is refreshed to the second position value; otherwise, keeping the execution position value when the current position ring is refreshed unchanged.
[0009] The method further includes, after determining the position increment based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the target refresh count, setting the value of the counter to 1; wherein, between the change of the first position value to the second position value, the value of the counter is incremented by 1 in response to each refresh of the position ring, and the value of the counter at the current moment is determined as the target refresh count in response to the change of the pulse position command.
[0010] The process includes, after incrementing the counter value, determining whether the counter value exceeds a preset threshold; updating the counter value to the preset threshold in response to the counter value exceeding the preset threshold; otherwise, keeping the counter value unchanged.
[0011] A second aspect of this application provides an interpolation device, comprising: a detection module, configured to determine whether a pulse position command sent by a host computer has changed in response to a refresh of the position ring; a calculation module, configured to determine a position increment based on a first position value carried by the pulse position command before the change, a second position value carried by the pulse position command at the current moment, and a target refresh count, wherein the target refresh count is the number of times the position ring is refreshed between the change of the position value carried by the pulse position command from the first position value to the second position value; and an execution module, configured to determine the execution position value each time the position ring is refreshed between the change of the first position value and the second position value, based on the first position value and the position increment.
[0012] The calculation module includes: a difference module, used to calculate the difference between the second position value and the first position value; and a ratio module, used to calculate the ratio of the difference to the target refresh count to obtain the position increment.
[0013] A third aspect of this application provides an interpolation device, including a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the interpolation method in the first aspect described above.
[0014] The fourth aspect of this application provides a computer-readable storage medium having program instructions stored thereon, which, when executed by a processor, implement the interpolation method described in the first aspect above.
[0015] In the above scheme, each time the position ring is refreshed, it detects whether the pulse position command sent by the host computer has changed. If a change is detected, the position increment is calculated based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the number of position ring refreshes between the change of the position value carried by the pulse position command from the first position value to the second position value. Then, using the first position value and the position increment, the execution position value at each position ring refresh between the change of the first position value to the second position value is calculated. This makes the transition between the change of the first position value and the second position value smoother and more continuous, effectively improving the smoothness of the position command and reducing equipment vibration.
[0016] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this application. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.
[0018] Figure 1 This is a flowchart illustrating an embodiment of the interpolation method of this application;
[0019] Figure 2 This is a flowchart illustrating another embodiment of the interpolation method of this application;
[0020] Figure 3 This is a comparative schematic diagram of the previous embodiment of the interpolation in this application;
[0021] Figure 4 This is a comparative schematic diagram of a later embodiment of the interpolation in this application;
[0022] Figure 5 This is a schematic diagram of the framework of an embodiment of the interpolation device of this application;
[0023] Figure 6 This is a schematic diagram of the framework of an embodiment of the interpolation device of this application;
[0024] Figure 7This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium of this application. Detailed Implementation
[0025] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0026] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0027] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the interpolation method of this application, where the execution entity of this embodiment is a server system. Specifically, it may include the following steps:
[0028] Step S110: In response to the position loop being refreshed, determine whether the pulse position command sent by the host computer has changed.
[0029] The interpolation method in this application is mainly applied in high-precision machining equipment such as machine tools to improve the stability and positioning accuracy of the servo system, playing a crucial role in the machining effect. Specifically, the interpolation method in this application can perform asynchronous smooth interpolation based on the time interval of the pulse position command, especially when the pulse position command changes slowly or intermittently. This reduces the vibration caused by the discontinuity of the pulse position command, thereby improving the control effect of the servo system under low-speed pulse position command input conditions.
[0030] In this embodiment, the servo system is connected to the host computer via an axis. After receiving the pulse position command from the host computer, the servo system performs closed-loop position control. The position loop is located within the servo system, and the input to the position loop is an external pulse; the host computer can be a numerical control system.
[0031] In some embodiments, before the servo system enters the refresh cycle of the position loop, the servo system has a default preset initial pulse position command. After the servo system enters the refresh cycle of the position loop each time, it will check whether it has received the latest pulse position command sent by the host computer. If the latest pulse position command is received, the position value of the latest pulse position command is compared with the position value of the initial pulse position command. If the position values are inconsistent, it is determined that the pulse position command has changed.
[0032] In other embodiments, the pulse position commands received by the servo system are configured such that each pulse position command represents the same unit position value. For example, a pulse position command is set to represent a position value of 100mm. The initial pulse position command has a position value of 0. After receiving a first pulse position command with a position value of 100mm, the servo system controls the machine tool drill bit to advance 100mm. Then, after receiving a second pulse position command with a position value of 100mm, the servo system controls the machine tool drill bit to advance another 100mm on top of the initial 100mm advance. The machine tool drill bit has advanced 200mm relative to the initial pulse position command value. Therefore, the final movement distance of the machine tool drill bit can be calculated by summing the number of received pulse position commands. Thus, the servo system can directly determine whether the pulse position command has changed by checking whether a new pulse position command has been received after the position loop refresh cycle.
[0033] Step S120: In response to a change in the pulse position command, determine the position increment rate based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the target refresh count.
[0034] The target refresh count is the number of times the position loop is refreshed when the position value carried by the pulse position command changes from the first position value to the second position value.
[0035] In some embodiments, if a change in the pulse position command is detected, the first position value carried by the pulse position command of the previous time adjacent to the current time, the second position value carried by the pulse position command at the current time, and the target refresh count can be obtained. The position increment rate is obtained by dividing the second position value by the first position value, and the average position increment rate during each position ring refresh is obtained by dividing the position increment rate by the target refresh count. The formula is as follows:
[0036] x=PulsePosCmd-PosCmdPrev (1)
[0037] y=x÷d (2)
[0038] z= PosCmdPrev×(1+n×y) (3)
[0039] Wherein, PulsePosCmd represents the second position value carried by the pulse position command at the current moment, PosCmdPrev represents the first position value carried by the pulse position command before the change, x represents the position increment rate, d represents the target refresh count, y represents the average position increment rate, z represents the position value when the current position ring is refreshed, and n represents the refresh count of the current position ring.
[0040] In other embodiments, the step of obtaining the location increment may include steps S121 to S122.
[0041] Step S121: Calculate the difference between the second position value and the first position value.
[0042] In some embodiments, the position value difference is obtained by subtracting the first position value carried by the pulse position command before the change from the second position value carried by the pulse position command at the current moment. The formula is as follows:
[0043] m=PulsePosCmd-PosCmdPrev (4)
[0044] Where m represents the difference.
[0045] Step S122: Calculate the ratio of the difference to the target refresh count to obtain the position increment.
[0046] In some embodiments, dividing the difference calculated above by the target refresh count yields the position increment, which is the position value differing between adjacent position ring refresh cycles. The specific calculation method is as follows:
[0047] InterPosCmd_Delta=m÷d (5)
[0048] InterPosCmd_Delta represents the position increment.
[0049] In some embodiments, to accurately calculate the number of times the position loop is refreshed during the pulse position command change, a counter can be added to the servo system. Specifically, after obtaining the position increment, the counter value is set to 1. Between the change from the first position value to the second position value, the counter value is incremented by 1 each time the position loop is refreshed, and simultaneously, in response to a change in the pulse position command, the current value of the counter is determined as the target refresh count. The specific formula is as follows:
[0050] InterCount = InterCount + 1 (6)
[0051] Where InterCount represents the value of the counter.
[0052] To facilitate understanding, the following describes the specific process of the pulse position command changing from the first position value to the second position value:
[0053] Initially, the position value carried by the pulse position command is the first position value, and the counter value is 1. Then, before the position value carried by the pulse position command changes to the second position value, the counter value is automatically incremented by 1 each time the position ring is refreshed. Finally, when a position ring is refreshed, it is detected that the value carried by the pulse position command has changed to the second position value. At this time, the counter value is the target refresh count, and then the counter value is reset to 1 again, and the process of the position value carried by the pulse position command changing from the second position value to the third position value begins, and so on.
[0054] Before receiving the next pulse position command, the position loop is refreshed, and the counter value is incremented by 1. To prevent excessive command interpolation counts during prolonged periods without pulse command input, it is determined whether the counter value exceeds a preset threshold. If the counter value exceeds the preset threshold, the counter value is updated to the preset threshold, as shown in the following formula:
[0055] InterCount = CNTMAX (7)
[0056] CNTMAX represents the preset threshold; otherwise, the counter value remains unchanged.
[0057] Step S130: Based on the first position value and the position increment, determine the execution position value each time the position ring is refreshed between the change of the pulse position command from the first position value to the second position value.
[0058] In some embodiments, between changes in the pulse position command from the first position value to the second position value, each time the position ring is refreshed, the sum of the executed position value and the position increment at the time of the previous position ring refresh is determined to obtain the executed position value at the time of the current position ring refresh. The specific formula is as follows:
[0059] z=PosCmdPrev+ InterPosCmd_Delta (8)
[0060] In some embodiments, to prevent the execution position value from exceeding the limit when the position ring is refreshed, the execution position value when the position ring is refreshed needs to be limited. Specifically, by determining whether the execution position value when the current position ring is refreshed exceeds a second position value, in response to exceeding the second position value, the execution position value when the current position ring is refreshed is updated to the second position value; otherwise, the execution position value when the current position ring is refreshed remains unchanged.
[0061] The following example illustrates this. In a specific application scenario, the interpolation method of this application is used to solve the problem of mismatch between the frequency of the position loop refresh cycle of the machine tool servo system and the frequency of the pulse position command sent by the host computer. This can be achieved by combining... Figure 2 Perform the operation.
[0062] First, the servo system is configured to represent each pulse position command as 100mm. Each time the servo system enters a position ring refresh cycle, it first checks if the pulse position command sent by the host computer has changed. If the pulse position command has changed, the updated position increment is calculated based on the second position value PulsePosCmd carried by the latest pulse position command received by the servo system, the first position value PosCmdPrev carried by the pulse position command before the change, and the value InterCount of the asynchronous interpolation cycle counter. If the pulse position command has not changed, the counter value is incremented by 1 each time the position ring is detected to be refreshed, as shown in Formula 6. Furthermore, the counter value is limited to determine if it exceeds a preset threshold CNTMAX, which can be set to 10. If the counter value exceeds the preset threshold CNTMAX, the counter value is updated to the preset threshold CNTMAX; otherwise, the counter value remains unchanged. When the pulse position command has not changed, the calculation of the updated position increment is skipped, and the default position increment is used for subsequent calculations. The default position increment is 0. Therefore, when the pulse position command has not changed, the execution position value when the position ring is refreshed is still the same as the first position value PosCmdPrev.
[0063] Before the servo system changes, the first position value PosCmdPrev carried by the pulse position command is 0. When the servo system receives the second position value PulsePosCmd carried by the latest pulse position command at the current moment, the position ring refresh count calculated by the counter is 5, which does not exceed the preset threshold CNTMAX, so the target refresh count d is 5. Using formula 4, the difference between the second position value and the first position value is obtained as 100mm. Then, using formula 5, the position increment InterPosCmd_Delta is calculated as 20mm. After that, the value of the counter InterCount is set to 1.
[0064] The executed position values at the five position ring refreshes during the pulse position command change period can be obtained using the first position value PosCmdPrev and the position increment InterPosCmd_Delta: 20mm, 40mm, 60mm, 80mm, and 100mm. Each time the executed position value at the time of position ring refresh is obtained, it is necessary to determine whether the current executed position value at the time of position ring refresh is greater than or equal to the second position value. If it is, the executed position value at the time of current position ring refresh is updated to the second position value. Since the executed position value at the time of the last position ring refresh was 100mm, which is equal to the second position value, the current executed position value at the time of current position ring refresh is updated to the second position value, which is still 100mm. Otherwise, the executed position value at the time of current position ring refresh remains unchanged. Since the executed position values at the time of the first four position ring refreshes all exceed the second position value by 100mm, the executed position values at the time of the first four position ring refreshes remain unchanged.
[0065] After completing the interpolation during the pulse position command change, the first position value PosCmdPrev carried by the pulse position command before the change is updated, and the second position value PulsePosCmd is used to replace the first position value PosCmdPrev, as shown in Formula 9:
[0066] PosCmdPrev=PulsePosCmd (9)
[0067] At this point, the interpolation algorithm is complete. The position command z information calculated through the above process will be sent to the subsequent PID closed-loop control stage for closed-loop control calculation.
[0068] Please see Figure 3 The host computer sends pulse position command signals to the servo system at a fixed, low frequency (as shown in waveform 1). The servo system is expected to perform closed-loop control of the position loop according to the position command (number of pulses, as shown in waveform 2) and speed command (frequency of the pulse command, as shown in waveform 3) contained in the pulse position command signal. However, due to the high refresh frequency of the servo system's position loop (the refresh period is shown by the dotted line in the figure), the updated position information at each refresh frequency becomes discontinuous (as shown in waveform 4). Further differentiation of the position information in waveform 4 yields the speed command (as shown in waveform 5). Waveform 5 shows that after the servo system receives the pulse position command from the host computer, the speed command becomes discontinuous, exhibiting a periodic change of "start running – stop waiting – start running – stop waiting." This leads to a decrease in the servo system's control effect, causing crawling and vibration in the high-precision machining equipment, thus affecting its machining performance.
[0069] Please refer to the following: Figure 4 Compared to the position and speed command control effects before the interpolation function was used (as shown in waveforms 5 and 6 in the figure), the smoothness of the position command and the fluctuation of the speed command were optimized to a certain extent after the asynchronous interpolation function was added.
[0070] This application addresses the problem of discontinuous position command reception and fluctuating command speed information caused by mismatched position loop refresh cycles during low-frequency pulse position command reception between the host computer and the servo system. It designs an asynchronous interpolation method based on asynchronous cycle counting and synchronous interpolation. This effectively reduces the discontinuity in position control and speed fluctuations in the servo system under low-speed pulse position commands, and the code is easy to implement, possessing good engineering application value. Furthermore, the interpolation method in this application can be extended to control devices using similar application conditions, demonstrating scalability.
[0071] Please see Figure 5 , Figure 5 This is a schematic diagram of an embodiment of the interpolation device of this application. The interpolation device 500 includes: a detection module 510, a calculation module 520, and an execution module 530. The detection module 510 is used to determine whether the pulse position command sent by the host computer has changed in response to a refresh of the position ring. The calculation module 520 is used to determine the position increment based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the target refresh number in response to a change in the pulse position command. The target refresh number is the number of times the position ring is refreshed between the change of the position value carried by the pulse position command from the first position value to the second position value. The execution module 530 is used to determine the execution position value each time the position ring is refreshed between the change of the first position value and the second position value, based on the first position value and the position increment.
[0072] In some embodiments, the calculation module 520 includes a difference module 521 and a ratio module 522. The difference module 521 is used to calculate the difference between the second position value and the first position value. The ratio module 522 is used to calculate the ratio of the difference to the target refresh count to obtain the position increment.
[0073] In some embodiments, the execution module 530 performs the step of determining the execution position value each time the position ring is refreshed between the first position value and the second position value, based on the first position value and the position increment. This includes: determining the sum of the first position value and the position increment to obtain the execution position value when the position ring is refreshed for the first time; and subsequently, before the second position value carried by the pulse position command at the current moment, each time the position ring is refreshed, determining the sum of the execution position value when the previous position ring was refreshed and the position increment to obtain the execution position value when the current position ring is refreshed.
[0074] In some embodiments, the execution module 530 performs the step of obtaining the execution position value when the current position ring is refreshed, including: determining whether the execution position value when the current position ring is refreshed exceeds a second position value; in response to exceeding the second position value, updating the execution position value when the current position ring is refreshed to the second position value; otherwise, keeping the execution position value when the current position ring is refreshed unchanged.
[0075] In some embodiments, before the calculation module 520 determines the execution position value each time the position ring is refreshed between the first position value and the position increment based on the first position value and the position increment, the calculation module 520 further includes: setting a counter to one; wherein, between the first position value and the second position value, in response to the position ring being refreshed, the value of the counter is incremented by one, and in response to the change of the pulse position command, the value of the counter at the current moment is determined as the target refresh number.
[0076] In some embodiments, after incrementing the value of the counter, the calculation module 520 further includes: determining whether the value of the counter exceeds a preset threshold; updating the value of the counter to the preset threshold in response to the value of the counter exceeding the preset threshold; otherwise, keeping the value of the counter unchanged.
[0077] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0078] Please see Figure 6 , Figure 6 This is a schematic diagram of an embodiment of the interpolation device 60 of this application. The interpolation device 60 includes a memory 61 and a processor 62 coupled to each other. The processor 62 is used to execute program instructions stored in the memory 61 to implement the steps in any of the above-described interpolation method embodiments. In a specific implementation scenario, the interpolation device 60 may include, but is not limited to, a microcomputer or a server. In addition, the interpolation device 60 may also include mobile devices such as laptops and tablets, which are not limited here.
[0079] Specifically, processor 62 controls itself and memory 61 to implement the steps in the above-described interpolation method embodiments. Processor 62 can also be referred to as a CPU (Central Processing Unit). Processor 62 may be an integrated circuit chip with signal processing capabilities. Processor 62 can also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 62 can be implemented using integrated circuit chips.
[0080] Please see Figure 7 , Figure 7 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium 70 of this application. The computer-readable storage medium 70 stores program instructions 701 that can be executed by a processor. The program instructions 701 are used to implement the steps in any of the above-described interpolation method embodiments.
[0081] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0082] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0083] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.
[0084] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0085] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
Claims
1. An interpolation method, characterized in that, The interpolation method includes: In response to the position loop being refreshed, determine whether the pulse position command sent by the host computer has changed; In response to a change in the pulse position command, the position increment is determined based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the target refresh count, wherein the target refresh count is the number of refreshes of the position loop between the change of the position value carried by the pulse position command from the first position value to the second position value; Based on the first position value and the position increment, determine the execution position value each time the position ring is refreshed between the change of the pulse position command from the first position value to the second position value; The process of determining the position increment based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the target refresh count further includes: Set the counter value to 1; wherein, between the change of the first position value to the second position value, in response to each refresh of the position ring, increment the counter value by 1, determine whether the counter value exceeds a preset threshold, and in response to the counter value exceeding the preset threshold, update the counter value to the preset threshold; otherwise, keep the counter value unchanged; at the same time, in response to the change of the pulse position command, determine the current value of the counter as the target refresh count.
2. The method according to claim 1, characterized in that, The step of determining the position increment based on the first position value carried by the pulse position command before the change, the second position value carried by the pulse position command at the current moment, and the target refresh count includes: Calculate the difference between the second position value and the first position value; The position increment is obtained by calculating the ratio of the difference to the number of target refreshes.
3. The method according to claim 1, characterized in that, The step of determining the execution position value each time the position ring is refreshed between the change of the pulse position command from the first position value to the second position value based on the first position value and the position increment includes: Between the pulse position command changes from the first position value to the second position value, each time the position ring is refreshed, the sum of the execution position value at the time the position ring was refreshed in the previous time and the position increment is determined to obtain the execution position value at the time the position ring is refreshed in the current time.
4. The method according to claim 3, characterized in that, After obtaining the execution position value when the current position ring is refreshed, the method further includes: Determine whether the execution position value when the current position ring is refreshed exceeds the second position value; In response to exceeding the second position value, the execution position value at the time the current position ring is refreshed is updated to the second position value; Otherwise, the execution position value at the time the current position ring is refreshed remains unchanged.
5. An interpolation device, characterized in that, include: The detection module is used to determine whether the pulse position command sent by the host computer has changed in response to the position loop being refreshed; The calculation module is configured to, in response to a change in the pulse position command, determine a position increment based on a first position value carried by the pulse position command before the change, a second position value carried by the pulse position command at the current moment, and a target refresh count, wherein the target refresh count is the number of refreshes of the position loop between the change of the position value carried by the pulse position command from the first position value to the second position value; and is further configured to set a counter value to 1, wherein, between the change of the first position value to the second position value, in response to each refresh of the position loop, the counter value is incremented by 1, and it is determined whether the counter value exceeds a preset threshold. If the counter value exceeds the preset threshold, the counter value is updated to the preset threshold; otherwise, the counter value remains unchanged; and simultaneously, in response to a change in the pulse position command, the current value of the counter is determined as the target refresh count. The execution module is used to determine the execution position value each time the position ring is refreshed, based on the first position value and the position increment, between the change of the first position value and the second position value.
6. The apparatus according to claim 5, characterized in that, The computing module includes: The difference module is used to calculate the difference between the second position value and the first position value; The ratio module is used to calculate the ratio of the difference to the target refresh count to obtain the position increment.
7. An interpolation device, characterized in that, It includes a memory and a processor coupled to each other, the processor being used to execute program instructions stored in the memory to implement the interpolation method according to any one of claims 1 to 4.
8. A computer-readable storage medium having program instructions stored thereon, characterized in that, When the program instructions are executed by the processor, they implement the interpolation method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Servo positioning control system and method
CN103941646A
Position instruction synchronization method and device and computer readable storage medium
CN111552325A