A servo driver electronic cam control method, system, medium and product

CN122902337APending Publication Date: 2026-10-13ANHUI LANGE ELECTRIC CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611271201.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-20
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

然而随着23位高分辨率编码器的应用,完整映射表需存储数百万个映射点,数十兆字节的存储需求远超驱动器片上RAM容量;同时表项的急剧膨胀使得单次查表过程中索引计算和数据读取的时间开销显著增加,在伺服系统极短的控制周期内,难以兼顾映射表的完整存储与查表的实时响应

Benefits of technology

1、通过获取电子凸轮的曲线定义参数并基于预设的五次多项式曲线算法生成平滑凸轮轨迹,再对所述平滑凸轮轨迹进行预设固定分辨率的等间隔重采样得到第一预设数量个映射点并生成目标映射表,使得映射表的存储容量与编码器实际分辨率完全解耦,无论主轴编码器为17位还是23位,映射表均仅占用固定大小的存储空间;同时通过基于预设乘法逆元算法计算实时位置脉冲值在目标映射表中的索引位置与插值权重,将浮点除法和插值运算转换为整数乘法和移位运算,避免了除法指令和浮点运算在控制周期内的耗时,从而在伺服驱动器有限的片上存储资源和极短的控制周期约束下,实现了高分辨率编码器下电子凸轮映射表的紧凑存储与高效实时查表,提高了从轴位置输出的实时响应速度和同步控制精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122902337A_ABST
    Figure CN122902337A_ABST
Patent Text Reader

Abstract

A servo driver electronic cam control method, system, medium and product, relate to the field of industrial automation. The method comprises: obtaining curve definition parameters of an electronic cam, and generating a smooth cam trajectory based on the curve definition parameters and a preset quintic polynomial curve algorithm; performing equal-interval resampling of the smooth cam trajectory at a preset fixed resolution to obtain a first preset number of mapping points, and generating a target mapping table; obtaining a real-time position pulse value of a main shaft, and calculating an index position and an interpolation weight of the real-time position pulse value in the target mapping table based on a preset multiplicative inverse algorithm; determining a target slave shaft position corresponding to the real-time position pulse value based on the index position and the interpolation weight, and outputting a real-time slave shaft position instruction. The application can improve the synchronization control precision of the slave shaft position output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of industrial control automation, and in particular to a servo drive electronic cam control method, system, medium, and product. Background Technology

[0002] The electronic cam function of servo drives simulates the nonlinear synchronous motion relationship between the master and slave axes through software, gradually replacing traditional mechanical cams in industrial equipment such as printing, packaging, and textiles. However, most existing servo drives do not have built-in electronic cam calculation capabilities, relying on a host PLC to calculate and issue slave axis position commands in real time. This method is limited by the communication cycle, and there is an inherent lag between the command update time and the internal control cycle of the drive, reducing the instantaneous synchronization accuracy between the master and slave axes. Existing technology proposes to pre-store a mapping table between the master and slave axis positions inside the drive, and directly look up the table to obtain the slave axis position command during runtime, thereby eliminating communication delay. However, with the application of 23-bit high-resolution encoders, a complete mapping table needs to store millions of mapping points, and the storage requirement of tens of megabytes far exceeds the on-chip RAM capacity of the drive. At the same time, the rapid expansion of the table entries significantly increases the time overhead of index calculation and data reading during a single table lookup. Within the extremely short control cycle of the servo system, it is difficult to balance the complete storage of the mapping table and the real-time response of the table lookup. This limits the integration of the electronic cam function under high-resolution encoders into the drive, making it difficult to guarantee the synchronous control accuracy of the slave axis position output. Summary of the Invention

[0003] This application provides a servo driver electronic cam control method, system, medium, and product to address how to improve the synchronous control accuracy of the slave axis position output.

[0004] In a first aspect, embodiments of this application provide a servo driver electronic cam control method, including: Obtain the curve definition parameters of the electronic cam, and generate a smooth cam trajectory based on the curve definition parameters and the preset fifth-order polynomial curve algorithm; The smooth cam trajectory is resampled at equal intervals with a preset fixed resolution to obtain a first preset number of mapping points. Based on all mapping points, a target mapping table is generated. The real-time position pulse value fed back by the spindle encoder is obtained, and the index position and interpolation weight of the real-time position pulse value in the target mapping table are calculated based on the preset multiplicative inverse algorithm. Based on the index position, the slave axis position values ​​corresponding to two adjacent mapping points are read from the target mapping table, and the slave axis position values ​​of the two adjacent mapping points are linearly interpolated based on the interpolation weight to obtain the target slave axis position corresponding to the real-time position pulse value. Real-time slave position command of the electronic cam based on the target slave position.

[0005] Optionally, a smooth cam trajectory is generated based on curve definition parameters and a preset fifth-order polynomial curve, including: obtaining target cam segment parameters from the curve definition parameters, where the target cam segment parameters are any cam segment parameters in the curve definition parameters, and the target cam segment parameters include the master axis start position, master axis end position, slave axis start position, slave axis end position, and acceleration / deceleration ratio of the target cam segment; determining the acceleration segment duration and deceleration segment duration based on the acceleration / deceleration ratio, and calculating the constant speed segment speed of the target cam segment using the acceleration segment duration, deceleration segment duration, master axis start position, and master axis end position; determining the first intermediate position of the target cam segment based on the constant speed segment speed and acceleration segment duration, and determining the second intermediate position of the target cam segment based on the constant speed segment speed and deceleration segment duration; and determining the first fifth-order polynomial coefficients based on a first set of boundary conditions, where the first set of boundary conditions is based on the slave axis start position as the first... The system defines the starting position, the first starting velocity and acceleration (zero), the first ending position (first intermediate position), the first ending velocity (uniform speed segment), and the first ending acceleration (zero). Based on the second set of boundary conditions, it determines the coefficients of a second fifth-order polynomial. The second boundary conditions are: the second starting position (second intermediate position), the second starting velocity (uniform speed segment), the second starting acceleration (zero), the second ending position (from the axis ending position), the second ending velocity (zero), and the second ending acceleration. Based on the coefficients of the first fifth-order polynomial, it generates the acceleration trajectory of the target cam segment, and based on the coefficients of the second fifth-order polynomial, it generates the deceleration trajectory of the target cam segment. Using the uniform speed segment as a constant velocity, it generates a uniform speed segment trajectory between the first intermediate position and the second intermediate position. The acceleration trajectory, uniform speed segment trajectory, and deceleration trajectory are then spliced ​​together in ascending order of spindle travel to generate a smooth cam trajectory for the target cam segment.

[0006] Optionally, before obtaining the curve definition parameters of the electronic cam, the method further includes: obtaining a pre-configured second preset number of cam segment parameters, and sorting the second preset number of cam segment parameters according to the numerical increment of the spindle position to obtain a cam segment parameter sequence; performing continuity verification on all adjacent cam segment parameter pairs in the cam segment parameter sequence; if any adjacent cam segment parameter pair fails the continuity verification, the target mapping table is rejected and an error flag is returned; if all adjacent cam segment parameter pairs pass the continuity verification, the cam segment parameter sequence is used as the curve definition parameters of the corresponding cam segment.

[0007] Optionally, adjacent cam segment parameter pairs include the cam segment parameters of the preceding and following cam segments. A continuity check is performed on all adjacent cam segment parameter pairs in the cam segment parameter sequence, including: if the spindle end point of the preceding cam segment is the end point of a single spindle revolution, and the spindle start point of the following cam segment is the start point of a single spindle revolution, then the adjacent cam segment parameter pairs are determined to be continuous in the spindle travel; if the slave shaft position corresponding to the spindle end point of the preceding cam segment is the end point of a single slave shaft revolution, and the slave shaft position corresponding to the spindle start point of the following cam segment is the start point of a single slave shaft revolution, then the adjacent cam segment parameter pairs are determined to be continuous in the slave shaft travel; if If adjacent cam segment parameter pairs are continuous in both the main shaft travel and the driven shaft travel, the adjacent cam segment parameter pairs are determined to pass the continuity check. If the main shaft end position of the previous cam segment is the middle position of the main shaft single-turn travel and is not equal to the main shaft start position of the next cam segment in terms of main shaft position, the adjacent cam segment parameter pairs are determined to fail the continuity check and the first error code is returned. If the driven shaft position corresponding to the main shaft end position of the previous cam segment is not equal to the driven shaft position corresponding to the main shaft start position of the next cam segment in terms of driven shaft position, and the connection condition of the end position and start position of the driven shaft single-turn travel is not met, the adjacent cam segment parameter pairs are determined to fail the continuity check and the second error code is returned.

[0008] Optionally, before obtaining the pre-configured second preset number of cam segment parameters, the method further includes: displaying the curve configuration interface of the electronic cam through host computer software, the curve configuration interface including a parameter input area and a curve preview area; receiving the configuration parameters of each cam segment input by the user through the parameter input area; generating a preview cam trajectory according to the currently input configuration parameters in response to a preview command triggered by the user, and synchronously displaying the position curve and speed curve of the preview cam trajectory in the curve preview area; and writing the configuration parameters into the parameter register group of the driver through a bus communication protocol in response to a download command triggered by the user, as a pre-configured set of cam segment parameters.

[0009] Optionally, the index position and interpolation weight of the real-time position pulse value in the target mapping table are calculated based on a preset multiplicative inverse algorithm, including: obtaining the number of pulses per revolution of the spindle encoder, and determining the first inverse based on a first preset constant, a first preset quantity, and the number of pulses per revolution in the following manner: First inverse = (2 第一预设常数 / Number of pulses per revolution) × First preset quantity; Based on the second preset constant and the number of pulses per revolution, the second inverse is determined as follows: Second inverse = 2 (第二预设常数+16) / Number of pulses per cycle; Calculate the first product of the first inverse and the real-time position pulse value, shift the first product based on the first preset constant, and obtain the index position of the real-time position pulse value in the target mapping table; Calculate the second product of the real-time position pulse value and the first preset number, and calculate the third product of the index position and the number of pulses per cycle, and use the difference between the second product and the third product as the position remainder; Calculate the fourth product of the position remainder and the second inverse, and shift the fourth product based on the second preset constant to obtain the interpolation weight of the real-time position pulse value in the target mapping table.

[0010] Optionally, before generating the target mapping table, the method further includes: reading the current control mode of the servo drive; when the current control mode is speed control mode or torque control mode, clearing the enable flag of the electronic cam and synchronously writing the cleared state back to the enable control parameters in the parameter register group, and refusing to execute subsequent steps; when the drive is powered off or the electronic cam is turned off, automatically clearing the spindle position, slave position and multi-turn count values ​​stored in the servo drive.

[0011] In a second aspect, embodiments of this application provide a servo drive electronic cam control system, which includes: one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the servo drive electronic cam control system to perform the method described in the first aspect and any possible implementation thereof.

[0012] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a servo driver electronic cam control system, cause the servo driver electronic cam control system to perform the method described in the first aspect and any possible implementation thereof.

[0013] Fourthly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a servo driver electronic cam control system, cause the servo driver electronic cam control system to perform the method described in the first aspect and any possible implementation thereof.

[0014] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages: 1. By acquiring the curve definition parameters of the electronic cam and generating a smooth cam trajectory based on a preset fifth-order polynomial curve algorithm, the smooth cam trajectory is then resampled at equal intervals with a preset fixed resolution to obtain a first preset number of mapping points and generate a target mapping table. This completely decouples the storage capacity of the mapping table from the actual resolution of the encoder. Regardless of whether the spindle encoder is 17-bit or 23-bit, the mapping table occupies only a fixed amount of storage space. Simultaneously, by calculating the index position and interpolation weight of the real-time position pulse value in the target mapping table based on a preset multiplicative inverse algorithm, floating-point division and interpolation operations are converted into integer multiplication and shift operations, avoiding the time consumption of division instructions and floating-point operations within the control cycle. Thus, under the constraints of limited on-chip storage resources of the servo driver and extremely short control cycles, compact storage and efficient real-time table lookup of the electronic cam mapping table under a high-resolution encoder are achieved, improving the real-time response speed and synchronous control accuracy of the slave axis position output.

[0015] 2. By obtaining the acceleration and deceleration ratios in the target cam segment parameters, the duration of the acceleration and deceleration segments is determined, and the speed of the uniform segment is calculated. Based on the boundary conditions that the starting and ending speeds and accelerations are both zero, the coefficients of the fifth-order polynomial are determined, and the trajectories of the acceleration and deceleration segments are generated respectively. After generating the uniform segment trajectory with the speed of the uniform segment, the trajectories are spliced ​​together, so that the acceleration of a single cam trajectory changes continuously, avoiding abrupt changes in speed and acceleration, thereby ensuring the smoothness of the motion within the segment and providing a basis for the smooth splicing of the beginning and end of multiple cam curves.

[0016] 3. By sorting and verifying the continuity of pre-configured cam segment parameters, the generation of the mapping table is rejected and an error flag is returned when the verification fails. This ensures that the position continuity of the multi-segment cam curve is verified during the parameter configuration stage, thus preventing sudden jumps in the driven shaft position caused by incorrect parameter configuration. At the same time, the position and speed curves of the cam trajectory can be previewed on the host computer interface, allowing users to verify the rationality of the parameters before downloading. In addition, by reading the current control mode of the driver, the system only allows enabling in position control mode, and forcibly clears the enable flag and writes it back to the parameter register in speed or torque mode. Furthermore, the main shaft position, driven shaft position, and multi-turn count values ​​are cleared when the driver is powered off or the cam is closed, preventing abnormal startup caused by accidental enabling and residual status, thus improving the safety of the system. Attached Figure Description

[0017] Figure 1 This is a schematic flowchart of the servo driver electronic cam control method provided in the embodiments of this application; Figure 2 This is a schematic diagram of the parameter verification process provided in an embodiment of this application; Figure 3 This is a schematic diagram of the continuous verification curve provided in the embodiments of this application; Figure 4This is a schematic diagram of a servo driver electronic cam control system provided in an embodiment of this application.

[0018] Explanation of reference numerals in the attached figures: 401, Central Processing Unit; 402, Read-Only Memory; 403, Random Access Memory; 404, Bus; 405, Input / Output Interface; 406, Input Section; 407, Output Section; 408, Storage Section; 409, Communication Section; 410, Driver; 411, Removable Media. Detailed Implementation

[0019] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.

[0020] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.

[0021] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.

[0022] This application provides a servo driver electronic cam control method, system, medium, and product to address how to improve the synchronous control accuracy of the slave axis position output.

[0023] Figure 1 This is a schematic flowchart of the servo driver electronic cam control method provided in the embodiments of this application.

[0024] This application discloses a servo driver electronic cam control method, such as... Figure 1 As shown, the steps include the following.

[0025] S101. Obtain the curve definition parameters of the electronic cam, and generate a smooth cam trajectory based on the curve definition parameters and the preset fifth-order polynomial curve algorithm.

[0026] Specifically, the system obtains the user-pre-configured electronic cam curve definition parameters. These parameters contain various constraint information required to describe the shape of the cam trajectory. After obtaining the curve definition parameters, a preset fifth-order polynomial curve algorithm is used. This algorithm uses a fifth-order polynomial as a position function to describe the change in slave position with spindle travel. The core of this algorithm is to determine the six coefficients of the polynomial through constraint conditions, thereby obtaining a smooth curve where position, velocity, and acceleration are all continuous. The curve definition parameters provide the boundary conditions required to determine the coefficients of the fifth-order polynomial, such as the starting and ending positions of the trajectory, and the approximate velocities and accelerations at the starting and ending points. By substituting the aforementioned boundary conditions into the fifth-order polynomial position function and its first derivative (velocity function) and second derivative (acceleration function), six coefficients can be uniquely determined, resulting in a smooth cam trajectory that continuously varies from the start to the end point. This trajectory is a continuous curve with the master axis position as the abscissa and the slave axis position as the ordinate. Preset velocity and acceleration constraints are satisfied at the start and end points, ensuring a smooth and shock-free trajectory during start-stop phases. When the curve definition parameters include constraint information for multiple trajectory segments, the fifth-order polynomial coefficients for each segment are solved separately and then spliced ​​together in the master axis travel sequence to form a continuous trajectory covering the complete master axis travel. The fifth-order polynomial used in this application is the lowest-order polynomial that ensures continuity of position, velocity, and acceleration. Polynomials of lower order than five cannot simultaneously constrain the six conditions of position, velocity, and acceleration at both the start and end points.

[0027] Among them, the curve definition parameters refer to the data set configured by the user to describe the shape of the electronic cam trajectory, including constraint information such as the starting position, ending position, starting velocity, ending velocity, starting acceleration, and ending acceleration of the trajectory; the quintic polynomial curve algorithm refers to the mathematical method of trajectory planning using a quintic polynomial as the position function; the smooth cam trajectory refers to the mapping curve generated by the quintic polynomial curve algorithm, in which the position, velocity, and acceleration of the slave axis change with the position of the master axis.

[0028] The current solution is suitable for general scenarios of electronic cam trajectory generation—the user configures the start and end points of the trajectory, as well as the velocity and acceleration constraints at the start and end points. The driver generates a smooth cam trajectory using a fifth-order polynomial curve algorithm, suitable for single-segment cam trajectories or simple applications where constraints do not need to be set at specific positions in the middle of the stroke. When more precise trajectory shape control is required—for example, setting different slave axis start and end positions and acceleration / deceleration ratios in different intervals of the spindle stroke, or when multiple cam curves with different characteristics need to be spliced ​​together—an optional embodiment is provided based on the above embodiment, specifically for… Figure 1The step S101 shown can be implemented through steps S201-S205, which will be explained in detail below.

[0029] S201. Obtain the target cam segment parameter from the curve definition parameters. The target cam segment parameter is any cam segment parameter in the curve definition parameters. The target cam segment parameter includes the main shaft start position, main shaft end position, driven shaft start position, driven shaft end position, and acceleration / deceleration ratio of the target cam segment.

[0030] Specifically, the curve definition parameters are a complete set of data configured by the user through the host computer software and downloaded to the driver parameter register group. It contains the configuration information of one or more cam segments. When generating the electronic cam trajectory, each set of cam segment parameters is taken from the curve definition parameters in sequence as the current processing object. This set of parameters is the target cam segment parameter. The target cam segment parameter does not refer to a specific fixed segment, but rather represents the cam segment parameter that the driver is currently processing. After processing the current segment, the driver automatically takes the next set of parameters as the new target cam segment parameter until all cam segments have been processed. The target cam segment parameters include five basic configuration items: the spindle start position and spindle end position, which define the range of the target cam segment within a single spindle revolution. For example, a spindle start position of 20% and a spindle end position of 40% indicate that this segment is responsible for the follower motion of the slave shaft within the range of 20% to 40% of the spindle's stroke. The slave shaft start position and slave shaft end position indicate the positions the slave shaft should reach when the spindle reaches the start and end of this segment, respectively. The acceleration / deceleration ratio controls the smoothness of the slave shaft during the start and stop phases, with a value range of 0 to 50%. The larger the value, the smoother the acceleration / deceleration process. The value range is limited to no more than 50% to ensure the existence of a uniform speed segment and avoid direct overlap between acceleration and deceleration segments. If the curve definition parameters include multiple cam segment parameters, the spindle intervals of each set of parameters are arranged sequentially according to the spindle stroke order and connected end-to-end, collectively covering the complete single-turn stroke of the spindle from 0% to 100%. After the driver obtains the target cam segment parameters, it obtains all the constraint information required to subsequently generate the smooth cam trajectory of this segment.

[0031] Through the above embodiments, since the target cam segment parameters are any cam segment parameters obtained from the curve definition parameters, rather than fixed segments, the number of cam segments included in the curve definition parameters is unlimited. Users can configure any number of cam segments according to process requirements, and each segment can be independently configured with the spindle start and end positions, slave spindle start and end positions, and acceleration / deceleration ratio. Simultaneously, since the acceleration / deceleration ratio of each segment is independently adjustable, different cam segments can have different degrees of acceleration / deceleration smoothness, achieving differentiated smooth control in complex motion trajectories with varying spindle speeds.

[0032] S202. Determine the duration of the acceleration segment and the duration of the deceleration segment based on the acceleration / deceleration ratio, and calculate the constant speed segment speed of the target cam segment using the acceleration segment duration, deceleration segment duration, main shaft start position, and main shaft end position.

[0033] Specifically, in electronic cam trajectory planning, a complete cam segment trajectory consists of three parts in chronological order: an acceleration segment, a constant speed segment, and a deceleration segment. The acceleration and deceleration segments are located at the two ends of the segment's travel, respectively, while the constant speed segment is in the middle. The acceleration / deceleration ratio represents the proportion of the acceleration segment's duration to the total travel time of that segment, and also represents the proportion of the deceleration segment's duration to the total travel time of that segment—the acceleration and deceleration segments use the same ratio value to ensure the symmetry of the acceleration and deceleration process. For example, when the acceleration / deceleration ratio is 30%, the acceleration segment accounts for 30% of the total travel time, the deceleration segment accounts for 30% of the total travel time, and the constant speed segment accounts for 40% of the total travel time. After determining the duration of the acceleration and deceleration phases, the driver calculates the spindle travel corresponding to the cam segment based on the spindle start and end positions, and subtracts the spindle travel during the acceleration and deceleration phases to obtain the spindle travel during the constant speed phase. Simultaneously, the total displacement of the driven shaft is calculated based on the driven shaft start and end positions. Since the driven shaft operates at a constant speed during the constant speed phase, the displacement required by the driven shaft during the constant speed phase is divided by the duration of the constant speed phase to obtain the speed value of the constant speed phase.

[0034] S203. Determine the first intermediate position of the target cam segment based on the constant speed segment speed and the acceleration segment duration, and determine the second intermediate position of the target cam segment based on the constant speed segment speed and the deceleration segment duration.

[0035] Specifically, in electronic cam trajectory planning, a complete cam segment trajectory consists of three segments: an acceleration segment, a constant speed segment, and a deceleration segment. Clear dividing points need to be defined between these three segments: the acceleration segment starts from the current position (starting point of the cam axis) and ends at the first intermediate position; the constant speed segment starts from the first intermediate position and ends at the second intermediate position; and the deceleration segment starts from the second intermediate position and ends at the ending point of the cam axis. The first intermediate position is determined as follows: taking the starting point of the cam axis as the starting point, the displacement traveled by the cam axis during the acceleration segment's duration from rest to the constant speed segment is superimposed on this position. Specifically, this is calculated by multiplying the constant speed segment speed by the acceleration segment duration and then by a proportionality coefficient (this proportionality coefficient is determined by the displacement characteristics of the fifth-order polynomial acceleration segment; for a fifth-order polynomial with starting and ending velocities of 0 and v respectively, and both starting and ending accelerations of 0, its displacement at time T is v × T × 0.5, i.e., the displacement equals the constant speed segment speed multiplied by the acceleration segment duration multiplied by 0.5). Similarly, the second intermediate position is determined as follows: starting from the first intermediate position, the displacement traveled by the shaft during the constant speed segment within the duration of the constant speed segment is superimposed on this position; that is, the constant speed segment speed multiplied by the constant speed segment duration. The constant speed segment duration is obtained by subtracting the acceleration segment duration and the deceleration segment duration from the total travel time of the cam segment. Determining the two intermediate positions divides the complete cam segment into three continuous intervals in terms of position, providing clear segment boundaries for the subsequent generation of the acceleration segment, constant speed segment, and deceleration segment trajectories.

[0036] S204. Determine the coefficients of the first fifth-order polynomial based on the first set of boundary conditions. The first set of boundary conditions is: the starting position of the axis is the first starting position, zero is the first starting velocity and the first starting acceleration, the first intermediate position is the first ending position, the uniform speed segment velocity is the first ending velocity, and zero is the first ending acceleration. Determine the coefficients of the second fifth-order polynomial based on the second set of boundary conditions. The second boundary conditions are: the second intermediate position is the second starting position, the uniform speed segment velocity is the second starting velocity, zero is the second starting acceleration, the starting position of the axis is the second ending position, zero is the second ending velocity and the second ending acceleration.

[0037] Specifically, the position function of the fifth-degree polynomial curve is pos(t) = a0 + a1×t + a2×t 2 +a3×t 3 +a4×t 4 +a5×t 5The first derivative of the equation represents velocity, and the second derivative represents acceleration. Therefore, the shape of the trajectory is entirely determined by six coefficients a0 to a5. To determine these six coefficients, six independent constraints, or boundary conditions, are required. For the acceleration segment trajectory, the actuator takes the starting position of the drive shaft as the starting position (position at t=0), and zero as the starting velocity and acceleration, indicating that the drive shaft is stationary at the beginning of this segment. Simultaneously, the first intermediate position is taken as the ending position (position at t=T), the uniform velocity is taken as the ending velocity, and zero as the ending acceleration, indicating that the drive shaft reaches the uniform velocity and has zero acceleration at the end of this segment. Substituting these six boundary conditions—starting position, starting velocity, starting acceleration, ending position, ending velocity, and ending acceleration—into the position function and its first and second derivatives respectively, constitutes a system of six linear equations containing six unknowns a0 to a5. Solving this system of equations uniquely determines the six coefficients of the acceleration segment trajectory. Using the first intermediate position as the dividing point, the acceleration phase trajectory is active before the slave axis position reaches the first intermediate position; upon reaching the first intermediate position, the acceleration phase ends and the constant velocity phase begins. For the deceleration phase trajectory, the actuator uses the second intermediate position as the starting position (position at t=0), the constant velocity phase velocity as the starting velocity, and zero as the starting acceleration, indicating that the slave axis is in a state of constant velocity motion at the beginning of this phase; simultaneously, the slave axis end position is used as the ending position (position at t=T), with zero as the ending velocity and ending acceleration, indicating that the slave axis comes to a complete stop and has zero acceleration at the end of this phase. Similarly, substituting the six boundary conditions into the fifth-degree polynomial position function and its derivative, a system of six linear equations is solved to uniquely determine the six coefficients of the deceleration phase trajectory. Using the second intermediate position as the dividing point, the constant velocity phase trajectory is active before the slave axis position reaches the second intermediate position; upon reaching the second intermediate position, the constant velocity phase ends and the deceleration phase begins. The coefficients of the first and second fifth degree polynomials are solved in exactly the same way, the only difference being the values ​​of the boundary conditions substituted, namely the specific values ​​of the starting position, ending position, starting velocity, ending velocity, starting acceleration, and ending acceleration.

[0038] When determining the six coefficients based on boundary conditions, the starting position is taken as a0, the starting velocity as a1, half of the starting acceleration as a2, and a3 = (20 × h - (8 × ending velocity + 12 × starting velocity) × T - (3 × starting acceleration - ending acceleration) × T 2 ) / (2×T 3 ), where h is the displacement within the segment, T is the duration of the segment, and a4 = (-30 × h + (14 × final velocity + 16 × initial velocity) × T + (3 × initial acceleration - 2 × final acceleration) × T 2 ) / (2×T 4), a5 = (12 × h - 6 × (final velocity + initial velocity) × T - (initial acceleration - final acceleration) × T 2 ) / (2×T 5 ).

[0039] S205. Generate the acceleration trajectory of the target cam segment based on the coefficients of the first fifth-order polynomial, and generate the deceleration trajectory of the target cam segment based on the coefficients of the second fifth-order polynomial; generate the uniform speed trajectory between the first intermediate position and the second intermediate position with the uniform speed as a constant speed; splice the acceleration trajectory, uniform speed trajectory and deceleration trajectory in ascending order of spindle stroke to generate the smooth cam trajectory of the target cam segment.

[0040] Specifically, the coefficients of the first fifth-order polynomial have been solved under the boundary conditions of the acceleration segment, and the coefficients of the second fifth-order polynomial have been solved under the boundary conditions of the deceleration segment. The actuator substitutes the coefficients a0 to a5 of the first fifth-order polynomial into the fifth-order polynomial position function to generate the acceleration segment trajectory. The acceleration segment trajectory describes the complete position change curve of the axle from a stationary state (initial velocity is 0) to a constant velocity segment (final velocity is the constant velocity segment), with both the initial and final accelerations being 0, over time. Its independent variable is the cumulative running time starting from the beginning of this segment, and the dependent variable is the position of the axle. Similarly, the actuator substitutes the coefficients of the second fifth-order polynomial into the same fifth-order polynomial position function to generate the deceleration segment trajectory. The deceleration segment trajectory describes the complete position change curve of the axle from a constant velocity segment (initial velocity is the constant velocity segment, initial acceleration is 0) to a complete stop (final velocity is 0, final acceleration is 0) over time. For the constant speed segment trajectory, the actuator does not need to generate it using polynomial coefficients. Instead, it directly uses the constant speed segment speed as a constant value, with the first intermediate position as the starting point and the second intermediate position as the ending point, to generate a trajectory where the slave axis position changes linearly with the spindle travel. Since the constant speed segment speed no longer changes, the slave axis position at any given time is equal to the first intermediate position plus the product of the constant speed segment speed and the travel time. The three trajectories cover three continuous intervals from the slave axis's starting position to the first intermediate position (acceleration segment), from the first intermediate position to the second intermediate position (constant speed segment), and from the second intermediate position to the ending position (deceleration segment). After generating the three trajectories, the actuator sequentially splices them together in ascending spindle travel order—the ending position of the acceleration segment coincides with the starting position of the constant speed segment at the first intermediate position, and the ending position of the constant speed segment coincides with the starting position of the deceleration segment at the second intermediate position. The acceleration segment covers the first segment of the spindle travel, the constant speed segment covers the middle segment, and the deceleration segment covers the last segment. After splicing the three segments, a complete, continuous, smooth cam trajectory for the target cam segment is formed, spanning the entire travel range from the spindle's starting position to its ending position.

[0041] In the above embodiments, both the acceleration and deceleration segments are generated based on fifth-order polynomial coefficients, and the uniform speed segment connects the two at a constant speed. Since the acceleration is zero in the boundary conditions at the end of the acceleration segment and the beginning of the deceleration segment, when the three trajectory segments are spliced ​​at the first and second intermediate positions, the slave axis position, velocity, and acceleration are continuous, and there are no jumps between segments, thus forming a mathematically smooth and complete cam trajectory. Simultaneously, since the trajectory is spliced ​​in ascending order of the master shaft travel, a mapping relationship between the master shaft position and the slave axis position is directly established. During subsequent operation, it is only necessary to determine the cam segment based on the current master shaft position and retrieve the corresponding slave axis position value from that trajectory segment, eliminating the need for real-time trajectory curve calculation and significantly reducing the computational burden during operation. Furthermore, since the smooth cam trajectory is generated with the master shaft travel as the abscissa, the relationship between the slave axis and the master shaft position remains unchanged when the master shaft speed changes, thus ensuring that the shape of the cam trajectory does not change with the master shaft speed.

[0042] Based on the above embodiments, as an optional embodiment, see [link to embodiment]. Figure 2 , Figure 2 This is a schematic diagram of the parameter verification process provided in an embodiment of this application. Figure 1 Before step S101 shown, it may also include Figure 2 Steps S301-S304 are explained in detail below.

[0043] S301. Obtain the pre-configured second preset number of cam segment parameters, and sort the second preset number of cam segment parameters according to the numerical increment of the spindle position to obtain the cam segment parameter sequence.

[0044] Specifically, the trajectory of an electronic cam is typically composed of multiple cam segments joined end-to-end. Each cam segment is responsible for the follow-up motion of the slave shaft within a continuous interval of the spindle's stroke. When the user configures multiple sets of cam segment parameters through the host computer software, the order in which they are entered may not match the actual stroke order of the spindle. Therefore, after obtaining the pre-configured second preset number of cam segment parameters, the driver first needs to sort them according to the actual sequence of each cam segment in the spindle's stroke. Using the spindle start position or end position of each set of parameters as the sorting key, the cam segment parameters are rearranged in ascending order of value. This ensures that in the sorted sequence, the end position of the previous set connects to the start position of the next set sequentially in the spindle's stroke. After sorting, the cam segments are arranged sequentially from 0% to 100% of the spindle stroke, forming an ordered sequence of cam segment parameters. The positional relationship in this sequence directly reflects the order in which the slave shaft executes each segment of the trajectory during actual operation. If the user-configured cam segment parameters have already been entered in ascending order in the spindle's stroke, the sorted order remains unchanged. Once sorted, this cam segment parameter sequence will be used for subsequent continuity verification and trajectory generation.

[0045] The second preset quantity represents the total number of cam segments configured by the user, which is set by the user according to actual process requirements; the cam segment parameter sequence refers to an ordered set formed by arranging multiple sets of cam segment parameters in the order of spindle stroke.

[0046] Based on the above embodiments, as an optional embodiment, in Figure 2 Before step S301 shown, the following steps may also be included, which will be explained in detail below.

[0047] The host computer software displays the curve configuration interface of the electronic cam, which includes a parameter input area and a curve preview area. The parameter input area receives the configuration parameters of each cam segment input by the user. In response to the preview command triggered by the user, the software generates a preview cam trajectory based on the currently input configuration parameters and simultaneously displays the position curve and speed curve of the preview cam trajectory in the curve preview area. In response to the download command triggered by the user, the software writes the configuration parameters into the parameter register group of the driver through the bus communication protocol as a pre-configured set of cam segment parameters.

[0048] Specifically, after opening the electronic cam configuration interface in the host computer software, the interface presents two main functional areas: a parameter input area and a curve preview area. The parameter input area receives the parameters configured by the user for each cam segment, including the start and end positions of the master shaft, the start and end positions of the slave shaft, and the acceleration / deceleration ratio for each segment. Users can fill in these parameters segment by segment using input boxes or sliders. The curve preview area displays the cam trajectory graphic generated based on the currently input parameters. After the user completes the parameter input, they can trigger a preview command by clicking the preview button on the interface. The host computer software responds to this preview command by executing the cam trajectory generation algorithm based on all the configured parameters in the current parameter input area. This algorithm is consistent with the trajectory generation logic inside the driver, i.e., it generates smooth cam trajectories for each segment according to a fifth-order polynomial curve algorithm and splices them into a complete periodic trajectory. After generating the preview cam trajectory, a position curve is drawn in the curve preview area with the master shaft position as the horizontal axis and the slave shaft position as the vertical axis. At the same time, a velocity curve is drawn in the same coordinate system or adjacent area with the master shaft position as the horizontal axis and the slave shaft velocity as the vertical axis. Users can intuitively judge the cam trajectory by observing the shapes of the two curves. To ensure smoothness and rationality, if the curve shape does not meet the process requirements, the user can adjust the parameters and preview again until satisfied. After the user confirms that the configuration is correct, they can trigger a download command by clicking the download button on the interface. The host computer software responds to the download command and organizes the configuration parameters of all cam segments in the parameter input area into corresponding data frames according to the predefined register address mapping table through a bus communication protocol (such as Modbus protocol), and sends them to the servo driver. After receiving the data frames, the driver writes each parameter value into the corresponding parameter register group (such as PA-00 to PA-79) to complete the storage of the configuration parameters. After writing, these parameters are used as a pre-configured set of cam segment parameters for the driver to read and use when generating electronic cam trajectory later.

[0049] The host computer software refers to the configuration tool program running on a personal computer or industrial touch screen, used for communication and parameter configuration with the servo drive; the curve configuration interface refers to the graphical user interface in the host computer software used to configure the electronic cam parameters; the parameter input area refers to the area in the interface used to receive user input of configuration parameters for each cam segment, including input controls for spindle start position, spindle end position, slave spindle start position, slave spindle end position, and acceleration / deceleration ratio; the curve preview area refers to the area in the interface used to display the cam trajectory graph, plotted with the spindle position as the horizontal axis and the slave spindle position or slave spindle velocity as the vertical axis; the configuration parameters refer to the set of values ​​input by the user for each cam segment, including the spindle start position, spindle end position, slave spindle start position, slave spindle end position, and acceleration / deceleration ratio; the preview cam trajectory refers to the complete cam trajectory generated by the host computer software based on the current configuration parameters, including position curves and velocity curves, used for preview.

[0050] Through the above embodiments, users can complete all parameter configurations of the electronic cam via host computer software, without the need for manual programming or oscilloscope debugging. The curve preview function in the configuration interface allows users to visually see the generated cam trajectory shape before downloading parameters to the driver, including whether the position curve is smooth and whether the velocity curve has sharp angles or abrupt changes. This allows for the identification and correction of unreasonable configurations during the parameter configuration stage, avoiding the inefficient process of discovering problems only after downloading incorrect parameters to the driver and requiring repeated downloads and debugging. The simultaneous display of position and velocity curves also facilitates observation of acceleration trends—the slope change of the velocity curve reflects the continuity of acceleration—further assisting users in judging the smoothness of the trajectory. The separation of preview and download allows users to complete parameter debugging without a driver connection, lowering the debugging threshold and reducing trial-and-error costs.

[0051] S302. Perform continuity verification on all adjacent cam segment parameter pairs in the cam segment parameter sequence.

[0052] Specifically, after sorting multiple sets of cam segment parameters to obtain the cam segment parameter sequence, since the complete cycle of the electronic cam is formed by splicing multiple cam trajectories end to end, the end position of the previous segment must be consistent with the starting position of the next segment on both the master and slave axes. Otherwise, the slave axis position will jump when running to the segment switching point, leading to mechanical shock or loss of control. Therefore, the purpose of continuity verification is to confirm whether adjacent sets of parameters are continuous in master axis stroke and slave axis position after sorting, ensuring that there are no position jumps at the segment connection points in the subsequently generated mapping table. Continuity verification can be implemented through the following steps, which are explained in detail below.

[0053] If the end point of the main shaft of the current cam segment is the end point of a single revolution of the main shaft, and the start point of the main shaft of the next cam segment is the start point of a single revolution of the main shaft, then the parameter pair of the adjacent cam segments is determined to be continuous in the main shaft stroke. If the slave shaft position corresponding to the end point of the main shaft of the current cam segment is the end point of a single revolution of the slave shaft, and the slave shaft position corresponding to the start point of the main shaft of the next cam segment is the start point of a single revolution of the slave shaft, then the parameter pair of the adjacent cam segments is determined to be continuous in the slave shaft stroke. If the parameter pair of the adjacent cam segments is continuous in both the main shaft stroke and the slave shaft stroke, then the parameter pair of the adjacent cam segments passes the continuity check.

[0054] Specifically, after sorting multiple sets of cam segment parameters, the driver needs to perform continuity verification on all adjacent cam segment parameter pairs in the sequence. Because the electronic cam trajectory is periodic—each rotation of the main shaft completes one full cam cycle—there is a natural boundary connection requirement between the beginning and end segments within a complete cycle. That is, the end point (100%) of a single rotation of the main shaft and the beginning point (0%) of the next cycle are physically the same position. Therefore, continuity verification needs to distinguish between two scenarios: when the main shaft intervals of two adjacent cam segments are both located in the middle of their strokes (i.e., not at the boundary), the end point of the first set of main shaft segments and the beginning point of the second set must be numerically equal; when two adjacent cam segments cross a cycle boundary, i.e., the end point of the first set of main shaft segments is exactly the end point (100%) of a single rotation of the main shaft, and the beginning point of the second set is exactly the beginning point (0%) of a single rotation of the main shaft, although 100% is not equal to 0% numerically, they are physically connected and should be considered continuous. Similarly, the continuity check of the driven shaft also needs to consider the periodic boundary of a single revolution of the driven shaft. If the end position of the previous segment on the driven shaft is exactly the end position of a single revolution of the driven shaft (100%), and the starting position of the next segment on the driven shaft is exactly the starting position of a single revolution of the driven shaft (0%), then the driven shaft stroke is considered continuous. Only when adjacent cam segment parameter pairs are both determined to be continuous in both the main shaft stroke and the driven shaft stroke, will the adjacent parameter pairs pass the continuity check; otherwise, they are considered discontinuous.

[0055] For examples, please see Figure 3 Curve 1, Figure 3 This is a schematic diagram of the continuous verification curve provided in this application embodiment. The user configures a four-segment cam curve 1 for a complete cycle. The sorted cam segment parameter sequence is as follows: Segment 1: Master shaft 0% to 20%, slave shaft 0% to 40%; Segment 2: Master shaft 20% to 40%, slave shaft 40% to 80%; Segment 3: Master shaft 40% to 80%, slave shaft 80% to 40%; Segment 4: Master shaft 80% to 100%, slave shaft 40% to 0%. The driver performs routine verification on the first three adjacent parameter pairs in sequence: the end point of segment 1 and the start point of segment 2 are equal in master-slave axis position, passing the continuity verification; the end point of segment 2 and the start point of segment 3 are equal in master-slave axis position, passing the continuity verification; the end point of segment 3 and the start point of segment 4 are equal in master-slave axis position, passing the continuity verification. Regarding the transition between segment 4 and segment 1 of the next cycle, since the endpoint of the main axis in group 4 is 100% (end of a single rotation of the main axis), and the starting point of the main axis in group 1 of the next cycle is 0% (start of a single rotation of the main axis), although 100% is not equal to 0%, it is determined to be a continuous main axis according to the cycle boundary transition rules. Similarly, since the endpoint of the slave axis in group 4 is 100% (end of a single rotation of the slave axis), and the starting point of the slave axis in group 1 of the next cycle is 0% (start of a single rotation of the slave axis), it is determined to be a continuous slave axis. This pair of adjacent parameters passes the continuity check. (Reference) Figure 3 Curve 2 in the diagram, although the principal axis positions are both 50%, the secondary axis positions are not equal, which does not meet the boundary connection conditions and is therefore judged as discontinuous.

[0056] Through the above embodiments, the continuity check introduces the periodic boundary connection judgment between the end point and the start point of the single-turn stroke of the main shaft and the single-turn stroke of the driven shaft, so that the natural continuity between the first and last segments of the complete cam cycle can be correctly identified, avoiding the situation of misjudging discontinuity due to the difference between the values ​​0 and 100. If misjudged, the user may need to merge the first and last segments into one segment or manually adjust the first and last positions, which increases the configuration complexity.

[0057] If the end position of the spindle of the previous cam segment is the middle position of the single revolution of the spindle, and is not equal to the starting position of the spindle of the next cam segment in terms of spindle position, then the parameter pair of the adjacent cam segments is determined to have failed the continuity check and the first error code is returned.

[0058] Specifically, during the continuity verification process, when the spindle positions of two adjacent cam segment parameters do not meet the periodic boundary connection conditions, the driver needs to determine whether their values ​​are equal at the midpoint of the spindle stroke. If neither of the spindle intervals of two adjacent cam segments involves a periodic boundary, that is, the spindle end position of the previous cam segment is not the end position of a single spindle stroke (100%), and the spindle start position of the subsequent cam segment is not the start position of a single spindle stroke (0%), then the spindle end position and the spindle start position must be equal in value. When the condition is not met—that is, the spindle end position of the previous cam segment and the spindle start position of the next cam segment have different spindle position values—then the parameter pair of the adjacent cam segments is determined to have failed the continuity check. Spindle position discontinuity means that there is a gap or overlap between the end position of the previous segment and the start position of the next segment. When the slave shaft runs to the connection point, it cannot smoothly transition from the end of the previous segment to the start of the next segment, which will cause the slave shaft position to jump. After detecting the discontinuity, the driver immediately stops all subsequent verification steps and returns the first error code. The first error code is used to indicate the specific error type of spindle position discontinuity. The return of the first error code allows the user to quickly locate the type of configuration error (spindle discontinuity or slave shaft discontinuity) and the adjacent segment position where the error occurred, so as to correct the parameter configuration in a targeted manner.

[0059] If the slave shaft position corresponding to the end position of the master shaft of the previous cam segment is not equal to the slave shaft position corresponding to the start position of the master shaft of the next cam segment, and the connection condition between the end position and the start position of the single revolution of the slave shaft is not met, then the parameter pair of the adjacent cam segments is determined to have failed the continuity check and the second error code is returned.

[0060] Specifically, during the continuity verification process, after two adjacent sets of cam segment parameters meet the continuity condition in the master shaft position, the driver needs to further verify the continuity of the slave shaft position. The slave shaft position continuity verification is another dimension independent of the master shaft continuity verification—even if the master shaft position is continuous, if the slave shaft position is discontinuous, the slave shaft will still experience a position jump during segment switching. The end position of the master shaft of the previous cam segment is substituted into the smoothed cam trajectory function of the previous cam segment to obtain the corresponding slave shaft position value; the starting position of the master shaft of the next cam segment is substituted into the smoothed cam trajectory function of the next cam segment to obtain the corresponding slave shaft position value; then, these two slave shaft position values ​​are compared to see if they are equal. If the two are not equal, the system further determines whether the cycle boundary connection condition of the single-turn stroke of the driven shaft is met—that is, whether the driven shaft position corresponding to the end position of the master shaft of the previous cam segment is the end position of the single-turn stroke of the driven shaft (100%), and whether the driven shaft position corresponding to the start position of the master shaft of the next cam segment is the start position of the single-turn stroke of the driven shaft (0%). If both conditions are met, the driven shaft stroke is determined to be continuous; if not, the parameter pair of the adjacent cam segments is determined to have failed the continuity check. After detecting a discontinuity in the driven shaft position, the driver immediately stops all subsequent verification steps and returns a second error code. This second error code indicates the specific error type of the discontinuity in the driven shaft position, which is different from the aforementioned first error code (discontinuous master shaft position), making it easier for the user to accurately locate the location and type of configuration error.

[0061] Through the above embodiments, the continuity check returns different error codes for spindle position discontinuities and slave position discontinuities, allowing users to identify the specific error type without having to check all parameters one by one when the check fails—the first error code directly indicates a spindle position discontinuity. Compared to returning a single, general failure identifier, users can quickly pinpoint the problem as a failure to connect the spindle positions of two adjacent cam segments end-to-end, rather than due to other reasons, thus reducing the difficulty and time cost of parameter debugging.

[0062] S303. If any adjacent cam segment parameter pair fails the continuity check, the target mapping table will not be generated and an error flag will be returned.

[0063] Specifically, after verifying the continuity of all adjacent cam segment parameter pairs in the cam segment parameter sequence, the driver determines whether to continue the subsequent mapping table generation step based on the verification results. If any pair of adjacent cam segment parameters in the sequence fails the continuity verification—whether it's a discontinuity in the master shaft position or a discontinuity in the slave shaft position—it indicates that there is a position jump or stroke misalignment at the segment transition point of the currently configured multi-segment cam parameters. If the subsequent steps to generate the target mapping table are continued, the slave shaft will experience a sudden position jump when running to the segment transition point, leading to mechanical impact or loss of control. Therefore, when any adjacent parameter pair fails the verification, all subsequent operations are immediately terminated, the step of generating the target mapping table is refused, and a corresponding error identifier is returned based on the specific reason for the verification failure—the error identifier includes the failure type (master shaft discontinuity or slave shaft discontinuity) and the position information of the adjacent segment where the error occurred. After reading the error identifier through the host computer software, the user can know the specific location and reason for the configuration error, and thus correct the corresponding cam segment parameters accordingly. Only when all adjacent cam segment parameter pairs in the sequence pass the continuity verification will the driver continue to execute the step of generating the target mapping table.

[0064] S304. If all adjacent cam segment parameter pairs pass the continuity check, then the cam segment parameter sequence is used as the curve definition parameter of the corresponding cam segment.

[0065] Specifically, after verifying the continuity of all adjacent cam segment parameter pairs in the cam segment parameter sequence, if all adjacent parameter pairs pass the verification, it indicates that the user-configured cam segments are connected end-to-end in both the spindle travel and slave position, and the entire sequence covers a continuous travel range without gaps or overlaps. At this point, the cam segment parameter sequence is officially determined as the curve definition parameters used for subsequent trajectory generation. The curve definition parameters are the sole data source for the driver to subsequently perform smooth cam trajectory generation and mapping table construction. After passing the verification, the arrangement order of each group of parameters in the cam segment parameter sequence has been confirmed—arranged in ascending order according to the spindle position, and the positions of adjacent parameter pairs are continuous—which allows each segment to be generated sequentially in this order and spliced ​​end-to-end in the same order when generating smooth cam trajectories, without the need for re-sorting or additional processing. If the curve definition parameters contain multiple groups of cam segment parameters, the order after sorting and verification is the execution order of trajectory generation. The first group corresponds to the first segment of the spindle travel, the second group corresponds to the next continuous segment, and so on, until the entire spindle single-turn travel is covered.

[0066] Through the above embodiments, only the sequence of cam segment parameters that passes all continuity checks can become curve definition parameters. This ensures that the source data used to generate smooth cam trajectories is continuous in both the master and slave shaft strokes, avoiding positional jumps in the generated trajectory at the junctions of segments due to discontinuities or overlaps in the source data itself. Determining the validated sequence as the unique curve definition parameter clarifies the data flow of the entire electronic cam control process—configuration parameters can only enter the trajectory generation stage after passing validation, preventing unverified discontinuous parameters from being used to generate the mapping table and improving system reliability.

[0067] S102. Perform equal-interval resampling of the smooth cam trajectory at a preset fixed resolution to obtain a first preset number of mapping points. Based on all mapping points, generate a target mapping table.

[0068] Specifically, since the smooth cam trajectory is a continuous mathematical function generated by a fifth-order polynomial curve algorithm, calculating the slave axis position with time or spindle position as the independent variable, calculating this function in real time during runtime involves floating-point operations and polynomial evaluation, which is time-consuming and cannot meet the real-time requirements of the servo drive within its extremely short control cycle. Therefore, the drive performs equal-interval resampling of the smooth cam trajectory at a preset fixed resolution—that is, within the range of 0% to 100% of the spindle's single-turn travel, mapping points are uniformly collected at fixed position intervals. The number of mapping points is determined by a first preset number, which is a preset fixed value and is independent of the encoder's actual resolution. For example, when the first preset number is 4096, the drive evenly divides the spindle's single-turn travel into 4096 equal intervals, with the endpoint of each interval being a sampling point. The spindle travel interval between two adjacent sampling points is constant, equal to 100% divided by 4096. For each sampling point, the corresponding master spindle position value is substituted into the mathematical expression for smoothing the cam trajectory to calculate the corresponding slave spindle position value, thus forming a set of discrete mapping points with one-to-one correspondence between master spindle positions and slave spindle positions. All mapping points are arranged and stored in the driver memory in ascending order of master spindle position, forming the target mapping table. The target mapping table is stored in array form with a length of a first preset number. The value of each array member is the slave spindle position value corresponding to the sampling point. The array index corresponds one-to-one with the master spindle position of the sampling point—that is, array index 0 corresponds to the slave spindle position at 0% master spindle travel, index 1 corresponds to the slave spindle position at 100% master spindle travel / first preset number, and so on, down to index first preset number minus one corresponding to the slave spindle position at 100% master spindle travel.

[0069] Based on the above embodiments, as an optional embodiment, in Figure 1 Before step S102 shown, the following steps may also be included, which are described in detail below.

[0070] Read the current control mode of the servo drive; when the current control mode is speed control mode or torque control mode, clear the enable flag of the electronic cam and synchronously write the cleared state back to the enable control parameters in the parameter register group, and refuse to execute subsequent steps; when the drive is powered off or the electronic cam is turned off, automatically clear the spindle position, slave position and multi-turn count values ​​stored in the servo drive.

[0071] Specifically, before generating the target mapping table, the driver first needs to confirm whether the current control mode allows the execution of the electronic cam function. Servo drivers typically support multiple control modes, including position control mode, speed control mode, and torque control mode. The electronic cam function is essentially a slave axis following the position synchronization control of the spindle, so it can only be executed correctly in position control mode. In speed control mode, the driver takes speed commands as input and does not respond to position commands; in torque control mode, the driver takes torque commands as input and cannot perform position following. Therefore, the driver reads the currently active control mode and determines whether the mode matches the operating conditions of the electronic cam function. If the current mode is speed control or torque control, the driver clears the electronic cam's enable flag—the enable flag is an internal flag used by the driver to indicate whether the electronic cam function is allowed to be executed; clearing it means execution is prohibited—and synchronously writes the cleared enable state back to the enable control parameters in the parameter register group. This allows the host computer software to know the enable failure state when reading the parameter, avoiding inconsistencies between the enable state displayed by the host computer and the actual enable state of the driver. After clearing the enable flag and writing back the state, the driver refuses to execute subsequent steps, i.e., it does not generate a target mapping table or respond to the electronic cam's running commands. In addition, when the driver is normally powered off or the electronic cam function is turned off by the user, the driver automatically clears the internally stored spindle position, slave position, and multi-turn count value to prevent the slave axis from starting from a non-zero position due to residual state data during the next enable.

[0072] Through the above embodiments, by automatically detecting the current control mode of the drive, the electronic cam is enabled only in position control mode, and forcibly disabled and the enable state is synchronously written back in speed or torque mode. This prevents erroneous enabling due to control mode mismatch—if enabled in speed or torque mode, the slave shaft will not run according to the cam trajectory, which may lead to abnormal commands or equipment malfunction. The enable flag is synchronously written back to the parameter register group, allowing the host computer to know the specific reason for the enable failure by reading the parameter, avoiding the problem of information asynchrony between the host computer's displayed status and the actual status of the drive. When the drive is powered off or the electronic cam is turned off, the spindle position, slave position, and multi-turn count value are automatically cleared, preventing the slave shaft from starting directly from the residual non-zero position when enabled again, which would cause position jumps and mechanical shocks. The automatic clearing of status variables also reduces the burden of manual reset operations for users and avoids repetitive failures caused by forgetting to clear the status.

[0073] S103. Obtain the real-time position pulse value fed back by the spindle encoder, and calculate the index position and interpolation weight of the real-time position pulse value in the target mapping table based on the preset multiplicative inverse algorithm.

[0074] Specifically, in the real-time control cycle of the servo drive, at the beginning of each control cycle, the drive first obtains the real-time position pulse value fed back by the spindle encoder through the encoder interface. This value is the original encoder count value of the spindle's current position, and its range is related to the encoder resolution. Since the target mapping table only stores a limited number of discrete sampling points, and the actual resolution of the spindle encoder is much higher than the number of sampling points in the mapping table, it is impossible to directly read the slave shaft position value that precisely corresponds to the current spindle position from the mapping table. Therefore, the drive needs to map the high-precision real-time position pulse value onto the low-resolution target mapping table. First, it needs to determine which interval of the target mapping table the current spindle position falls into, and the precise proportional position within that interval. To achieve the above mapping within a very short control cycle, the drive uses a preset multiplicative inverse algorithm. The core of this algorithm is to use integer multiplication and displacement operations to replace division operations. In the electronic cam lookup table calculation, the process of mapping the real-time position pulse value to the target mapping table index essentially involves a division operation that compares the current spindle position with the resolution of the mapping table. Traditional solutions directly execute the division instruction, and on embedded processors, division usually requires tens of clock cycles. The multiplicative inverse algorithm pre-calculates a constant related to the encoder resolution (i.e., the multiplicative inverse), converting the division required at runtime into two integer multiplications and two displacement operations—both multiplication and displacement are instructions that can be completed in a single cycle or several cycles. This reduces the total time for table lookup calculations from tens of cycles to several cycles. The driver uses this algorithm to directly calculate the index position of the current spindle position in the target mapping table, as well as the interpolation weight between two adjacent sampling points, based on the real-time position pulse value and the preset multiplicative inverse constant. The specific value of the preset multiplicative inverse constant is pre-calculated during the configuration phase based on the encoder resolution and the mapping table resolution, and is not recalculated at runtime.

[0075] Based on the above embodiments, as an optional embodiment, for Figure 1 Step S103 shown can be achieved through the following steps, which are explained in detail below.

[0076] The number of pulses per revolution of the spindle encoder is obtained. Based on a first preset constant, a first preset quantity, and the number of pulses per revolution, the first inverse element is determined in the following way: First inverse element = (2 第一预设常数 / Number of pulses per revolution) × First preset quantity; Based on the second preset constant and the number of pulses per revolution, the second inverse is determined as follows: Second inverse = 2 (第二预设常数+16) / Number of pulses per cycle; Calculate the first product of the first inverse and the real-time position pulse value, shift the first product based on the first preset constant, and obtain the index position of the real-time position pulse value in the target mapping table; Calculate the second product of the real-time position pulse value and the first preset number, and calculate the third product of the index position and the number of pulses per cycle, and use the difference between the second product and the third product as the position remainder; Calculate the fourth product of the position remainder and the second inverse, and shift the fourth product based on the second preset constant to obtain the interpolation weight of the real-time position pulse value in the target mapping table.

[0077] Specifically, after the servo drive completes the generation of the target mapping table and enters the real-time operation stage, each control cycle needs to quickly find the corresponding slave axis position value from the target mapping table based on the real-time position pulse value fed back by the spindle encoder. Since the target mapping table only stores a first preset number of discrete sampling points, while the actual resolution of the spindle encoder is much higher than the first preset number, it is necessary to map the high-precision real-time position pulse value onto the low-resolution target mapping table. The drive obtains the number of pulses per revolution of the spindle encoder, which is determined by the encoder model. Then, based on the first preset constant, the first preset number, and the number of pulses per revolution, the first inverse is calculated. The formula is: First inverse = (2 第一预设常数 / Number of pulses per revolution) × First preset quantity; Calculate the second inverse based on the second preset constant and the number of pulses per revolution, the formula is: Second inverse = 2 (第二预设常数+16) / Number of pulses per revolution. These two inverses are pre-calculated and cached in the driver after parameter configuration, and used directly during runtime. In the real-time control cycle, the driver reads the real-time position pulse value fed back by the spindle encoder, multiplies this value by the first inverse to obtain the first product, and then shifts the first product to the right by a first preset constant to obtain the index position of the real-time position pulse value in the target mapping table. Next, the driver calculates the product of the real-time position pulse value and a first preset number as the second product, and calculates the product of the index position and the number of pulses per revolution as the third product. Subtracting the third product from the second product yields the position remainder, which represents the pulse offset between two adjacent sampling points in the target mapping table of the current spindle position. Finally, the position remainder is multiplied by the second inverse to obtain the fourth product, and then shifted to the right by a second preset constant to obtain the interpolation weight. This interpolation weight is an integer value in fixed-point format, ranging from 0 to the full amplitude of the interpolation weight, corresponding to a relative position between floating-point numbers 0.0 and 1.0.

[0078] Wherein, the first preset constant refers to the number of displacement bits used for index position calculation, with a value of 32, used to restore the first product to an integer index; the second preset constant refers to the number of displacement bits used for interpolation weight calculation, with a value of 48, used to restore the fourth product to a fixed-point interpolation weight; the number of pulses per revolution refers to the total number of pulses output by the spindle encoder in one revolution; the first inverse element refers to the multiplicative inverse element constant used for index position calculation, obtained by multiplying (2 raised to the power of the first preset constant by the number of pulses per revolution) by the first preset quantity; the second inverse element refers to the multiplicative inverse element constant used for interpolation weight calculation, obtained by dividing 2 raised to the power of the second preset constant by the number of pulses per revolution.

[0079] For example, assuming the spindle encoder is 23-bit, the number of pulses per revolution is 8,388,608, the first preset quantity is 4096, the first preset constant is 32, and the second preset constant is 48. The first inverse is pre-calculated as (2^...). 32 (÷8388608) × 4096 = 2097152, the second inverse is 2. (48+16) ÷8388608=2199023255552(2 41 After the driver enters real-time operation, a control cycle reads a real-time position pulse value of 4198400. When calculating the index position, the first product is calculated as 4198400 × 2097152, which, after shifting right by 32 bits, yields an index position of 2049. When calculating the position remainder, the second product is 4198400 × 4096 = 17196646400, the third product is 2049 × 8388608 = 17188257792, and the position remainder is 17196646400 − 17188257792 = 8388608. When calculating the interpolation weight, the fourth product is 8388608 × 2199023255552 = 2. 23 ×2 41 =2 64 Shifting right by 48 bits yields 65536, corresponding to the full-scale value of the interpolation weight (i.e., 1.0), indicating that the current position has reached or is close to the position of the 2050th sampling point. This is a boundary case in integer fixed-point arithmetic. In this case, the result calculated by the linear interpolation formula is directly equal to the slave-axis position value of the 2050th sampling point, which is equivalent to taking the value of the next sampling point when the weight is 1.0. In actual implementation, when the interpolation weight reaches its full-scale value, the index position can be incremented by 1 and the weight reset to 0 to ensure that the index position correctly points to the current sampling point interval. If the real-time position pulse value is 4196352, then the index position is 2049, the position remainder is 4194304, and the fourth product is 4194304 × 2199023255552 = 2. 22 ×2 41 =2 63 Shifting right by 48 bits yields 2 15=32768, which is 0.5 in Q16 fixed-point format, indicates that the current principal axis position is located at the exact midpoint between the 2049th and 2050th sampling points. The linear interpolation result is the average of the two sampling points' principal axis positions.

[0080] Through the above embodiments, by pre-calculating and caching the first and second inverses, only four integer multiplications and two shift operations are required per control cycle to obtain the index position and interpolation weight, completely avoiding division instructions and floating-point operations. This reduces the total time for table lookup calculations to only a few instruction cycles. The first preset constant is set to 32, allowing the right shift of 32 bits in the calculation of the first inverse to restore the integer index. Furthermore, 32-bit multiplication on a 32-bit processor directly yields a 64-bit result without additional overflow handling. The second preset constant is set to 48, allowing the right shift of 48 bits in the calculation of the second inverse to obtain a 16-bit precision interpolation weight, balancing interpolation accuracy and computational efficiency. Since both the first and second inverses are integer constants, they do not require repeated calculations during runtime, further reducing the computational load of the control cycle. The calculation of the index position and interpolation weights does not involve loops or branch judgments, ensuring constant and predictable execution time and guaranteeing a stable and controllable computational load within each control cycle. Meanwhile, the calculation of the position remainder provides an accurate pulse offset for the subsequent interpolation weight calculation, enabling the interpolation weight to reflect the precise ratio of the current master axis position between two adjacent sampling points, and to achieve high-precision slave axis position output in conjunction with the subsequent linear interpolation steps.

[0081] S104. Based on the index position, read the slave axis position values ​​corresponding to two adjacent mapping points from the target mapping table, and perform linear interpolation on the slave axis position values ​​of the two adjacent mapping points based on the interpolation weight to obtain the target slave axis position corresponding to the real-time position pulse value.

[0082] Specifically, since the target mapping table is a discrete mapping point array stored in ascending order of spindle travel, its array indices correspond one-to-one with the spindle positions—index 0 corresponds to the 0% position of the spindle travel, index 1 corresponds to the first sampling interval position of the spindle travel, and so on. The index position indicates which two adjacent sampling points in the target mapping table the current spindle position falls between: the mapping point corresponding to the index position (i.e., the previous sampling point) and the mapping point corresponding to the index position plus one (i.e., the next sampling point). The driver reads the first slave axis position value from the target mapping table using the index position as the array index; it reads the second slave axis position value using the index position plus one as the array index. After reading two adjacent mapping points, the driver calculates the difference between the next slave axis position value and the previous slave axis position value, and multiplies this difference by the interpolation weight (the interpolation weight is in fixed-point format, with a value range from 0 to full). The amplitude (corresponding to floating-point numbers 0.0 to 1.0) is multiplied, and then the product result is shifted to the right by the bit width of the interpolation weight to obtain the offset. Finally, this offset is added to the previous slave axis position value to obtain the target slave axis position corresponding to the real-time position pulse value. If the interpolation weight is 0, the target slave axis position is equal to the previous slave axis position value; if the interpolation weight is full amplitude, the target slave axis position is equal to the next slave axis position value; if the interpolation weight is between the two, the target slave axis position changes linearly between the previous slave axis position value and the next slave axis position value. When the index position reaches the last sampling point of the target mapping table (i.e., the index position is equal to the first preset number minus one), the index of the next mapping point is processed by wrapping around - that is, taking the index position plus one and then taking the modulo of the first preset number, so that the last sampling point is connected with the first sampling point, realizing the seamless loop of the cam trajectory at the period boundary.

[0083] S105, Output the real-time slave position command of the electronic cam based on the target slave position.

[0084] Specifically, after obtaining the target slave axis position through linear interpolation, the driver uses this position value as the input to the position loop. The position loop calculates the proportional gain of the position loop based on the deviation between the input and the actual position value fed back by the slave axis encoder, and then outputs the input to the speed loop. The speed loop further calculates the proportional gain of the speed loop based on the deviation between the input and the slave axis speed feedback value, and then outputs the input to the torque loop. The torque loop ultimately controls the PWM duty cycle of the inverter to drive the slave axis motor to rotate to the target position. This output process is executed once in each control cycle to ensure that the slave axis position follows the changes in the master axis position in real time. When the electronic cam function is enabled, the driver executes the above lookup, interpolation, and output steps in each control cycle, converting the continuous master axis position pulse stream into a continuous slave axis position command stream, realizing real-time synchronous following of the slave axis to the master axis. The frequency of the real-time slave axis position command output of the electronic cam is consistent with the control cycle. For example, when the control cycle is 83 microseconds, the output frequency is 12kHz. When the spindle stops rotating, the real-time position pulse value fed back by the spindle encoder remains unchanged. Therefore, the target slave position obtained by table lookup and interpolation also remains unchanged, and the driver continues to output the position command to keep the slave shaft in the current position.

[0085] Among them, the target slave axis position refers to the slave axis target position value that is precisely corresponding to the current master axis position, calculated by linear interpolation, and is expressed in pulses; the real-time slave axis position command refers to the position setpoint signal output by the driver to the position loop in each control cycle; the position loop refers to the closed-loop control link in the servo driver that takes the position deviation as input and the speed command as output; the slave axis encoder feedback refers to the actual position value fed back in real time by the encoder installed on the slave axis motor; and the control cycle refers to the fixed time interval between the driver's execution of the position loop, speed loop, and current loop operations.

[0086] Through the above embodiments, the target slave axis position is directly output to the position loop in the form of pulses, which have the same unit as the physical position fed back by the slave axis encoder. No unit conversion is required, avoiding quantization errors and calculation delays that may be introduced during the conversion process. The entire process from table lookup to output in each control cycle is completed within the current cycle, and there is no cross-cycle cumulative delay, ensuring the real-time performance of the slave axis position command. The position loop drives the slave axis motor to move towards the target position according to the command. Since the target slave axis position is calculated in real time based on the current position of the master axis, and the command update frequency is consistent with the control cycle, the slave axis can follow the position at a rhythm synchronized with the master axis, realizing instantaneous synchronous control between the master and slave axes.

[0087] The servo driver electronic cam control system in the embodiments of this invention is described below from the perspective of hardware processing. Please refer to [link to relevant documentation]. Figure 4 , Figure 4This is a schematic diagram of a servo driver electronic cam control system provided in an embodiment of this application.

[0088] It should be noted that, Figure 4 The structure of the servo drive electronic cam control system shown is merely an example and should not impose any limitations on the functionality and scope of the embodiments of this application.

[0089] like Figure 4 As shown, the servo drive electronic cam control system includes a central processing unit 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory 402 or a program loaded from a storage section 408 into a random access memory 403, such as performing the methods described in the above embodiments. The random access memory 403 also stores various programs and data required for system operation. The central processing unit 401, the read-only memory 402, and the random access memory 403 are interconnected via a bus 404. An input / output interface 405 is also connected to the bus 404.

[0090] The following components are connected to the input / output interface 405: an input section 406 including audio input devices, push-button switches, etc.; an output section 407 including a liquid crystal display (LCD) and audio output devices, indicator lights, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the input / output interface 405 as needed. A removable medium 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 410 as needed so that computer programs read from it can be installed into the storage section 408 as needed.

[0091] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by central processing unit 401, it performs the various functions defined in the present invention. It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0092] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.

[0093] Specifically, the servo driver electronic cam control system of this embodiment includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the servo driver electronic cam control method provided in the above embodiment.

[0094] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the servo driver electronic cam control system described in the above embodiments; or it may exist independently and not assembled into the servo driver electronic cam control system. The storage medium carries one or more computer programs that, when executed by a processor of the servo driver electronic cam control system, cause the servo driver electronic cam control system to implement the servo driver electronic cam control method provided in the above embodiments.

[0095] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.

Claims

1. A servo driver electronic cam control method, characterized in that, include: Obtain the curve definition parameters of the electronic cam, and generate a smooth cam trajectory based on the curve definition parameters and a preset fifth-order polynomial curve algorithm; The smooth cam trajectory is resampled at equal intervals with a preset fixed resolution to obtain a first preset number of mapping points. Based on all the mapping points, a target mapping table is generated. The real-time position pulse value fed back by the spindle encoder is obtained, and the index position and interpolation weight of the real-time position pulse value in the target mapping table are calculated based on the preset multiplicative inverse algorithm. Based on the index position, the slave axis position values ​​corresponding to two adjacent mapping points are read from the target mapping table, and the slave axis position values ​​of the two adjacent mapping points are linearly interpolated based on the interpolation weight to obtain the target slave axis position corresponding to the real-time position pulse value. The electronic cam outputs a real-time slave axis position command based on the target slave axis position.

2. The method according to claim 1, characterized in that, The process of generating a smooth cam trajectory based on the curve definition parameters and a preset fifth-order polynomial curve includes: Obtain the target cam segment parameter from the curve definition parameters. The target cam segment parameter is any cam segment parameter in the curve definition parameters. The target cam segment parameter includes the main shaft start position, main shaft end position, slave shaft start position, slave shaft end position, and acceleration / deceleration ratio of the target cam segment. The acceleration and deceleration durations are determined based on the acceleration-deceleration ratio, and the constant speed of the target cam segment is calculated using the acceleration duration, the deceleration duration, the spindle start position, and the spindle end position. The first intermediate position of the target cam segment is determined based on the constant speed segment speed and the duration of the acceleration segment, and the second intermediate position of the target cam segment is determined based on the constant speed segment speed and the duration of the deceleration segment. The coefficients of the first fifth-order polynomial are determined based on the first set of boundary conditions. The first set of boundary conditions is: the starting position of the axis is taken as the first starting position, zero is taken as the first starting velocity and the first starting acceleration, the first intermediate position is taken as the first ending position, the uniform speed segment velocity is taken as the first ending velocity and zero is taken as the first ending acceleration. The coefficients of the second fifth-order polynomial are determined based on the second set of boundary conditions. The second boundary conditions are: the second intermediate position as the second starting position, the uniform segment velocity as the second starting velocity, zero as the second starting acceleration, the end position of the axis as the second ending position, zero as the second ending velocity and the second ending acceleration. The acceleration trajectory of the target cam segment is generated based on the first fifth-order polynomial coefficients, and the deceleration trajectory of the target cam segment is generated based on the second fifth-order polynomial coefficients. Using the constant velocity segment speed as a constant speed, a constant velocity segment trajectory is generated between the first intermediate position and the second intermediate position; The acceleration segment trajectory, the constant speed segment trajectory, and the deceleration segment trajectory are spliced ​​together in ascending order of spindle travel to generate the smooth cam trajectory of the target cam segment.

3. The method according to claim 1, characterized in that, Before obtaining the curve definition parameters of the electronic cam, the method further includes: Obtain the pre-configured second preset number of cam segment parameters, and sort the second preset number of cam segment parameters according to the numerical increment of the spindle position to obtain the cam segment parameter sequence; Continuity verification is performed on all adjacent cam segment parameter pairs in the cam segment parameter sequence; If any of the adjacent cam segment parameter pairs fails the continuity check, the target mapping table is not generated and an error flag is returned. If all the adjacent cam segment parameter pairs pass the continuity check, then the cam segment parameter sequence is used as the curve definition parameter of the corresponding cam segment.

4. The method according to claim 3, characterized in that, The adjacent cam segment parameter pairs include the cam segment parameters of the preceding and following cam segments. The continuity check of all adjacent cam segment parameter pairs in the cam segment parameter sequence includes: When the spindle end point of the preceding cam segment is the end point of a single revolution of the spindle, and the spindle start point of the following cam segment is the start point of a single revolution of the spindle, it is determined that the parameter pair of the adjacent cam segments is continuous in the spindle stroke. When the slave shaft position corresponding to the end position of the main shaft of the previous cam segment is the end position of a single revolution of the slave shaft, and the slave shaft position corresponding to the start position of the main shaft of the next cam segment is the start position of a single revolution of the slave shaft, it is determined that the parameter pair of the adjacent cam segments is continuous in the slave shaft stroke. If the adjacent cam parameter pairs are continuous on both the main shaft travel and the driven shaft travel, the adjacent cam segment parameter pairs are determined to have passed the continuity check. If the spindle end point of the preceding cam segment is at the middle position of a single spindle revolution and is not equal to the spindle start point of the following cam segment in terms of spindle position, then the parameter pair of the adjacent cam segments is determined to have failed the continuity check and the first error code is returned. If the slave shaft position corresponding to the end position of the main shaft of the previous cam segment is not equal to the slave shaft position corresponding to the start position of the main shaft of the next cam segment, and the connection condition between the end position and the start position of the single revolution of the slave shaft is not met, then the parameter pair of the adjacent cam segments is determined to have failed the continuity check and a second error code is returned.

5. The method according to claim 3, characterized in that, Before obtaining the pre-configured second preset number of cam segment parameters, the method further includes: The curve configuration interface of the electronic cam is displayed through the host computer software. The curve configuration interface includes a parameter input area and a curve preview area. The parameter input area receives the configuration parameters for each cam segment input by the user. In response to a preview command triggered by the user, a preview cam trajectory is generated based on the currently input configuration parameters, and the position curve and velocity curve of the preview cam trajectory are simultaneously displayed in the curve preview area; In response to a user-triggered download command, the configuration parameters are written into the driver's parameter register group via a bus communication protocol as a pre-configured set of cam segment parameters.

6. The method according to claim 1, characterized in that, The calculation of the index position and interpolation weight of the real-time position pulse value in the target mapping table based on the preset multiplicative inverse algorithm includes: The number of pulses per revolution of the spindle encoder is obtained, and the first inverse element is determined based on a first preset constant, a first preset quantity, and the number of pulses per revolution in the following manner: The first inverse = (2 所述第一预设常数 (the number of pulses per cycle) × the first preset quantity; Based on the second preset constant and the number of pulses per cycle, the second inverse element is determined in the following way: Second inverse = 2 (所述第二预设常数+16) / The number of pulses per cycle; Calculate the first product of the first inverse and the real-time position pulse value, and shift the first product based on the first preset constant to obtain the index position of the real-time position pulse value in the target mapping table; Calculate the second product of the real-time position pulse value and the first preset number, and calculate the third product of the index position and the number of pulses per cycle. Use the difference between the second product and the third product as the position remainder. Calculate the fourth product of the position remainder and the second inverse, and shift the fourth product based on the second preset constant to obtain the interpolation weight of the real-time position pulse value in the target mapping table.

7. The method according to claim 1, characterized in that, Prior to generating the target mapping table, the method further includes: Read the current control mode of the servo driver; When the current control mode is speed control mode or torque control mode, the enable flag of the electronic cam is cleared to zero, and the cleared state is synchronously written back to the enable control parameter in the parameter register group, and subsequent steps are refused to be executed. When the driver is powered off or the electronic cam is turned off, the spindle position, slave position, and multi-turn count values ​​stored in the servo driver are automatically cleared.

8. A servo-driven electronic cam control system, characterized in that, The servo drive electronic cam control system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the servo drive electronic cam control system to perform the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is executed on the servo driver electronic cam control system, the servo driver electronic cam control system performs the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, When the computer program product is run on the servo drive electronic cam control system, the servo drive electronic cam control system performs the method as described in any one of claims 1-7.