A PID steering engine control method, device, equipment and storage medium
Patent Information
- Application Number
- CN202310331029.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2043-03-31
AI Technical Summary
[0004]有鉴于此,本发明的目的在于提供一种PID舵机控制方法、装置、设备及存储介质,解决了现有技术中舵机调节不稳定的问题
[0036]可见,本发明通过获取舵机状态,若舵机状态为异常状态,获取异常状态的持续时间;若持续时间达到预设时间时,根据异常状态确定Kp、Ki、Kd对应的调节等级;根据调节等级调节舵机,直至舵机达到稳定状态或PID参数Kp=KPT、Kd=KDT和Ki=KIT,KPT、KDT和KIT为舵机正常使用时的控制参数范围内的参数。本发明通过调节等级进而调节PID渐进步长,使矩形式变换的PID参数转变为阶梯式变换,使舵机状态变化更为平滑,在消除舵机异常状态的同时保证舵机性能。
Smart Images

Figure CN116256968B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of control, and in particular to a PID servo control method, apparatus, device, and storage medium. Background Technology
[0002] As the position actuators of drones, the rapid, stable, and accurate response of electric servos to control signals is a key focus in the drone industry. PID (Proportional Integral Derivative) control is widely used in drone servo control due to its simplicity, ease of operation, and good adaptability. However, PID control also has many drawbacks, one significant one being its susceptibility to jitter, steady-state error, or overshoot.
[0003] Currently, in some engineering applications, only PD (Proportional Derivative) is used to control the motor, which can prevent jitter caused by excessive integral percentage. Alternatively, when the servo is in an abnormal state, the PID parameters are directly reduced. Using small parameters will inevitably lead to a decrease in servo performance. When the servo returns to normal, restoring the parameters will easily cause jitter to reappear, resulting in repeated jittering and unstable servo operation. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a PID servo control method, device, equipment and storage medium, which solves the problem of unstable servo adjustment in the prior art.
[0005] To solve the above-mentioned technical problems, the present invention provides a PID servo control method, comprising:
[0006] Obtain the servo status; if the servo status is abnormal, obtain the duration of the abnormal status.
[0007] If the duration reaches the preset time, the adjustment level corresponding to Kp, Ki, and Kd is determined according to the abnormal state;
[0008] Adjust the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp = KPT, Kd = KDT and Ki = KIT, where KPT, KDT and KIT are parameters within the control parameter range when the servo motor is in normal use.
[0009] Optionally, the step of obtaining the servo status, and if the servo status is abnormal, obtaining the duration of the abnormal status, includes:
[0010] Obtain the duration of the jitter state and record it as the first time, the duration of the overshoot state and record it as the second time, and the duration of the steady-state error state and record it as the third time.
[0011] Optionally, when the duration reaches a preset time, it includes:
[0012] The first time reaches the first preset time, or the second time reaches the second preset time, or the third time reaches the third preset time;
[0013] Wherein, the first preset time is less than the second preset time, and the second preset time is less than the third preset time.
[0014] Optionally, determining the adjustment levels corresponding to Kp, Ki, and Kd based on the abnormal state includes:
[0015] Get the number of abnormal servo statuses;
[0016] When the number of abnormal servo states is greater than or equal to 1, an adjustment rule is obtained, wherein the jitter state takes precedence over the overshoot state, and the overshoot state takes precedence over the static error state.
[0017] The adjustment levels corresponding to Kp, Ki, and Kd are determined according to the adjustment rules.
[0018] Optionally, determining the adjustment levels corresponding to Kp, Ki, and Kd according to the adjustment rules includes:
[0019] When the servo motor is in the jitter state, the adjustment level corresponding to Kp is reduced by a first value, the adjustment level of Kd is reduced by a second value, and Ki is adjusted to 0.
[0020] When the servo is in the overshoot state, the adjustment level corresponding to Kp is reduced by the third value, the adjustment level of Kd is reduced by the fourth value, and Ki is adjusted to 0.
[0021] When the servo motor is in the static error state, the adjustment level corresponding to Kp is increased by the fifth value, and the adjustment level of Kd is increased by the sixth value. If the static error state still exists when Kp = KpT and Kd = KdT, then the adjustment level corresponding to Ki is increased by the seventh value.
[0022] When the servo is in the stable state, the adjustment level of Ki is reduced by the eighth value.
[0023] Optionally, the servo motor is initially controlled by the PD.
[0024] The present invention also provides a PID servo control device, comprising:
[0025] The acquisition module is used to acquire the servo motor status, and if the servo motor status is an abnormal state, to acquire the duration of the abnormal state.
[0026] The determination module is used to determine the adjustment levels corresponding to Kp, Ki, and Kd based on the abnormal state if the duration reaches a preset time.
[0027] The adjustment module is used to adjust the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp = KPT, Kd = KDT and Ki = KIT, where KPT, KDT and KIT are parameters within the control parameter range when the servo motor is in normal use.
[0028] Optionally, the determining module includes:
[0029] The status anomaly count acquisition unit is used to acquire the number of servo status anomalies;
[0030] The adjustment rule acquisition unit is used to acquire an adjustment rule when the number of abnormal servo states is greater than or equal to 1. The adjustment rule is that the jitter state takes precedence over the overshoot state, and the overshoot state takes precedence over the static error state.
[0031] The determining unit is used to determine the adjustment level corresponding to Kp, Ki, and Kd according to the adjustment rules.
[0032] The present invention also provides a PID servo control device, comprising:
[0033] Memory, used to store computer programs;
[0034] A processor is used to implement the steps of the PID servo control method described above when executing the computer program.
[0035] The present invention also provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the PID servo control method described above.
[0036] As can be seen, this invention acquires the servo motor status; if the servo motor status is abnormal, it acquires the duration of the abnormal status; if the duration reaches a preset time, it determines the adjustment level corresponding to Kp, Ki, and Kd based on the abnormal status; and it adjusts the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp = KPT, Kd = KDT, and Ki = KIT, where KPT, KDT, and KIT are parameters within the control parameter range for normal servo motor use. This invention adjusts the PID step size gradually by adjusting the adjustment level, transforming the rectangular PID parameter change into a step-like change, making the servo motor status change smoother, and ensuring servo motor performance while eliminating abnormal servo motor states.
[0037] In addition, the present invention also provides a PID servo control device, equipment and storage medium, which also have the above-mentioned beneficial effects. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0039] Figure 1 A flowchart of a PID servo control method provided in an embodiment of the present invention;
[0040] Figure 2 A flowchart illustrating a PID servo control method provided in an embodiment of the present invention;
[0041] Figure 3 This is a schematic diagram of the structure of a PID servo control device provided in an embodiment of the present invention;
[0042] Figure 4 This is a schematic diagram of the structure of a PID servo control device provided in an embodiment of the present invention. Detailed Implementation
[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0044] Please refer to Figure 1 , Figure 1A flowchart illustrating a PID servo control method provided in an embodiment of the present invention. The method may include:
[0045] S101: Get the servo status. If the servo status is abnormal, get the duration of the abnormal status.
[0046] In this embodiment, the execution entity is a terminal. This embodiment does not limit the type of terminal, as long as it can perform PID servo control operations. For example, the terminal can be a general-purpose terminal; or it can be a dedicated terminal.
[0047] This embodiment does not limit the method of controlling the servo to work normally. For example, it can be controlled using only a PD; or it can be controlled using a PID. In order to reduce a lot of jitter, the initial control of the servo can be controlled by only the PD.
[0048] This embodiment does not limit the specific state of the abnormal state. For example, a jittering state in the servo motor is an abnormal state; or a static error state in the servo motor is an abnormal state; or an overshoot state in the servo motor is an abnormal state; or the abnormal state of the servo motor can be any combination of the above states. In this embodiment, when an abnormal state of the servo motor occurs, the duration of the abnormal state is obtained.
[0049] Furthermore, to improve the accuracy of servo control and gain a more comprehensive understanding of the servo status, the above-mentioned acquisition of servo status, if the servo status is abnormal, and the duration of the abnormal status, may include the following steps:
[0050] Obtain the duration of the jitter state and record it as the first time, the duration of the overshoot state and record it as the second time, and the duration of the steady-state error state and record it as the third time.
[0051] S102: If the duration reaches the preset time, determine the adjustment level corresponding to Kp, Ki, and Kd according to the abnormal state.
[0052] In this embodiment, Kp is the proportional gain, which in the PID controller accelerates the system's response speed, improves the system's control accuracy, and quickly adjusts errors. Ki is the integral gain, which in the PID controller eliminates residuals and adjusts the steady-state time. Kd is the derivative gain, which in the PID controller improves the system's dynamic performance, predicts error trends, and corrects errors in advance.
[0053] This embodiment does not limit the setting of the preset time, and can be set according to the abnormal state of the servo. For example, if the abnormal state of the servo is a jitter state, then the preset time for the jitter state is the first preset time; or if the abnormal state of the servo is an overshoot state, then the preset time for the overshoot state is the second preset time; or if the abnormal state of the servo is a static error state, then the preset time for the static error state is the third preset time. This embodiment does not limit whether the first preset time, the second preset time, and the third preset time are the same. For example, the first preset time, the second preset time, and the third preset time can be the same; or they can be different; or two of the preset times can be the same. This embodiment does not limit the magnitude relationship between the first preset time, the second preset time, and the third preset time. For example, the first preset time can be greater than the second preset time, and the second preset time can be greater than the third preset time; or the first preset time can be less than the second preset time, and the second preset time can be less than the third preset time.
[0054] Furthermore, in order to accurately analyze the different performance impacts of various abnormal states and reduce the harm to servo performance, when the above-mentioned duration reaches a preset time, the following steps may be included:
[0055] The first preset time is reached in the first time, or the second preset time is reached in the second time, or the third preset time is reached in the third time;
[0056] The first preset time is less than the second preset time, and the second preset time is less than the third preset time.
[0057] In this embodiment, when the duration of the abnormal state reaches a preset time, the adjustment levels corresponding to Kp, Ki, and Kd are determined based on the abnormal state. This embodiment does not limit the order in which the adjustment levels corresponding to Kp, Ki, and Kd are determined for the abnormal state. For example, regardless of whether the abnormal state is a jitter state, a steady-state error state, or an overshoot state, the adjustment levels corresponding to Kp, Ki, and Kd can be determined simultaneously; or, if the servo state simultaneously exhibits a jitter state, a steady-state error state, and an overshoot state, first, the adjustment levels corresponding to Kp, Ki, and Kd are determined based on the jitter state, and adjustments are made accordingly; then, the adjustment levels corresponding to Kp, Ki, and Kd are determined based on the overshoot state, and adjustments are made accordingly; finally, the adjustment levels corresponding to Kp, Ki, and Kd are determined based on the steady-state error state, and adjustments are made accordingly.
[0058] Furthermore, in order to restore the main operating performance of the servo motor in a timely manner and reduce the impact on the operation of the servo motor, the above-mentioned determination of the adjustment levels corresponding to Kp, Ki, and Kd based on the abnormal state may include the following steps:
[0059] Step 31: Obtain the number of abnormal servo statuses;
[0060] Step 32: When the number of abnormal servo states is greater than or equal to 1, obtain the adjustment rules. The adjustment rules are that jitter state takes priority over overshoot state, and overshoot state takes priority over static error state.
[0061] Step 33: Determine the adjustment levels corresponding to Kp, Ki, and Kd according to the adjustment rules.
[0062] In this embodiment, the adjustment rules are first obtained based on the number of abnormal servo states. When one or more abnormal servo states occur, the adjustment levels corresponding to Kp, Ki, and Kd are determined according to the adjustment rules. The adjustment rules are as follows: first adjust the jitter state, then adjust the overshoot state, and finally adjust the steady-state error state.
[0063] To clearly define the adjustment level and improve the speed of determining the adjustment level, this embodiment establishes a fuzzy rule table based on the jitter state, steady-state error state, and overshoot state. The table contains the corresponding adjustment levels for each abnormal servo state. This embodiment does not limit the content of the jitter state. For example, the jitter state can include severe jitter, or it can also include severe jitter and slight jitter. This embodiment does not limit the content of the steady-state error state. For example, the steady-state error state can include large steady-state error; or it can also include small steady-state error and large steady-state error. This embodiment does not limit the content of the overshoot state. For example, the overshoot state can include large overshoot; or it can also include large overshoot and small overshoot.
[0064] Furthermore, in order to make the servo motor return to normal more quickly and smoothly, the above-mentioned determination of the adjustment levels corresponding to Kp, Ki, and Kd according to the adjustment rules may include the following steps:
[0065] When the servo is in a jitter state, the adjustment level corresponding to Kp is reduced by the first value, the adjustment level of Kd is reduced by the second value, and Ki is adjusted to 0.
[0066] When the servo is in overshoot mode, the adjustment level corresponding to Kp is reduced by the third value, the adjustment level of Kd is reduced by the fourth value, and Ki is adjusted to 0.
[0067] When the servo is in a static error state, the adjustment level corresponding to Kp increases by the fifth value, and the adjustment level of Kd increases by the sixth value. If the static error state still exists when Kp = KpT and Kd = KdT, then the adjustment level corresponding to Ki is increased by the seventh value.
[0068] When the servo is in the stable state, the adjustment level of Ki is reduced by the eighth value.
[0069] This embodiment does not limit the adjustment level corresponding to the abnormal state. For example, when the jitter state is severe jitter, kp can be reduced by 2 levels, kd can be reduced by 2 levels, and Ki can be adjusted to 0; when the jitter state is slight jitter, kp can be reduced by 1 level, kd can be reduced by 1 level, and Ki can be adjusted to 0; when the overshoot state is large overshoot, kp can be reduced by 3 levels, kd can be reduced by 3 levels, and Ki can be adjusted to 0; when the overshoot state is small overshoot, kp can be reduced by 1 level, kd can be reduced by 1 level, and Ki can be adjusted to 0.
[0070] In this embodiment, the level is divided by dividing the adjustment range of the corresponding parameter into at least 3 intervals. For example, if the adjustment range of Ki is 0-10, it can be divided into 5 levels, that is, each level has a value of 2. If the current Ki level is 4, when Ki decreases by one level, it will change from the current level to 3, and the corresponding value will decrease by 2.
[0071] S103: Adjust the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp = KPT, Kd = KDT and Ki = KIT, where KPT, KDT and KIT are the parameters within the control parameter range when the servo motor is in normal use.
[0072] In this embodiment, KPT, KDT, and KIT are the parameters within the control parameter range for normal operation of the servo motor. The control parameter range for normal operation of the servo motor will vary depending on the performance of the servo motor.
[0073] By applying the PID steering gear control method provided in the embodiments of the present invention, the state of the steering gear is acquired; if the steering gear is in an abnormal state, the duration of the abnormal state is acquired; when the duration reaches a preset time, adjustment levels corresponding to Kp, Ki, and Kd are determined according to the abnormal state; the steering gear is adjusted according to the adjustment levels until the steering gear reaches a stable state or the PID parameters satisfy Kp=KPT, Kd=KDT and Ki=KIT, wherein KPT, KDT and KIT are parameters within the control parameter range for normal operation of the steering gear. In this method, the PID gradual step size is adjusted through the adjustment levels, so that the PID parameters with rectangular transformation are transformed into step transformation, which makes the state change of the steering gear smoother, and ensures the performance of the steering gear while eliminating the abnormal state of the steering gear. Furthermore, initial control of the steering gear by PD can reduce a large amount of jitter, which facilitates subsequent control of the steering gear. The abnormal states of the steering gear include jitter state, static error state and overshoot state, and the abnormal states are extracted from multiple aspects, which improves the accuracy of subsequent steering gear control. Furthermore, different abnormal duration is set for different abnormal states, which enables accurate analysis of different performance impacts of different abnormal states and reduces the harm to the performance of the steering gear. Furthermore, when there are multiple abnormal states, priorities are set to preferentially restore important performance of the steering gear, which reduces the impact on the operation of the steering gear. Furthermore, the steering gear is adjusted according to different abnormal states and adjustment levels, so that the state of the steering gear tends to a normal state faster and more smoothly.
[0074] In order to make the present invention easier to understand, please refer to Figure 2 , Figure 2 which is a schematic flow chart of a PID steering gear control method provided by an embodiment of the present invention, the method may specifically include:
[0075] When the steering gear is in initial operation, it is controlled by PD (that is, Kp=KPT, Kd=KDT, Ki=0), and the state of the steering gear is continuously acquired, including jitter state, static error state and overshoot state. When the jitter state occurs and its duration reaches T1, or the overshoot state occurs and its duration reaches T2, or the static error state occurs and its duration reaches T3, it indicates that the steering gear operates abnormally (jitter / static error / overshoot); when the steering gear remains in a stable state and the duration reaches T4, it indicates that the operating state of the steering gear is stable. Wherein, the hazard level for the device is: jitter state > overshoot state > static error state, therefore, the priority of the jitter state is higher than that of the overshoot state, and the priority of the overshoot state is higher than that of the static error state, and the corresponding abnormal state duration satisfies 0<T1<T2<T3<T4. That is, when there is both jitter state and overshoot state or static error state, jitter is preferentially considered; when it is confirmed that no jitter occurs, adjustment for overshoot state takes effect; when neither jitter state nor overshoot state exists, adjustment for static error state takes effect. Wherein, the jitter state may include severe jitter and slight jitter, the static error state may include large static error and small static error, and the overshoot state may include large overshoot and small overshoot.
[0076] Obtain fuzzy rule tables for jitter state, steady-state error state, and overshoot state. Please refer to Table 1 for details. Table 1 is a fuzzy rule table provided in an embodiment of the present invention.
[0077] Table 1 Fuzzy Rule Table
[0078]
[0079]
[0080] In Table 1, DD=2 indicates severe jitter, DD=1 indicates slight jitter, CT=2 indicates large overshoot, CT=1 indicates small overshoot, JC=2 indicates large steady-state error, JC=1 indicates small steady-state error, CT=0 indicates no overshoot, DD=0 indicates no jitter, and JC=0 indicates no steady-state error. The minimum step sizes for the parameters Kp, Kd, and Ki are designed as Kpt, Kdt, and Kit, respectively. When severe jitter occurs, the Kp and Kd parameters decrease by a factor of 2 each time (i.e., the level decreases by 2) to help the servo stabilize as quickly as possible. When non-severe jitter occurs (i.e., slight jitter), the Kp and Kd parameters decrease by a step of 1 each time (i.e., the level decreases by 1) to ensure the servo stabilizes without affecting performance. The same principle applies to the servo overshoot state.
[0081] When DD=2, it indicates that the servo motor is shaking violently. The Ki parameter drops to 0, and the Kp and Kd parameters are reduced by the corresponding level based on the current level: Kp`=Kp-2Kpt, Kd`=Kd-2Kdt;
[0082] When DD=1, it indicates that the servo motor is not violently vibrating. The Ki parameter is reduced to 0, and the Kp and Kd parameters are reduced by the corresponding level based on the current level: Kp`=Kp-1Kpt, Kd`=Kd-1Kdt;
[0083] When DD=0 and CT=2, it indicates that the servo has a large overshoot. The Ki parameter drops to 0, and the Kp and Kd parameters are reduced by the corresponding level from the current level: Kp`=Kp-3Kpt, Kd`=Kd-3Kdt;
[0084] When DD=0 and CT=1, it indicates that the servo has a small overshoot. The integral parameter drops to 0, and the Kp and Kd parameters are reduced by the corresponding level from the current level: Kp`=Kp-1Kpt, Kd`=Kd-1Kdt;
[0085] When DD=0, CT=0 and JC=2, it indicates that the servo has a large static error. The Ki parameter remains unchanged at 0. First, restore the Kp and Kd parameters to the corresponding levels based on the current levels: Kp`=Kp+2Kpt, Kd`=Kd+2Kdt;
[0086] When DD=0, CT=0 and JC=1, it indicates that the servo has a large static error. The Ki parameter remains unchanged at 0. First, restore the Kp and Kd parameters to the corresponding levels based on the current levels: Kp`=Kp+1Kpt, Kd`=Kd+1Kdt;
[0087] When DD=0, CT=0, JC≠0 and Kp=KpT, Kd=KdT, perform a rank operation on the Ki parameter: Ki`=Ki+1Kit;
[0088] When DD=0, CT=0 and JC=0, gradually restore the Kp, Kd, and Ki parameters to their normal operating values: Kp`=Kp+1Kpt, Kd`=Kd+1Kdt, Ki`=Ki-1Kit, until they reach the normal operating values, i.e., Kp=KPT, Kd=KDT, Ki`=KIT, or the servo reaches a stable state. Here, KPT, KDT, and KIT are the parameters within the control parameter range when the servo is in normal use.
[0089] The PID servo control device provided in the embodiments of the present invention will be described below. The PID servo control device described below can be referred to in correspondence with the PID servo control method described above.
[0090] Please refer to the details. Figure 3 , Figure 3 A schematic diagram of a PID servo control device provided in an embodiment of the present invention may include:
[0091] The acquisition module 100 is used to acquire the servo motor status, and if the servo motor status is an abnormal state, to acquire the duration of the abnormal state.
[0092] The determination module 200 is used to determine the adjustment levels corresponding to Kp, Ki, and Kd based on the abnormal state if the duration reaches a preset time.
[0093] The adjustment module 300 is used to adjust the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp = KPT, Kd = KDT and Ki = KIT, where KPT, KDT and KIT are parameters within the control parameter range when the servo motor is in normal use.
[0094] Based on the above embodiments, the acquisition module 100 may include:
[0095] The acquisition unit is used to acquire the duration of the jitter state and record it as the first time, the duration of the overshoot state and record it as the second time, and the duration of the steady-state error state and record it as the third time.
[0096] Based on the above embodiments, the determining module 200 may include:
[0097] A time unit is used to reach a first preset time, or a second preset time, or a third preset time; wherein the first preset time is less than the second preset time, and the second preset time is less than the third preset time.
[0098] Based on any of the above embodiments, the determining module 200 may include:
[0099] The status anomaly count acquisition unit is used to acquire the number of servo status anomalies;
[0100] The adjustment rule acquisition unit is used to acquire an adjustment rule when the number of abnormal servo states is greater than or equal to 1. The adjustment rule is that the jitter state takes precedence over the overshoot state, and the overshoot state takes precedence over the static error state.
[0101] The determining unit is used to determine the adjustment level corresponding to Kp, Ki, and Kd according to the adjustment rules.
[0102] Based on the above embodiments, the determining unit may include:
[0103] The jitter adjustment subunit is used to decrease the adjustment level corresponding to Kp by a first value, decrease the adjustment level of Kd by a second value, and adjust Ki to 0 when the servo state is the jitter state.
[0104] The overshoot adjustment subunit is used to reduce the adjustment level corresponding to Kp by a third value, reduce the adjustment level of Kd by a fourth value, and adjust Ki to 0 when the servo state is the overshoot state.
[0105] The static error adjustment subunit is used to increase the adjustment level corresponding to Kp by a fifth value and the adjustment level of Kd by a sixth value when the servo state is the static error state. If the static error state still exists when Kp = KpT and Kd = KdT, then the adjustment level corresponding to Ki is increased by a seventh value.
[0106] A stabilization adjustment subunit is used to decrease the adjustment level of Ki by an eighth value when the servo state is the stable state.
[0107] Based on the above embodiments, the servo motor in the acquisition module 100 is initially controlled by the PD.
[0108] It should be noted that the order of the modules and units in the above-mentioned PID servo control device can be changed without affecting the logic.
[0109] The PID servo control device provided in this embodiment of the invention uses an acquisition module 100 to acquire the servo state, and if the servo state is abnormal, to acquire the duration of the abnormal state; a determination module 200 is used to determine the adjustment level corresponding to Kp, Ki, and Kd based on the abnormal state if the duration reaches a preset time; and an adjustment module 300 is used to adjust the servo according to the adjustment level until the servo reaches a stable state or the PID parameters Kp = KPT, Kd = KDT, and Ki = KIT, where KPT, KDT, and KIT are parameters within the control parameter range for normal servo operation. This device adjusts the PID step size gradually by adjusting the adjustment level, transforming the rectangular PID parameter changes into a step-like changes, making the servo state changes smoother, and ensuring servo performance while eliminating abnormal servo states. Furthermore, using PD for initial control of the servo can significantly reduce jitter, facilitating subsequent servo control. Abnormal servo states include jitter, static error, and overshoot; multi-faceted anomaly extraction improves the accuracy of servo control. Additionally, setting different durations for different abnormal states allows for accurate analysis of their varying performance impacts, minimizing harm to servo performance. When multiple abnormal states exist, prioritizing them restores critical servo performance, reducing disruption to servo operation. Finally, adjusting the servo based on different abnormal states and adjustment levels allows for a faster and smoother return to normal operation.
[0110] The PID servo control device provided in the embodiments of the present invention will be described below. The PID servo control device described below can be referred to in correspondence with the PID servo control method described above.
[0111] Please refer to Figure 4 , Figure 4 A schematic diagram of the structure of the PID servo control device provided in the embodiments of the present invention may include:
[0112] Memory 10 is used to store computer programs;
[0113] The processor 20 is used to execute computer programs to implement the PID servo control method described above.
[0114] The system includes a memory 10, a processor 20, a communication interface 31, and a communication bus 32. The memory 10, processor 20, and communication interface 31 communicate with each other through the communication bus 32.
[0115] In this embodiment of the invention, the memory 10 is used to store one or more programs. The programs may include program code, which includes computer operation instructions. In this embodiment, the memory 10 may store programs for implementing the following functions:
[0116] Get the servo status; if the servo status is abnormal, get the duration of the abnormal status.
[0117] If the duration reaches the preset time, the adjustment level corresponding to Kp, Ki, and Kd will be determined according to the abnormal state;
[0118] Adjust the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp = KPT, Kd = KDT and Ki = KIT, where KPT, KDT and KIT are the parameters within the control parameter range when the servo motor is in normal use.
[0119] In one possible implementation, the memory 10 may include a program storage area and a data storage area, wherein the program storage area may store the operating system and applications required for at least one function; and the data storage area may store data created during use.
[0120] Furthermore, memory 10 may include read-only memory and random access memory, providing instructions and data to the processor. A portion of the memory may also include NVRAM. The memory stores operating systems and operating instructions, executable modules, or data structures, or subsets thereof, or extended sets thereof, wherein the operating instructions may include various operating instructions for implementing various operations. The operating system may include various system programs for implementing various basic tasks and handling hardware-based tasks.
[0121] Processor 20 can be a central processing unit (CPU), an application-specific integrated circuit, a digital signal processor, a field-programmable gate array, or other programmable logic device. Processor 20 can be a microprocessor or any conventional processor. Processor 20 can call programs stored in memory 10.
[0122] Communication interface 31 can be an interface for the communication module, used to connect with other devices or systems.
[0123] Of course, it should be noted that, Figure 4 The structure shown does not constitute a limitation on the PID servo control device in the embodiments of this application. In practical applications, the PID servo control device may include... Figure 4 More or fewer components as shown, or combinations of certain components.
[0124] The storage medium provided in the embodiments of the present invention will be described below. The storage medium described below can be referred to in correspondence with the PID servo control method described above.
[0125] The present invention also provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the PID servo control method described above.
[0126] The storage medium can include various media that can store program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0127] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0128] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0129] Finally, it should be noted that in this document, relationships such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations 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 process, method, article, or apparatus.
[0130] The above provides a detailed description of the PID servo control method, apparatus, device, and storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A PID servo motor control method, characterized in that, include: Obtain the servo status; if the servo status is abnormal, obtain the duration of the abnormal status. If the duration reaches the preset time, the adjustment level corresponding to Kp, Ki, and Kd is determined according to the abnormal state; Adjust the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp=KPT, Kd=KDT and Ki=KIT, where KPT, KDT and KIT are parameters within the control parameter range when the servo motor is in normal use; The step of determining the adjustment levels corresponding to Kp, Ki, and Kd based on the abnormal state includes: Get the number of abnormal servo statuses; When the number of abnormal servo states is greater than or equal to 1, an adjustment rule is obtained, wherein the adjustment rule prioritizes jitter state over overshoot state, and the overshoot state prioritizes static error state. The adjustment levels corresponding to Kp, Ki, and Kd are determined according to the adjustment rules.
2. The PID servo control method according to claim 1, characterized in that, The step of obtaining the servo status, and if the servo status is abnormal, obtaining the duration of the abnormal status, includes: Obtain the duration of the jitter state and record it as the first time, the duration of the overshoot state and record it as the second time, and the duration of the steady-state error state and record it as the third time.
3. The PID servo control method according to claim 2, characterized in that, When the duration reaches the preset time, it includes: The first time reaches the first preset time, or the second time reaches the second preset time, or the third time reaches the third preset time; Wherein, the first preset time is less than the second preset time, and the second preset time is less than the third preset time.
4. The PID servo control method according to claim 1, characterized in that, The step of determining the adjustment levels corresponding to Kp, Ki, and Kd according to the adjustment rules includes: When the servo motor is in the jitter state, the adjustment level corresponding to Kp is reduced by a first value, the adjustment level of Kd is reduced by a second value, and Ki is adjusted to 0. When the servo is in the overshoot state, the adjustment level corresponding to Kp is reduced by the third value, the adjustment level of Kd is reduced by the fourth value, and Ki is adjusted to 0. When the servo motor is in the static error state, the adjustment level corresponding to Kp is increased by the fifth value, and the adjustment level of Kd is increased by the sixth value. If the static error state still exists when Kp=KpT and Kd=KdT, then the adjustment level corresponding to Ki is increased by the seventh value. When the servo is in the stable state, the adjustment level of Ki is reduced by the eighth value.
5. The PID servo control method according to claim 1, characterized in that, The servo motor is initially controlled by the PD.
6. A PID servo motor control device, characterized in that, include: The acquisition module is used to acquire the servo motor status, and if the servo motor status is an abnormal state, to acquire the duration of the abnormal state. The determination module is used to determine the adjustment levels corresponding to Kp, Ki, and Kd based on the abnormal state if the duration reaches a preset time. The adjustment module is used to adjust the servo motor according to the adjustment level until the servo motor reaches a stable state or the PID parameters Kp=KPT, Kd=KDT and Ki=KIT, where KPT, KDT and KIT are parameters within the control parameter range when the servo motor is in normal use; The determining module includes: The status anomaly count acquisition unit is used to acquire the number of servo status anomalies; The adjustment rule acquisition unit is used to acquire adjustment rules when the number of abnormal servo states is greater than or equal to 1. The adjustment rules prioritize jitter state over overshoot state, and overshoot state prioritizes static error state.
7. A PID servo motor control device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the PID servo control method as described in any one of claims 1 to 5 when executing the computer program.
8. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the steps of the PID servo control method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Unmanned aerial vehicle rudder surface control method, system and device and computer readable memory medium
CN110618699A
