Servo system position compensation method and device, electronic equipment and storage medium
By recording the time difference between physical port signal flip and probe function switching in the servo system, the position latch compensation time of the servo system is calculated, which solves the problem of low latch position accuracy of the servo system and improves the industrial control accuracy.
Patent Information
- Application Number
- CN202510101233.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-22
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, the latch position of the servo system cannot be accurately determined, resulting in a reduced position latch accuracy.
By saving the physical latch time when the physical port signal of the microprocessor unit in the servo system is flipped, and the switching time is determined when the probe function is switched, the time difference between the switching time and the physical latch time is calculated as the position latch compensation time, and the position compensation value of the servo system is determined.
It realizes the accurate determination of compensation time when position latch in the servo system, improves the accuracy of position latch in the servo system, and improves the accuracy of industrial control.
Smart Images

Figure CN119937455A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of industrial control technology, and in particular to a servo system position compensation method, device, electronic equipment and storage medium. Background Art
[0002] In modern industry, automated production based on servo systems has been widely used in all walks of life. Different functions of servo systems are also adapted to different industries. The servo probe function, also known as the position latch function, is mainly used to latch the position of the servo shaft or encoder in real time through an external probe signal (DI signal), and upload it to a control system such as a PLC in a timely manner.
[0003] The probe function requires extremely high responsiveness. Usually, when the servo captures the rising or falling edge of the probe signal, the real-time position of the servo axis should be saved immediately. The probe function is usually calculated based on the captured rising or falling edge, and there is a delay in the calculation process. In addition, in an environment with external interference, it is necessary to add a certain amount of filtering to the signal, and the resulting time delay is more obvious.
[0004] The existence of delay greatly reduces the accuracy of the latch position, so it is necessary to compensate for the delay of the probe function. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a servo system position compensation method, device, electronic device and storage medium to solve the problem in the prior art that the servo system latch position cannot be accurately determined.
[0006] According to a first aspect of an embodiment of the present application, a servo system position compensation method is provided, comprising:
[0007] In response to determining that a physical port signal flips, saving a physical latch time, the physical port being a physical port of a microprocessor unit in the servo system;
[0008] In response to determining that the probe function is switched based on the physical port signal, determining a switching time, wherein the probe function switching includes the probe function switching from valid to invalid, or switching from invalid to valid;
[0009] Calculate the time difference between the switching time and the physical latching time to obtain the position latching compensation time of the servo system;
[0010] A position compensation value for the servo system is determined based at least on the position latch compensation time.
[0011] In some embodiments, in response to determining that a physical port signal is flipped, saving a physical latch time includes:
[0012] In response to determining that a physical port signal flips, the capture module acquires a first value of a clock counter;
[0013] The first value of the clock counter is used as the physical latch time and stored in the register of the capture module.
[0014] In some embodiments, in response to determining that a probe function is switched based on a physical port signal, determining a switching time includes:
[0015] The calculation module obtains the physical port signal and calculates the probe function of capturing the physical port signal;
[0016] In response to determining that the probe function is switched, the calculation module obtains a second value of the clock counter;
[0017] A second value of the clock counter is determined to be the switching time.
[0018] In some embodiments, calculating the time difference between the switching time and the physical latching time includes:
[0019] The calculation module obtains the physical latch time from the capture module;
[0020] Calculate the time difference between the switching time and the physical latch time.
[0021] In some embodiments, the time difference between the switching time and the physical latch time includes:
[0022] The calculation module determines the calculation delay for switching of the probe function based on the physical port signal; or
[0023] The calculation module determines the calculation delay of switching the probe function and the filtering delay of filtering the physical port signal based on the physical port signal.
[0024] In some embodiments, determining a position compensation value of a servo system based at least on a position latch compensation time comprises:
[0025] Get the current running speed of the servo motor in the servo system;
[0026] A position compensation value of the servo system is determined based on at least the position latch compensation time and the current operating speed.
[0027] In some embodiments, the capture module includes at least a first register and a second register;
[0028] The first register is configured to store the physical latch time corresponding to the rising edge flip of the physical port signal, and the second register is configured to store the physical latch time corresponding to the falling edge flip of the physical port signal; or
[0029] The first register is configured to store the physical latch time corresponding to the falling edge flip of the physical port signal, and the second register is configured to store the physical latch time corresponding to the rising edge flip of the physical port signal.
[0030] According to a second aspect of an embodiment of the present application, a servo system position compensation device is provided, comprising:
[0031] A physical latch time determination module is configured to save the physical latch time in response to determining that a physical port signal is flipped, the physical port being a physical port of a microprocessor unit in the servo system;
[0032] A switching time determination module is configured to determine a switching time in response to determining that a probe function switches based on a physical port signal, wherein the switching of the probe function includes switching the probe function from valid to invalid, or switching from invalid to valid;
[0033] A compensation time determination module is configured to calculate the time difference between the switching time and the physical latching time to obtain the position latching compensation time of the servo system;
[0034] The compensation module is configured to determine a position compensation value of the servo system based at least on the position latch compensation time.
[0035] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0036] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0037] The beneficial effects of the embodiments of the present application compared with the prior art are as follows: the embodiments of the present application save the physical latch time when determining that the physical port signal of the microprocessor unit in the servo system is flipped, and determine the switching time when determining that the probe function is switched based on the physical port signal; the difference between the switching time and the physical latch time is used as the position latch compensation time of the servo system, and then the position of the servo system is determined at least based on the position latch compensation time, so as to accurately determine the compensation time for position latching in the servo system, thereby improving the accuracy of the position latching of the servo system and improving the accuracy of industrial control. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0039] Figure 1 It is a flow chart of a method for realizing position latching in a servo system based on a probe function in the related art.
[0040] Figure 2 It is a flow chart of a servo system position compensation method provided in an embodiment of the present application.
[0041] Figure 3 It is a flowchart of a method for preserving a physical latch time in response to determining that a physical port signal has flipped, provided in an embodiment of the present application.
[0042] Figure 4 It is a flowchart of a method for determining a switching time in response to determining that a probe function switches based on a physical port signal, provided in an embodiment of the present application.
[0043] Figure 5 It is a flowchart of a method for calculating the time difference between a switching time and a physical latching time provided in an embodiment of the present application.
[0044] Figure 6 It is a flowchart of a method for determining a position compensation value of a servo system based at least on a position latch compensation time provided in an embodiment of the present application.
[0045] Figure 7 It is a flow chart of another servo system position compensation method provided in an embodiment of the present application.
[0046] Figure 8 It is a schematic diagram of a servo system position compensation device provided in an embodiment of the present application.
[0047] Fig. 9 It is a schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0049] A servo system position compensation method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.
[0050] As mentioned above, the probe function requires extremely high responsiveness. Usually, when the servo captures the rising or falling edge of the probe signal, the real-time position of the servo axis should be saved immediately. The probe function is usually calculated based on the captured rising or falling edge, and there is a delay in the calculation process. In addition, in an environment with external interference, it is necessary to add a certain amount of filtering to the signal, and the resulting time delay is more obvious.
[0051] Figure 1 FIG. 1 is a flow chart of a method for realizing position latching in a servo system based on a probe function in the related art. Figure 1 As shown, the probe function can be configured in the servo system first, and then the clock counter is started. When the external probe signal edge changes, the servo motor position when the signal edge changes is calculated by software and the position is latched. The control system of the servo system reads the probe state and latched position, and then generates control instructions based on the latched position to control the operation of the industrial equipment.
[0052] Among them, software calculation and latching of probe position are key steps. However, in the process of capturing edge changes, software will inevitably have different degrees of delay, especially in some environments with external interference. When capturing and judging external edge changes, the software needs to add a certain amount of filtering, and the delay caused by this is more obvious and cannot be ignored. The existence of delay greatly reduces the accuracy of the latched position.
[0053] In the related art, the capture delay can be reduced by increasing the refresh frequency of the software. At the same time, for the set software filter, compensation can be calculated and added according to the filter time. The former still cannot accurately compensate for the position deviation of the servo system when the servo motor runs at a fast speed. The latter needs to calculate the software delay and filter delay separately, which is cumbersome.
[0054] Therefore, it is necessary to further optimize and improve the correction compensation method of the probe capture position to further improve the probe position capture accuracy and achieve higher precision processing and manufacturing.
[0055] In view of this, an embodiment of the present application provides a servo system position compensation method, which saves the physical latch time when determining that the physical port signal of the microprocessor unit in the servo system is flipped, and determines the switching time when determining that the probe function is switched based on the physical port signal; the difference between the switching time and the physical latch time is used as the position latch compensation time of the servo system, and then the position of the servo system is determined at least based on the position latch compensation time. This method can accurately determine the compensation time for position latching in the servo system, thereby improving the accuracy of the servo system position latching and improving the accuracy of industrial control.
[0056] Figure 2 FIG. 1 is a flow chart of a servo system position compensation method provided in an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0057] In step S201 , in response to determining that a physical port signal is flipped, a physical latch time is saved.
[0058] The physical port is a physical port of a microprocessor unit in the servo system.
[0059] In step S202, in response to determining that the probe function is switched based on the physical port signal, a switching time is determined.
[0060] The switching of the probe function includes the switching of the probe function from valid to invalid, or from invalid to valid.
[0061] In step S203, the time difference between the switching time and the physical latching time is calculated to obtain the position latching compensation time of the servo system.
[0062] In step S204 , a position compensation value of the servo system is determined based on at least the position latch compensation time.
[0063] In certain embodiments of the present application, the method may be executed by a servo system, which may obtain a position compensation value, determine position information based on the position compensation value, and then generate a control instruction using the position information to control the industrial equipment to act as required.
[0064] In some embodiments of the present application, the physical port signal of the MCU (Microcontroller Unit) in the servo system can be detected in real time. If it is determined that the physical port signal of the MCU has flipped, for example, a rising edge of the physical port signal of the MCU is detected, or a falling edge of the physical port signal of the MCU is detected, the current time when the physical port signal flips can be saved as the physical latch time.
[0065] In other embodiments of the present application, the physical port signal of the MCU can also be used for calculation to determine whether the probe function has been switched. Wherein, the probe function can include valid and invalid. When the probe function is switched from valid to invalid, or when the probe function is switched from invalid to valid, it can be determined that the probe function has been switched. At this time, the current time when it is determined that the probe function has been switched can be used as the switching time.
[0066] In some embodiments, the time difference between the switching time and the physical latching time can be calculated to obtain the position latching compensation time of the servo system. The position latching compensation time can be used to determine the position compensation value of the servo system, thereby obtaining the accurate position of the servo system.
[0067] According to the technical solution provided in the embodiment of the present application, by saving the physical latch time when determining that the physical port signal of the microprocessor unit in the servo system is flipped, and determining the switching time when determining that the probe function is switched based on the physical port signal; using the difference between the switching time and the physical latch time as the position latch compensation time of the servo system, and then determining the position of the servo system based at least on the position latch compensation time, the compensation time for position latching in the servo system can be accurately determined, thereby improving the accuracy of the position latching of the servo system and improving the accuracy of industrial control.
[0068] Figure 3 1 is a flow chart of a method for saving a physical latch time in response to determining that a physical port signal has flipped, provided by an embodiment of the present application. Figure 3 As shown, the method comprises the following steps:
[0069] In step S301, in response to determining that a physical port signal is flipped, a capture module obtains a first value of a clock counter.
[0070] In step S302, the first value of the clock counter is used as the physical latch time and stored in the register of the capture module.
[0071] In some embodiments of the present application, when it is determined that the physical port signal of the MCU is flipped, the ECAP (Enhanced Capture Module) can capture the physical latch time when the signal flips. The ECAP can be connected to a TSCTR (Time Stamp Counter Register), which continuously performs clock counting operations. The ECAP can determine the physical latch time by obtaining the value of the TSCTR.
[0072] In one example, the ECAP module can capture the value of the clock counter when the physical port signal of the MCU flips, as the first value of the clock counter. The first value of the clock counter is the physical latch time.
[0073] The physical latch time can be saved in the register of ECAP. Among them, the physical latch time can be saved in the register CAP1 of ECAP, or the register CAP2 of ECAP according to the actual configuration of ECAP. For example, if CAP1 of ECAP is configured to save the rising edge event time, and CAP2 is configured to save the falling edge event time, then when a rising edge flip occurs in the physical port signal of the MCU, the ECAP module can save the current value of TSCTR in CAP1 as the physical latch time. Alternatively, when a falling edge flip occurs in the physical port signal of the MCU, the ECAP module can save the current value of TSCTR in CAP2 as the physical latch time.
[0074] That is, the capture module includes at least a first register and a second register. The first register is configured to store the physical latch time corresponding to the rising edge flip of the physical port signal, and the second register is configured to store the physical latch time corresponding to the falling edge flip of the physical port signal. Alternatively, the first register is configured to store the physical latch time corresponding to the falling edge flip of the physical port signal, and the second register is configured to store the physical latch time corresponding to the rising edge flip of the physical port signal.
[0075] Among them, since the CAP1 register and CAP2 register in ECAP are triggered sequentially, the latter will work normally only when the former has a non-zero value. Therefore, when configuring ECAP, it is necessary to ensure that the value of the CAP1 register first captures the physical port signal flip that triggers the probe function switch.
[0076] Figure 4 FIG. 1 is a flow chart of a method for determining a switching time in response to determining that a probe function switches based on a physical port signal provided by an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:
[0077] In step S401, the calculation module obtains the physical port signal and calculates the probe function of capturing the physical port signal.
[0078] In step S402, in response to determining that the probe function is switched, the calculation module obtains a second value of the clock counter.
[0079] In step S403, the second value of the clock counter is determined to be the switching time.
[0080] In some embodiments of the present application, a calculation module that obtains the transmission value of the physical port signal of the MCU can be used to perform calculations to determine whether the function of the probe has been switched. In other words, the calculation module can obtain the physical port signal of the MCU to calculate whether the function of the probe that captures the physical port signal has been switched.
[0081] If the calculation result indicates that the probe function has been switched, the calculation module can obtain the current value of TSCTR as the second value of the clock counter, and the second value of the clock counter is used to determine the switching time of the probe function.
[0082] On the contrary, if the calculation result indicates that the probe function has not been switched, the probe continues to detect the signal of the MCU physical port until the next flip.
[0083] Figure 5 1 is a flow chart of a method for calculating the time difference between the switching time and the physical latching time provided in an embodiment of the present application. Figure 5 As shown, the method comprises the following steps:
[0084] In step S501 , the calculation module obtains the physical latch time from the capture module.
[0085] In step S502 , the time difference between the switching time and the physical latching time is calculated.
[0086] In some embodiments of the present application, when calculating the time difference between the switching time and the physical latching time, the physical latching time can be obtained by the calculation module from the capture module. In one example, the calculation module can obtain the physical latching time from CAP1 or CAP2 of ECPA. Next, the switching time determined by the calculation module is subtracted from the physical latching time to obtain the time difference between the switching time and the physical latching time.
[0087] The time difference between the switching time and the physical latching time may include a calculation delay for the calculation module to determine the switching of the probe function based on the physical port signal. Alternatively, the time difference between the switching time and the physical latching time may also include a calculation delay for the calculation module to determine the switching of the probe function based on the physical port signal, and a filtering delay for filtering the physical port signal.
[0088] Figure 6 1 is a flow chart of a method for determining a position compensation value of a servo system based at least on a position latch compensation time provided by an embodiment of the present application. Figure 6 As shown, the method comprises the following steps:
[0089] In step S601, the current operating speed of the servo motor in the servo system is obtained.
[0090] In step S602, a position compensation value of the servo system is determined based on at least the position latch compensation time and the current operating speed.
[0091] In certain embodiments of the present application, when determining the position compensation value of the servo system, the current operating speed of the servo motor in the servo system can be obtained, wherein the current operating speed of the servo motor can be a value to be signed, that is, the current operating speed needs to be able to characterize the operating speed and operating direction of the servo motor.
[0092] Next, a method for calculating the position value of the servo system in the related art may be used, for example, using an encoder to calculate the position compensation value of the servo system based on the position latch compensation time and the current operating speed.
[0093] Figure 7 FIG. 1 is a flow chart of another servo system position compensation method provided by an embodiment of the present application. Figure 7 As shown, the ECAP can be initialized and configured first, and the relevant registers of the ECAP module can be configured. When the ECAP module is initialized and configured, the corresponding number of ECAP functional modules can be configured according to the number of probes. Because each probe can capture the position of the rising edge and the falling edge, each ECAP module enables two clock identification registers CAP1 and CAP2, and then performs specific configuration of CAP1 and CAP2 event capture according to the normally open or normally closed configuration state of the external probe signal (DI signal). In one example, register CAP1 can be configured to capture the time of the rising edge event, and register CAP2 can be configured to capture the time of the falling edge event.
[0094] Next, it is determined whether an edge change event has occurred on the MCU physical port side. When the external probe signal is valid or invalid, the corresponding MCU physical pin will have a level flip, and the hardware circuit delay during this period is negligible at the nanosecond level. When the MCU physical port pin has a level flip, the ECAP can latch the clock counter value M when the event occurs, that is, the ECAP module can latch the value M of the clock counter TSCTR at this moment in real time. For example, when the external probe signal is valid, the corresponding pin of the MCU flips from low level to high level (rising edge), and the CAP1 register will latch the value of the clock counter when this rising edge event occurs.
[0095] The calculation module can then perform software monitoring and determine whether an effective edge change of the probe function occurs. Among them, the effective edge change of the probe function refers to the effectiveness and failure of the configured probe function at the software function level. The DI port function is configured as a probe function. After the software detects an edge change at the MCU physical port, the software probe function will be set to valid or invalid. During the software monitoring and judgment period, a software monitoring and judgment delay will be generated. In addition, in some environments with external interference, it is necessary to add filtering to the level signal, and a delay caused by the filtering time will also be generated. No matter what kind of delay, it cannot be ignored and must be compensated. Therefore, after the calculation module determines that the probe function edge has changed through software detection, it can record the value N of the clock counter TSCTR at that moment.
[0096] Finally, the position compensation value can be calculated based on the running speed of the servo motor in the servo system and the values of M and N. As mentioned above, the clock counter value M recorded when the physical port signal is valid and the clock counter value N recorded when the probe function in the software is set to valid, the difference NM between the two includes the software judgment delay and the actively added filter delay, and the calculated total delay time is more accurate. Therefore, according to the current running speed of the servo motor (including positive and negative) and the difference NM, the actual position amount that needs to be compensated by the servo system can be calculated. After compensating this position amount, the control system can obtain a more accurate probe capture position and achieve higher precision processing and manufacturing.
[0097] By adopting the technical solution provided in the embodiment of the present application, higher precision compensation of the capture position can be achieved without increasing the hardware cost. It can be realized only by software programming, which is economical, simple and efficient.
[0098] At the same time, the technical solution provided in the embodiment of the present application can also take into account the software monitoring and judgment delay and the actively added filtering delay, without ignoring any one of them, and without the need to calculate and compensate separately, so as to achieve a better compensation effect.
[0099] In addition, the technical solution provided in the embodiment of the present application can better adapt to different circuit topologies and logic configurations of external probe signals (DI signals). During the initialization phase, the software will adapt the relevant configurations of the ECAP module according to the characteristics of the external signal and enable the capture function.
[0100] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0101] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.
[0102] Figure 8Schematic diagram of a servo system position compensation device provided in an embodiment of the present application. Figure 7 As shown, the device comprises:
[0103] The physical latch time determination module 801 is configured to save the physical latch time in response to determining that a physical port signal is flipped, where the physical port is a physical port of a microprocessor unit in the servo system.
[0104] The switching time determination module 802 is configured to determine the switching time in response to determining that the probe function switches based on the physical port signal. The switching of the probe function includes switching the probe function from valid to invalid, or from invalid to valid.
[0105] The compensation time determination module 803 is configured to calculate the time difference between the switching time and the physical latching time to obtain the position latching compensation time of the servo system.
[0106] The compensation module 804 is configured to determine a position compensation value of the servo system based at least on the position latch compensation time.
[0107] According to the technical solution provided in the embodiment of the present application, by saving the physical latch time when determining that the physical port signal of the microprocessor unit in the servo system is flipped, and determining the switching time when determining that the probe function is switched based on the physical port signal; using the difference between the switching time and the physical latch time as the position latch compensation time of the servo system, and then determining the position of the servo system based at least on the position latch compensation time, the compensation time for position latching in the servo system can be accurately determined, thereby improving the accuracy of the position latching of the servo system and improving the accuracy of industrial control.
[0108] In some implementations, in response to determining that a physical port signal has flipped, saving a physical latch time includes: in response to determining that a physical port signal has flipped, a capture module obtains a first value of a clock counter; using the first value of the clock counter as the physical latch time, and saving it in a register of the capture module.
[0109] In some embodiments, in response to determining that a probe function has switched based on a physical port signal, determining a switching time includes: a calculation module obtains the physical port signal, and calculates the probe function of capturing the physical port signal; in response to determining that the probe function has switched, the calculation module obtains a second value of a clock counter; and determining the second value of the clock counter as the switching time.
[0110] In some implementations, calculating the time difference between the switching time and the physical latching time includes: a calculation module obtaining the physical latching time from a capture module; and calculating the time difference between the switching time and the physical latching time.
[0111] In some embodiments, the time difference between the switching time and the physical latch time includes: the calculation delay of the calculation module determining the switching of the probe function based on the physical port signal; or the calculation delay of the calculation module determining the switching of the probe function based on the physical port signal, and the filtering delay of filtering the physical port signal.
[0112] In some implementations, determining a position compensation value of a servo system based at least on a position latch compensation time includes: acquiring a current operating speed of a servo motor in the servo system; and determining a position compensation value of the servo system based at least on the position latch compensation time and the current operating speed.
[0113] In some embodiments, the capture module includes at least a first register and a second register; the first register is configured to save the physical latch time corresponding to the rising edge flip of the physical port signal, and the second register is configured to save the physical latch time corresponding to the falling edge flip of the physical port signal; or the first register is configured to save the physical latch time corresponding to the falling edge flip of the physical port signal, and the second register is configured to save the physical latch time corresponding to the rising edge flip of the physical port signal.
[0114] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0115] Fig. 9 Schematic diagram of an electronic device provided in an embodiment of the present application. Fig. 9 As shown, the electronic device 9 of this embodiment includes: a processor 901, a memory 902, and a computer program 903 stored in the memory 902 and executable on the processor 901. When the processor 901 executes the computer program 903, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 901 executes the computer program 903, the functions of the modules / units in the above-mentioned device embodiments are implemented.
[0116] The electronic device 9 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 9 may include, but is not limited to, a processor 901 and a memory 902. Those skilled in the art will appreciate that Fig. 9 The electronic device 9 is merely an example and does not limit the electronic device 9 , and may include more or less components than those shown in the figure, or different components.
[0117] The processor 901 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0118] The memory 902 may be an internal storage unit of the electronic device 9, for example, a hard disk or memory of the electronic device 9. The memory 902 may also be an external storage device of the electronic device 9, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 9. The memory 902 may also include both an internal storage unit of the electronic device 9 and an external storage device. The memory 902 is used to store computer programs and other programs and data required by the electronic device.
[0119] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0120] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, which may be in source code form, object code form, executable file or some intermediate form. Computer-readable media may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0121] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A servo system position compensation method, characterized in that: include: In response to determining that a physical port signal flips, saving a physical latch time, the physical port being a physical port of a microprocessor unit in the servo system; In response to determining that a probe function is switched based on the physical port signal, determining a switching time, wherein the switching of the probe function includes switching the probe function from valid to invalid, or from invalid to valid; Calculating the time difference between the switching time and the physical latching time to obtain the position latching compensation time of the servo system; A position compensation value for the servo system is determined based at least on the position latch compensation time.
2. The method according to claim 1, characterized in that The step of saving the physical latch time in response to determining that the physical port signal flips includes: In response to determining that a physical port signal flips, the capture module acquires a first value of the clock counter; The first value of the clock counter is used as the physical latch time and stored in the register of the capture module.
3. The method according to claim 1, characterized in that The step of determining a switching time in response to determining that a probe function is switched based on the physical port signal includes: The calculation module obtains the physical port signal and calculates the probe function of capturing the physical port signal; In response to determining that the probe function is switched, the calculation module obtains a second value of the clock counter; Determine the second value of the clock counter as the switching time.
4. The method according to claim 1, wherein The calculating the time difference between the switching time and the physical latching time includes: The calculation module obtains the physical latch time from the capture module; A time difference between the switching time and the physical latch time is calculated.
5. The method according to claim 1, characterized in that The time difference between the switching time and the physical latch time includes: The calculation module determines a calculation delay for switching of the probe function based on the physical port signal; or The calculation module determines a calculation delay for switching the probe function and a filtering delay for filtering the physical port signal based on the physical port signal.
6. The method according to claim 1, wherein The determining of the position compensation value of the servo system based at least on the position latch compensation time comprises: Obtaining the current operating speed of the servo motor in the servo system; A position compensation value of the servo system is determined based on at least the position latch compensation time and the current operating speed.
7. The method according to claim 2, characterized in that The capture module includes at least a first register and a second register; The first register is configured to store a physical latch time corresponding to a rising edge flip of the physical port signal, and the second register is configured to store a physical latch time corresponding to a falling edge flip of the physical port signal; or The first register is configured to store a physical latch time corresponding to a falling edge flip of the physical port signal, and the second register is configured to store a physical latch time corresponding to a rising edge flip of the physical port signal.
8. A servo system position compensation device, characterized in that: include: a physical latch time determination module configured to save the physical latch time in response to determining that a physical port signal flips, the physical port being a physical port of a microprocessor unit in the servo system; a switching time determining module configured to determine a switching time in response to determining that a probe function switches based on the physical port signal, wherein the switching of the probe function includes switching the probe function from valid to invalid, or switching from invalid to valid; A compensation time determination module is configured to calculate a time difference between the switching time and the physical latch time to obtain a position latch compensation time of the servo system; The compensation module is configured to determine a position compensation value of the servo system based at least on the position latch compensation time.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.