Linear compensation method, system and medium for periodic synchronous position pattern based on bare machine system
By using a cache and pointer approach and linear prediction compensation in the bare-metal system, the problems of complex calculations and incomplete interrupts in the bare-metal system are solved, and continuous output and stable operation of the motor target position are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-03-24
AI Technical Summary
Existing compensation methods in bare-metal systems suffer from problems such as complex decimal calculation requirements, large storage space requirements, incomplete interrupt handling, and limited compensation scenarios, leading to unstable synchronization relationships and affecting motor operation.
By using a cache and pointer approach, PDI data processing is decomposed into the smallest execution unit. Linear prediction compensation is performed through a two-level cache array and a compensation array to ensure the continuity and stability of the target position. The compensation value is calculated using linear equations, and compensation operations are selectively executed to adapt to interruption scenarios.
It achieves continuous output of the target position in periodic synchronous position mode, which improves the smoothness and accuracy of motor operation and reduces the impact of interruptions on the compensation algorithm.
Smart Images

Figure CN121412141B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of parameter compensation technology, and more specifically, to a linear compensation method, system, and medium for periodic synchronization position modes based on a bare-metal system. Background Technology
[0002] The shortcomings of existing compensation methods:
[0003] Disadvantage 1: To ensure the synchronization between PDI and SYNC0, complex decimal calculations and a large amount of storage space are required to store the data;
[0004] Disadvantage 2: Many slave stations are bare-metal systems, and the processing of instructions has a sequential relationship. Many compensation algorithm flags are interrupted by high-priority tasks before they are completed, resulting in incomplete compensation algorithms and inability to compensate in a timely and accurate manner.
[0005] Disadvantage 3: The compensation scenarios are limited, not comprehensive enough, and lack versatility. Summary of the Invention
[0006] The purpose of this application is to provide a linear compensation method, system, and medium for periodic synchronous position mode based on a bare-metal system. By using a cache and pointer approach, each step of the PDI data processing interrupt is decomposed into the smallest CPU execution unit, assigned a value, and linear prediction compensation is performed to update the target position information, ensuring the continuity of the target position under periodic synchronous mode and making the motor run more smoothly.
[0007] This application also provides a linear compensation method for periodic synchronization position patterns based on a bare-metal system, including:
[0008] When the PDI data interrupt is triggered, the target location is read from the ESC kernel and recorded as target location A. The target location A is stored in the first section of the second-level cache array, and the pointer to the second-level cache array is incremented by 1 to point to the next section of the cache.
[0009] When the SYNC0 synchronous interrupt is triggered, the target location is read from the ESC kernel and recorded as target location B. The target location B is compared with the data in the second-level cache array 1 to obtain the comparison result.
[0010] Obtain the pointer status to the cache array, and based on the pointer status and the comparison result, determine whether the PDI data interruption handling and target location data meet the set conditions in this cycle, and obtain the judgment result;
[0011] Based on the judgment result, match the timing interruption scenario of the corresponding PDI data interruption and SYNC0 signal, and selectively perform linear compensation operation or directly use the target position data;
[0012] During the SYNC0 interrupt handling process, the target position data or linear compensation value X is analyzed based on the motion control algorithm. Position planning is performed based on the analysis results and assigned to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode.
[0013] Optionally, in the linear compensation method for periodic synchronization position modes based on a bare-metal system described in the embodiments of this application, the linear compensation operation specifically includes:
[0014] If the data in buffer array 1 is the same as the target position B and the pointer is 1, it is determined that the PDI position data information of this cycle has been received completely. When handling the SYNC0 interrupt, the target position B is used directly, and the pointer is cleared to 0 and pointed to buffer array 1 to complete the update of the compensation array. The data in compensation array 1 is stored in compensation array 2, and buffer array 1 is stored in compensation array 1.
[0015] If the data in cache array 1 is the same as the target position B and the pointer is 0, compare the target position B with the data in compensation array 1 to determine whether the target position B and the data in compensation array 1 are the same.
[0016] If they are the same, set the missing flag, calculate the linear compensation value X based on the linear equation, use the compensation value X during SYNC0 interrupt handling, and update the compensation array and pointer state at the same time.
[0017] If they are different, it is determined that the PDI interrupt handling is incomplete but the target position B has been updated. During the SYNC0 interrupt handling, the target position B is used directly, and the compensation array and pointer state are updated synchronously.
[0018] Optionally, in the linear compensation method for periodic synchronization position patterns based on a bare-metal system described in the embodiments of this application, performing the linear compensation operation further includes:
[0019] If the data in cache array 1 is different from the target location B and the pointer is 0, it is determined that the PDI interrupt handling is incomplete but the target location B has been updated in time. When handling the SYNC0 interrupt, the target location B is used directly to update the cache array, compensation array and pointer status.
[0020] If the data in cache array 1 is different from the target position B and the pointer is 1, match the corresponding interruption scenario based on the data status and loss flag status in cache array 2.
[0021] Determine if compensation is needed: If no compensation is needed, select valid target position data for use by SYNC0 interrupt; if compensation is needed, perform the corresponding data update operation, synchronously clear the loss flag and adjust the pointer state.
[0022] If the data in cache array 1 is different from the target position B and the pointer is 2, based on the interruption scenario matched by the loss flag status, if it is determined that no compensation is needed, the target position data in cache array 2 is selected for use by SYNC0 interrupt, the cache array, compensation array and pointer status are updated, and the loss flag is cleared synchronously.
[0023] Optionally, in the linear compensation method for periodic synchronization position patterns based on a bare-metal system described in the embodiments of this application, the cache data update method is as follows:
[0024] When the loss flag is 1, store the data in cache array 1 into compensation array 2, store the data in cache array 2 into compensation array 1, then clear cache array 2 and clear the loss flag to 0.
[0025] When cache array 2 is 0 and the loss flag is 1, store the data in cache array 1 into compensation array 2, store the target position B into compensation array 1 and compensation array 2 respectively, and clear the loss flag to 0.
[0026] When cache array 2 is 0 and the loss flag is 0, store the target position B into cache array 1, move the original data stored in compensation array 1 into compensation array 2, store the target position B into compensation array 1, and at the same time clear the pointer to 0 to point to cache array 1.
[0027] Optionally, in the linear compensation method for periodic synchronization position mode based on bare-metal system described in the embodiments of this application, the secondary cache array includes cache array 1 and cache array 2, and adopts a first-in-first-out storage rule to temporarily store the target position data received during PDI data interruption.
[0028] The compensation array includes Compensation Array 1 and Compensation Array 2, which are used to record historical valid location data and provide data support for linear compensation calculation.
[0029] Optionally, in the linear compensation method for periodic synchronization position patterns based on a bare-metal system described in the embodiments of this application, the derivation process of the compensation value X is as follows:
[0030] Assume the historical values in the compensation array are A and B, respectively;
[0031] Based on the linear relationship, establish the system of equations a+b=A and 2a+b=B, solve for a=BA and b=2A-B, substitute a and b into the formula X=3a+b, and calculate X=B+BA.
[0032] Secondly, embodiments of this application provide a linear compensation system for periodic synchronization position patterns based on a bare-metal system. The system includes a memory and a processor. The memory includes a program for a linear compensation method for periodic synchronization position patterns based on a bare-metal system. When the program for the linear compensation method for periodic synchronization position patterns based on a bare-metal system is executed by the processor, it implements the following steps:
[0033] When the PDI data interrupt is triggered, the target location is read from the ESC kernel and recorded as target location A. The target location A is stored in the first section of the second-level cache array, and the pointer to the second-level cache array is incremented by 1 to point to the next section of the cache.
[0034] When the SYNC0 synchronous interrupt is triggered, the target location is read from the ESC kernel and recorded as target location B. The target location B is compared with the data in the second-level cache array 1 to obtain the comparison result.
[0035] Obtain the pointer status to the cache array, and based on the pointer status and the comparison result, determine whether the PDI data interruption handling and target location data meet the set conditions in this cycle, and obtain the judgment result;
[0036] Based on the judgment result, match the timing interruption scenario of the corresponding PDI data interruption and SYNC0 signal, and selectively perform linear compensation operation or directly use the target position data;
[0037] During the SYNC0 interrupt handling process, the target position data or linear compensation value X is analyzed based on the motion control algorithm. Position planning is performed based on the analysis results and assigned to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode.
[0038] Optionally, in the linear compensation system for periodic synchronization position modes based on a bare-metal system described in this application embodiment, performing linear compensation operations specifically includes:
[0039] If the data in buffer array 1 is the same as the target position B and the pointer is 1, it is determined that the PDI position data information of this cycle has been received completely. When handling the SYNC0 interrupt, the target position B is used directly, and the pointer is cleared to 0 and pointed to buffer array 1 to complete the update of the compensation array. The data in compensation array 1 is stored in compensation array 2, and buffer array 1 is stored in compensation array 1.
[0040] If the data in cache array 1 is the same as the target position B and the pointer is 0, compare the target position B with the data in compensation array 1 to determine whether the target position B and the data in compensation array 1 are the same.
[0041] If they are the same, set the missing flag, calculate the linear compensation value X based on the linear equation, use the compensation value X during SYNC0 interrupt handling, and update the compensation array and pointer state at the same time.
[0042] If they are different, it is determined that the PDI interrupt handling is incomplete but the target position B has been updated. During the SYNC0 interrupt handling, the target position B is used directly, and the compensation array and pointer state are updated synchronously.
[0043] Optionally, in the linear compensation system for periodic synchronization position modes based on a bare-metal system described in this application embodiment, performing the linear compensation operation further includes:
[0044] If the data in cache array 1 is different from the target location B and the pointer is 0, it is determined that the PDI interrupt handling is incomplete but the target location B has been updated in time. When handling the SYNC0 interrupt, the target location B is used directly to update the cache array, compensation array and pointer status.
[0045] If the data in cache array 1 is different from the target position B and the pointer is 1, match the corresponding interruption scenario based on the data status and loss flag status in cache array 2.
[0046] Determine if compensation is needed: If no compensation is needed, select valid target position data for use by SYNC0 interrupt; if compensation is needed, perform the corresponding data update operation, synchronously clear the loss flag and adjust the pointer state.
[0047] If the data in cache array 1 is different from the target position B and the pointer is 2, based on the interruption scenario matched by the loss flag status, if it is determined that no compensation is needed, the target position data in cache array 2 is selected for use by SYNC0 interrupt, the cache array, compensation array and pointer status are updated, and the loss flag is cleared synchronously.
[0048] Thirdly, embodiments of this application also provide a computer-readable storage medium, which includes a linear compensation method program for a periodic synchronization position pattern based on a bare-metal system. When the linear compensation method program for a periodic synchronization position pattern based on a bare-metal system is executed by a processor, it implements the steps of the linear compensation method for a periodic synchronization position pattern based on a bare-metal system as described in any of the preceding claims.
[0049] As can be seen from the above, the linear compensation method, system, and medium for periodic synchronization position modes based on a bare-metal system provided in this application embodiment, when a PDI data interrupt is triggered, reads the target position from the ESC kernel and records it as target position A, stores target position A in area 1 of the L2 cache array, and increments the pointer to the L2 cache array to point to the next cache area; when a SYNC0 synchronization interrupt is triggered, reads the target position from the ESC kernel and records it as target position B, compares target position B with the data in area 1 of the L2 cache array to obtain the comparison result; obtains the pointer state to the cache array, and determines the processing of the PDI data interrupt for this period and whether the target position data meets the set conditions based on the pointer state and the comparison result. The system obtains a judgment result; based on the judgment result, it matches the timing interruption scenario of the corresponding PDI data interruption and SYNC0 signal, selectively performs linear compensation operation or directly uses the target position data; during the SYNC0 interrupt handling process, it analyzes the target position data or linear compensation value X based on the motion control algorithm, performs position planning based on the analysis result, and assigns the value to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode; by using a buffer and pointer method, each step of the PDI data processing interrupt is decomposed into the smallest execution unit of the CPU, and the assignment operation is performed to perform linear prediction compensation, update the target position information, ensure the continuity of the target position in the periodic synchronous mode, and make the motor run more smoothly. Attached Figure Description
[0050] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0051] Figure 1 A flowchart illustrating a linear compensation method for periodic synchronization position patterns based on a bare-metal system, provided in an embodiment of this application.
[0052] Figure 2 A flowchart illustrating the linear compensation operation of a linear compensation method for a periodic synchronization position mode based on a bare-metal system, provided in an embodiment of this application.
[0053] Figure 3 A schematic diagram of a PDI data interruption method based on a bare-metal system for linear compensation of periodic synchronization position patterns provided in an embodiment of this application;
[0054] Figure 4 A schematic diagram of another PDI data interruption for a linear compensation method for periodic synchronization position patterns based on a bare-metal system, provided in an embodiment of this application.
[0055] Figure 5 This is a schematic diagram of the cache array and compensation array of the linear compensation method for the periodic synchronization position mode based on the bare-metal system provided in the embodiments of this application. Detailed Implementation
[0056] The technical solutions of the embodiments of this application 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. The components of the embodiments of this application described and shown in the accompanying drawings can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0057] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0058] Please refer to Figures 1-5 As shown, the linear compensation method for periodic synchronization position patterns based on bare-metal systems is used in terminal devices. This linear compensation method for periodic synchronization position patterns based on bare-metal systems includes the following steps:
[0059] S101, when the PDI data interrupt is triggered, read the target location from the ESC kernel and record it as target location A, store target location A into the first section of the second-level cache array, and increment the pointer to the second-level cache array to point to the next section of the cache.
[0060] When the S102, SYNC0 synchronous interrupt is triggered, the target location is read from the ESC kernel and recorded as target location B. The target location B is compared with the data in the second-level cache array 1 to obtain the comparison result.
[0061] S103, obtain the pointer status to the cache array, and based on the pointer status and the comparison result, determine whether the PDI data interruption processing and target position data of this cycle meet the set conditions, and obtain the judgment result;
[0062] S104, based on the judgment result, match the timing interruption scenario of the corresponding PDI data interruption and SYNC0 signal, and selectively perform linear compensation operation or directly use the target position data;
[0063] During the S105 SYNC0 interrupt handling process, the target position data or linear compensation value X is analyzed based on the motion control algorithm. Position planning is performed based on the analysis results and assigned to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode.
[0064] It should be noted that the internal processing flow of PDI data interrupt is as follows: Step 1, the target location is read from the ESC kernel (called target location A); Step 2, target location A is stored in the first area of the level 2 cache array; Step 3, the pointer to the target location cache array is incremented by 1, pointing to the next area of the cache.
[0065] When SYNC0 is interrupted, the target position (called target position B) is read from the ESC kernel again and compared with the data in cache data area 1 to confirm whether it is the target position data needed in this cycle. Then, it is used in the CIA402 motion control algorithm for position planning and finally assigned to the position loop setpoint of the motor drive. At the same time, the pointer is cleared to 0 and points to cache array area 1. The target position B is stored in the second-level compensation array area 1 in a first-in-first-out manner.
[0066] In a bare-metal system, PDI data interrupt processing may be interrupted at any time by high-priority tasks (such as the SYNC0 task), resulting in incomplete PDI data interrupt processing. The target position processing in PDI interrupt can be simplified into three steps: 1. Assign a value to the target position A; 2. Store the target position A in the cache array area; 3. Increment the pointer to the array by 1 to point to the next area of the cache.
[0067] According to an embodiment of the present invention, performing a linear compensation operation specifically includes:
[0068] S201, if the data in buffer array 1 is the same as the target position B and the pointer is 1, it is determined that the PDI position data information of this cycle has been received completely. When handling the SYNC0 interrupt, the target position B is used directly, and the pointer is cleared to 0 and pointed to buffer array 1 to complete the update of the compensation array. The data in compensation array 1 is stored in compensation array 2, and buffer array 1 is stored in compensation array 1.
[0069] S202, if the data in cache array 1 is the same as the target position B and the pointer is 0, compare the target position B with the data in compensation array 1 to determine whether the target position B and the data in compensation array 1 are the same;
[0070] S203, if the same, set the loss flag, calculate the linear compensation value X based on the linear equation, use the compensation value X during SYNC0 interrupt handling, and update the compensation array and pointer state at the same time.
[0071] S204 If they are not the same, it is determined that the PDI interrupt handling is incomplete but the target position B has been updated. When handling the SYNC0 interrupt, the target position B is used directly, and the compensation array and pointer status are updated synchronously.
[0072] When buffer array 1 and target location B are the same, and the pointer is 1, it indicates that PDI location data information has been received within this cycle, the PDI interrupt handling is complete, and it meets the interruption scenarios A1, A2, A3, A4, B4, C4, and D4. No compensation is needed during SYNC0 interrupt handling; target location B can be used during SYNC0 interrupt handling. Clear the pointer to 0 and point it to buffer array 1; store the data from compensation array 1 into compensation array 2, and store the data from buffer array 1 into compensation array 1.
[0073] When cache array 1 and target location B are the same, and the pointer is 0, it means that no PDI location data information was received in this cycle or the PDI interruption processing was incomplete, which is consistent with interruption scenarios B2 and D2.
[0074] The target position B is compared with the compensation array 1. If they are the same, it meets the interruption scenario D2, and the loss flag loss_flag is set to 1. The SYNC0 interrupt handling requires a linear compensation value. The compensation value X is inferred based on the linear equation y=ax+b. The linear compensation value X is the target position B in this cycle and is used in the SYNC0 interrupt handling. The pointer is cleared to 0 and points to the cache array 1. The data in the compensation array 1 is stored in the compensation array 2, and the linear compensation value X is stored in the compensation array 1.
[0075] The target position B is compared with the compensation array 1 area. If they are different, it meets the interruption scenario B2, indicating that the PDI interrupt processing is incomplete in this cycle, but the target position B has been updated and can be used during SYNC0 interrupt processing; the pointer is cleared to 0 and points to the cache array 1 area; the data in the compensation array 1 area is stored in the compensation array 2 area, and the cache array 1 area is stored in the compensation array 1 area.
[0076] When the cache array 1 area and the target location B are different, and the pointer is 0, it indicates that the PDI interrupt processing is incomplete in this cycle, which meets the interruption scenario C2; the pointer has not been incremented to point to the next area, but the target location B has been updated in time, so no compensation is needed here, and the target location B can be used directly in SYNC0; clear the pointer to 0 to point to the cache array 1 area, store the target location B into the cache array 1 area, store the data in the compensation array 1 area into the compensation array 2 area, and store the target location B into the compensation array 1 area;
[0077] When cache array 1 and target location B are different, and the pointer is 1, it indicates that the PDI interrupt was received during this cycle and the execution was incomplete.
[0078] If cache array 2 is 0 at this point, and the loss flag (loss_flag) is 1, it meets the interruption scenario H3, indicating that cache array 1 contains data that was not received in time last time, and the target position B contains the data for this PDI, which can be used directly; store cache array 1 into compensation array 2, store the target position B into compensation array 1, store the target position B into compensation array 2, and clear the loss flag to 0; if the loss flag (loss_flag) is 0, it meets the interruption scenario F3, indicating that the target position B has been updated in time, and no compensation is needed here, and the target position B can be used directly in SYNC0; clear the pointer to 0 and point it to cache array 1, store the target position B into cache array 1, store the data in compensation array 1 into compensation array 2, and store the target position B into compensation array 1;
[0079] If cache array 2 is not 0 at this point, it means that the second PDI data has been stored in cache array 2. If the loss flag (loss_flag) is 1, it meets the interruption scenario G3, indicating that cache array 1 contains data that was not received in time last time, and the target position B contains the data for this PDI, which can be used directly. Store cache array 2 into compensation array 1, store cache array 1 into compensation array 2, store the target position B into compensation array 2, and clear the loss flag to 0. If the loss flag (loss_flag) is 0, it meets the interruption scenario E3, indicating that the target position A has been stored in cache array 2, and no compensation is needed here. The target position in cache array 2 can be used directly in SYNC0. Clear the pointer to 0 and point it to cache array 1, store cache array 2 into cache array 1, store the data in compensation array 1 into compensation array 2, store cache array 2 into compensation array 1, and clear cache array 2 to zero.
[0080] When the cache array 1 area and the target location B are different, and the pointer is 2, it means that PDI location data information was received within this cycle. The pointer has increased 2 times, which is consistent with interruption scenarios B3, C3 and D3.
[0081] If the loss flag (loss_flag) is 0, it matches interruption scenarios B3 and C3, indicating that the PDI interruption processing in the previous cycle was incomplete, but the target position B has been updated in time, so no compensation is needed here. The target position in cache array 2 can be used directly in SYNC0. Clear the pointer to 0 and point it to cache array 1. Store cache array 2 into cache array 1. Store the data in compensation array 1 into compensation array 2. Store cache array 2 into compensation array 1. Clear cache array 2 to zero.
[0082] If the loss flag (loss_flag) is 1, it meets the interruption scenario D3, indicating that PDI data was not received in the previous cycle but was received in this cycle, and the target position B in this cycle has also been updated. No compensation is needed here, and the target position in cache array 2 can be used directly in SYNC0. Clear the pointer to 0 and point it to cache array 1. Store cache array 1 into compensation array 2, store cache array 2 into cache array 1, store cache array 2 into compensation array 1, clear cache array 2, and clear the loss flag (loss_flag) to 0.
[0083] By comparing whether the cache array 1 area and the target position B are the same and the pointer points, we can find out the interruption status of PDI in EtherCAT, decide whether to perform linear compensation, ensure the continuity of the target position, and ensure the smooth operation of the motor.
[0084] According to an embodiment of the present invention, the secondary cache array includes cache array 1 and cache array 2, and adopts a first-in-first-out storage rule to temporarily store the target location data of PDI data interruption reception;
[0085] The compensation array includes Compensation Array 1 and Compensation Array 2, which are used to record historical valid location data and provide data support for linear compensation calculation.
[0086] According to an embodiment of the present invention, the derivation process of the compensation value X is as follows:
[0087] Assume the historical values in the compensation array are A and B, respectively;
[0088] Based on the linear relationship, establish the system of equations a+b=A and 2a+b=B, solve for a=BA and b=2A-B, substitute a and b into the formula X=3a+b, and calculate X=B+BA.
[0089] Secondly, embodiments of this application provide a linear compensation system for periodic synchronization position patterns based on a bare-metal system. The system includes a memory and a processor. The memory includes a program for a linear compensation method for periodic synchronization position patterns based on a bare-metal system. When the program for the linear compensation method for periodic synchronization position patterns based on a bare-metal system is executed by the processor, it implements the following steps:
[0090] When the PDI data interrupt is triggered, the target location is read from the ESC kernel and recorded as target location A. The target location A is stored in the first section of the second-level cache array, and the pointer to the second-level cache array is incremented by 1 to point to the next section of the cache.
[0091] When the SYNC0 synchronous interrupt is triggered, the target location is read from the ESC kernel and recorded as target location B. The target location B is compared with the data in the second-level cache array 1 to obtain the comparison result.
[0092] Obtain the pointer status to the cache array, and based on the pointer status and the comparison result, determine whether the PDI data interruption handling and target location data meet the set conditions in this cycle, and obtain the judgment result;
[0093] Based on the judgment result, match the timing interruption scenario of the corresponding PDI data interruption and SYNC0 signal, and selectively perform linear compensation operation or directly use the target position data;
[0094] During the SYNC0 interrupt handling process, the target position data or linear compensation value X is analyzed based on the motion control algorithm. Position planning is performed based on the analysis results and assigned to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode.
[0095] According to an embodiment of the present invention, performing a linear compensation operation specifically includes:
[0096] If the data in buffer array 1 is the same as the target position B and the pointer is 1, it is determined that the PDI position data information of this cycle has been received completely. When handling the SYNC0 interrupt, the target position B is used directly, and the pointer is cleared to 0 and pointed to buffer array 1 to complete the update of the compensation array. The data in compensation array 1 is stored in compensation array 2, and buffer array 1 is stored in compensation array 1.
[0097] If the data in cache array 1 is the same as the target position B and the pointer is 0, compare the target position B with the data in compensation array 1 to determine whether the target position B and the data in compensation array 1 are the same.
[0098] If they are the same, set the missing flag, calculate the linear compensation value X based on the linear equation, use the compensation value X during SYNC0 interrupt handling, and update the compensation array and pointer state at the same time.
[0099] If they are different, it is determined that the PDI interrupt handling is incomplete but the target position B has been updated. During the SYNC0 interrupt handling, the target position B is used directly, and the compensation array and pointer state are updated synchronously.
[0100] According to an embodiment of the present invention, performing the linear compensation operation further includes:
[0101] If the data in cache array 1 is different from the target location B and the pointer is 0, it is determined that the PDI interrupt handling is incomplete but the target location B has been updated in time. When handling the SYNC0 interrupt, the target location B is used directly to update the cache array, compensation array and pointer status.
[0102] If the data in cache array 1 is different from the target position B and the pointer is 1, match the corresponding interruption scenario based on the data status and loss flag status in cache array 2.
[0103] Determine if compensation is needed: If no compensation is needed, select valid target position data for use by SYNC0 interrupt; if compensation is needed, perform the corresponding data update operation, synchronously clear the loss flag and adjust the pointer state.
[0104] If the data in cache array 1 is different from the target position B and the pointer is 2, based on the interruption scenario matched by the loss flag status, if it is determined that no compensation is needed, the target position data in cache array 2 is selected for use by SYNC0 interrupt, the cache array, compensation array and pointer status are updated, and the loss flag is cleared synchronously.
[0105] A third aspect of the present invention provides a computer-readable storage medium including a program for a linear compensation method for a periodic synchronization position pattern based on a bare-metal system. When the program for the linear compensation method for a periodic synchronization position pattern based on a bare-metal system is executed by a processor, it implements the steps of the linear compensation method for a periodic synchronization position pattern based on a bare-metal system as described in any of the above claims.
[0106] This invention discloses a linear compensation method, system, and medium for periodic synchronization position modes based on a bare-metal system. When a PDI data interrupt is triggered, the target position is read from the ESC kernel and recorded as target position A. Target position A is stored in area 1 of the L2 cache array, and the pointer to the L2 cache array is incremented by 1 to point to the next cache area. When a SYNC0 synchronization interrupt is triggered, the target position is read from the ESC kernel and recorded as target position B. Target position B is compared with the data in area 1 of the L2 cache array to obtain the comparison result. The pointer state to the cache array is obtained. Based on the pointer state and the comparison result, the processing of the PDI data interrupt for this period and whether the target position data meet the set conditions are determined. The judgment result is used to match the timing interruption scenarios of the corresponding PDI data interruption and SYNC0 signal, and to selectively perform linear compensation operation or directly use the target position data. During the SYNC0 interrupt handling, the target position data or linear compensation value X is analyzed based on the motion control algorithm. Based on the analysis result, position planning is performed and assigned to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode. By using a buffer and pointer method, each step of the PDI data processing interruption is decomposed into the smallest execution unit of the CPU, and the assignment operation is performed to perform linear prediction compensation and update the target position information to ensure the continuity of the target position in the periodic synchronous mode, so that the motor can run more smoothly.
[0107] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.
[0108] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.
[0109] In addition, in the various embodiments of the present invention, each functional unit can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.
[0110] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0111] Alternatively, if the integrated units of the present invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.
Claims
1. A linear compensation method for periodic synchronization position patterns based on a bare-metal system, characterized in that, include: When the PDI data interrupt is triggered, the target location is read from the ESC kernel and recorded as target location A. The target location A is stored in the first section of the second-level cache array, and the pointer to the second-level cache array is incremented by 1 to point to the next section of the cache. When the SYNC0 synchronous interrupt is triggered, the target location is read from the ESC kernel and recorded as target location B. The target location B is compared with the data in the second-level cache array 1 to obtain the comparison result. Obtain the pointer status to the cache array, and based on the pointer status and the comparison result, determine whether the PDI data interruption handling and target location data meet the set conditions in this cycle, and obtain the judgment result; Based on the judgment result, the timing interruption scenarios of the corresponding PDI data interruption and SYNC0 signal are matched, and linear compensation operation is selectively performed or the target position data is directly used. Specifically, the linear compensation operation includes: if the data in buffer array 1 is the same as the target position B and the pointer is 1, it is determined that the PDI position data information received in this cycle is complete. During SYNC0 interruption processing, the target position B is directly used, and the pointer is cleared to 0 and points to buffer array 1, completing the update of the compensation array. The data in compensation array 1 is stored in compensation array 2, and buffer array 1 is stored in compensation array 1. If the data in buffer array 1 is the same as the target position B and the pointer is 0, the target position B is compared with the data in compensation array 1 to determine whether the target position B and the data in compensation array 1 are the same. If they are the same, the loss flag is set, and the linear compensation value X is calculated based on the linear equation. During SYNC0 interruption processing, the compensation value X is used, and the compensation array and pointer state are updated. If they are different, it is determined that the PDI interruption processing is incomplete but the target position B has been updated. During SYNC0 interruption processing, the target position B is directly used, and the compensation array and pointer state are updated synchronously. During the SYNC0 interrupt handling process, the target position data or linear compensation value X is analyzed based on the motion control algorithm. Position planning is performed based on the analysis results and assigned to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode. The cache array 1 area is a preset storage area in the cache memory, and the cache array 2 area is another preset storage area in the cache memory.
2. The linear compensation method for periodic synchronization position patterns based on bare-metal systems according to claim 1, characterized in that, Performing linear compensation operations also includes: If the data in cache array 1 is different from the target location B and the pointer is 0, it is determined that the PDI interrupt handling is incomplete but the target location B has been updated in time. When handling the SYNC0 interrupt, the target location B is used directly to update the cache array, compensation array and pointer status. If the data in cache array 1 is different from the target position B and the pointer is 1, match the corresponding interruption scenario based on the data status and loss flag status in cache array 2. Determine if compensation is needed: If no compensation is needed, select valid target position data for use by SYNC0 interrupt; if compensation is needed, perform the corresponding data update operation, synchronously clear the loss flag and adjust the pointer state. If the data in cache array 1 is different from the target position B and the pointer is 2, based on the interruption scenario matched by the loss flag status, if it is determined that no compensation is needed, the target position data in cache array 2 is selected for use by SYNC0 interrupt, the cache array, compensation array and pointer status are updated, and the loss flag is cleared synchronously.
3. The linear compensation method for periodic synchronization position patterns based on a bare-metal system according to claim 2, characterized in that, The method for updating the cache array is as follows: When the loss flag is 1, store the data in cache array 1 into compensation array 2, store the data in cache array 2 into compensation array 1, then clear cache array 2 and clear the loss flag to 0. When cache array 2 is 0 and the loss flag is 1, store the data in cache array 1 into compensation array 2, store the target position B into compensation array 1 and compensation array 2 respectively, and clear the loss flag to 0. When cache array 2 is 0 and the loss flag is 0, store the target position B into cache array 1, move the original data stored in compensation array 1 into compensation array 2, store the target position B into compensation array 1, and at the same time clear the pointer to 0 to point to cache array 1.
4. The linear compensation method for periodic synchronization position patterns based on bare-metal systems according to claim 3, characterized in that, The secondary cache array includes cache array 1 and cache array 2, which adopts a first-in-first-out storage rule and is used to temporarily store the target location data of PDI data interruption reception; The compensation array includes Compensation Array 1 and Compensation Array 2, which are used to record historical valid location data and provide data support for linear compensation calculation.
5. The linear compensation method for periodic synchronization position patterns based on a bare-metal system according to claim 4, characterized in that, The derivation process of the compensation value X is as follows: Assume the historical values in the compensation array are A and B, respectively; Based on the linear relationship, establish the system of equations a+b=A and 2a+b=B, solve for a=BA and b=2A-B, substitute a and b into the formula X=3a+b, and calculate X=B+BA.
6. A linear compensation system for periodic synchronization position patterns based on a bare-metal system, characterized in that, The system includes a memory and a processor. The memory contains a program for a linear compensation method for a periodic synchronization position mode based on a bare-metal system. When the program for the linear compensation method for a periodic synchronization position mode based on a bare-metal system is executed by the processor, it performs the following steps: When the PDI data interrupt is triggered, the target location is read from the ESC kernel and recorded as target location A. The target location A is stored in the first section of the second-level cache array, and the pointer to the second-level cache array is incremented by 1 to point to the next section of the cache. When the SYNC0 synchronous interrupt is triggered, the target location is read from the ESC kernel and recorded as target location B. The target location B is compared with the data in the second-level cache array 1 to obtain the comparison result. Obtain the pointer status to the cache array, and based on the pointer status and the comparison result, determine whether the PDI data interruption handling and target location data meet the set conditions in this cycle, and obtain the judgment result; Based on the judgment result, the timing interruption scenarios of the corresponding PDI data interruption and SYNC0 signal are matched, and linear compensation operation is selectively performed or the target position data is directly used. Specifically, the linear compensation operation includes: if the data in buffer array 1 is the same as the target position B and the pointer is 1, it is determined that the PDI position data information received in this cycle is complete. During SYNC0 interruption processing, the target position B is directly used, and the pointer is cleared to 0 and points to buffer array 1, completing the update of the compensation array. The data in compensation array 1 is stored in compensation array 2, and buffer array 1 is stored in compensation array 1. If the data in buffer array 1 is the same as the target position B and the pointer is 0, the target position B is compared with the data in compensation array 1 to determine whether the target position B and the data in compensation array 1 are the same. If they are the same, the loss flag is set, and the linear compensation value X is calculated based on the linear equation. During SYNC0 interruption processing, the compensation value X is used, and the compensation array and pointer state are updated. If they are different, it is determined that the PDI interruption processing is incomplete but the target position B has been updated. During SYNC0 interruption processing, the target position B is directly used, and the compensation array and pointer state are updated synchronously. During the SYNC0 interrupt handling process, the target position data or linear compensation value X is analyzed based on the motion control algorithm. Position planning is performed based on the analysis results and assigned to the position loop setpoint of the motor drive to achieve continuous output of the target position in the periodic synchronous position mode. The cache array 1 area is a preset storage area in the cache memory, and the cache array 2 area is another preset storage area in the cache memory.
7. The linear compensation system for periodic synchronization position modes based on a bare-metal system according to claim 6, characterized in that, Performing linear compensation operations also includes: If the data in cache array 1 is different from the target location B and the pointer is 0, it is determined that the PDI interrupt handling is incomplete but the target location B has been updated in time. When handling the SYNC0 interrupt, the target location B is used directly to update the cache array, compensation array and pointer status. If the data in cache array 1 is different from the target position B and the pointer is 1, combine the data status in cache array 2 and the loss flag status to match the corresponding interruption scenario; Determine if compensation is needed: If no compensation is needed, select valid target position data for use by SYNC0 interrupt; if compensation is needed, perform the corresponding data update operation, synchronously clear the loss flag and adjust the pointer state. If the data in cache array 1 is different from the target position B and the pointer is 2, based on the interruption scenario matched by the loss flag status, if it is determined that no compensation is needed, the target position data in cache array 2 is selected for use by SYNC0 interrupt, the cache array, compensation array and pointer status are updated, and the loss flag is cleared synchronously.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a linear compensation method program for a periodic synchronization position pattern based on a bare-metal system. When the linear compensation method program for a periodic synchronization position pattern based on a bare-metal system is executed by a processor, it implements the steps of the linear compensation method for a periodic synchronization position pattern based on a bare-metal system as described in any one of claims 1 to 5.
Citation Information
Patent Citations
EtherCAT bus driving controller and synchronous control method thereof
CN117707100A
Signal processing system control method and apparatus
US20050060512A1