Motion interpolation method, servo driver, and computer readable storage medium

CN122621072APending Publication Date: 2026-08-21SHENZHEN HUACHUANG INTELLIGENT ENTERPRISE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610733753.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-26
Publication Date
2026-08-21

AI Technical Summary

Technical Problem

[0004]本发明要解决的技术问题在于,针对上述短距离运动时无法精确到达目标位置的问题,提供一种运动插补方法、伺服驱动器及计算机可读存储介质

Benefits of technology

[0014] The present invention has the following technical effects: by triggering adaptive replanning at the boundary of the deceleration sub-segment of the traditional seven-segment S-curve, the endpoint positioning accuracy of short-distance motion can be consistent with that of long-distance motion, eliminating overshoot and undershoot.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122621072A_ABST
    Figure CN122621072A_ABST
Patent Text Reader

Abstract

The application provides a motion interpolation method, a servo driver and a computer readable storage medium. The method comprises the following steps: acquiring a current position of a rotor in real time in a running section of motion according to a seven-segment S-curve velocity planning, and generating a current remaining distance according to the current position and a pre-planned target position; when a preset re-planning flag is valid and the current remaining distance is less than or equal to a pre-planned deceleration distance, re-generating jerk and maximum deceleration of a deceleration sub-section; generating a planning position increment of each interpolation period in the deceleration sub-section according to the jerk and the maximum deceleration, and generating a position command of a current interpolation period by accumulating a position command of a previous interpolation period and the planning position increment of the current interpolation period in each interpolation period of the deceleration sub-section. The application can make the end positioning accuracy of short distance motion consistent with that of long distance motion, and eliminate overshoot and undershoot.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of motor control, and more specifically, to a motion interpolation method, a servo driver, and a computer-readable storage medium. Background Technology

[0002] In precision motion control applications such as CNC machine tools, industrial robots, and electronic manufacturing, the speed planning of position commands directly affects the smoothness of motion, positioning accuracy, and machining efficiency. S-curve speed planning, by introducing jerk constraints, achieves a smooth acceleration transition and is currently the mainstream solution for high-performance servo systems. Figure 1 As shown, the complete seven-segment S-curve includes: acceleration segment, uniform acceleration segment, deceleration segment, uniform speed segment, acceleration-deceleration segment, uniform deceleration segment, and deceleration-deceleration segment.

[0003] However, in practical applications, short-distance movement may cause some segments to be truncated. That is, when the total distance of movement is short, the sum of the lengths of the three pre-planned sub-segments of "acceleration + constant speed + deceleration" exceeds the total length. During the initialization phase, the length of the constant speed segment is automatically cut to zero, so that the acceleration segment is directly connected to the deceleration sub-segment, which leads to the inability to accurately reach the target position. Summary of the Invention

[0004] The technical problem to be solved by the present invention is to provide a motion interpolation method, a servo driver, and a computer-readable storage medium to address the problem of not being able to accurately reach the target position during short-distance movement.

[0005] The technical solution of the present invention to solve the above-mentioned technical problems is to provide a motion interpolation method, applied to motion control in position control mode, the method comprising the following steps: During the running segment where the motion is planned according to the seven-segment S-curve speed, the current position of the rotor is obtained in real time, and the current remaining distance is generated based on the current position and the pre-planned target position. When the preset replanning flag is valid and the current remaining distance is less than or equal to the preplanned deceleration distance, the acceleration and maximum deceleration of the deceleration segment are regenerated based on the remaining distance, current speed, and preplanned speed of the target position. The planned position increment for each interpolation cycle in the deceleration segment is generated based on the acceleration and maximum deceleration. In each interpolation cycle of the deceleration segment, the accumulated position command value of the previous interpolation cycle and the planned position increment of the current interpolation cycle are used to generate the position command for the current interpolation cycle. As a further improvement of the present invention, the planned position increment is composed of fixed-point numbers in Q16.16 format, and the step of generating the position command for the current interpolation cycle by combining the accumulated value of the position command from the previous interpolation cycle with the planned position increment for the current interpolation cycle includes: Obtain the fractional part of the actual position increment from the previous interpolation cycle, and use the sum of the planned position increment of the current interpolation cycle and the fractional part of the actual position increment from the previous interpolation cycle as the actual position increment of the current interpolation cycle. The sum of the integer part of the actual position increment in the current interpolation cycle and the cumulative value of the position command in the previous interpolation cycle is used as the position command for the current interpolation cycle.

[0006] As a further improvement of the present invention, the step of regenerating the acceleration and maximum deceleration of the deceleration segment based on the pre-planned speed of the remaining distance, current speed, and target position includes: The total number of interpolation cycles to generate the deceleration sub-segment; The maximum deceleration of the deceleration segment is generated based on the total number of interpolation cycles, the current speed, and the pre-planned speed at the target position. The jerk of the deceleration segment is generated based on the total number of interpolation cycles and the maximum deceleration.

[0007] As a further improvement of the present invention, the deceleration segment includes an acceleration-deceleration segment, a uniform deceleration segment, and a deceleration segment connected in sequence, and the deceleration acceleration in the acceleration-deceleration segment increases linearly, while the acceleration in the deceleration segment decreases linearly. The acceleration-deceleration segment and the deceleration segment each account for 25% of the total interpolation cycle number of the deceleration segment.

[0008] As a further improvement of the present invention, the method includes: When the planned position increment of the current interpolation cycle is greater than or equal to the current remaining distance, the interpolation status of the current interpolation cycle is set to complete. Output the difference between the planned speed of the uniform sub-segment in the current running segment and the current remaining distance. The first interpolation cycle of the next running segment plans the position increment based on the difference value.

[0009] As a further improvement of the present invention, the method includes: During the running segment planned according to the trapezoidal speed, the current position of the rotor is obtained in real time, and the remaining distance is generated based on the current position and the pre-planned target position; When the remaining distance is less than or equal to the pre-planned deceleration distance and the preset replanning flag is valid, the compensation amount for each interpolation cycle in the deceleration sub-segment is generated based on the pre-planned deceleration distance and the remaining distance. Based on the compensation amount, adjust the planned position increment for each interpolation cycle in the deceleration sub-segment.

[0010] As a further improvement of the present invention, the compensation amount for each interpolation cycle in the first half of the deceleration sub-segment is the replanning compensation amount, and the compensation amount for each interpolation cycle in the second half of the deceleration sub-segment is zero.

[0011] As a further improvement of the present invention, the replanning compensation amount compsnt is generated by the following formula: compsnt = diff / tmpCnt, where diff is the difference between the preplanned deceleration distance and the remaining distance, and tmpCnt is half of the total number of interpolation cycles of the deceleration sub-segment.

[0012] The present invention also provides a servo driver, including a storage unit and a control chip, wherein the storage unit stores a computer program executable on the control chip, and the control chip executes the computer program to implement the steps of the motion interpolation method as described above.

[0013] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the motion interpolation method described above.

[0014] The present invention has the following technical effects: by triggering adaptive replanning at the boundary of the deceleration sub-segment of the traditional seven-segment S-curve, the endpoint positioning accuracy of short-distance motion can be consistent with that of long-distance motion, eliminating overshoot and undershoot. Attached Figure Description

[0015] Figure 1 This is a schematic diagram of a seven-segment S-curve.

[0016] Figure 2 This is a schematic flowchart of the motion interpolation method provided in an embodiment of the present invention.

[0017] Figure 3 This is a schematic diagram of short-distance running speed curves before and after using the motion interpolation method provided in the embodiments of the present invention.

[0018] Figure 4 This is a flowchart illustrating the last interpolation cycle of the current running segment in the motion interpolation method provided in this embodiment of the invention.

[0019] Figure 5 This is a schematic diagram of the running speed curves of multiple consecutive running segments before and after using the motion interpolation method provided in the embodiments of the present invention.

[0020] Figure 6 This is a schematic flowchart of a motion interpolation method provided in another embodiment of the present invention. Detailed Implementation

[0021] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0022] like Figure 2The diagram shown is a schematic of the motion interpolation method provided in an embodiment of the present invention. This motion interpolation method can be applied to motion control in position control mode, thereby improving the control accuracy of permanent magnet synchronous motors used in CNC machine tools, industrial robots, electronic manufacturing and other applications.

[0023] The motion interpolation method of the present invention can be implemented in conjunction with a servo driver for controlling a permanent magnet synchronous motor, for example by software code running on the control module of the servo driver, and the motion interpolation method of this embodiment includes the following steps: Step S21: During the running segment where the motion is planned according to the seven-segment S-curve speed, the current position of the rotor is obtained in real time, and the current remaining distance is generated based on the current position and the pre-planned target position.

[0024] The pre-planned target position is calculated by the servo driver before the start of each running segment, based on acceleration distance formulas such as total distance, starting speed, constant speed, stopping speed, and deceleration. Specifically, the servo driver performs seven-segment S-curve speed planning before the start of each running segment. For example, during the initialization phase of each running segment, the servo driver plans the acceleration sub-segment, constant acceleration sub-segment, deceleration sub-segment, constant speed sub-segment, acceleration / deceleration sub-segment, constant deceleration sub-segment, and deceleration / deceleration sub-segment for that running segment. If the running segment is short, the servo driver plans it as an acceleration sub-segment, constant acceleration sub-segment, deceleration sub-segment, acceleration / deceleration sub-segment, constant deceleration sub-segment, and deceleration / deceleration sub-segment. The above seven-segment S-curve speed planning can be the same as existing schemes and will not be elaborated further here.

[0025] In this step, the real-time position of the rotor can be obtained by means of Hall sensors, and the current remaining distance can be generated by comparing the real-time position of the rotor with the pre-planned target position. For example, the current remaining distance can be the difference between the pre-planned target position and the current position.

[0026] Step S22: Determine whether the current remaining distance obtained in step S21 is less than or equal to the pre-planned deceleration distance. If the current remaining distance is less than or equal to the pre-planned deceleration distance, execute step S23. Otherwise, return to step S21 and continue to obtain the rotor position.

[0027] Step S23: Determine whether the preset replanning flag is valid. If the replanning flag is valid, proceed to step S24; otherwise, proceed to step S25. For example, the above replanning flag can be set to valid by default or set to valid when the distance of the movement segment is lower than a preset value (when the movement segment is initialized, the servo driver sets the replanning flag to 1). The servo driver confirms that the replanning flag is valid when it reads that the flag bit is 1, and confirms that the replanning flag is invalid when it reads that the flag bit is zero.

[0028] Step S24: Regenerate the acceleration and maximum deceleration of the deceleration segment based on the remaining distance, current speed, and pre-planned speed at the target position.

[0029] Specifically, the acceleration / deceleration sub-segments, uniform deceleration sub-segments, and deceleration sub-segments within the deceleration sub-segments can be planned according to a preset ratio, thereby generating the acceleration and maximum deceleration within the deceleration sub-segments. In particular, the distances between the planned acceleration / deceleration sub-segments and deceleration sub-segments in this step can be equal, that is, the absolute values ​​of the acceleration and deceleration of the acceleration / deceleration sub-segments are equal.

[0030] Those skilled in the art will understand that while regenerating the jerk and maximum deceleration of the deceleration segment, the replanning flag must be set to zero, meaning that the operation of regenerating the jerk and maximum deceleration of the deceleration segment is performed only once.

[0031] Step S25: Generate the planned position increment for each interpolation cycle in the deceleration segment based on the acceleration and maximum deceleration, and generate the position command for the current interpolation cycle by combining the accumulated position command value of the previous interpolation cycle with the planned position increment of the current interpolation cycle in each interpolation cycle of the deceleration segment. The speed of each interpolation cycle in the deceleration segment can be generated by using the current speed, jerk, and maximum deceleration. The corresponding planned position increment can then be generated based on this speed. This planned position increment is sent to the position loop of the servo driver in each interpolation cycle and added to the accumulated position command value of the previous interpolation cycle to generate the position command for the current interpolation cycle. This position command can be used to generate a position deviation with the feedback position and then sent to the PI controller in the speed loop, or sent to the feedforward link for appropriate processing.

[0032] The aforementioned motion interpolation method, by triggering adaptive replanning at the boundary of the deceleration segment of the traditional seven-segment S-curve—that is, regenerating the velocity trajectory of the deceleration segment when the remaining distance is less than or equal to the pre-planned deceleration distance—effectively solves the problem of deceleration profile mismatch after the uniform velocity segment is truncated in short-distance motion. This ensures that the endpoint positioning accuracy of short-distance motion is consistent with that of long-distance motion, eliminating overshoot and undershoot. Figure 3 As shown.

[0033] In one embodiment of the present invention, the above-mentioned planned position increment is composed of fixed-point numbers (high 16 integer bits, low 16 decimal bits) in Q16.16 format. Correspondingly, the deceleration replanning in step S24, that is, regenerating the acceleration and maximum deceleration of the deceleration segment based on the remaining distance, current speed, and pre-planned speed of the target position, is completed using fixed-point numbers in Q16.16 format. All calculations retain Q16 precision throughout.

[0034] Accordingly, in step S25, generating the position command for the current interpolation period by combining the accumulated position command value of the previous interpolation period with the planned position increment of the current interpolation period includes: obtaining the fractional part of the actual position increment of the previous interpolation period, and using the sum of the planned position increment of the current interpolation period and the fractional part of the actual position increment of the previous interpolation period as the actual position increment of the current interpolation period; and using the sum of the integer part of the actual position increment of the current interpolation period and the accumulated position command value of the previous interpolation period as the position command for the current interpolation period.

[0035] In each interpolation cycle, the high 16 bits of the planned position increment for the current interpolation cycle are taken as an integer pulse output, while the low 16 bits are stored in PlanValueRemainQ16 and used in the calculation of the next interpolation cycle. This allows the cumulative accuracy to reach 1 / 65536 of the encoder resolution. For example, if the planned position increment for the current interpolation cycle generated by deceleration replanning is 167.3 (represented as 167×65536+19660 in Q16), the integer part 167 is sent for the current interpolation cycle, and the remainder 0.3 (19660 in Q16) is saved in PlanValueRemainQ16. The planned position increment for the next cycle is added to the remainder and then rounded before output. After several consecutive interpolation cycles, when the decimal part accumulates to 65536, an extra pulse is output. Finally, at the stop, the actual cumulative output and the remaining distance are precisely matched without any tail difference.

[0036] By accumulating the Q16 pulses as described above, long-distance accumulation accuracy at the 1 / 65536 encoder resolution level can be achieved, with no accumulation error after long-stroke motion.

[0037] In one embodiment of the present invention, step S24 above, regenerating the acceleration and maximum deceleration of the deceleration segment based on the remaining distance, current speed, and pre-planned speed at the target position, includes: generating the total number of interpolation cycles for the deceleration segment (if the calculated total number of interpolation cycles is less than 4, it is automatically clamped to 4 to ensure the validity of the S-curve profile; if the calculated total number of interpolation cycles exceeds a preset upper limit, it is clamped to the upper limit to avoid overflow); generating the maximum deceleration of the deceleration segment based on the total number of interpolation cycles, current speed, and pre-planned speed at the target position; and generating the acceleration of the deceleration segment based on the total number of interpolation cycles and the maximum deceleration.

[0038] Specifically, the aforementioned deceleration sub-segment includes sequentially connected acceleration / deceleration sub-segment, uniform deceleration sub-segment, and deceleration sub-segment. The deceleration acceleration in the acceleration / deceleration sub-segment increases linearly, while the acceleration in the deceleration sub-segment decreases linearly. The acceleration / deceleration sub-segment and the deceleration sub-segment each account for 25% of the total interpolation cycle number of the deceleration sub-segment.

[0039] For example, when the velocity V_now is 10000 (pulses / cycle, Q16, the same below) when the current motion segment enters the deceleration sub-segment (i.e., the instant of deceleration sub-segment replanning), the pre-planned velocity V_stop at the target position is zero and the remaining distance D is 400000. Then, during the deceleration sub-segment replanning, the total number of interpolation cycles decCnt (i.e., the total deceleration duration) of the replanned deceleration sub-segment is first calculated according to the following formula (1): decCnt=2D / (V_now+V_stop)=80(1) Since the reprogrammed deceleration segment consists of acceleration / deceleration segments, uniform deceleration segments, and deceleration segments, and the acceleration / deceleration segments and deceleration segments each account for 25% of the total interpolation cycles of the deceleration segment, the interpolation cycles of the acceleration / deceleration segments, uniform deceleration segments, and deceleration segments are 20, 40, and 20, respectively. Thus, the maximum deceleration DecMaxPulseQ16 (i.e., peak deceleration) of the deceleration segment can be generated using the following formula (2): DecMaxPulseQ16=10000 / (80-20)=167(2) Since the equivalent integral contribution of the uniform deceleration segment plus the acceleration / deceleration segment and the deceleration segment to the deceleration is equal to (DecCntTotal) JerkDnCntTotal) cycles × peak value (where DecCntTotal is the total number of interpolation cycles for the deceleration sub-segment, and JerkDnCntTotal is the number of cycles for the acceleration / deceleration sub-segment), because DecMaxPulseQ16 = (V_now) V_stop) / (DecCntTotal JerkDnCntTotal)), thus the jerk of the deceleration segment JerkDecPulseRevQ16 (i.e., the deceleration increment per cycle) can be generated by the following formula (3). JerkDecPulseRevQ16=167 / 20≈8(3) During the acceleration / deceleration phase, the deceleration AccPulseQ16 increases linearly with respect to JerkDecPulseRevQ16 per cycle, and decreases linearly with respect to JerkDecPulseRevQ16 per cycle during the deceleration phase. This linearly establishes and releases the peak deceleration 167, avoiding abrupt deceleration shocks.

[0040] For multiple consecutive motion segments (each motion segment can be programmed using a seven-segment S-curve), such as Figure 4 As shown, in one embodiment of the present invention, the above-described motion interpolation method further includes, in addition to steps S21-S25: Step S41: Obtain the planned position increment and the current remaining distance for the current interpolation cycle.

[0041] Specifically, the planned position increment of the current interpolation cycle is the number of pulses generated by the replanning of the deceleration sub-segment in this interpolation cycle (Q16.16 fixed-point format), and the current remaining distance is the total length of this motion segment minus the cumulative sum of the actual position increments of all previous interpolation cycles.

[0042] Step S42: Determine whether the difference between the planned position increment and the remaining distance in the current interpolation cycle is greater than or equal to zero (i.e., whether the planned position increment in the current interpolation cycle is greater than or equal to the remaining distance), and execute step S43 if the difference is greater than or equal to zero, otherwise return to step S41.

[0043] Step S43: When the planned pulse of the current interpolation cycle is greater than or equal to the current remaining distance, it is the last interpolation cycle of the current motion segment (i.e., the interpolation cycle is the junction point between multiple continuous motion segments). Set the interpolation state of the current interpolation cycle to complete (without performing position control), and output the difference between the planned speed of the uniform sub-segment in the current running segment (determined by the speed planning during initialization) and the current remaining distance. The first interpolation cycle of the next running segment plans the position increment based on the difference value.

[0044] In continuous multi-segment positioning mode, the average pulse is output at the end of the current motion segment instead of the actual remaining distance. Excessive or insufficient pulses are stored in the first interpolation cycle of the next motion segment and absorbed, avoiding mechanical shocks caused by sudden speed changes between segments, which could affect the surface quality and mechanical life. This achieves zero-sudden speed transition between segments. Figure 5 As shown.

[0045] For example, after the current running segment is completed, the difference between the planned velocity AvergePulseQ16 (determined by the velocity planning during initialization) and the current remaining distance LineRemainLengthQ16 in the uniform sub-segment of the current running segment, valued as MbpExtraPlsQ16 (which can be positive or negative; a positive result indicates that more pulses were generated in this movement segment, and a negative result indicates that fewer pulses were generated), is immediately reset to zero after the first interpolation cycle of the next movement segment is read. That is, the position increment PlanIntpltValQ16 in the first cycle of the next movement segment is: PlanIntpltValQ16 += MbpExtraPlsQ16, achieving a zero-velocity abrupt transition between segments.

[0046] When multiple motion segments include motion segments planned according to a trapezoidal shape, such as Figure 6 As shown, in one embodiment of the present invention, the above-described motion interpolation method, in addition to steps S21-S25, further includes: Step S61: In the running segment planned according to the trapezoidal speed, the current position of the rotor is obtained in real time, and the remaining distance is generated based on the current position and the pre-planned target position.

[0047] Step S62: Determine whether the current remaining distance obtained in step S61 is less than or equal to the pre-planned deceleration distance. If the current remaining distance is less than or equal to the pre-planned deceleration distance, execute step S63. Otherwise, return to step S61 and continue to obtain the rotor position.

[0048] Step S63: Determine whether the preset replanning flag is valid. If the replanning flag is valid, proceed to step S64; otherwise, proceed to step S65.

[0049] Step S64: Generate the compensation amount for each interpolation cycle in the deceleration sub-segment based on the pre-planned deceleration distance and the remaining distance.

[0050] Specifically, the compensation amount for each interpolation cycle in the first half of the deceleration sub-segment is the replanning compensation amount, while the compensation amount for each interpolation cycle in the second half of the deceleration sub-segment is zero. For example, the replanning compensation amount compsnt can be generated by the following formula (4): compsnt = diff / tmpCnt(4) Where diff is the difference between the pre-planned deceleration distance and the remaining distance, and tmpCnt is half of the total interpolation cycle number of the deceleration sub-segment. Specifically, the total interpolation cycle can be generated according to the calculation formula (1).

[0051] Step S65: Adjust the planned position increment of each interpolation cycle in the deceleration sub-segment according to the compensation amount.

[0052] By using trapezoidal deceleration differential compensation, positioning time can be shortened (eliminating correction movement) and machining efficiency can be improved.

[0053] The present invention also provides a servo driver, including a storage unit and a control chip, wherein the storage unit stores a computer program executable on the control chip, and the control chip executes the computer program to implement the steps of the motion interpolation method as described above.

[0054] The servo driver in this embodiment is the same as the one described above. Figure 2-6 The motion interpolation methods in the corresponding embodiments belong to the same concept. The specific implementation process can be found in the corresponding method embodiments. Furthermore, the technical features in the method embodiments are all applicable to this system embodiment, and will not be repeated here.

[0055] The present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the motion interpolation method described above.

[0056] The computer-readable storage medium in this embodiment is the same as described above. Figure 2-6 The motion interpolation methods in the corresponding embodiments belong to the same concept, and their specific implementation process can be found in the corresponding method embodiments. Furthermore, the technical features in the method embodiments are all applicable to the embodiments of this computer-readable storage medium, and will not be repeated here.

[0057] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0058] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the functions can be assigned to different functional units and modules as needed. The functional units and modules in the embodiments can be integrated into a single processor, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated units can be implemented in hardware or as software functional units. Furthermore, the specific names of the functional units and modules are merely for easy differentiation and are not intended to limit the scope of protection of this application. The specific working processes of the units and modules in the above system can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0059] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0060] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0061] In the embodiments provided in this application, it should be understood that the disclosed motion interpolation method and servo driver can be implemented in other ways. For example, the servo driver embodiments described above are merely illustrative. Furthermore, the functional units in the various embodiments of this application can be integrated into a single processor, or each unit can exist physically separately, or two or more units can be integrated into a single unit. The integrated units described above can be implemented in hardware or as software functional units.

[0062] If the integrated module / 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, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or interface switching device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0063] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A motion interpolation method applied to motion control in a position control mode, characterized in that, The method includes the following steps: During the running segment where the motion is planned according to the seven-segment S-curve speed, the current position of the rotor is obtained in real time, and the current remaining distance is generated based on the current position and the pre-planned target position. When the preset replanning flag is valid and the current remaining distance is less than or equal to the preplanned deceleration distance, the acceleration and maximum deceleration of the deceleration segment are regenerated based on the remaining distance, current speed, and preplanned speed of the target position. The planned position increment for each interpolation cycle in the deceleration segment is generated based on the acceleration and maximum deceleration. In each interpolation cycle of the deceleration segment, the accumulated position command value of the previous interpolation cycle and the planned position increment of the current interpolation cycle are used to generate the position command for the current interpolation cycle.

2. The motion interpolation method according to claim 1, characterized in that, The planned position increment consists of fixed-point numbers in Q16.16 format. The step of generating the position command for the current interpolation period by combining the accumulated position command value from the previous interpolation cycle with the planned position increment for the current interpolation cycle includes: Obtain the fractional part of the actual position increment from the previous interpolation cycle, and use the sum of the planned position increment of the current interpolation cycle and the fractional part of the actual position increment from the previous interpolation cycle as the actual position increment of the current interpolation cycle. The sum of the integer part of the actual position increment in the current interpolation cycle and the cumulative value of the position command in the previous interpolation cycle is used as the position command for the current interpolation cycle.

3. The motion interpolation method according to claim 1, characterized in that, The process of regenerating the acceleration and maximum deceleration of the deceleration segment based on the pre-planned speed of the remaining distance, current speed, and target position includes: The total number of interpolation cycles to generate the deceleration sub-segment; The maximum deceleration of the deceleration segment is generated based on the total number of interpolation cycles, the current speed, and the pre-planned speed at the target position. The jerk of the deceleration segment is generated based on the total number of interpolation cycles and the maximum deceleration.

4. The motion interpolation method according to claim 3, characterized in that, The deceleration segment includes sequentially connected acceleration / deceleration segments, uniform deceleration segments, and deceleration segments. The deceleration acceleration in the acceleration / deceleration segments increases linearly, and the acceleration in the deceleration segments decreases linearly. The acceleration / deceleration segments and deceleration segments each account for 25% of the total interpolation cycles of the deceleration segments.

5. The motion interpolation method according to claim 1, characterized in that, The method includes: When the planned position increment of the current interpolation cycle is greater than or equal to the current remaining distance, the interpolation status of the current interpolation cycle is set to complete. Output the difference between the planned speed of the uniform sub-segment in the current running segment and the current remaining distance. The first interpolation cycle of the next running segment plans the position increment based on the difference value.

6. The motion interpolation method according to claim 1, characterized in that, The method includes: During the running segment planned according to the trapezoidal speed, the current position of the rotor is obtained in real time, and the remaining distance is generated based on the current position and the pre-planned target position; When the remaining distance is less than or equal to the pre-planned deceleration distance and the preset replanning flag is valid, the compensation amount for each interpolation cycle in the deceleration sub-segment is generated based on the pre-planned deceleration distance and the remaining distance. Based on the compensation amount, adjust the planned position increment for each interpolation cycle in the deceleration sub-segment.

7. The motion interpolation method according to claim 6, characterized in that, The compensation amount for each interpolation cycle in the first half of the deceleration sub-segment is the replanning compensation amount, and the compensation amount for each interpolation cycle in the second half of the deceleration sub-segment is zero.

8. The motion interpolation method according to claim 7, characterized in that, The replanning compensation amount compsnt is generated by the following formula: compsnt = diff / tmpCnt, where diff is the difference between the preplanned deceleration distance and the remaining distance, and tmpCnt is half of the total number of interpolation cycles of the deceleration sub-segment.

9. A servo driver, characterized in that, It includes a storage unit and a control chip, wherein the storage unit stores a computer program executable on the control chip, and the control chip executes the computer program to implement the steps of the motion interpolation method as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the steps of the motion interpolation method as described in any one of claims 1-8.