Device control method and computer device

By recording position errors in the servo system and adaptively adjusting PID parameters, the positioning accuracy problem caused by gear backlash and load variations in high-precision servo systems is solved, achieving high-precision positioning and stability under complex working conditions and reducing maintenance costs.

CN122639744APending Publication Date: 2026-08-25GEER TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610722827.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-22
Publication Date
2026-08-25

AI Technical Summary

Technical Problem

In existing technologies, the motor control of high-precision servo systems is easily affected by gear backlash, transmission nonlinearity and load changes, leading to problems such as overshoot and oscillation, which reduces the positioning accuracy and stability of the system, and makes it difficult to maintain optimal performance, especially under complex working conditions.

Method used

By acquiring the position error value of the target device and adding it to the task context information, the PID parameters are adjusted when the error exceeds the threshold to achieve adaptive optimization control, automatically responding to mechanical wear, load changes and environmental disturbances, and ensuring that optimal positioning accuracy is maintained throughout the motion control process.

Benefits of technology

It significantly improves positioning accuracy under complex working conditions, reduces later maintenance and debugging costs, and enhances the system's adaptability and stability in different environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122639744A_ABST
    Figure CN122639744A_ABST
Patent Text Reader

Abstract

The application discloses a device control method and a computer device, and belongs to the technical field of automatic control. The method comprises the following steps: obtaining a control task, wherein the control task comprises a target position; controlling a target device to move to the target position based on PID parameters; adding a first position error value between the position of the target device and the target position to task context information after the movement of the target device is completed; and if the first position error value is greater than or equal to a first preset error value, adjusting the PID parameters based on the task context information, and re-executing the step of controlling the target device to move to the target position based on the PID parameters and subsequent steps. The PID parameters can be adjusted to the current optimal state through the task context information, the optimal positioning accuracy can be maintained in the whole motion control process, and therefore the positioning accuracy of the system under complex working conditions is significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of automatic control technology, and in particular to a device control method and a computer device. Background Technology

[0002] With the continuous development of technology, devices such as bionic robots, precision optical platforms, and extended reality (XR) equipment testing instruments are becoming increasingly popular. These devices typically employ high-precision servo systems, which require motors to drive the controlled equipment to a designated position quickly, smoothly, and accurately.

[0003] In related technologies, proportional-integral-derivative (PID) controllers are commonly used to control motors. However, due to factors such as gear backlash, transmission nonlinearity, and load variations, the controlled equipment is prone to overshoot and oscillation, which reduces the system's positioning accuracy. Summary of the Invention

[0004] This application provides a device control method and a computer device, which can improve the positioning accuracy of the system. The technical solution is as follows: Firstly, a device control method is provided for use in a servo system, the method comprising: Acquire a control task, the control task including a target location; The target device is moved to the target position based on proportional-integral-derivative (PID) parameters. After the target device finishes moving, a first position error value between the position of the target device and the target position is obtained, and the first position error value is added to the task context information; If the first position error value is greater than or equal to the first preset error value, the PID parameters are adjusted based on the task context information, and the steps of controlling the target device to move to the target position based on the proportional-integral-derivative PID parameters and subsequent steps are re-executed.

[0005] In this application, a control task is acquired, which includes a target position. A target device is controlled to move towards the target position based on PID parameters. After the target device has moved, a first position error value between the target device's current position and the target position is acquired and added to the task context information. If the first position error value is greater than or equal to a first threshold, the PID parameters are adjusted based on the task context information, and the steps of controlling the target device to move towards the target position based on the PID parameters and subsequent steps are re-executed. By comparing the actual position with the target position, a first position error value that reflects the magnitude of the error and performance is generated. When this error exceeds the first threshold, the current error is recorded as key historical data in the task context information. Then, based on this context containing historical error information, the PID parameters are adjusted specifically, and the device is driven to re-execute the movement task. This method can achieve complete automation, autonomously responding to deviations caused by mechanical wear, load changes, environmental disturbances, etc., without human intervention, thus enhancing adaptability in different environments. By continuously iterating and adjusting the PID parameters to their current optimal state, the optimal positioning accuracy is maintained throughout the entire motion control process, thereby significantly improving positioning accuracy under complex working conditions and greatly reducing the cost of later maintenance and debugging.

[0006] Optionally, before controlling the target device to move to the target position based on proportional-integral-derivative PID parameters, the method further includes: adding the position of the target device as the starting position to the task context information, and adding the target position as the ending position to the task context information; The method of controlling the target device to move to the target position based on proportional-integral-derivative (PID) parameters includes: controlling the target device to move based on the start position, end position and PID parameters in the task context information; After the target device moves to the target position using proportional-integral-derivative (PID) parameters, the method further includes: updating the starting position in the task context information based on the position of the target device after the movement of the target device is completed.

[0007] Optionally, the control task includes one or more target locations, and after adding the first position error value to the task context information, it further includes: If the first position error value is less than the first preset error value, the end position in the task context information is updated based on the next target position, and the step of controlling the target device to move to the target position based on proportional-integral-derivative PID parameters and subsequent steps are re-executed.

[0008] Optionally, adjusting the PID parameters based on the task context information includes: The motion state of the target device is determined based on the position error value in the task context information; The PID parameters are adjusted based on the motion state.

[0009] Optionally, determining the motion state of the target device based on the position error value in the task context information includes: If the absolute value of the first position error is greater than the first preset error value and less than or equal to the second preset error value, the motion state is determined to be a stable state; or... If the number of position error values ​​in the task context information is greater than or equal to 2, the first position error value is greater than the second preset error value, and the second position error value in the task context information is greater than or equal to 0, then the motion state is determined to be an error state, and the second position error value is the position error value preceding the first position error value; or... If the first position error value is less than 0 and the absolute value of the first position error value is greater than the second preset error value, the motion state is determined to be an overshoot state; or... If the absolute value of the first position error value is greater than the second preset error value, and the positive and negative attributes of the first position error value and the second position error value are different, the motion state is determined to be an oscillation state.

[0010] Optionally, the task context information further includes an integral term, which is used to accumulate position error. Before adjusting the PID parameters based on the motion state, the method further includes updating the integral term based on the first position error value and the motion state. The step of adjusting the PID parameters based on the motion state includes: adjusting the PID parameters based on the motion state and the integral term.

[0011] Optionally, the task context information further includes a stability count value, and before adjusting the PID parameters based on the motion state and the integral term, the method further includes: incrementing the stability count value by 1 when the motion state is stable; The step of adjusting the PID parameters based on the motion state and the integral term includes: when the motion state is the stable state, adjusting the PID parameters based on the stable count value and the integral term.

[0012] Optionally, the task context information further includes an adaptive gain factor, and adjusting the PID parameters based on the stable count value and the integral term includes: Adjust the proportional, integral, and derivative parameters in the PID parameters based on the stable count value and the integral term; If the stable count value is greater than or equal to the first pre-designed value, the adaptive gain factor is increased by a first factor. The proportional and derivative parameters in the PID parameters are adjusted based on the adaptive gain factor.

[0013] Optionally, adjusting the PID parameters based on the motion state and the integral term includes: When the motion state is the error state, the PID parameters are adjusted based on the first position error value and the integral term.

[0014] Optionally, the task context information further includes a continuous overshoot count value. Before adjusting the PID parameters based on the motion state and the integral term, the method further includes: incrementing the continuous overshoot count value by 1 when the motion state is in an overshoot state, and resetting the continuous overshoot count value when the motion state is not in an overshoot state. The step of adjusting the PID parameters based on the motion state and the integral term includes: when the motion state is the overshoot state, adjusting the PID parameters based on the continuous overshoot count value and the integral term.

[0015] Optionally, after incrementing the continuous overshoot count value by 1 when the motion state is in an overshoot state, the method further includes: When the absolute values ​​of the third position error value, the second position error value, and the first position error value in the task context information decrease, and the positive and negative attributes of the first position error value and the second position error value are the same, the difference between the absolute value of the third position error value and the absolute value of the second position error value is divided by a first duration to obtain a first deceleration rate. The difference between the absolute value of the second position error value and the absolute value of the first position error value is divided by a second duration to obtain a second deceleration rate. The third position error value is the previous position error value of the second position error value, the second position error value is the previous position error value of the first position error value, the first duration is the time interval between the acquisition time of the third position error value and the acquisition time of the second position error value, and the second duration is the time interval between the acquisition time of the second position error value and the acquisition time of the first position error value. If the product of the first deceleration rate and the preset value is less than the second deceleration rate, the continuous overshoot count value is incremented by 1.

[0016] Optionally, the task context information further includes an adaptive gain factor, and adjusting the PID parameters based on the continuous overshoot count value and the integral term includes: The proportional, derivative, and integral parameters in the PID controller are adjusted based on the continuous overshoot count value and the integral term. If the continuous overshoot count value is greater than or equal to the second pre-designed value, the adaptive gain factor is reduced by a second factor. Based on the adaptive gain factor, the proportional and derivative parameters in the PID controller are adjusted.

[0017] Optionally, the task context information further includes an oscillation count value. Before adjusting the PID parameters based on the motion state and the integral term, the method further includes: incrementing the oscillation count value by 1 when the motion state is an oscillation state. The step of adjusting the PID parameters based on the motion state and the integral term includes: when the motion state is the oscillation state, adjusting the PID parameters based on the oscillation count value and the integral term.

[0018] Optionally, the task context information further includes an adaptive gain factor, and adjusting the PID parameters based on the oscillation count value and the integral term includes: The proportional, derivative, and integral parameters in the PID controller are adjusted based on the oscillation count value and the integral term. If the oscillation count value is greater than or equal to the third pre-designed value, the adaptive gain factor is reduced by a third factor. Based on the adaptive gain factor, the proportional and derivative parameters in the PID controller are adjusted.

[0019] Optionally, after adjusting the PID parameters based on the task context information, the method further includes: if the number of position error values ​​in the task context information is greater than or equal to 2, and if the absolute value of the first position error value is less than the absolute value of the second position error value in the task context information, and the first position error value and the second position error value have the same positive or negative attribute, then the difference between the absolute value of the second position error value and the absolute value of the first position error value is divided by a second duration to obtain a second deceleration rate, where the second position error value is the previous position error value of the first position error value, and the second duration is the time interval between the acquisition time of the second position error value and the acquisition time of the first position error value; if the second deceleration rate is greater than or equal to a preset deceleration rate, a dynamic attenuation factor is determined based on the second deceleration rate. The method of controlling the target device to move to the target position based on proportional-integral-derivative (PID) parameters includes: determining a first movement parameter based on the position of the target device, the target position, and the PID parameters; determining a second movement parameter based on the first movement parameter and the dynamic attenuation factor; and controlling the movement of the target device based on the second movement parameter.

[0020] Optionally, determining the second movement parameter based on the first movement parameter and the dynamic attenuation factor includes: Multiply the first moving parameter by the dynamic decay factor to obtain the second moving parameter; If the first position error value is greater than the third preset error value, the first position error value is multiplied by the first preset value to obtain the third movement parameter; If the second movement parameter is greater than the third movement parameter, then the second movement parameter is updated to the third movement parameter.

[0021] Secondly, a device control apparatus is provided for use in a servo system, the apparatus comprising: The first acquisition module is used to acquire the control task, which includes the target location; The control module is used to control the target device to move towards the target position based on proportional-integral-derivative (PID) parameters; The second acquisition module is used to acquire a first position error value between the position of the target device and the target position after the target device has finished moving, and add the first position error value to the task context information; The adjustment module is used to adjust the PID parameters based on the task context information when the first position error value is greater than or equal to the first preset error value, and to re-execute the step of controlling the target device to move to the target position based on the proportional-integral-derivative PID parameters and subsequent steps.

[0022] Thirdly, a computer device is provided, the computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the device control method described in the first aspect.

[0023] Fourthly, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program, which, when executed by a processor, implements the device control method described in the first aspect.

[0024] Fifthly, a computer program product is provided that, when the computer program product is run on a computer device, causes the computer device to execute the device control method described in the first aspect.

[0025] It is understood that the beneficial effects of the second, third, fourth, and fifth aspects mentioned above can be found in the relevant descriptions in the first aspect above, and will not be repeated here. Attached Figure Description

[0026] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0027] Figure 1 This is a schematic diagram of the structure of a servo system provided in an embodiment of this application; Figure 2 This is a flowchart of a device control method provided in an embodiment of this application; Figure 3 This is a flowchart of a device control method provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of a device control apparatus provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0029] It should be understood that "multiple" as mentioned in this application refers to two or more. In the description of this application, unless otherwise stated, " / " indicates "or," for example, A / B can mean A or B; "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist, for example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, to facilitate a clear description of the technical solutions of this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function and effect. Those skilled in the art will understand that the terms "first," "second," etc., do not limit the quantity or execution order, and that "first," "second," etc., do not necessarily imply differences.

[0030] The terms "one embodiment" or "some embodiments" used in this application mean that one or more embodiments of this application include the specific features, structures, or characteristics described in that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this application do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. Furthermore, the terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.

[0031] Before providing a detailed explanation of the embodiments of this application, the application scenarios of these embodiments will be described first.

[0032] With the continuous development of technology, devices such as bionic robots, precision optical platforms, and XR equipment testing instruments are becoming increasingly common. These devices typically employ high-precision servo systems, in which the PID controller is responsible for driving the motor to reach the target position quickly, smoothly, and accurately. However, in practical applications, disturbances such as gear backlash, transmission nonlinearity, and sudden load changes often lead to problems such as overshoot and oscillation in the system, thereby affecting positioning accuracy and stability. In scenarios with high control precision requirements, the limitations of traditional PID control are becoming increasingly apparent.

[0033] In related technologies, two methods are typically used to improve positioning accuracy.

[0034] 1. Fixed parameter tuning optimization: During the system debugging phase, a set of fixed and optimal parameters (such as the P, I, and D gain coefficients of the PID controller) are determined through theoretical calculations, experience, or trial and error.

[0035] 2. Traditional PID control based on error feedback directly calculates the control quantity in real time according to the system error in order to reduce the error.

[0036] However, both methods have several problems. In the first method, the PID controller parameters are fixed and cannot adapt to dynamic load changes; overshoot and oscillation suppression require manual parameter tuning, which is inefficient. In both methods, synchronization errors accumulate during multi-motor coordinated control, lacking adaptive compensation for the system's nonlinear characteristics, and mechanical deviations cannot be automatically corrected after long-term use. These problems make it difficult for the system to maintain optimal performance throughout the entire motion control process (such as the large error convergence period, the small error fine-tuning period, and the stable holding period). Especially in dynamic scenarios where structural oscillations need to be suppressed and a "soft landing" needs to be achieved, its positioning accuracy is still insufficient.

[0037] Therefore, this application provides a device control method applied to a servo system. In this method, a control task is acquired, including a target position. Then, a target device is controlled to move towards the target position based on PID parameters. After the target device has moved, a first position error value between the target device's current position and the target position is acquired and added to the task context information. If the first position error value is greater than or equal to a first threshold, the PID parameters are adjusted based on the task context information, and the steps of controlling the target device to move towards the target position based on the PID parameters and subsequent steps are re-executed. By comparing the actual position with the target position, a first position error value that reflects the magnitude of the error and performance is generated. When the error exceeds the first threshold, this error is recorded as key historical data in the task context information. Then, based on this context containing historical error information, the PID parameters are adjusted specifically, and the device is driven to re-execute the movement task. This method can achieve complete automation, autonomously responding to deviations caused by mechanical wear, load changes, environmental disturbances, etc., without human intervention, thus enhancing adaptability in different environments. By continuously iterating and adjusting the PID parameters to their current optimal state, the optimal positioning accuracy is maintained throughout the entire motion control process, thereby significantly improving positioning accuracy under complex working conditions and greatly reducing the cost of later maintenance and debugging.

[0038] The servo system provided in the embodiments of this application will be described below.

[0039] For example, this servo system can be applied to bionic robots, precision optical platforms, and XR equipment testing instruments.

[0040] Figure 1 This is a schematic diagram of the servo system provided in an embodiment of this application. See also... Figure 1 The servo system 10 may include a host computer 101, a main controller 102, a servo motor 103, a gear transmission mechanism 104, and a position sensor 105.

[0041] The host computer 101 can communicate with the main controller 102 via wired or wireless connection.

[0042] The main controller 102 can communicate with the servo motor 103 and the position sensor 105 via wired or wireless connection.

[0043] The host computer 101 is used to receive or generate control tasks and send the control tasks to the main controller 102. The control tasks include target locations. For example, the host computer 101 can be a personal computer (PC), etc., and this embodiment of the application does not limit it. For example, the target locations in the control tasks can be one or more.

[0044] The main controller 102 receives control tasks sent by the host computer 101, acquires sensor data sent by the position sensor 105, and generates a control signal based on the control task and the sensor data using PID parameters, then sends the control signal to the servo motor 103. For example, the PID parameters may include a proportional parameter (i.e., proportional gain (Kp)), an integral parameter (i.e., integral gain (Ki)), and a derivative parameter (i.e., derivative gain (Kd)). Specifically, the main controller 102 determines the position error based on the target position in the control task and the current position of the controlled device (hereinafter referred to as the target device) indicated by the sensor data, and then generates a control signal based on the position error using the PID algorithm running in the PID controller. For example, the main controller 102 may be an STM32, etc., but this embodiment does not limit this.

[0045] The servo motor 103 is used to receive control signals sent by the main controller 102, and controls the motor to run based on the control signals, so as to drive the gear transmission mechanism 104 to rotate.

[0046] The gear transmission mechanism 104 is used to convert the high-speed, torque motion output by the servo motor 103 into the low-speed, high-torque motion required by the target device.

[0047] The position sensor 105 is used to measure the rotation angle and speed of the motor shaft, as well as the position of the target device, and the rotation angle. For example, the position sensor 105 may include a motor-embedded encoder and a load-side high-precision encoder. The motor-embedded encoder can be located at the tail of the motor to measure the rotation angle and speed of the motor shaft, forming an inner loop (such as a speed loop) feedback. The load-side high-precision encoder can be located at the end of the target device or transmission chain to measure the actual position of the target device, forming an outer position loop feedback. The load-side high-precision encoder can directly detect errors caused by gear backlash, transmission elastic deformation, etc., enabling the servo system 10 to correct for the final output.

[0048] In some implementations, the servo system 10 may include task context information, which is used to continuously track key state variables of the motion process corresponding to the current control task.

[0049] For example, the context information may include one or more of the following: starting position, ending position, historical error queue, integral term, stability counter value, continuous overshoot count value, oscillation count value, and adaptive gain factor. This application embodiment does not limit this. Wherein, the starting position is the current position of the target device, the ending position is the desired position, the historical error queue includes position errors generated by historical movement, the integral term is used to accumulate position errors, the stability counter value is used to count the number of times the system enters a stable state, the continuous overshoot count value is used to count the number of times the system continuously overshoots, the oscillation count value is used to count the number of times the system oscillates, and the adaptive gain factor is used to adjust the PID parameters.

[0050] After receiving the sensor data sent by the position sensor 105, the main controller 102 can determine the position error value based on the target position and the sensor data, add the position error value to the context information, and then adjust the PID parameters based on the context information if the position error value is greater than the first preset error value. Then, based on the adjusted PID parameters and the position error value, a control signal is generated to control the target device to move to the target position.

[0051] It should be noted that the embodiments in this application are only those described above. Figure 1 The servo system 10 is described using an example embodiment. In actual applications, the servo system 10 may include more components or modules than shown in the figure, and this application embodiment does not limit this.

[0052] The device control method provided in the embodiments of this application will be explained in detail below.

[0053] Figure 2 This is a flowchart illustrating a device control method provided in an embodiment of this application. For example, this method can be applied to the above... Figure 1 The servo system 10 in this embodiment. For example, the servo system 10 may run on a computer device. See also... Figure 2 The method includes the following steps: Step 201: The computer device acquires a control task, which includes the target location.

[0054] The target position is the location that needs to be reached. For example, the target position can be an attitude angle, which can include horizontal angle, vertical angle, and torsion angle.

[0055] In some implementations, the control task may include one or more target locations.

[0056] Step 202: The computer device controls the target device to move to the target position based on proportional-integral-derivative (PID) parameters.

[0057] Specifically, the computer device can obtain the current position of the target device, determine the position error based on the current position and the target position, and then calculate the control signal (such as a pulse signal) through a PID algorithm based on the position error. The control signal is used to control the motor to generate corresponding torque to drive the target device to move towards the target position.

[0058] In some implementations, before the computer device controls the target device to move to the target position based on proportional-integral-derivative (PID) parameters, the position of the target device can be added to the task context information as the starting position, and the target position can be added to the task context information as the starting position.

[0059] This starting position is the starting point for controlling the target device to move to the target location.

[0060] The task context information is used to continuously track key state variables during this motion process.

[0061] Optionally, the computer device may reset the task context information when it acquires a new control task, or reset the task context information when the target position in the control task changes.

[0062] Step 203: After the target device finishes moving, the computer device obtains the first position error value between the position of the target device and the target position, and adds the first position error value to the task context information.

[0063] The location of the target device is its current location.

[0064] The first position error value is the difference between the current position of the target device and the position it should reach (i.e., the target position). For example, the first position error value can be determined by the formula e(t) = Target - Actual, where e(t) is the first position error value, Target is the target position, and Actual is the position of the target device.

[0065] By determining the difference between the actual location of the target device and the target location it should reach, we can know the magnitude of the current position error. Adding the first position error value to the task context information can provide data for the subsequent system to perceive the system status and adjust the PID parameters.

[0066] In some implementations, step 203 may involve controlling the movement of the target device based on the start position, end position, and PID parameters in the task context information.

[0067] By updating the start and end positions in the task context information, subsequent movements of the target device towards the target location can be based directly on these start and end positions without recalculation.

[0068] In some implementations, after the computer device controls the target device to move to the target location based on PID parameters, the starting position in the task context information can be updated based on the position of the target device after the movement of the target device is completed.

[0069] Optionally, after the computer device adds the first position error value to the task context information, if the first position error value is less than the first preset error value and the control task includes only one target position, it determines that the target device has moved to the target position, so the control can be terminated.

[0070] Optionally, after the computer device adds the first position error value to the task context information, if the first position error value is less than the first preset error value and the control task includes multiple target positions, the end position in the task context information can be updated based on the next target position. Then, the steps of controlling the target device to move to the target position based on proportional-integral-derivative PID parameters and subsequent steps are re-executed until the target device moves to the last target position among the multiple target positions, and then the control ends.

[0071] Step 204: If the first position error value is greater than or equal to the first preset error value, the computer device adjusts the PID parameter based on the task context information and re-executes the step of controlling the target device to move to the target position based on the proportional-integral-derivative PID parameter and subsequent steps.

[0072] The magnitude of the first position error value reflects the motion state of the system. When the first position error value is greater than 0, a larger value indicates a greater distance between the target device's position and the target position, meaning a larger error. Conversely, a value closer to 0 indicates a smaller distance between the target device's position and the target position, meaning a smaller error. And vice versa.

[0073] The first preset error value can be set in advance. For example, when the target position is an attitude angle, the first preset error value can be set to 0°.

[0074] For example, one or more of the PID parameters Kp, Ki, Kd, ​​etc. can be adjusted, but this application embodiment does not limit this.

[0075] If the first position error value is greater than the first preset error value, it means that the error between the target device's current position and the target position has exceeded the acceptable range, that is, the target device has not yet reached the target position. Therefore, the PID parameter can be adjusted based on this context information. If the first position error value is less than or equal to the first preset error value, it means that the error between the target device's current position and the target position has not exceeded the acceptable range. It can be considered that the target device has reached the target position. Therefore, the PID parameter can be adjusted based on this context information.

[0076] By recording the position error generated by each movement as task context information, a closed-loop feedback data chain is constructed, enabling it to accurately reflect the actual control effect and dynamic characteristics of the system. Adaptive adjustment of PID parameters based on this information allows the system to continuously optimize control parameters according to the real-time motion state, thereby effectively improving the system's adaptability, stability, and overall positioning accuracy under different operating conditions.

[0077] In some implementations, step 204 may include steps (1) to (2) as follows.

[0078] Step (1): The computer device determines the motion state of the target device based on the position error value in the task context information.

[0079] The position error value in the task context information can reflect the recent motion state of the system. For example, this motion state may include one or more of the following: stable state, error state, overshoot state, oscillation state, etc., and this application embodiment does not limit this. The stable state refers to the system control effect basically meeting the target. The error state refers to the system having a positive deviation. The overshoot state indicates that the target device has moved excessively, exceeding the target position. The oscillation state refers to the system fluctuating back and forth around the target position, unable to stabilize.

[0080] By determining the motion state of the target device, a clear decision basis is provided for adjusting the PID parameters, thereby enabling the refinement of the adjustment strategy.

[0081] In some implementations, the operation of the computer device to determine the motion state of the target device based on the position error value in the task context information may include the following four cases.

[0082] The first scenario: If the absolute value of the first position error is greater than the first preset error value and less than or equal to the second preset error value, the computer device determines the motion state as a stable state.

[0083] The second preset error value can be set in advance. For example, when the target position is an attitude angle, the second preset error value can be set to 0.01.

[0084] The number of position error values ​​in the task context information can indicate the number of control attempts.

[0085] If the absolute value of the first position error is greater than the first preset error value and less than or equal to the second preset error value, it indicates that the difference between the position of the target device and the target position is small, the error magnitude is relatively stable, and it meets the characteristics of stability. Therefore, the motion state can be determined to be a stable state. If the absolute value of the first position error is greater than the second preset error value, it indicates that the difference between the position of the target device and the target position is large, and it does not meet the characteristics of a stable state. Therefore, it is uncertain whether the motion state is a stable state.

[0086] Optionally, the task context information also includes a stability count value, which the computer device increments by 1 if the motion state is stable.

[0087] This stability count is used to count the number of times the system reaches a stable state.

[0088] By statistically analyzing the stability count, we can determine the current level of system stability.

[0089] The second scenario: If the number of position error values ​​in the task context information of the computer device is greater than or equal to 2, the first position error value is greater than the second preset error value, and the second position error value in the task context information is greater than or equal to 0, then the motion state is determined to be an error state, and the second position error value is the position error value preceding the first position error value.

[0090] If the first position error value is greater than the second preset error value, and the second position error value is greater than or equal to 0, it indicates that the difference between the current position and the target position of the target device is large, and the target device does not overshoot in the control stage corresponding to the second position error value, which meets the characteristics of an error state. Therefore, the motion state can be determined to be an error state. If the first position error value is less than the second preset error value, and / or the second position error value is less than 0, it indicates that the difference between the position of the target device and the target position is small, which does not meet the characteristics of an error state. Therefore, the motion state is determined not to be an error state.

[0091] Optionally, if the number of position error values ​​in the task context information is equal to 1, and the first position error value is greater than the second preset error value, the computer device determines the motion state as an error state.

[0092] The third scenario: If the computer device determines that the motion state is an overshoot state when the first position error value is less than 0 and the absolute value of the first position error value is greater than the second preset error value.

[0093] If the first position error value is less than 0 and the absolute value of the first position error value is greater than the second preset error value, it indicates that the current position of the target device has exceeded the target position and the position error between it and the target position is large, which meets the overshoot characteristics. Therefore, the motion state can be determined to be an overshoot state. If the first position error value is greater than or equal to 0, and / or the absolute value of the first position error value is less than or equal to the second preset error value, it indicates that the overshoot state does not meet the characteristics. Therefore, the motion state can be determined to be a non-overshoot state.

[0094] Optionally, the task context information also includes a continuous overshoot count value, which the computer device increments by 1 when the motion state is in an overshoot state, and resets the continuous overshoot count value when the motion state is not in an overshoot state.

[0095] This consecutive overshoot count is used to count the number of consecutive overshoots that occur in the system.

[0096] By statistically analyzing the continuous overshoot count, we can determine the current inertia of the system, which provides a basis for adjusting the PID parameters based on this continuous overshoot count.

[0097] In some embodiments, when the computer device increments the continuous overshoot count by 1 in the case of an overshoot state, and then, if the absolute values ​​of the third position error value, the second position error value, and the first position error value in the task context information decrease, and the first and second position error values ​​have the same positive or negative attribute, the difference between the absolute values ​​of the third and second position error values ​​is divided by a first duration to obtain a first deceleration rate, and the difference between the absolute values ​​of the second and first position error values ​​is divided by a second duration to obtain a second deceleration rate. The third position error is the position error value preceding the second position error value, the second position error is the position error value preceding the first position error value, the first duration is the time interval between the acquisition time of the third position error value and the acquisition time of the second position error value, and the second duration is the time interval between the acquisition time of the second position error value and the acquisition time of the first position error value. If the product of the first deceleration rate and a preset value is less than the second deceleration rate, the continuous overshoot count is incremented by 1.

[0098] The decreasing absolute values ​​of the third position error value, the second position error value, and the first position error value in the task context information indicate that the position of the target device is gradually approaching the target position, i.e., the "error rapidly decreasing" stage.

[0099] The fact that the first position error value and the second position error value have the same positive and negative attributes means that the position of the target device does not oscillate and the target device gradually approaches the target position.

[0100] For example, the first duration and the second duration are also called control durations.

[0101] The first and second deceleration rates refer to the reduction in position error value per unit time (e.g., millimeters per second). 2 (The dimensions are not specified). The larger the first and second deceleration rates, the higher the target equipment is moving towards the target position at a higher "braking" speed. The smaller the first and second deceleration rates, the lower the target equipment is moving towards the target position at a lower speed.

[0102] The preset value can be set in advance. For example, the preset value can be set to 0.79, 0.8 or 0.81, etc., but this application embodiment does not limit it.

[0103] If the product of the first deceleration rate and the preset value is less than the second deceleration rate, it means that the current deceleration speed is greater than the previous deceleration speed. Since both the first and second deceleration rates are negative, the deceleration speed is decreasing, that is, the "brake" is softening. The system may not be able to stop at the target position and will most likely rely on inertia to cross the target point, which will result in overshoot (i.e., overshoot will occur in the next control).

[0104] The fourth scenario: If the absolute value of the first position error is greater than the second preset error value, and the positive and negative attributes of the first position error and the second position error are different, the computer device determines that the motion state is an oscillation state.

[0105] The positive or negative attribute of the position error value refers to whether the position error value is positive or negative.

[0106] If the absolute value of the first position error is greater than the second preset error value, and the positive and negative attributes of the first and second position error values ​​are different, it indicates that the first position error is large, and the control process corresponding to the first or second position error value has overshoot, which is consistent with the oscillation characteristics. Therefore, the motion state can be determined to be an oscillation state. If the absolute value of the first position error is less than or equal to the second preset error value, and / or the positive and negative attributes of the first and second position error values ​​are the same, it indicates that the motion state does not meet the characteristics of an oscillation state. Therefore, it is uncertain whether the motion state is an oscillation state.

[0107] Optionally, the task context information also includes an oscillation count value, which the computer device increments by 1 when the motion state is an oscillation state.

[0108] This oscillation count is used to count the number of times the system oscillates.

[0109] Step (2): The computer device adjusts the PID parameters based on the motion state.

[0110] Adjusting PID parameters based on different motion states allows for targeted adjustments, thereby improving the effectiveness and accuracy of parameter tuning.

[0111] In some implementations, the task context information also includes an integral term, which can be updated based on a first position error value and the motion state before the computer device adjusts the PID parameters based on the motion state. The integral term is used to accumulate the position error.

[0112] The integral term plays a different role under different motion states, so it can be updated based on the first position error value and the motion state. In this way, different strategies are selected to update the integral term based on different motion states, which can improve the accuracy of the integral term update.

[0113] For example, in a steady state, the position error is very small. The integral term acts as a fine-tuning agent, continuously accumulating the small residual error until it is driven to zero, achieving high-precision, error-free positioning. However, in an error state, the system exhibits a continuous deviation in the same direction. In this case, the integral action needs to be enhanced to accumulate the deviation more quickly, generating sufficient control force to overcome system resistance or interference. In an overshoot state, the system has already exceeded the target position, and the error sign changes. The direction of the integral term's accumulation is opposite to the direction that needs to be controlled. Therefore, in this state, the integral term needs to be strongly suppressed or even cleared to prevent it from "helping" and allowing the system to correct itself more quickly. In an oscillating state, the system swings back and forth around the target position. Excessive integral action will exacerbate the oscillation, so the integral action needs to be weakened.

[0114] Optionally, if the computer device is in a stable state during motion, it can reduce the integral term by a first ratio. The first ratio can be preset. For example, the first ratio can be set to 10%.

[0115] Optionally, if the motion state is an error state and the first position error value is moderate or small, the computer device can add the integral term to the first position error value to update the integral term; if the motion state is an error state and the first position error value is large, the integral term is not updated.

[0116] Optionally, the computer device may not update the integral term if the motion state is in an overshoot or oscillating state. In some cases, when the motion state is in an oscillating state, the upper limit of the integral term (also known as the amplitude limit) may be reduced to a second proportion. The second proportion may be preset. For example, the second proportion may be set to 30%.

[0117] In some implementations, the computer device's adjustment of the PID parameters based on the motion state and the integral term can include the following four cases.

[0118] The first scenario: When the motion state is in a stable state, the computer device adjusts the PID parameters based on the stable count value and the integral term.

[0119] For example, this stability count (such as stable_count) can be counted using a stability counter. This stability counter is used to quantify and confirm that the system has reached a stable state. The smaller the stability count, the larger the recent error in the system and the worse the control performance; the larger the stability count, the smaller the recent error in the system and the better the control performance.

[0120] Optionally, based on the stable count value, the computer device can obtain the corresponding first coefficient and second coefficient from the first correspondence; multiply the first coefficient by the first proportional parameter to obtain the second proportional parameter; multiply the second coefficient by the first differential parameter to obtain the second differential parameter; and update the integral term of the PID controller with the integral term.

[0121] The first proportional parameter is the proportional parameter in the PID parameters before adjustment. The second proportional parameter is the proportional parameter in the PID parameters after adjustment.

[0122] The first derivative parameter is the derivative parameter in the PID parameters before adjustment. The second derivative parameter is the derivative parameter in the PID parameters after adjustment.

[0123] The first correspondence can be preset. The first correspondence is the relationship between the stable count value and the first coefficient and the second coefficient.

[0124] For example, when the stable count value is greater than or equal to 1 and less than or equal to 6, the first coefficient in the first correspondence is 1 and the second coefficient is 1; when the stable count value is greater than 6, the first coefficient in the first correspondence is 1 and the second coefficient is 1.01.

[0125] In some implementations, the task context information also includes an adaptive gain factor. The operation of adjusting the PID parameters based on the stable count value and the integral term can be as follows: adjusting the proportional, integral, and derivative parameters in the PID parameters based on the stable count value and the integral term; increasing the adaptive gain factor by a first factor if the stable count value is greater than or equal to a first pre-designed value; and adjusting the proportional and derivative parameters in the PID parameters based on the adaptive gain factor.

[0126] The first pre-design value can be preset. For example, the first pre-design value can be 6.

[0127] The first multiplier can be preset. For example, the first multiplier can be set to 1.01.

[0128] For example, the initial and maximum values ​​of the adaptive gain factor are 1.

[0129] For example, the adaptive gain factor can be multiplied by the proportional and derivative parameters in the PID parameters, and then the updated value can be set as the PID parameter.

[0130] By sensing its own operating status through this stable count value, the system can slowly recover its gain after a long period of stability, enabling the system to learn and adapt.

[0131] The second scenario: When the motion state is in the error state, the computer device adjusts the PID parameters based on the first position error value and the integral term.

[0132] The magnitude of the first position error value can reflect the magnitude of the position error.

[0133] Optionally, based on the first position error value, the computer device can obtain the corresponding third, fourth, and fifth coefficients from the second correspondence; multiply the third coefficient by the first proportional parameter to obtain the second proportional parameter; multiply the fourth coefficient by the first differential parameter to obtain the second differential parameter; multiply the fifth coefficient by the first integral parameter to obtain the second integral parameter; and update the integral term of the PID controller with the integral term.

[0134] The first integral parameter is the integral parameter in the PID parameters before adjustment. The second integral parameter is the integral parameter in the PID parameters after adjustment.

[0135] The second correspondence can be preset.

[0136] For example, when the first position error value is greater than 0 and less than or equal to 0.005, the third coefficient in the second correspondence is 0.005, the fourth coefficient is 10.0, and the fifth coefficient is 0.00005; when the first position error value is greater than 0.005 and less than or equal to 0.02, the third coefficient in the second correspondence is 0.02, the fourth coefficient is 5.0, and the fifth coefficient is 0.0005; when the first position error value is greater than 0.01 and less than or equal to 0.02, the third coefficient in the second correspondence is 0.1, the fourth coefficient is 2.0, and the fifth coefficient is 0.001; when the first position error value is greater than 0.7, the third coefficient in the second correspondence is 2, the fourth coefficient is 0.2, and the fifth coefficient is 0.0001.

[0137] The third scenario: When the computer device is in the overshoot state during the motion, it adjusts the PID parameters based on the continuous overshoot count value and the integral term.

[0138] The continuous overshoot count is the number of consecutive overshoots recorded. The magnitude of this continuous overshoot count reflects the system's inertia. A larger continuous overshoot count indicates greater system inertia and a tendency to repeatedly exceed the target position; a smaller continuous overshoot count indicates less system inertia.

[0139] Optionally, based on the continuous overshoot count value, the computer device can obtain the corresponding sixth and seventh coefficients from the third correspondence; multiply the sixth coefficient by the first proportional parameter to obtain the second proportional parameter; multiply the seventh coefficient by the first differential parameter to obtain the second differential parameter; and update the integral term of the PID controller to the integral term.

[0140] The third correspondence can be preset.

[0141] For example, when the continuous overshoot count value is greater than or equal to 1 and less than or equal to 2, the sixth coefficient in the third correspondence is 0.3 and the seventh coefficient is 0.1; when the continuous overshoot count value is greater than 2, the sixth coefficient in the third correspondence is 0.5 and the seventh coefficient is 0.1.

[0142] In some implementations, the task context information also includes an adaptive gain factor. The operation of the computer device adjusting the PID parameters based on the continuous overshoot count value and the integral term can be as follows: adjusting the proportional, derivative, and integral parameters in the PID controller based on the continuous overshoot count value and the integral term; reducing the adaptive gain factor by a second factor if the continuous overshoot count value is greater than or equal to a second pre-designed value; and adjusting the proportional and derivative parameters in the PID controller based on the adaptive gain factor.

[0143] The second pre-design value can be preset. For example, the second pre-design value can be set to 2, 3 or 4, etc., but this application embodiment does not limit this.

[0144] The second multiplier can be preset. For example, the second multiplier can be set to 0.89, 0.9 or 0.91, etc., but this application embodiment does not limit this.

[0145] For example, the computer device can multiply the proportional and derivative parameters in the PID controller by the adaptive gain factor, and then update the proportional and derivative parameters in the PID controller accordingly.

[0146] By reducing the adaptive gain factor and then adjusting the proportional and derivative parameters in the PID controller accordingly, the system gain can be quickly reduced, effectively preventing overshoot and prompting the system to return to stability rapidly. This improves the system's ability to handle overshoot and enhances positioning accuracy.

[0147] The fourth scenario: When the motion state is in the oscillation state, the computer device adjusts the PID parameter based on the oscillation count value and the integral term.

[0148] The oscillation count value is a statistical measure of the number of times the system has oscillated during this control task. The magnitude of this oscillation count value reflects the system stability. A larger oscillation count value indicates poorer system stability, with the system oscillating back and forth around the target position and unable to converge quickly; a smaller oscillation count value indicates better system stability.

[0149] Optionally, based on the oscillation count value, the computer device can obtain the corresponding eighth and ninth coefficients from the fourth correspondence; multiply the eighth coefficient by the first proportional parameter to obtain the second proportional parameter; multiply the ninth coefficient by the first differential parameter to obtain the second differential parameter; and update the integral term of the PID controller with the integral term.

[0150] The fourth correspondence can be preset.

[0151] For example, when the oscillation count value is greater than or equal to 1 and less than or equal to 2, the eighth coefficient in the fourth correspondence is 0.3 and the ninth coefficient is 0.1; when the oscillation count value is greater than 2, the eighth coefficient in the fourth correspondence is 0.5 and the ninth coefficient is 0.1.

[0152] In some implementations, the task context information also includes an adaptive gain factor. The operation of the computer device adjusting the PID parameters based on the oscillation count value and the integral term can be as follows: adjusting the proportional, derivative, and integral parameters in the PID controller based on the oscillation count value and the integral term; reducing the adaptive gain factor by a third factor if the oscillation count value is greater than or equal to a third pre-designed value; and adjusting the proportional and derivative parameters in the PID controller based on the adaptive gain factor.

[0153] The third pre-design value can be preset. For example, the third pre-design value can be set to 2, 3 or 4, etc., but this application embodiment does not limit this.

[0154] The third multiple can be preset. For example, the third multiple can be set to 0.89, 0.9 or 0.91, etc., but this application embodiment does not limit this.

[0155] For example, the computer device can multiply the proportional and derivative parameters in the PID controller by the adaptive gain factor, and then update the proportional and derivative parameters in the PID controller accordingly.

[0156] By reducing the adaptive gain factor and then adjusting the proportional and derivative parameters in the PID controller accordingly, the system gain can be quickly reduced, effectively preventing oscillations and prompting the system to return to stability rapidly. This improves the system's ability to handle oscillations and enhances positioning accuracy.

[0157] In some implementations, after the computer device adjusts the PID parameters based on the task context information, if the number of position error values ​​in the task context information is greater than or equal to 2, and if the absolute value of the first position error value is less than the absolute value of the second position error value in the task context information, and the first and second position error values ​​have the same positive or negative attribute, then the difference between the absolute value of the second position error value and the absolute value of the first position error value is divided by a second duration to obtain a second deceleration rate. The second position error value is the previous position error value of the first position error value, and the second duration is the time interval between the acquisition time of the second position error value and the acquisition time of the first position error value. If the second deceleration rate is greater than or equal to a preset deceleration rate, a dynamic attenuation factor is determined based on the second deceleration rate.

[0158] The absolute value of the first position error is less than the absolute value of the second position error, indicating that the position error is decreasing between the second and first position errors, meaning that the controlled equipment is getting closer and closer to the target position.

[0159] The fact that the first position error value and the second position error value have the same positive and negative attributes means that the system has not overshooted again after overshooting occurred.

[0160] The preset deceleration rate is the lowest acceptable standard for the rate at which the absolute value of the system position error decreases. The preset deceleration rate can be preset. For example, the preset deceleration rate can be set to 1.9, 2.0, or 2.1, etc., but this application embodiment does not limit this.

[0161] The dynamic attenuation factor is used to moderately attenuate the deceleration process when the ability to detect deceleration is low, thereby enhancing the deceleration effect and preventing overshoot. For example, the minimum value of this dynamic attenuation factor is 0.1 to prevent the output from being completely cut off, causing the system to stall.

[0162] If the second deceleration rate is greater than or equal to the preset deceleration rate, it indicates that the current deceleration rate of the system is too high and the kinetic energy is too large. If it is not limited, the next control is very likely to overshoot. Therefore, the dynamic attenuation factor can be determined based on the second deceleration rate. If the second deceleration rate is less than the preset deceleration rate, it indicates that the current deceleration rate of the system is normal and the kinetic energy is normal. The probability of overshoot in the next control is low. Therefore, there is no need to limit it and there is no need to determine the dynamic attenuation factor based on the second deceleration rate.

[0163] By introducing a deceleration rate detection mechanism, the speed trend of position error changes can be predicted in advance, and the probability of overshoot can be judged in advance. In the case of a high probability of overshoot, a dynamic attenuation factor is determined based on the second deceleration rate, providing data basis for subsequent early intervention to avoid overshoot. This can significantly improve positioning accuracy and stability.

[0164] In some implementations, the operation of the computer device to determine the dynamic attenuation factor based on the second deceleration rate can be: dividing the second deceleration rate by a preset value to obtain the dynamic attenuation factor.

[0165] The preset value can be set in advance. For example, the preset value can be set to 10. For example, when the second deceleration rate is 10, the dynamic attenuation factor is 1; when the second deceleration rate is 5, the dynamic attenuation factor is 0.5, that is, the control output will be attenuated to half of its original value.

[0166] In this way, when the second deceleration rate is large, the system kinetic energy can be reduced by a large proportion, while when the second deceleration rate is small, the system kinetic energy will not be reduced too much and the system will stop.

[0167] In some implementations, after adjusting the PID parameter, the operation of the computer device controlling the target device to move to the target position based on the PID parameter can be as follows: determining a first movement parameter based on the position of the target device, the target position, and the PID parameter; determining a second movement parameter based on the first movement parameter and the dynamic attenuation factor; and controlling the target device to move based on the second movement parameter.

[0168] The first movement parameter is a parameter for controlling the motor determined based on the position of the target device, the target position, and the PID parameter. For example, the first control parameter may include one or more of torque, speed difference, PWM pulse width, etc., and this embodiment of the application does not limit this. For example, the target speed can be determined first based on the position of the target device, the target position, and the PID parameter; then, the current speed of the motor shaft can be obtained through the motor's built-in encoder; and finally, the target speed can be subtracted from the current speed to obtain the speed difference.

[0169] By using a dynamic attenuation factor that reflects the real-time dynamic trend of the system, the first movement parameter can be proactively corrected in advance, achieving pre-compensation of control commands. Before the system may overshoot or oscillate due to inertia, the control "force" is weakened in advance, effectively suppressing overshoot. This allows the entire motion control process, especially during the deceleration phase approaching the target position, to reach the target position more smoothly and accurately. Thus, system stability and positioning accuracy are improved.

[0170] In some implementations, the computer device determines the second movement parameter based on the first movement parameter and the dynamic decay factor in three ways.

[0171] The first method is as follows: The computer device multiplies the first movement parameter by the dynamic attenuation factor to obtain the second movement parameter; if the first position error value is greater than the third preset error value, the first position error value is multiplied by the first preset value to obtain the third movement parameter; if the second movement parameter is greater than the third movement parameter, the second movement parameter is updated to the third movement parameter.

[0172] The third preset error value can be set in advance. For example, the third preset error value can be set to 1, 2 or 3, etc., but this embodiment does not limit it.

[0173] The first preset value can be set in advance. The first preset value is greater than 0 and less than 1. For example, the first preset value can be set to 0.2.

[0174] If the first position error value is greater than the third preset error value, it indicates that the current system position error is large. Providing a large output may cause the system to respond violently, so the second movement parameter can be limited.

[0175] If the second movement parameter is greater than the third movement parameter, it indicates that the kinetic energy corresponding to the second movement parameter is still relatively large. Therefore, the second movement parameter can be updated to the third movement parameter to further limit its magnitude. In this way, when far from the target position, a larger output can be provided to quickly approach the target position without being too large and causing a violent system response.

[0176] Optionally, if the third shift parameter is greater than the fourth preset value, the third shift parameter can be set to the fourth preset value to further limit the movement. For example, the fourth preset value can be 0.7.

[0177] The second method is as follows: The computer device multiplies the first movement parameter by the dynamic attenuation factor to obtain the second movement parameter; if the first position error value is greater than the fourth preset error value and less than or equal to the third preset error value, the first position error value is multiplied by the second preset value to obtain the fourth movement parameter; if the second movement parameter is greater than the fourth movement parameter, the second movement parameter is updated to the third movement parameter.

[0178] The fourth preset error value can be set in advance. For example, the fourth preset error value can be set to 0.7.

[0179] The second preset value is greater than the first preset value. The second preset value can be set in advance. For example, the second preset value can be set to 0.4.

[0180] If the first position error value is greater than the fourth preset error value and less than or equal to the third preset error value, it indicates that the current system position error is moderate. If a large output is provided, it may cause system oscillation. Therefore, the second movement parameter can be limited.

[0181] If the second shift parameter is greater than the fourth shift parameter, it means that the kinetic energy corresponding to the second shift parameter is still relatively large. Therefore, the second shift parameter can be updated to the fourth shift parameter to further limit its magnitude. In this way, at medium distances, the gain can be increased to maintain a faster response speed.

[0182] Optionally, if the fourth moving parameter is greater than the fourth preset value, the fourth moving parameter can be set to the fourth preset value to further restrict it.

[0183] The third method: The computer device multiplies the first movement parameter by the dynamic attenuation factor to obtain the second movement parameter; if the first position error value is less than or equal to the fourth preset error value, the first position error value is multiplied by the third preset value to obtain the fifth movement parameter; if the second movement parameter is greater than the fifth movement parameter, the second movement parameter is updated to the fifth movement parameter.

[0184] The third preset value can be set in advance. For example, the third preset value can be set to 0.6.

[0185] In this way, even with a small error, the system has sufficient control force to overcome resistance such as static friction by increasing the relative gain (percentage) as it approaches the target position, preventing it from stalling before the target point. Meanwhile, since the error itself is already very small, the actually calculated output value will not be large, ensuring smooth convergence.

[0186] Optionally, if the fifth moving parameter is greater than the fourth preset value, the fifth moving parameter can be set to the fourth preset value to further restrict it.

[0187] To facilitate understanding, the following will be combined with... Figure 3 The device control method provided in the embodiments of this application will be described by way of example.

[0188] Figure 3 This is a flowchart of a device control method provided in an embodiment of this application. Figure 3 As shown, the device control method may include the following steps 301 to 311.

[0189] Step 301: The computer device obtains the target location and the actual location of the target device.

[0190] Step 302: The computer device determines whether the target location is a new trajectory.

[0191] If the target location is a new trajectory, proceed to step 303; otherwise, proceed to step 304.

[0192] Step 303: The computer device updates the task context information.

[0193] Step 304: The computer device calculates the PID output.

[0194] After calculating the PID output, the computer device can control the target device accordingly and then acquire position sensor data.

[0195] Step 305: The computer device updates the task context information.

[0196] For example, the computer device can update the start position, end position, etc. in the task context information based on the acquired location sensing data and target position.

[0197] Step 306: The computer device performs a status check based on the task context information to determine whether one of the following occurs: stable, error, overshoot, or oscillation.

[0198] If the computer device detects one of the following: stability, error, overshoot, or oscillation, it executes step 307; otherwise, it executes step 311.

[0199] Step 307: The computer device updates the PID parameter based on the task context information.

[0200] Step 308: The computer device calculates the PID output based on the task context information.

[0201] Step 309: The computer device performs predictive braking processing on the PID data.

[0202] Step 310: The computer device outputs a compensation command and updates the status.

[0203] Step 311: The computer device determines whether the accuracy requirements have been met.

[0204] If the computer device determines that the accuracy requirement has been met, it proceeds to step 302; otherwise, it proceeds to step 301.

[0205] Step 312: The computer device control is complete.

[0206] In this embodiment, the computer device acquires a control task, which includes a target position. The target device is controlled to move towards the target position based on PID parameters. After the target device has moved, a first position error value between the target device's current position and the target position is acquired and added to the task context information. If the first position error value is greater than or equal to a first threshold, the PID parameters are adjusted based on the task context information, and the steps of controlling the target device to move towards the target position based on the PID parameters and subsequent steps are re-executed. By comparing the actual position with the target position, a first position error value that reflects the magnitude of the error and performance is generated. When the error exceeds the first threshold, this error is recorded as key historical data in the task context information. Then, based on this context containing historical error information, the PID parameters are adjusted specifically, and the device is driven to re-execute the movement task. This method can achieve complete automation, autonomously responding to deviations caused by mechanical wear, load changes, environmental disturbances, etc., without human intervention, thus enhancing adaptability in different environments. By continuously iterating and adjusting the PID parameters to their current optimal state, the optimal positioning accuracy is maintained throughout the entire motion control process, thereby significantly improving positioning accuracy under complex working conditions and greatly reducing the cost of later maintenance and debugging.

[0207] Figure 4 This is a schematic diagram of a device control apparatus provided in an embodiment of this application. The apparatus can be implemented as part or all of a computer device by software, hardware, or a combination of both. This computer device can be described below. Figure 5 The computer equipment shown. See also Figure 4 The device includes: a first acquisition module 401, a control module 402, a second acquisition module 403, and an adjustment module 404.

[0208] The first acquisition module 401 is used to acquire the control task, which includes the target location; Control module 402 is used to control the target device to move towards the target position based on proportional-integral-derivative (PID) parameters; The second acquisition module 403 is used to acquire a first position error value between the position of the target device and the target position after the target device has finished moving, and add the first position error value to the task context information; The adjustment module 404 is used to adjust the PID parameters based on the task context information when the first position error value is greater than or equal to the first preset error value, and to re-execute the step of controlling the target device to move to the target position based on the proportional-integral-derivative PID parameters and subsequent steps.

[0209] Optionally, the device further includes: The add module is used to add the location of the target device as the starting position to the task context information and add the target location as the ending position to the task context information. Optionally, the first acquisition module 401 is used for: The target device is moved based on the start and end positions in the task context information and the PID parameters.

[0210] Optionally, the device further includes: The first update module is used to update the starting position in the task context information based on the location of the target device after the target device has finished moving.

[0211] Optionally, the device further includes: The second update module is used to update the end position in the task context information based on the next target position when the first position error value is less than the first preset error value, and to re-execute the step of moving the target device to the target position based on the proportional-integral-derivative PID parameter control and subsequent steps.

[0212] Optionally, the adjustment module 404 is used for: The motion state of the target device is determined based on the position error value in the task context information. The PID parameters are adjusted based on the motion state.

[0213] Optionally, the adjustment module 404 is used for: If the absolute value of the first position error is greater than the first preset error value and less than or equal to the second preset error value, the motion state is determined to be a stable state; or, If the number of position error values ​​in the task context information is greater than or equal to 2, the first position error value is greater than the second preset error value, and the second position error value in the task context information is greater than or equal to 0, then the motion state is determined to be an error state, and the second position error value is the position error value preceding the first position error value; or... If the first position error value is less than 0 and the absolute value of the first position error value is greater than the second preset error value, the motion state is determined to be an overshoot state; or, If the absolute value of the first position error is greater than the second preset error value, and the positive and negative attributes of the first position error and the second position error are different, the motion state is determined to be an oscillation state.

[0214] Optionally, the integral term is used to accumulate position errors, and the device further includes: The third update module is used to update the integral term based on the first position error value and the motion state.

[0215] Optionally, the adjustment module 404 is used for: The PID parameters are adjusted based on the motion state and the integral term.

[0216] Optionally, the task context information also includes a stable count value, and the device further includes: The first accumulation module is used to increment the stable count value by 1 when the motion state is stable.

[0217] Optionally, the adjustment module 404 is used for: When the motion state is in a stable state, the PID parameters are adjusted based on the stable count value and the integral term.

[0218] Optionally, the task context information also includes an adaptive gain factor, which the adjustment module 404 uses to: Adjust the proportional, integral, and derivative parameters in the PID based on the stable count value and the integral term; If the stable count value is greater than or equal to the first pre-designed value, the adaptive gain factor is increased by a first factor. The proportional and derivative parameters in the PID are adjusted based on this adaptive gain factor.

[0219] Optionally, the adjustment module 404 is used for: When the motion state is in the error state, the PID parameters are adjusted based on the first position error value and the integral term.

[0220] Optionally, the task context information also includes a continuous overshoot count value, and the device further includes: The second accumulation module is used to increment the continuous overshoot count value by 1 when the motion state is in an overshoot state, and to reset the continuous overshoot count value when the motion state is not in an overshoot state.

[0221] Optionally, the adjustment module 404 is used for: When the motion state is in the overshoot state, the PID parameters are adjusted based on the continuous overshoot count value and the integral term.

[0222] Optionally, the device further includes: The first calculation module is used to calculate the first deceleration rate by dividing the difference between the absolute value of the third position error and the absolute value of the second position error by a first duration when the absolute values ​​of the third position error, the second position error, and the first position error in the task context information decrease and the first position error and the second position error have the same positive or negative attribute. The module also calculates the second deceleration rate by dividing the difference between the absolute value of the second position error and the absolute value of the first position error by a second duration. The third position error is the position error value preceding the second position error, the second position error is the position error value preceding the first position error, the first duration is the time interval between the acquisition time of the third position error and the acquisition time of the second position error, and the second duration is the time interval between the acquisition time of the second position error and the acquisition time of the first position error. The third accumulation module is used to increment the continuous overshoot count value by 1 if the product of the first deceleration rate and the preset value is less than the second deceleration rate.

[0223] Optionally, the task context information also includes an adaptive gain factor, which the adjustment module 404 uses to: Adjust the proportional, derivative, and integral parameters in the PID controller based on the continuous overshoot count value and the integral term. If the continuous overshoot count value is greater than or equal to the second pre-designed value, the adaptive gain factor is reduced by a second factor. Based on this adaptive gain factor, the proportional and derivative parameters in the PID controller are adjusted.

[0224] Optionally, the task context information also includes an oscillation count value, and the device further includes: The fourth accumulation module is used to increment the oscillation count value by 1 when the motion state is an oscillation state.

[0225] Optionally, the adjustment module 404 is used for: When the motion state is in the oscillation state, the PID parameter is adjusted based on the oscillation count value and the integral term.

[0226] Optionally, the task context information also includes an adaptive gain factor, which the adjustment module 404 uses to: Adjust the proportional, derivative, and integral parameters in the PID controller based on the oscillation count value and the integral term. If the oscillation count value is greater than or equal to the third pre-designed value, the adaptive gain factor is reduced by a third factor. Based on this adaptive gain factor, the proportional and derivative parameters in the PID controller are adjusted.

[0227] Optionally, the device further includes: The second calculation module is used to, when the number of position error values ​​in the task context information is greater than or equal to 2, if the absolute value of the first position error value is less than the absolute value of the second position error value in the task context information, and the positive and negative attributes of the first and second position error values ​​are the same, divide the difference between the absolute value of the second position error value and the absolute value of the first position error value by a second duration to obtain a second deceleration rate. The second position error value is the position error value preceding the first position error value, and the second duration is the time interval between the acquisition time of the second position error value and the acquisition time of the first position error value. If the second deceleration rate is greater than or equal to a preset deceleration rate, determine a dynamic attenuation factor based on the second deceleration rate.

[0228] Optionally, the adjustment module 404 is used for: The first movement parameter is determined based on the location of the target device, the target location, and the PID parameter; the second movement parameter is determined based on the first movement parameter and the dynamic attenuation factor; and the movement of the target device is controlled based on the second movement parameter.

[0229] Optionally, the adjustment module 404 is used for: Multiply the first shift parameter by the dynamic attenuation factor to obtain the second shift parameter; If the first position error value is greater than the third preset error value, the first position error value is multiplied by the first preset value to obtain the third movement parameter; If the second shift parameter is greater than the third shift parameter, then the second shift parameter is updated to the third shift parameter.

[0230] In this embodiment, a control task is acquired, which includes a target position. A target device is controlled to move towards the target position based on PID parameters. After the target device has moved, a first position error value between the target device's current position and the target position is acquired and added to the task context information. If the first position error value is greater than or equal to a first threshold, the PID parameters are adjusted based on the task context information, and the steps of controlling the target device to move towards the target position based on the PID parameters and subsequent steps are re-executed. By comparing the actual position with the target position, a first position error value that reflects the magnitude of the error and performance is generated. When the error exceeds the first threshold, this error is recorded as key historical data in the task context information. Then, based on this context containing historical error information, the PID parameters are adjusted specifically, and the device is driven to re-execute the movement task. This method can achieve complete automation, autonomously responding to deviations caused by mechanical wear, load changes, environmental disturbances, etc., without human intervention, thus enhancing adaptability in different environments. By continuously iterating and adjusting the PID parameters to their current optimal state, the optimal positioning accuracy is maintained throughout the entire motion control process, thereby significantly improving positioning accuracy under complex working conditions and greatly reducing the cost of later maintenance and debugging.

[0231] It should be noted that the device control device provided in the above embodiments is only illustrated by the division of the above functional modules when controlling the device. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0232] The functional modules in the above embodiments can be integrated into one processing unit, or each functional module can exist as a separate physical processing unit, or two or more functional modules can be integrated into one processing unit. The processing unit can be implemented in hardware or software. Furthermore, the specific names of the functional modules are only for easy differentiation and are not intended to limit the scope of protection of the embodiments of this application.

[0233] The device control apparatus and device control method embodiments provided in the above embodiments belong to the same concept. The specific working process and technical effects of the functional modules in the above embodiments can be found in the method embodiment section, and will not be repeated here.

[0234] Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 5As shown, the computer device 5 includes: a processor 50, a memory 51, and a computer program 52 stored in the memory 51 and executable on the processor 50. When the processor 50 executes the computer program 52, it implements the steps in the device control method in the above embodiments.

[0235] Computer device 5 can be a general-purpose computer device or a special-purpose computer device. In specific implementations, computer device 5 can be a desktop computer, portable computer, network server, handheld computer, mobile phone, tablet computer, wireless terminal device, communication device, or embedded device. This application embodiment does not limit the type of computer device 5. Those skilled in the art will understand that... Figure 5 The computer device 5 is merely an example and does not constitute a limitation on the computer device 5. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0236] Processor 50 can be a Central Processing Unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0237] In some embodiments, memory 51 may be an internal storage unit of the computer device 5, such as a hard disk or memory of the computer device 5. In other embodiments, memory 51 may be an external storage device of the computer device 5, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD) card, flash card, etc., provided on the computer device 5. Furthermore, memory 51 may include both internal storage units and external storage devices of the computer device 5. Memory 51 is used to store the operating system, applications, boot loader, data, and other programs. Memory 51 may also be used to temporarily store data that has been output or will be output.

[0238] This application also provides a computer device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor executes the computer program to implement the steps in any of the above method embodiments.

[0239] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can implement the steps in the various method embodiments described above.

[0240] This application provides a computer program product that, when run on a computer, causes the computer to perform the steps described in the various method embodiments above.

[0241] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above method embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate form. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a photographing device / terminal device, a recording medium, a computer memory, ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM (Compact Disc Read-Only Memory), magnetic tape, floppy disk, and optical data storage devices. The computer-readable storage medium mentioned in this application can be a non-volatile storage medium; in other words, it can be a non-transient storage medium.

[0242] It should be understood that all or part of the steps of the above embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented in whole or in part as a computer program product. The computer program product includes one or more computer instructions. The computer instructions can be stored in the above-described computer-readable storage medium.

[0243] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0244] Those skilled in the art will 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, or a combination of computer software and electronic hardware. 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 implementation should not be considered beyond the scope of this application.

[0245] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0246] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0247] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0248] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A device control method, characterized in that, Applied to a servo system, the method includes: Acquire a control task, the control task including a target location; The target device is moved to the target position based on proportional-integral-derivative (PID) parameters. After the target device finishes moving, a first position error value between the position of the target device and the target position is obtained, and the first position error value is added to the task context information; If the first position error value is greater than or equal to the first preset error value, the PID parameters are adjusted based on the task context information, and the steps of controlling the target device to move to the target position based on the proportional-integral-derivative PID parameters and subsequent steps are re-executed.

2. The method as described in claim 1, characterized in that, Before the target device moves to the target position using proportional-integral-derivative (PID) parameter control, the method further includes: adding the position of the target device as the starting position to the task context information, and adding the target position as the ending position to the task context information. The method of controlling the target device to move to the target position based on proportional-integral-derivative (PID) parameters includes: controlling the target device to move based on the start position, end position and PID parameters in the task context information; After the target device moves to the target position using proportional-integral-derivative (PID) parameters, the method further includes: updating the starting position in the task context information based on the position of the target device after the movement of the target device is completed.

3. The method as described in claim 2, characterized in that, The control task includes one or more target locations, and after adding the first location error value to the task context information, it further includes: If the first position error value is less than the first preset error value, the end position in the task context information is updated based on the next target position, and the step of controlling the target device to move to the target position based on proportional-integral-derivative PID parameters and subsequent steps are re-executed.

4. The method as described in claim 1, characterized in that, Adjusting the PID parameters based on the task context information includes: The motion state of the target device is determined based on the position error value in the task context information; The PID parameters are adjusted based on the motion state.

5. The method as described in claim 4, characterized in that, Determining the motion state of the target device based on the position error value in the task context information includes: If the absolute value of the first position error is greater than the first preset error value and less than or equal to the second preset error value, the motion state is determined to be a stable state; or... If the number of position error values ​​in the task context information is greater than or equal to 2, the first position error value is greater than the second preset error value, and the second position error value in the task context information is greater than or equal to 0, then the motion state is determined to be an error state, and the second position error value is the position error value preceding the first position error value; or... If the first position error value is less than 0 and the absolute value of the first position error value is greater than the second preset error value, the motion state is determined to be an overshoot state; or... If the absolute value of the first position error value is greater than the second preset error value, and the positive and negative attributes of the first position error value and the second position error value are different, the motion state is determined to be an oscillation state.

6. The method as described in claim 4, characterized in that, The task context information also includes an integral term, which is used to accumulate position error. Before adjusting the PID parameters based on the motion state, the method further includes: updating the integral term based on the first position error value and the motion state. The step of adjusting the PID parameters based on the motion state includes: adjusting the PID parameters based on the motion state and the integral term.

7. The method as described in claim 6, characterized in that, The task context information also includes a stability count value. Before adjusting the PID parameters based on the motion state and the integral term, the method further includes: incrementing the stability count value by 1 when the motion state is stable. The step of adjusting the PID parameters based on the motion state and the integral term includes: when the motion state is the stable state, adjusting the PID parameters based on the stable count value and the integral term.

8. The method as described in claim 7, characterized in that, The task context information also includes an adaptive gain factor, and adjusting the PID parameters based on the stable count value and the integral term includes: Adjust the proportional, integral, and derivative parameters in the PID parameters based on the stable count value and the integral term; If the stable count value is greater than or equal to the first pre-designed value, the adaptive gain factor is increased by a first factor. The proportional and derivative parameters in the PID parameters are adjusted based on the adaptive gain factor.

9. The method as described in claim 6, characterized in that, The adjustment of the PID parameters based on the motion state and the integral term includes: When the motion state is the error state, the PID parameters are adjusted based on the first position error value and the integral term.

10. The method as described in claim 6, characterized in that, The task context information also includes a continuous overshoot count value. Before adjusting the PID parameters based on the motion state and the integral term, the method further includes: incrementing the continuous overshoot count value by 1 when the motion state is in an overshoot state, and resetting the continuous overshoot count value when the motion state is not in an overshoot state. The step of adjusting the PID parameters based on the motion state and the integral term includes: when the motion state is the overshoot state, adjusting the PID parameters based on the continuous overshoot count value and the integral term.

11. The method as described in claim 10, characterized in that, After incrementing the continuous overshoot count value by 1 when the motion state is in an overshoot state, the method further includes: When the absolute values ​​of the third position error value, the second position error value, and the first position error value in the task context information decrease, and the positive and negative attributes of the first position error value and the second position error value are the same, the difference between the absolute value of the third position error value and the absolute value of the second position error value is divided by a first duration to obtain a first deceleration rate. The difference between the absolute value of the second position error value and the absolute value of the first position error value is divided by a second duration to obtain a second deceleration rate. The third position error value is the previous position error value of the second position error value, the second position error value is the previous position error value of the first position error value, the first duration is the time interval between the acquisition time of the third position error value and the acquisition time of the second position error value, and the second duration is the time interval between the acquisition time of the second position error value and the acquisition time of the first position error value. If the product of the first deceleration rate and the preset value is less than the second deceleration rate, the continuous overshoot count value is incremented by 1.

12. The method as described in claim 10, characterized in that, The task context information also includes an adaptive gain factor, and adjusting the PID parameters based on the continuous overshoot count value and the integral term includes: The proportional, derivative, and integral parameters in the PID controller are adjusted based on the continuous overshoot count value and the integral term. If the continuous overshoot count value is greater than or equal to the second pre-designed value, the adaptive gain factor is reduced by a second factor. Based on the adaptive gain factor, the proportional and derivative parameters in the PID controller are adjusted.

13. The method as described in claim 6, characterized in that, The task context information also includes an oscillation count value. Before adjusting the PID parameters based on the motion state and the integral term, the method further includes: incrementing the oscillation count value by 1 when the motion state is an oscillation state. The step of adjusting the PID parameters based on the motion state and the integral term includes: when the motion state is the oscillation state, adjusting the PID parameters based on the oscillation count value and the integral term.

14. The method as described in claim 13, characterized in that, The task context information also includes an adaptive gain factor, and adjusting the PID parameters based on the oscillation count value and the integral term includes: The proportional, derivative, and integral parameters in the PID controller are adjusted based on the oscillation count value and the integral term. If the oscillation count value is greater than or equal to the third pre-designed value, the adaptive gain factor is reduced by a third factor. Based on the adaptive gain factor, the proportional and derivative parameters in the PID controller are adjusted.

15. The method according to any one of claims 1 to 14, characterized in that, After adjusting the PID parameters based on the task context information, the method further includes: if the number of position error values ​​in the task context information is greater than or equal to 2, and if the absolute value of the first position error value is less than the absolute value of the second position error value in the task context information, and the first position error value and the second position error value have the same positive or negative attribute, then the difference between the absolute value of the second position error value and the absolute value of the first position error value is divided by a second duration to obtain a second deceleration rate, where the second position error value is the previous position error value of the first position error value, and the second duration is the time interval between the acquisition time of the second position error value and the acquisition time of the first position error value; if the second deceleration rate is greater than or equal to a preset deceleration rate, a dynamic attenuation factor is determined based on the second deceleration rate; The method of controlling the target device to move to the target position based on proportional-integral-derivative (PID) parameters includes: determining a first movement parameter based on the position of the target device, the target position, and the PID parameters; determining a second movement parameter based on the first movement parameter and the dynamic attenuation factor; and controlling the movement of the target device based on the second movement parameter.

16. The method as described in claim 15, characterized in that, The step of determining the second movement parameter based on the first movement parameter and the dynamic attenuation factor includes: Multiply the first moving parameter by the dynamic decay factor to obtain the second moving parameter; If the first position error value is greater than the third preset error value, the first position error value is multiplied by the first preset value to obtain the third movement parameter; If the second movement parameter is greater than the third movement parameter, then the second movement parameter is updated to the third movement parameter.

17. A computer device, characterized in that, The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method as described in any one of claims 1 to 16.