Method, system, terminal device and medium for latching motor position
By receiving the delay compensation time value of the interrupt signal and probe signal, the position value of the motor encoder is obtained and the timer of the motor drive device is corrected. By adopting the motor position correction rule, the problem of inaccurate motor latching position is solved, and higher precision motor position latching is achieved.
Patent Information
- Application Number
- CN202111459782.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-01
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2041-12-01
AI Technical Summary
Communication delay between the motor drive and the encoder can cause inaccurate motor latch-up position, which is especially prominent in high-speed motion applications.
By receiving interrupt signals, the delay compensation time values of the control cycle and probe signals are obtained, multiple position values of the motor encoder are obtained, and the timer inside the motor drive device is latched within the control cycle. The motor position is corrected and latched based on the preset motor position correction rules.
It improves the accuracy of motor latching position, reduces errors caused by communication delay, and achieves more accurate motor position latching.
Smart Images

Figure CN114362638B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of motor drive technology, and in particular to a method, system, terminal device, and computer-readable storage medium for latching motor position. Background Technology
[0002] The motor drive unit has a position latching function, which directly latches the position value of the current control cycle after receiving the probe signal through the control chip. Servo motors are generally equipped with communication encoders. The motor drive unit and the encoder transmit data in a question-and-answer manner. That is, the motor drive unit sends a command to the encoder, the encoder receives the command, latches the current position, and then transmits the latched value to the motor drive unit.
[0003] However, the communication delay between the motor drive and the encoder causes a large error between the position value latched by the probe signal and the current position latched by the encoder, resulting in problems such as inaccurate motor latching position. This problem is particularly prominent when the motor is moving at high speed. Summary of the Invention
[0004] The main objective of this invention is to provide a method, system, terminal device, and computer-readable storage medium for latching motor positions, with the aim of improving the accuracy of motor latching positions.
[0005] To achieve the above objectives, the present invention provides a method for latching a motor position, the method comprising:
[0006] The system receives an interrupt signal and acquires the control cycle and the preset delay compensation time value of the probe signal, while also acquiring multiple position values of the motor encoder.
[0007] Multiple timer values are obtained by latching the timer inside the motor drive device during the control cycle;
[0008] Based on the control cycle, the delay compensation time value, multiple position values, and multiple timer values, the position of the motor is corrected according to a preset motor position correction rule to obtain a motor position latch value, and the position of the motor is latched based on the motor position latch value.
[0009] Optionally, after receiving the interrupt signal and before the steps of acquiring the control cycle and the preset delay compensation time value of the probe signal, and simultaneously acquiring multiple position values of the motor encoder, the method further includes:
[0010] The probe signal is received, and the status value of the probe signal is obtained, so as to determine whether the position of the motor needs to be corrected and latched based on the status value of the probe signal.
[0011] Optionally, the plurality of position values includes: a first position value and a second position value, and the step of obtaining the plurality of position values of the motor encoder includes:
[0012] Obtain the first position value of the motor encoder in the previous control cycle, and obtain the second position value of the motor encoder in the current control cycle.
[0013] Optionally, the plurality of timer values includes: a first timer value and a second timer value. The step of latching the timer inside the motor drive device to obtain the plurality of timer values within the control cycle includes:
[0014] During the control cycle, the probe signal is used to latch the timer inside the motor drive device to obtain the first timer value;
[0015] The feedback data of the motor encoder is obtained, and the second timer value is obtained by latching the timer according to the first start bit in the feedback data.
[0016] Optionally, the method further includes:
[0017] Configure the motor position correction rule, wherein the motor position correction rule includes: determining the motor position latch value based on a preset time correction coefficient and a preset position correction amount.
[0018] Optionally, the step of correcting the motor position according to a preset motor position correction rule to obtain the motor position latch value includes:
[0019] The time correction coefficient is determined based on the control cycle, the compensation time value, the first timer value, and the second timer value.
[0020] The position correction amount is determined based on the time correction factor, the first position value, and the second position value.
[0021] The motor position latch value is determined based on the time correction coefficient, the position correction amount, and the second position value.
[0022] To achieve the above objectives, the present invention also provides a system for latching motor position, the system comprising:
[0023] The acquisition module is used to receive interrupt signals, acquire control cycles and preset delay compensation time values of probe signals, and acquire multiple position values of the motor encoder.
[0024] A latching module is used to latch the timer inside the motor drive device to obtain multiple timer values within the control cycle;
[0025] The correction module is used to correct the position of the motor according to a preset motor position correction rule based on the control cycle, the delay compensation time value, multiple position values and multiple timer values to obtain a motor position latch value, and to latch the position of the motor based on the motor position latch value.
[0026] Optionally, the system for latching the motor position further includes:
[0027] The rule configuration module is used to configure the motor position correction rule, wherein the motor position correction rule includes: determining the motor position latch value based on a preset time correction coefficient and a preset position correction amount.
[0028] In this invention, each functional module of the system for latching the motor position implements the steps of the method for latching the motor position as described above during operation.
[0029] To achieve the above objectives, the present invention also provides a terminal device, the terminal device comprising: a memory, a processor, and a program for latching motor positions stored in the memory and executable on the processor, wherein when the program for latching motor positions is executed by the processor, it implements the steps of the method for latching motor positions as described above.
[0030] Furthermore, to achieve the above objectives, the present invention also proposes a computer-readable storage medium storing a program for latching a motor position, wherein when the program for latching the motor position is executed by a processor, it implements the steps of the method for latching the motor position as described above.
[0031] In addition, to achieve the above objectives, the present invention also provides a computer program product comprising a computer program that, when executed by a processor, implements the steps of the method for latching motor position as described above.
[0032] This invention provides a method, system, terminal device, computer-readable storage medium, and computer program product for latching motor position. The method involves receiving an interrupt signal and acquiring a control cycle and a preset delay compensation time value for a probe signal, while simultaneously acquiring multiple position values of the motor encoder. Within the control cycle, multiple timer values are latched from a timer inside the motor drive device. Based on the control cycle, the delay compensation time value, the multiple position values, and the multiple timer values, the motor position is corrected according to a preset motor position correction rule to obtain a motor position latch value, and the motor position is latched based on this latch value.
[0033] This invention receives a periodic interrupt signal generated by the control chip inside the motor drive device and obtains the control period of the interrupt signal. Simultaneously, it acquires a probe signal, its compensation time value, and multiple position values of the motor encoder. When the CPU in the motor drive device receives a trigger signal from the probe signal source, it latches its internal timer. It also latches its internal timer value when it receives the first start bit of the encoder feedback data. After acquiring the control period of the interrupt signal, the delay compensation time value of the probe signal, the multiple encoder position values, and the multiple timer values inside the motor drive device, it corrects the motor latch position according to a preset motor position correction rule to obtain a motor position latch value. The motor position is then latched based on this motor position latch value. This effectively improves the accuracy of the motor latch position. Attached Figure Description
[0034] Figure 1 This is a schematic diagram of the hardware operating environment involved in the embodiments of the present invention;
[0035] Figure 2 This is a flowchart illustrating an embodiment of the method for latching motor position according to the present invention;
[0036] Figure 3 This is a schematic diagram illustrating the implementation of the probe signal latching motor position method according to an embodiment of the present invention.
[0037] Figure 4 This is a schematic diagram of the first process of motor position latching in an embodiment of the method for latching motor position of the present invention;
[0038] Figure 5 This is a schematic diagram of the second process of motor position latching in one embodiment of the method for latching motor position of the present invention;
[0039] Figure 6 This is a functional module diagram of an embodiment of the system for latching the motor position according to the present invention.
[0040] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0041] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0042] like Figure 1 As shown, Figure 1 This is a schematic diagram of the device structure of the hardware operating environment involved in the embodiments of the present invention.
[0043] It should be noted that the terminal device in the embodiments of the present invention can be a terminal device for accurately locking the position of a motor, and the terminal device can specifically be a motor drive device, etc.
[0044] like Figure 1 As shown, the device may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0045] Those skilled in the art will understand that Figure 1 The device structure shown does not constitute a limitation on the device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0046] like Figure 1 As shown, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a program for latching motor positions. The operating system is a program that manages and controls the hardware and software resources of the device, supporting the operation of the program for latching motor positions and other software or programs. Figure 1 In the device shown, the user interface 1003 is mainly used for data communication with the client; the network interface 1004 is mainly used for establishing a communication connection with the server; and the processor 1001 can be used to call the program for latching the motor position stored in the memory 1005 and perform the following operations:
[0047] The system receives an interrupt signal and acquires the control cycle and the preset delay compensation time value of the probe signal, while also acquiring multiple position values of the motor encoder.
[0048] Multiple timer values are obtained by latching the timer inside the motor drive device during the control cycle;
[0049] Based on the control cycle, the delay compensation time value, multiple position values, and multiple timer values, the position of the motor is corrected according to a preset motor position correction rule to obtain a motor position latch value, and the position of the motor is latched based on the motor position latch value.
[0050] Furthermore, after receiving the interrupt signal and before the steps of acquiring the control cycle and the preset probe signal delay compensation time value, and simultaneously acquiring multiple position values of the motor encoder, the processor 1001 can also call the program for latching the motor position stored in the memory 1005, and further perform the following operations:
[0051] The probe signal is received, and the status value of the probe signal is obtained, so as to determine whether the position of the motor needs to be corrected and latched based on the status value of the probe signal.
[0052] Furthermore, the plurality of position values include: a first position value and a second position value. The processor 1001 can also be used to call the program for latching the motor position stored in the memory 1005, and further perform the following operations:
[0053] Obtain the first position value of the motor encoder in the previous control cycle, and obtain the second position value of the motor encoder in the current control cycle.
[0054] Furthermore, the plurality of timer values include: a first timer value and a second timer value. The processor 1001 can also be used to call the program storing the latched motor position in the memory 1005 to perform the following operations:
[0055] During the control cycle, the probe signal is used to latch the timer inside the motor drive device to obtain the first timer value;
[0056] The feedback data of the motor encoder is obtained, and the second timer value is obtained by latching the timer according to the first start bit in the feedback data.
[0057] Furthermore, the processor 1001 can also be used to call the program storing the latched motor position in the memory 1005, and also perform the following operations:
[0058] Configure the motor position correction rule, wherein the motor position correction rule includes: determining the motor position latch value based on a preset time correction coefficient and a preset position correction amount.
[0059] Furthermore, the processor 1001 can also be used to call the program storing the latched motor position in the memory 1005, and also perform the following operations:
[0060] The time correction coefficient is determined based on the control cycle, the delay compensation time value, the first timer value, and the second timer value.
[0061] The position correction amount is determined based on the time correction factor, the first position value, and the second position value.
[0062] The motor position latch value is determined based on the time correction coefficient, the position correction amount, and the second position value.
[0063] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the method for latching motor position according to the present invention.
[0064] In this embodiment, an embodiment of a motor position latching method is provided. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0065] Step S10: Receive an interrupt signal and obtain the control cycle and the preset delay compensation time value of the probe signal, and at the same time obtain multiple position values of the motor encoder.
[0066] The motor drive unit receives a periodic interrupt signal generated by the control chip inside the motor drive unit and obtains the control period of the interrupt signal. At the same time, it acquires the probe signal and the delay compensation time value of the probe signal, as well as multiple position values of the motor encoder.
[0067] It should be noted that in this embodiment, the servo motor drive device may have multiple latched inputs, enabling real-time and accurate capture of the encoder position; that is, the servo motor drive device possesses a probe function. After receiving the probe signal sent by the probe signal source, the CPU (control chip) in the servo motor drive device latches the internal timer. For example... Figure 3 The diagram shows the implementation of probe signal latching of motor position. After receiving the probe signal, the CPU in the motor drive device latches the timer inside the motor drive device. When the interrupt signal is triggered, it sends a latching instruction to the motor encoder. Upon receiving the latching instruction, the motor encoder latches the current position of the motor, obtains the current position value, and returns the current position value to the CPU.
[0068] Specifically, for example, such as Figure 4The diagram illustrates the first process of motor position latching. In this process, an interrupt signal, acting as a periodic signal, can be used to latch the encoder position, read latched data from the previous cycle (including latched position values and timer values), perform probe position calculations, receive motor drive commands, and execute FOC (vector control) tasks. If the control period of the interrupt signal is T, then within the current control cycle T1, the interrupt signal triggers a command to read the encoder position, resulting in an encoder position value of P1. Further, within the next control cycle T2, the interrupt signal again triggers a command to read the encoder position, resulting in an encoder position value of P2. This value is then latched using the interrupt signal and the encoder position value P1 obtained in the previous control cycle T1. Similarly, within the next control cycle T3, the interrupt signal again triggers a command to read the encoder position, resulting in an encoder position value of P3. This value is then latched using the interrupt signal and the encoder position value P2 obtained in the previous control cycle T2.
[0069] It should be noted that in this embodiment, because the CPU and encoder in the motor drive device communicate using a query-response method, a signal transmission delay occurs when the CPU sends latching commands to the encoder, and a response delay occurs when the encoder feeds back data to the CPU. These signal transmission and response delays result in inaccurate motor position latching. For example, as... Figure 4 The diagram shows the first process of motor position latching. Tc1 is the signal transmission delay, and Tc2 is the response delay. The encoder receives the latching command after the signal transmission delay Tc1, latches the current position value P1 based on the latching command, and transmits the latched position value P1 to the CPU. The CPU receives the position value P1 only after the response delay Tc2. If the rising edge of the probe signal is within the control cycle T2 at this time, the position latched based on the rising edge of the probe signal is P1, but the actual motor position value is P2. m P is caused by signal transmission delay and response delay. m It is not the same as P1.
[0070] Furthermore, in step S10 above, "obtaining multiple position values of the motor encoder" may include:
[0071] Step S101: Obtain the first position value of the motor encoder in the previous control cycle, and obtain the second position value of the motor encoder in the current control cycle.
[0072] After the motor drive device sends a latching command to the motor encoder through the CPU, it will receive the position value latched based on the latching command sent by the motor encoder. The position value includes the position value in the previous control cycle and the position value in the current control cycle.
[0073] Specifically, for example, such as Figure 5 The diagram illustrates the second process of motor position latching. If the control period of the interrupt signal is T, then within the current control period T1, the interrupt signal triggers a read encoder position command to read the encoder's position value within the current control period. The read encoder position value is P1. Further, within the next control period T2, the interrupt signal again triggers a read encoder position command, and the read encoder position value is P2.
[0074] Furthermore, the method for latching the motor position according to the present invention further includes:
[0075] Step S20: During the control cycle, latch the timer inside the motor drive device to obtain multiple timer values;
[0076] When the CPU in the motor drive receives a trigger signal from the probe signal source, it latches its internal timer, and it also latches its internal timer value when it receives the first start bit of the encoder feedback data.
[0077] Specifically, for example, after receiving a latching instruction from the motor drive device via the CPU, the motor encoder latches its current position based on the instruction to obtain a position value, and then feeds this position value back to the CPU. The encoder can transmit the position value back to the CPU using a serial port message format of "start bit + data bit + check bit + stop bit". Furthermore, when the CPU in the motor drive device receives the first start bit of the encoder's feedback data, it latches the encoder's internal timer value. Additionally, the CPU in the motor drive device will also latch its internal timer when it detects the rising or falling edge of the probe signal.
[0078] Furthermore, in step S20 above, the step of "latching the timer inside the motor drive device to obtain multiple timer values within the control cycle" includes:
[0079] Step S201: During the control cycle, the probe signal is used to latch the timer inside the motor drive device to obtain the first timer value;
[0080] Specifically, for example, such as Figure 5The schematic diagram of the second process for motor position latching shows that the rising edge of the probe signal is represented as "2" and the falling edge as "1". If the rising edge and falling edge of the probe signal are within control period T2 and control period T4 respectively, then when the motor drive device detects the rising edge of the probe signal within control period T2, it will latch its internal timer and obtain the first timer value t. m Furthermore, the first timer value t obtained in control cycle T2 will be latched within control cycle T3 via an interrupt signal. m The rising edge state 2 of the probe signal.
[0081] It should be noted that, in this embodiment, Figure 5 In this context, "Td1" represents the delay compensation time for the rising edge of the probe signal, and "Td2" represents the delay compensation time for the falling edge of the probe signal. Both delays are physical delays.
[0082] Step S202: Obtain the feedback data of the motor encoder, and latch the timer according to the first start bit in the feedback data to obtain the second timer value.
[0083] The CPU in the motor drive receives feedback data sent by the encoder, latches the timer inside the motor drive when the first start bit of the feedback data is detected, and obtains the second timer value.
[0084] Specifically, for example, such as Figure 5 The diagram illustrates the second process of motor position latching. When the rising edge of the probe signal is within control cycle T2, the encoder position value obtained based on the interrupt signal within control cycle T2 is P2. At this time, the encoder position value in the previous control cycle T1 is P1. Furthermore, within control cycle T2, when the CPU in the motor drive device receives the first start bit in the encoder feedback data, it latches the internal timer to obtain the second timer value, t2.
[0085] Furthermore, the method for latching the motor position according to the present invention further includes:
[0086] Step S30: Based on the control cycle, the delay compensation time value, multiple position values and multiple timer values, the position of the motor is corrected according to a preset motor position correction rule to obtain a motor position latch value, and the position of the motor is latched based on the motor position latch value.
[0087] After acquiring the control cycle of the interrupt signal, the delay compensation time value of the probe signal, multiple encoder position values, and multiple timer values inside the motor drive device, the motor drive device will correct the motor latch position according to the preset motor position correction rule to obtain the motor position latch value, and latch the motor position based on the motor position latch value.
[0088] It should be noted that in this embodiment, the terminal device will accurately latch the motor position according to the preset motor position correction rules.
[0089] Furthermore, in step S30 above, "correcting the motor position according to a preset motor position correction rule to obtain the motor position latch value" may include:
[0090] Step S301: Determine the time correction coefficient based on the control cycle, the delay compensation time value, the first timer value, and the second timer value;
[0091] The motor drive device obtains the time correction coefficient by using the interrupt signal generated by its CPU, according to the preset motor position correction rule, and based on the control cycle of the interrupt signal, the delay compensation time value of the probe signal, the first timer value of the internal timer of the motor drive device latched based on the probe signal, and the second timer value of the internal timer of the motor drive device latched based on the first start bit of the encoder feedback data.
[0092] Specifically, for example, when the rising edge of the probe signal is at the control period T2, the time correction coefficient ΔTu corresponding to this rising edge is...
[0093] ΔTu=(t m -Td1-t2) / T
[0094] Among them, t m Td1 is the internal timer value of the motor drive device latched based on the rising edge of the probe signal; Td2 is the rising edge delay compensation time value of the probe signal; T2 is the internal timer value of the motor drive device latched based on the first start bit of the encoder feedback data; and T is the control period of the interrupt signal. Since the interrupt signal is a periodic signal, T1 = T2 = T3 = T4 = T.
[0095] Step S302: Determine the position correction amount based on the time correction coefficient, the first position value, and the second position value;
[0096] Step S303: Determine the motor position latch value based on the time correction coefficient, the position correction amount, and the second position value.
[0097] The motor drive unit determines the position correction amount based on the time correction coefficient ΔTu, the first position value P1 of the encoder read in the current control cycle T2, and the second position value P2 of the encoder read in the previous control cycle T1, according to the preset motor position correction rule, through the interrupt signal generated by its CPU. Then, it determines the motor position latch value based on the correction amount, the time correction coefficient, and the second position value of the encoder.
[0098] Specifically, for example, the motor position correction amount ΔP
[0099] ΔP=ΔPu*ΔTu
[0100] Where ΔPu=P2-P1, and the corresponding motor position latch value PU at the rising edge of the probe signal.
[0101] PU=P2+ΔPu*ΔTu
[0102] It should be noted that, in this embodiment, when the falling edge of the probe signal is at the control period T4, the time correction coefficient ΔTd corresponding to the falling edge of the probe signal is...
[0103] ΔTd=(t n -Td2-t4) / T
[0104] Among them, t n Td2 is the internal timer value of the motor drive device latched based on the falling edge of the probe signal; Td2 is the falling edge delay compensation time value of the probe signal; t4 is the internal timer value of the motor drive device latched based on the first start bit of the encoder feedback data within the control cycle T4; and T is the control cycle of the interrupt signal. At this time, the motor position correction amount ΔP...
[0105] ΔP=ΔPd*ΔTd
[0106] Where ΔPd = P4 - P3, and the corresponding motor position latch value PD at the falling edge of the probe signal is...
[0107] PD = P4 + ΔPd * ΔTd
[0108] Where P4 is the encoder position value within control cycle T4, and P3 is the encoder position value within control cycle T3. In summary, after obtaining the motor position latch value PU corresponding to the rising edge and the motor position latch value PD corresponding to the falling edge, the motor position will be latched according to PU and PD.
[0109] In this embodiment, the motor drive device receives a periodic interrupt signal generated by the control chip inside the motor drive device and obtains the control period of the interrupt signal. Simultaneously, it acquires a probe signal and its compensation time value, as well as multiple position values of the motor encoder. The CPU in the motor drive device latches its internal timer when it receives a trigger signal from the probe signal source, and also latches its internal timer value when it receives the first start bit of the encoder feedback data. After acquiring the control period of the interrupt signal, the delay compensation time value of the probe signal, the multiple encoder position values, and the multiple timer values inside the motor drive device, the terminal device corrects the motor latch position according to a preset motor position correction rule to obtain a motor position latch value, and latches the motor position based on the motor position latch value. This invention can effectively improve the accuracy of the motor latch position.
[0110] Furthermore, based on the first embodiment of the method for latching motor position of the present invention described above, a second embodiment of the method for latching motor position of the present invention is proposed.
[0111] The main difference between this embodiment and the first embodiment described above is that the method for latching the motor position of the present invention further includes:
[0112] Step S40: Configure the motor position correction rule, wherein the motor position correction rule includes: determining the motor position latch value based on a preset time correction coefficient and a preset position correction amount.
[0113] Before calculating the motor latch position based on the interrupt signal, the motor drive device needs to configure a motor position correction rule to correct the motor latch position, so that the motor position latched by the rising or falling edge of the probe signal is more accurate.
[0114] It should be noted that, in this embodiment, the timer value t is obtained by latching the timer inside the motor drive position using a probe signal. m On the other hand, considering factors such as transmission delay and response delay between the motor encoder and the CPU of the motor drive device, the timer inside the motor drive position is latched based on the feedback data of the motor encoder to obtain the timer value t1. In order to improve the accuracy of motor position latching, the motor position correction rule will be further configured based on parameters such as timer value, transmission delay, response delay and physical delay of probe signal, so as to correct the position of motor latching according to the motor position correction rule and achieve accurate motor position latching.
[0115] Furthermore, after "receiving the interrupt signal" in step S10 above, and before "acquiring the control cycle and the preset delay compensation time value of the probe signal, and simultaneously acquiring multiple position values of the motor encoder", the following may also be included:
[0116] Step S50: Receive the probe signal and obtain the status value of the probe signal to determine whether the position of the motor needs to be corrected and latched based on the status value of the probe signal.
[0117] Before correcting the motor position, the motor drive device needs to determine whether the probe signal is in a rising edge or falling edge state. If the interrupt signal is determined to be neither in a rising edge nor a falling edge state, then the motor position will not be corrected or latched.
[0118] It should be noted that in this embodiment, the rising edge state value of the probe signal can be represented as "2", and the falling edge state of the probe signal can be represented as "1". When the CPU of the motor drive device detects that the probe signal state is neither "2" nor "1", it will not perform the motor position correction latching operation.
[0119] In this embodiment, before calculating the motor latching position based on the interrupt signal, the motor drive device needs to configure a motor position correction rule to correct the motor latching position, making the motor position latched by the rising or falling edge of the probe signal more accurate. Before receiving the motor position correction, the terminal device needs to pre-determine whether the probe signal is in a rising or falling edge state. If it determines that the probe signal is neither in a rising nor falling edge state, then it will not perform correction latching of the motor position.
[0120] Furthermore, embodiments of the present invention also propose a system for latching motor position, referring to... Figure 6 , Figure 6 This is a functional module diagram illustrating one embodiment of the present invention for latching the motor position. Figure 6 As shown, the system for latching the motor position according to the present invention includes:
[0121] The acquisition module is used to receive interrupt signals, acquire control cycles and preset delay compensation time values of probe signals, and acquire multiple position values of the motor encoder.
[0122] A latching module is used to latch the timer inside the motor drive device to obtain multiple timer values within the control cycle;
[0123] The correction module is used to correct the position of the motor according to a preset motor position correction rule based on the control cycle, the delay compensation time value, multiple position values and multiple timer values to obtain a motor position latch value, and to latch the position of the motor based on the motor position latch value.
[0124] Furthermore, the system for latching the motor position according to the present invention also includes:
[0125] The receiving module is used to receive the probe signal and obtain the status value of the probe signal, so as to determine whether the position of the motor needs to be corrected and latched based on the status value of the probe signal.
[0126] Furthermore, the acquisition module includes:
[0127] The acquisition unit is used to acquire the first position value of the motor encoder in the previous control cycle and to acquire the second position value of the motor encoder in the current control cycle.
[0128] Furthermore, the latching module includes:
[0129] The first latching unit is used to latch the timer inside the motor drive device through the probe signal to obtain the first timer value during the control cycle;
[0130] The second latching unit is used to acquire the feedback data of the motor encoder and latch the timer according to the first start bit in the feedback data to obtain the second timer value.
[0131] Furthermore, the system for latching the motor position according to the present invention also includes:
[0132] A configuration module is used to configure the motor position correction rule, wherein the motor position correction rule includes: determining the motor position latch value based on a preset time correction coefficient and a preset position correction amount.
[0133] Furthermore, the correction module includes:
[0134] The first determining unit is configured to determine the time correction coefficient based on the control cycle, the delay compensation time value, the first timer value, and the second timer value.
[0135] The second determining unit is configured to determine the position correction amount based on the time correction coefficient, the first position value, and the second position value.
[0136] The third determining unit is used to determine the motor position latch value based on the time correction coefficient, the position correction amount, and the second position value.
[0137] The specific implementation methods of each functional module of the system for latching the motor position of the present invention are basically the same as those of the above-described methods for latching the motor position, and will not be repeated here.
[0138] Furthermore, embodiments of the present invention also propose a computer-readable storage medium storing a program for latching motor positions, wherein when the program for latching motor positions is executed by a processor, it implements the steps of the method for latching motor positions as described above.
[0139] The various embodiments of the system and computer-readable storage medium for latching the motor position of the present invention can be referred to the various embodiments of the method for latching the motor position of the present invention, and will not be described again here.
[0140] Furthermore, embodiments of the present invention also provide a computer program product, the computer program product including a computer program, which, when executed by a processor, implements the steps of the method for latching motor position as described in any of the embodiments of the above-described method for latching motor position.
[0141] The specific embodiments of the computer program product of the present invention are basically the same as the embodiments of the method for latching motor position described above, and will not be repeated here.
[0142] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0143] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0144] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a motor drive device, etc.) to execute the methods described in the various embodiments of the present invention.
[0145] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A method for latching the position of a motor, characterized in that, The method for latching motor position is applied to a system for latching motor position, the system including: a motor drive, a motor, and a motor encoder; The method includes: The system receives an interrupt signal and acquires the control cycle and the preset delay compensation time value of the probe signal. At the same time, it acquires multiple position values of the motor encoder. The interrupt signal is a periodic interrupt signal generated by the control chip inside the motor drive device, and the control cycle is the trigger cycle of the interrupt signal. Multiple timer values are obtained by latching the timer inside the motor drive device during the control cycle; Based on the control cycle, the delay compensation time value, multiple position values and multiple timer values, the position of the motor is corrected according to a preset motor position correction rule to obtain a motor position latch value, and the position of the motor is latched based on the motor position latch value; The plurality of position values includes: a first position value and a second position value. The step of obtaining the plurality of position values of the motor encoder includes: Obtain the first position value of the motor encoder in the previous control cycle, and obtain the second position value of the motor encoder in the current control cycle; The plurality of timer values includes: a first timer value and a second timer value. The step of latching the timer inside the motor drive device to obtain the plurality of timer values within the control cycle includes: During the control cycle, the probe signal is used to latch the timer inside the motor drive device to obtain the first timer value; The feedback data of the motor encoder is obtained, and the second timer value is obtained by latching the timer according to the first start bit in the feedback data.
2. The method for latching motor position as described in claim 1, characterized in that, After receiving the interrupt signal and before the steps of acquiring the control cycle and the preset probe signal delay compensation time value, and simultaneously acquiring multiple position values of the motor encoder, the method further includes: The probe signal is received, and the status value of the probe signal is obtained, so as to determine whether the position of the motor needs to be corrected and latched based on the status value of the probe signal.
3. The method for latching motor position as described in claim 1, characterized in that, The method further includes: Configure the motor position correction rule, wherein the motor position correction rule includes: determining the motor position latch value based on a preset time correction coefficient and a preset position correction amount.
4. The method for latching motor position as described in claim 3, characterized in that, The step of correcting the motor position according to a preset motor position correction rule to obtain the motor position latch value includes: The time correction coefficient is determined based on the control cycle, the delay compensation time value, the first timer value, and the second timer value. The position correction amount is determined based on the time correction factor, the first position value, and the second position value; The motor position latch value is determined based on the time correction coefficient, the position correction amount, and the second position value.
5. A system for latching the position of a motor, characterized in that, The system for latching the motor position includes: The acquisition module is used to receive an interrupt signal and acquire the control cycle and the compensation time value of the preset probe signal. At the same time, it acquires multiple position values of the motor encoder. The interrupt signal is a periodic interrupt signal generated by the control chip inside the motor drive device. The control cycle is the triggering cycle of the interrupt signal. The multiple position values include: a first position value and a second position value. The latching module is used to latch the timer inside the motor drive device to obtain multiple timer values within the control cycle, the multiple timer values including: a first timer value and a second timer value; The correction module is used to correct the position of the motor according to a preset motor position correction rule based on the control cycle, the compensation time value, multiple position values and multiple timer values to obtain a motor position latch value, and to latch the position of the motor based on the motor position latch value; The acquisition module is further configured to acquire the first position value of the motor encoder in the previous control cycle and the second position value of the motor encoder in the current control cycle. The latching module is further configured to latch the timer inside the motor drive device through the probe signal to obtain the first timer value within the control cycle; acquire the feedback data of the motor encoder, and latch the timer according to the first start bit in the feedback data to obtain the second timer value.
6. The system for latching motor position as described in claim 5, characterized in that, The system for latching the motor position also includes: The rule configuration module is used to configure the motor position correction rule, wherein the motor position correction rule includes: determining the motor position latch value based on a preset time correction coefficient and a preset position correction amount.
7. A terminal device, characterized in that, The terminal device includes a memory, a processor, and a program for latching motor positions stored in the memory and executable on the processor. When the program for latching motor positions is executed by the processor, it implements the steps of the method for latching motor positions as described in any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for latching the motor position, which, when executed by a processor, implements the steps of the method for latching the motor position as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Position latching method, servo driver and storage medium
CN112803865A