A method for controlling the end position of a rope-driven flexible arm
The intelligent agent control method that combines BP neural network and deep reinforcement learning algorithm solves the problems of nonlinearity and infinite freedom in traditional rope-driven flexible arm control, achieves efficient end position control and adaptability, and is suitable for complex environments and dynamic conditions.
Patent Information
- Application Number
- CN202410935477.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-12
AI Technical Summary
The traditional control method of rope-driven flexible arms is difficult to handle the problems of high nonlinearity and infinite degrees of freedom, resulting in low system operating speed and low control frequency, and it is difficult to adapt to unstructured complex environments and parameter uncertainty.
Using BP neural network and deep reinforcement learning algorithm, combined with long and short memory neural network, the agent is trained to perform dynamic model prediction and control action decision-making, avoiding the complex modeling and inverse dynamics equation solving in traditional methods, and improving the adaptability of the model. performance and prediction accuracy.
It achieves precise position control of the end of the rope-driven flexible arm, adapts to different types and shapes of flexible robots, improves the control effect and system operation speed, and can handle real-time and accuracy requirements in dynamic environments.
Smart Images

Figure CN118493364B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to robot and computer deep learning technology, and in particular to an end position control method of a rope-driven flexible arm. Background Art
[0002] Compared with traditional rigid robotic arms, the main body of the rope-driven flexible arm can be deformed, and has special compliance and flexibility in environmental interaction and application, which is safer in the process of human-machine collaboration. The unique structural design also makes the rope-driven flexible arm smaller in size, which can fill the application gap of rigid robots in a variety of space environments, such as deep-sea pipeline detection and ship engine maintenance in narrow spaces, and has broad application prospects.
[0003] Most of the traditional control methods of rope-driven flexible arms are based on models, which are mainly divided into kinematic and dynamic methods. Since the continuum robot has infinite degrees of freedom, its mechanism modeling often adopts ideal assumptions and describes the geometric configuration approximately equivalently through finite curve segments. The kinematic model requires the establishment of a mapping relationship from the drive space to the joint space and then to the task space of the rope-driven flexible arm under static assumptions, and then the control of the end effector is achieved by solving the inverse kinematic equations. The dynamic method covers more behavior information and material properties of the continuum robot. It usually establishes a dynamic model based on kinematic analysis combined with Newton-Euler method, virtual work principle and Lagrangian method. However, the rope-driven continuous robot has infinite redundancy and highly nonlinear characteristics, and is mostly used in unstructured complex environments. The model-based control method has problems that are difficult to solve. The kinematic method has difficulties in accurate kinematic modeling and numerical solution of the inverse kinematic equations, which will also lead to a low operating speed and control frequency of the system. The model-based dynamic method is difficult to deal with the influence of various parameter uncertainties and unknown interactive environments, and cannot achieve the expected control effect. Specifically, traditional solutions include: (1) Piecewise constant curvature modeling: widely used in modeling continuum robots, this method loses its effectiveness under external loads. (2) Cosserat rod theory: this theory takes external loads into account, but the dynamic model is established through a set of nonlinear partial differential equations, which requires a lot of time to calculate to output control actions. (3) Finite element method: depending on the material and geometry of the soft manipulator, this method has limited generalization ability and is too complicated.
[0004] It should be noted that the information disclosed in the above background technology section is only used for understanding the background of the present application, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0005] The main purpose of the present invention is to overcome the defects of the above-mentioned background technology and provide a method for controlling the end position of a rope-driven flexible arm.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] A method for controlling the end position of a rope-driven flexible arm comprises the following steps:
[0008] T1. Data acquisition: Obtain the spatial position coordinate data of the end of the flexible arm and synchronously collect the rotation value of the flexible arm servo to form a data set for training the dynamic model;
[0009] T2. Dynamic model training: Based on the data set, a BP neural network is trained as a dynamic model, which is used to predict the spatial position coordinates of the end of the flexible arm according to the rotation value of the flexible arm servo;
[0010] T3. Reinforcement learning agent training: Using the flexible arm end position prediction information provided by the dynamic model, the agent is trained using a deep reinforcement learning algorithm. The agent includes an actor network and a critic network to learn the optimal control actions under different states. The actor network is responsible for generating control actions, and the critic network is responsible for evaluating the effects of the actions and guiding the optimization of the actor network through feedback. The actor network and the critic network are both constructed by the fusion of a fully connected network and an LSTM network. The fully connected network is used to process state features and make decision outputs, and the LSTM network is used to capture the dynamic characteristics in time series data, providing the agent with the ability to remember historical decision information.
[0011] T4. Obtain a trained and optimized dynamics model and reinforcement learning agent, which work together to achieve precise position control of the end of the flexible arm.
[0012] A method for controlling the end position of a rope-driven flexible arm, using the dynamic model obtained by the above method and a reinforcement learning agent to control the end position of the rope-driven flexible arm, comprises the following steps:
[0013] I1. Real-time state acquisition: receiving and processing the real-time spatial position coordinates of the end of the flexible arm and the steering gear rotation value as the observation state of the intelligent agent at the current moment;
[0014] I2. Dynamic model mapping: Using the trained dynamic model, the spatial position coordinates of the end of the flexible arm are predicted in real time according to the rotation value of the flexible arm servo in the current observation state;
[0015] I3. Control action decision: The agent generates control actions, i.e., the precise rotation value of the servo, through the Actor network based on the prediction of the dynamics model and the current state;
[0016] I4. Control action execution: The control actions generated by the Actor network are applied to the flexible arm to adjust the end position to track a predetermined trajectory or reach a specific goal.
[0017] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the end position control method of the rope-driven flexible arm is implemented.
[0018] A computer program product comprises a computer program, wherein when the computer program is executed by a processor, the end position control method of a rope-driven flexible arm is realized.
[0019] The present invention has the following beneficial effects:
[0020] The present invention proposes an innovative method for controlling the end position of a rope-driven flexible arm, which breaks through the limitations of traditional model-based control strategies, especially the difficulty of accurately modeling and precisely controlling a continuum robot with high nonlinearity and infinite degrees of freedom. The present invention embodies its significant advantages in the following aspects: the present invention does not rely on complex dynamic or kinematic models, avoids the reliance on idealized assumptions in traditional methods, and thus saves the tedious modeling and parameter derivation process. The approximate dynamic model of the flexible arm is established by using a BP neural network, and the model parameters are optimized by an intelligent optimization algorithm to improve the adaptability and prediction accuracy of the model; a deep reinforcement learning algorithm is used, preferably a double-delayed deep deterministic policy gradient algorithm (TD3), and the structure of the Actor and Critic network is improved by combining a long short-term memory neural network (LSTM), which enhances the observation ability of the intelligent agent to the global strategy, so that it can formulate a better control strategy. The control method of the present invention is not limited to specific flexible arm parameters or structures, has strong generalization ability, and can adapt to flexible robots of different types and forms. The present invention has real-time decision-making and precise control capabilities. Even when the end load changes, the present invention can achieve fast and precise end position control, meeting the dual requirements of real-time and precision of the flexible arm in a dynamic environment. Compared with traditional methods, the present invention also eliminates the steps of complex mathematical modeling and solving inverse dynamics equations, reduces the complexity of calculations, and improves the operating speed and control frequency of the system. The control strategy of the present invention is applicable to various unstructured complex environments, can handle the influence of parameter uncertainty and unknown interactive environments, and significantly improves the control effect. The present invention is not only suitable for specific applications such as equipment installation and obstacle clearing in the ocean, but also provides an effective control solution for highly nonlinear industrial systems and robotic systems.
[0021] In summary, the present invention realizes precise control of the end position of the rope-driven flexible arm by combining data-driven models and deep reinforcement learning technology, which has broad application prospects and important practical value.
[0022] Other beneficial effects of the embodiments of the present invention will be further described below. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a structural diagram of the interaction between an intelligent agent and a rope-driven flexible arm system according to an embodiment of the present invention.
[0024] Figure 2 The figure is a specific structural diagram of the Actor and Critic network of an embodiment of the present invention.
[0025] Figure 3 This is a diagram showing the tracking result of the trajectory circle according to an embodiment of the present invention.
[0026] Figure 4 A target character tracking result diagram according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0027] The following is a detailed description of the embodiments of the present invention. It should be emphasized that the following description is only exemplary and is not intended to limit the scope and application of the present invention.
[0028] See also Figure 1 and Figure 2 The embodiment of the present invention provides a method for controlling the end position of a rope-driven flexible arm, comprising the following steps:
[0029] T1. Data acquisition: Obtain the spatial position coordinate data of the end of the flexible arm and synchronously collect the rotation value of the flexible arm servo to form a data set for training the dynamic model;
[0030] T2. Dynamic model training: Based on the data set, a BP neural network is trained as a dynamic model. This model is used to predict the spatial position coordinates of the end of the flexible arm according to the rotation value of the flexible arm servo. The dynamic model provides the agent with the ability to predict the position of the end of the flexible arm, which serves as the basis for the agent to perform state evaluation and action decision-making.
[0031] T3. Reinforcement learning agent training: Using the flexible arm end position prediction information provided by the dynamic model, the agent is trained using a deep reinforcement learning algorithm. The agent includes an actor network and a critic network to learn the optimal control actions under different states. The actor network is responsible for generating control actions, and the critic network is responsible for evaluating the effects of the actions and guiding the optimization of the actor network through feedback. The actor network and the critic network are both constructed by the fusion of a fully connected network and an LSTM network. The fully connected network is used to process state features and make decision outputs, and the LSTM network is used to capture the dynamic characteristics in time series data, providing the agent with the ability to remember historical decision information.
[0032] T4. Obtain a trained and optimized dynamics model and reinforcement learning agent. The dynamics model provides predictions of the end position. The reinforcement learning agent uses the information provided by the dynamics model to evaluate the consequences of different actions and learn how to choose the optimal action in various states. The two work together to achieve precise position control of the end of the flexible arm.
[0033] In a preferred embodiment, step T2 includes: the dynamic model is based on the BP neural network, the input layer receives the rotation amount of the servo, and the output layer outputs the position of the end of the flexible arm; the hidden layer uses the Sigmoid activation function, and the output layer uses the linear activation function; the training process uses the Adam solver to update the network parameters; the parameter update of the neural network is further optimized by the whale optimization algorithm, and the whale optimization algorithm simulates the hunting process of whales, including three stages of encirclement, capture and random search for prey; wherein, the encirclement stage calculates and updates parameters through a series of iterative processes, simulates the behavior of whales encircling prey, and gradually narrows the search range; the capture stage simulates the spiral forward behavior of whales when capturing prey, and updates parameters to approximate the optimal solution; random search stage introduces randomness to enhance the global search capability of the algorithm to avoid falling into the local optimal solution.
[0034] In the process of simulating prey capture, the algorithm chooses whether to continue encircling or spiral forward by setting a probability to achieve more efficient parameter update.
[0035] See also Figure 1In a preferred embodiment, step T3 includes: initializing the parameters of the agent's Actor network, Critic network and target network; constructing and maintaining an experience pool for storing the four-tuple of state, action, reward and next state; the agent obtains the current state vector by observing the environment; the Actor network selects an action vector according to the current state vector, applies the action vector to the rope-driven flexible arm system, and performs a specific action; after performing the action, the system returns an immediate reward and a new state vector according to the result of the action; the current state, action, reward and new state are stored in the experience pool; the Critic network evaluates the data sampled from the experience pool The current strategy is updated according to the reward function; the reward function is designed based on the control error based on the intelligent agent to guide the intelligent agent to learn to reduce the error; a soft update strategy is used to regularly update the target network parameters to keep the target network synchronized with the current network and increase the training stability; the target network is used as a copy of the Actor network and the Critic network, and the target network parameters are regularly copied from the main network, and the parameters are updated at a lower frequency during the training process; the Actor network is updated according to the delayed update strategy to maintain the stability of the strategy; the intelligent agent continues to interact with the environment and repeats the steps of state observation, action selection, execution, evaluation and network parameter update.
[0036] See also Figure 1 In a more preferred embodiment, the deep reinforcement learning adopts the TD3 algorithm, the Critic network includes a Critic1 network and a Critic2 network, and the strategy is double-evaluated using the Critic1 network and the Critic2 network, and the minimum estimated value is selected to update the strategy through a double Q learning method.
[0037] In a more preferred embodiment, in step T3, a target strategy smoothing regularization process is performed, and when the target network is updated, a small amount of random noise is added to the target network for regularization to prevent overfitting.
[0038] In a more preferred embodiment, in step T3, the Critic network learns to update the estimate of the current state through the time difference TD method, and adjusts the estimate of the current state based on the estimated value of the current state and the estimated value of the next state.
[0039] See also Figure 2In a more preferred embodiment, step T3 further includes: the agent obtains the current state vector by observing the environment as the input of the Actor network; the state vector is dimensionally adapted to match the input requirements of the Actor network; the state vector is input to the LSTM layer of the Actor network to process time series data and capture the dependencies between states; after passing through the LSTM layer, the ReLU activation function is used to increase nonlinearity to promote the network to learn complex patterns; regularization is performed through the Dropout layer to reduce overfitting and improve the generalization ability of the network; the state representation is further extracted and decided through the fully connected layer FC; the fully connected layer of the Actor network outputs an action vector to represent the decision of the agent; according to the action vector generated by the Actor network, the agent performs corresponding actions in the environment; after performing the action, the agent receives feedback from the environment, including rewards and new state vectors; the Critic network uses the received rewards and new states to update the Q value estimate; the Q value of the Critic network is used to evaluate the effect of the current strategy and guide the update of the Actor network; according to the gradient of the Q value and the performance of the strategy, the parameters of the Actor and Critic networks are updated to optimize the strategy.
[0040] See also Figure 1 and Figure 2 The embodiment of the present invention further provides a method for controlling the end position of a rope-driven flexible arm, which uses the dynamic model obtained by the method of any of the above embodiments and the reinforcement learning agent to control the end position of the rope-driven flexible arm, including the following steps:
[0041] I1. Real-time state acquisition: receiving and processing the real-time spatial position coordinates of the end of the flexible arm and the steering gear rotation value as the observation state of the intelligent agent at the current moment;
[0042] I2. Dynamic model mapping: Using the trained dynamic model, the spatial position coordinates of the end of the flexible arm are predicted in real time according to the rotation value of the flexible arm servo in the current observation state;
[0043] I3. Control action decision: The agent generates control actions, i.e., the precise rotation value of the servo, through the Actor network based on the prediction of the dynamics model and the current state;
[0044] I4. Control action execution: The control actions generated by the Actor network are applied to the flexible arm to adjust the end position to track a predetermined trajectory or reach a specific goal.
[0045] The embodiment of the present invention proposes an innovative rope-driven flexible arm end position control method, which effectively overcomes the challenges faced by traditional control strategies when dealing with highly nonlinear and infinite degrees of freedom continuum robots, especially the difficulties in accurate modeling and precise control. The outstanding advantage of this method is that it does not rely on traditional dynamics or kinematic models, thereby avoiding dependence on idealized assumptions and omitting complex modeling and parameter derivation processes. By using BP neural network to construct the dynamic model of the flexible arm and applying intelligent optimization algorithm to optimize the model parameters, the present invention improves the adaptability and prediction accuracy of the model. At the same time, a deep reinforcement learning algorithm is adopted, and the double-delay deep deterministic policy gradient algorithm (TD3) is particularly preferred, and the long short-term memory neural network (LSTM) is integrated to improve the structure of the Actor and Critic network. This combination not only enhances the observation ability of the intelligent agent to the global strategy, but also enables it to formulate a better control strategy. The control method of the present invention has a strong generalization ability, is not limited by specific flexible arm parameters or structures, and can adapt to flexible robots of different types and forms. In addition, the present invention demonstrates excellent real-time decision-making and precise control capabilities. Even under the condition of terminal load changes, the terminal position can be quickly and accurately controlled, meeting the high requirements for real-time and precision in dynamic environments. In comparison, the complex mathematical modeling and inverse dynamic equation solving steps in traditional methods are omitted, thereby reducing the complexity of calculations and improving the operating speed and control frequency of the system. The control strategy of the present invention is also applicable to various unstructured complex environments, and can effectively handle the influence of parameter uncertainty and unknown interactive environments, significantly improving the control effect.
[0046] The specific embodiments of the present invention are further described below.
[0047] Traditional control methods have problems such as model failure under load, poor generalization ability, long calculation time, difficult and complex modeling, etc. The preferred embodiment of the present invention proposes a new rope-driven flexible arm control method, which can realize the control of the end of the flexible arm under load, without modeling, rapid decision-making, and strong generalization ability. In a specific embodiment, a data set is formed by collecting the spatial position coordinates of the end of the flexible arm and the corresponding rotation values of the steering gear, and a forward dynamics model is fitted using a machine learning algorithm BP-WOA model (i.e., inputting the rotation values of four steering gears, and calculating the output through the BP-WOA model: the spatial position coordinates X, Y, and Z of the end of the flexible arm), and the trained BP-WOA network is used as an interactive environment for reinforcement learning, and the TD3 algorithm is preferably used as a controller to train the intelligent agent. The process is to use the spatial position coordinates X, Y, and Z of the end of the flexible arm in the data set as input, the TD3 algorithm outputs the rotation values of the four steering gears, and then the rotation values of the four steering gears are given as input to the BP-WOA network, and the spatial position coordinates X', Y', and Z' of the end of the flexible arm are output, compared with the initial spatial position coordinates X, Y, and Z of the end of the flexible arm, and rewards or penalties are given to optimize the decision of the intelligent agent.
[0048] Specifically, a preferred embodiment of the present invention provides a method for controlling the end position of a rope-driven flexible arm, comprising the following process:
[0049] Collecting Datasets
[0050] The spatial position coordinate data of the end of the flexible arm is obtained and the data is preprocessed. The data preprocessing includes cleaning the original data, detecting and modifying outliers, and filling in missing values.
[0051] The rotation values corresponding to the spatial position coordinate data of the four servos and the end of the flexible arm are obtained, and the data are unified. The specific method is to use the timestamp to match the spatial position coordinate data of the end of the flexible arm collected by the motion capture system with the servo data transmitted back in real time one by one to form a data set.
[0052] Fitting the forward kinetic model
[0053] The collected data set is divided into three parts: a training set of 70% of the data, a validation set of 10% of the data, and a training set of 20% of the data.
[0054] Based on the BP neural network, the forward dynamics model of the flexible arm is established. The input of the BP neural network is the rotation amount of the servo. , the output is the end position of the flexible arm .
[0055] The calculation formula of BP neural network can be shown as formula (1), where is the connection weight between neurons; is the bias of the neuron; For the activation function, Sigmoid is selected as the activation function between hidden layers, and the linear function is selected as the activation function of the output layer.
[0056] (1)
[0057] For updating the weights and biases between neurons, the Adam solver is used. This solver combines the advantages of the momentum algorithm and the root mean square back propagation method. It can adaptively adjust the learning rate, and during the parameter update process, it can consider the impact of past parameter change trends on the current parameter change trends.
[0058] The whale optimization algorithm is used to optimize the parameter update of the neural network, and the parameter vector composed of all weights and biases of the neural network is defined as For the whale optimization algorithm, the process of optimizing parameter updates can be summarized as three processes: surrounding prey, capturing prey, and searching for prey.
[0059] For encircling prey, the reference is the specific process of whales encircling prey when hunting, which can be summarized as formulas (2)-(4). Among them, Indicates the current number of iterations. Indicates the best parameter at present. The parameter representing the current number of iterations, is a random number in the range (0,1). It gradually decreases from 2 to 0 during the iteration process. The maximum number of iterations set for the initialization.
[0060] (2)
[0061] (3)
[0062] (4)
[0063] For capturing prey, the reference is the spiral process of whales capturing prey, as shown in formula (5). Represents the distance between the current parameter and the optimal parameter, is a constant that defines the shape of the logarithmic spiral, is a random number between [-1,1].
[0064] (5)
[0065] When whales capture prey, they will choose between the two processes of contraction and spiral advance, by setting the probability To achieve this process, as shown in formula (6).
[0066] (6)
[0067] The essence of searching for prey lies in the randomness of searching for prey. This randomness enhances the global search ability of the algorithm and helps to avoid falling into the local optimum, as shown in formula (7).
[0068] (7)
[0069] Through the above steps, a BP neural network model based on the whale optimization algorithm was established. This model was used to approximately replace the forward dynamics model of the rope-driven flexible arm.
[0070] Reinforcement Learning Agent Training
[0071] Based on the established forward dynamics model, the flexible arm is effectively controlled using deep reinforcement learning control strategy. The five basic elements of reinforcement learning are: state space ,Action Space , state change probability ,Reward function and the discount factor Give specific definitions respectively.
[0072] For the state space, every moment Corresponding to one , which is the observation state of the agent to the environment. For the rope-driven flexible arm system, it includes the load at the end of the flexible arm , the end position at the current moment (For convenience of description, Written ), its error from the expected position (in ), and the expected position at the next moment .therefore is defined as:
[0073] (8)
[0074] The action space is the agent's The action produced , is the output of the intelligent agent and also the control input of the rope-driven flexible arm. is defined as:
[0075] (9)
[0076] The state transition probability corresponds to the observed state of the rope-driven flexible arm , in the actions generated by the agent The observed state becomes The probability of the agent according to the current observation state Take action The decision is defined as .
[0077] The reward function represents the controlled object, that is, the rope-driven flexible arm, from state Transform to state A timely reward mapped , which is a scalar that measures the degree to which the agent completes the target task. Controlling the timely reward of the task The definition is as follows:
[0078] (10)
[0079] The timely reward function represented by formula (10) provides good guidance for the agent to make decisions that are conducive to achieving the control goal by comparing the position error between the current moment and the previous moment, the current position and the target position, and the constraints of the workspace. The reward for the control decision can be defined as ,in is the total time step, It is a discount factor used to prevent excessive accumulation of rewards and affect the training effect.
[0080] After determining the basic elements of reinforcement learning, the specific algorithm for deep reinforcement learning is the Twin Delayer Deep Deterministic Policy Gradient (TD3) algorithm, whose main steps can be summarized as: parameter initialization, target policy smoothing regularization, dual network, target network, and delayed update.
[0081] Parameter initialization, through random parameters Initialize the Critic Network and Actor Network ; Initialize the target network ; Initialize experience pool , the total time step and the time step of the target network update .
[0082] The target strategy smoothing regularization is proposed to address a common problem in deterministic gradient update algorithms: function overfitting. This is achieved by adding a small amount of random noise to the target network, as shown in formula (11). is the variance of random noise, is a constant used to limit the range of random noise to keep the target of the average processing close to the original target.
[0083] (11)
[0084] The dual network is essentially a double Q-learning, which is an optimization of formula (5-8). Define a set of strategies and a set of Q-learning networks ,The strategy is continuously optimized through network learning, and the formula of double Q learning can be obtained as follows:
[0085] (12)
[0086] For formula (12), the optimization objective is solved through the opposite Q learning network. If the two Q learning networks are independent, the deviation introduced by the strategy update can be avoided, thereby achieving unbiased estimation. It is worth noting that for the strategy Updates are still made using the learning network Completed, but when performing the overall optimization solution, the learning network is used , for strategy The same is true for .
[0087] However, since the optimization goal of the dual Q-learning is the same and it is performed in the same experience pool (ReplayBuffer, used to store the parameters of the network during training), the two Q-learning networks cannot be completely independent. , will appear , which leads to the high estimate being further amplified, so usually, The problem of overestimation arises.
[0088] The above problem can be solved by limited bias estimation. The basic idea is to use two different networks to optimize a strategy and take the smallest one to update the strategy, thus obtaining the Clipped Double Q-learning algorithm, whose formula is shown in formula (13). The Clipped Double Q-learning algorithm can effectively alleviate the problem of high estimation, but may introduce low estimation bias, which is more beneficial to the update of the strategy than the high estimation problem, because the low estimation bias is usually not propagated in the strategy update process, so it will not affect the search for the optimal strategy.
[0089] (13)
[0090] For the learning network, that is, the Critic network, its update method is temporal difference learning (TD). Its estimation of the current state is based on the estimation of the subsequent state, which will inevitably lead to a certain error. Although this error is small, after iterative accumulation, it will affect the Critic network and the Actor network, thus obtaining a suboptimal strategy. For each iteration, the temporal difference error The impact on the Critic network can be expressed as follows:
[0091] (14)
[0092] To solve the error problem of the Critic network itself, it is necessary to use the target network and the delayed update method. First of all, it is necessary to clarify that the TD3 algorithm includes 6 networks, namely: Actor network, Critic1 network, Critic2 network, target Actor network, target Critic1 network and target Critic2 network. The two Critic networks are the dual networks mentioned. The difference between the Actor network and the target Actor network is that the Actor network will update the parameters at every time step and put the parameters into the experience pool, but the target Actor network will select the optimal parameters from the experience pool at every time step and update itself. The purpose is to stabilize the training effect of the network so that it can update the parameters of the network from a global perspective.
[0093] The overall architecture of the TD3 control strategy can be called an agent, which is usually composed of two policy networks: Actor and Critic. The agent interacts with the observed environment through action vectors and state vectors. Therefore, the structure of the interaction between the agent and the rope-driven flexible arm system can be summarized as follows: Figure 1shown.
[0094] For the Actor and Critic networks, we choose to combine the fully connected neural network and the LSTM neural network. The LSTM neural network is a type of recurrent neural network. Compared with the original recurrent neural network, it realizes the selective memory function of long sequence data through three gate structures. When applied to the intelligent agent strategy network, it can help the intelligent agent coordinate the relationship between historical decisions and current decisions, so as to make the best overall decision and obtain the highest cumulative Q value. For the specific structure of the Actor and Critic network, Figure 2 shown.
[0095] In summary, the preferred embodiment of the present invention uses a model-free control method to achieve control of the end of the rope-driven flexible arm. Specifically, the present invention proposes a new control framework, that is, firstly training the forward dynamic model of the rope-driven flexible arm with a data set, and then using it as an interactive environment for a reinforcement learning agent to train the agent to make better decisions. In terms of reinforcement learning algorithms, we use the TD3 algorithm and use LSTM as a deep network to improve the prediction accuracy and achieve precise control of the end of the rope-driven flexible arm.
[0096] The end position control method of the rope-driven flexible arm proposed in the preferred embodiment of the present invention also has the following advantages:
[0097] No knowledge of any parameters related to the flexible arm body is required, and no calculation of the dynamics model is required. The available data can be used to complete the fitting of the forward dynamics model and the output of the control strategy.
[0098] The control method can be applied to any flexible robot and has strong transferability;
[0099] The end of the flexible arm can be precisely controlled with a load at the end;
[0100] Experimental example / verification example:
[0101] In order to verify the effectiveness and accuracy of the control method we proposed, we conducted a trajectory tracking experiment. In order to illustrate the superiority of the control method proposed in this invention, it was compared with the RBF neural network control method and the model-free adaptive control (MAFC) method in the experimental test.
[0102] The RBF neural network control method effectively controls the nonlinear system through the nonlinear fitting ability of the radial basis function. In this experiment, the structure of the selected RBF neural network control is 4-9-3, and the parameters in the radial basis function are updated according to the change in the distance to the target point. The model-free adaptive control (MAFC) method, by introducing concepts such as pseudo-gradients, approximately linearizes the nonlinear system and minimizes the loss function to obtain a data-driven control method. The specific parameter settings of the model-free adaptive controller are as follows:
[0103]
[0104] First, the trajectory of the target circle in the feasible domain is tracked. The target trajectory is a circle with [200mm (X axis), 200mm (Y axis)] as the circle point, 50mm as the radius, rotating counterclockwise around the Z axis direction, and maintaining a Z axis height of 315mm. The trajectory is simulated and tested experimentally. The specific results are as follows Figure 3 shown. Figure 3 The tracking results of the trajectory circle are as follows: A) Circular trajectory tracking effect based on reinforcement learning (RL); B) Circular trajectory tracking effect based on radial basis function (RBF); C) Circular trajectory tracking effect based on MAFC; D, E) Control error distribution of the three control algorithms in the simulation environment and the actual robot.
[0105] Regarding the analysis of the control effect, in addition to the above simulation and measured results, the distance error from the target point, the interquartile ranges (IQR) of the error, including the quarter and third quarters, have a better evaluation effect on the control effect. The IQRs of the three control methods are shown in Table 1.
[0106] Table 1 IQR of errors of three control algorithms
[0107]
[0108] Comparing the IQR values of the control errors of the three algorithms and the distance errors from the target point, it can be seen that the control effect of RL-based is basically better than that of RBF-based and MAFC-based control algorithms, whether in terms of the overall error between points or the corresponding errors of the three axes XYZ. RL-based can better "understand" the highly nonlinear characteristics of the flexible robotic arm and give a better control strategy based on the deep learning network and pre-training. However, although the RBF-based and MAFC-based algorithms are also data-driven control algorithms, their ability to understand highly nonlinear systems, whether in terms of radial basis functions or linearization of nonlinear systems, is worse than that of deep learning networks, and the decisions made are relatively worse.
[0109] The accuracy of the RL-based control method has been verified. Whether the control method is applicable to the entire feasible domain still needs to be further explored experimentally. Therefore, a new target trajectory tracking character "THU OASIS" is designed. These eight characters are distributed in different parts of the entire feasible domain. By tracking the target trajectory of these eight characters, it is possible to effectively test whether the control method can be well applied to the entire feasible domain.
[0110] For the trajectory tracking results of the eight characters of "THU OASIS", see Figure 4 As shown in the figure, these eight characters almost cover the entire feasible domain. For the two "S" that appear in the characters, the first "S" is located at the far left of the feasible domain, and the second "S" is located at the far right bottom of the feasible domain. Moreover, the Z-axis value of each target point in these eight characters is different and changes randomly, which also poses a great challenge to the control accuracy of the control algorithm.
[0111] Figure 4 The target character tracking results are shown. A) is the comparison between the expected trajectory and the actual trajectory of the eight characters. B) is a box plot of the error distribution between the actual trajectory and the expected trajectory, showing the distribution of the tracking errors of the eight characters. From the distribution, it can be seen that the IQR of the tracking errors of the eight characters is concentrated in [2.5 5.0] (mm). This is a relatively small IQR value, which fully demonstrates that the designed control algorithm has extremely high control accuracy.
[0112] In the embodiment of the present invention, a small and dexterous rope-driven flexible arm system is built, and the overall architecture of the system is composed of a rope-driven flexible arm main structure, data acquisition and other modules. The rope-driven flexible arm main structure is composed of materials such as silicone rods and transmission cables. The data acquisition module is composed of a motion capture module, which is used to collect motion data of the rope-driven flexible arm and provides a data basis for the establishment of an approximate dynamic model.
[0113] In order to solve the problem that the flexible arm is difficult to accurately model, the embodiment of the present invention uses the BP neural network model as a basis, establishes an approximate dynamic model of the flexible arm, and uses an intelligent optimization algorithm to optimize the parameters of the neural network model.
[0114] In order to solve the problem that the flexible arm cannot be precisely controlled, the present invention realizes the control of the rope-driven flexible arm through a deep reinforcement learning control strategy based on the established approximate dynamic model. For the deep reinforcement learning control algorithm, a double-delay deep deterministic policy gradient algorithm is preferably used, and by introducing a long short-term memory neural network, its observation ability of the global strategy is increased, so that it can make a control strategy that is more inclined to the global optimal. Compared with known solutions, the present invention can achieve better control accuracy and complete more complex control tasks. In the embodiment of the present invention, a long short-term memory neural network is introduced for the construction of the Actor and Critic networks in the double-delay deep deterministic policy gradient algorithm, which can enhance the observation ability of the intelligent agent for the global strategy, so that it can make a control strategy that is more inclined to the global optimal.
[0115] The present invention can be well applied to equipment installation of flexible arms in the ocean, obstacle clearing applications, and other aspects, as well as to highly nonlinear industrial systems and robot systems.
[0116] An embodiment of the present invention further provides a storage medium for storing a computer program, which at least performs the above method when executed.
[0117] An embodiment of the present invention further provides a control device, comprising a processor and a storage medium for storing a computer program; wherein the processor is configured to execute at least the method described above when executing the computer program.
[0118] An embodiment of the present invention further provides a processor, wherein the processor executes a computer program and at least executes the method described above.
[0119] The storage medium can be implemented by any type of non-volatile storage device, or a combination thereof. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a ferromagnetic random access memory (Flash Memory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM); the magnetic surface memory can be a disk memory or a tape memory. The storage medium described in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.
[0120] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0121] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0122] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0123] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0124] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0125] The methods disclosed in the several method embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments.
[0126] The features disclosed in several product embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new product embodiments.
[0127] The features disclosed in several method or device embodiments provided by the present invention can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0128] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art of the present invention, several equivalent substitutions or obvious variations can be made without departing from the concept of the present invention, and the performance or use is the same, which should be regarded as belonging to the protection scope of the present invention.
Claims
1. A method for controlling the end position of a rope-driven flexible arm, characterized in that: The following steps are involved: T1. Data acquisition: Obtain the spatial position coordinate data of the end of the flexible arm and synchronously collect the rotation value of the flexible arm servo to form a data set for training the dynamic model; T2. Dynamic model training: Based on the data set, a BP neural network is trained as a dynamic model, which is used to predict the spatial position coordinates of the end of the flexible arm according to the rotation value of the flexible arm servo; T3. Reinforcement learning agent training: Using the flexible arm end position prediction information provided by the dynamic model, the agent is trained using a deep reinforcement learning algorithm. The agent includes an actor network and a critic network to learn the optimal control actions under different states. The actor network is responsible for generating control actions, and the critic network is responsible for evaluating the effects of the actions and guiding the optimization of the actor network through feedback. The actor network and the critic network are both constructed by the fusion of a fully connected network and an LSTM network. The fully connected network is used to process state features and make decision outputs, and the LSTM network is used to capture the dynamic characteristics in time series data, providing the agent with the ability to remember historical decision information. T4. Obtain a trained and optimized dynamics model and reinforcement learning agent, which work together to achieve precise position control of the end of the flexible arm; Based on the established forward dynamics model, the flexible arm is effectively controlled using deep reinforcement learning control strategy. The five basic elements of reinforcement learning are: state space , action space , state transition probability P for , the reward function R for and the discount factor Give specific definitions respectively; For the state space, every moment Corresponding to one , which is the observation state of the agent to the environment. For the rope-driven flexible arm system, it includes the load at the end of the flexible arm , the end position at the current moment , the error between it and the expected position ,in , and the expected position at the next moment ,therefore is defined as: ; The action space is the agent's The action produced , is the output of the intelligent agent and also the control input of the rope-driven flexible arm, so is defined as: ; The state transition probability corresponds to the observed state of the rope-driven flexible arm , in the actions generated by the agent The observed state becomes The probability of the agent according to the current observation state Take action Decision making, defining decision making π for ; The reward function represents the controlled object, that is, the rope-driven flexible arm, from state Transform to state A timely reward mapped , which is a scalar that measures the degree to which the agent completes the target task; controls the timely reward of the task The definition is as follows: ; The timely reward function guides the agent to make decisions that are conducive to achieving the control goal by comparing the position error at the current moment and the previous moment, the current position and the target position, and the constraints of the workspace. The reward for the control decision is defined as ,in is the total time step, It is a discount factor used to prevent excessive accumulation of rewards and affect the training effect.
2. The end position control method of the rope-driven flexible arm according to claim 1, characterized in that: Step T2 includes: The dynamic model is based on BP neural network. The input layer receives the rotation of the servo, and the output layer outputs the position of the end of the flexible arm. The hidden layer uses Sigmoid activation function, and the output layer uses linear activation function. The training process uses the Adam solver to update the network parameters; The neural network's parameter updates are further optimized by a whale optimization algorithm that simulates the whale hunting process, including three stages: encirclement, capture, and random search for prey; In the stage of surrounding prey, a series of iterative processes are used to calculate and update parameters, simulate the behavior of whales surrounding prey, and gradually narrow the search range; The prey capture phase simulates the spiraling behavior of whales when capturing prey, and updates parameters to approach the optimal solution. The random prey search stage introduces randomness to enhance the global search capability of the algorithm and avoid falling into the local optimal solution; In the process of simulating prey capture, the algorithm chooses whether to continue encircling or spiral forward by setting a probability to achieve more efficient parameter update.
3. The end position control method of a rope-driven flexible arm according to claim 1 or 2, characterized in that: Step T3 includes: Initialize the parameters of the agent's Actor network, Critic network, and target network; Build and maintain an experience pool to store the quadruple of state, action, reward, and next state; The agent obtains the current state vector by observing the environment; The Actor network selects an action vector based on the current state vector, applies the action vector to the rope-driven flexible arm system, and performs a specific action; After executing the action, the system returns an immediate reward and a new state vector based on the result of the action; Store the current state, action, reward, and new state into the experience pool; The Critic network evaluates the current strategy from the data sampled from the experience pool and updates the strategy based on the reward function; the reward function is designed based on the control error of the agent to guide the agent to learn to reduce the error; A soft update strategy is used to regularly update the target network parameters to keep the target network synchronized with the current network and increase training stability. The target network is a copy of the Actor network and the Critic network. The target network parameters are regularly copied from the main network and updated during the training process. Update the Actor network according to the delayed update strategy to maintain the stability of the strategy; The agent continues to interact with the environment, repeating the steps of state observation, action selection, execution, evaluation, and network parameter update.
4. The end position control method of the rope-driven flexible arm according to claim 3, characterized in that: The deep reinforcement learning is a TD3 algorithm, the Critic network includes a Critic1 network and a Critic2 network, the Critic1 network and the Critic2 network are used to perform a double evaluation on the strategy, and the minimum estimated value is selected to update the strategy through a double Q learning method.
5. The method for controlling the end position of a rope-driven flexible arm according to claim 3, characterized in that: In step T3, the target strategy smoothing regularization processing is performed. When updating the target network, a small amount of random noise is added to the target network for regularization to prevent overfitting.
6. The method for controlling the end position of a rope-driven flexible arm according to claim 3, characterized in that: In step T3, the critic network learns to update the estimate of the current state through the time difference TD method, and adjusts the estimate of the current state based on the estimated value of the current state and the estimated value of the next state.
7. The method for controlling the end position of a rope-driven flexible arm according to claim 3, characterized in that: Step T3 further comprises: The agent obtains the current state vector by observing the environment as the input of the Actor network; Adapt the state vector to match the input requirements of the Actor network; The state vector is input into the LSTM layer of the Actor network to process time series data and capture the dependencies between states. After the LSTM layer, the ReLU activation function is used to increase nonlinearity and facilitate the network to learn complex patterns; Regularization through the Dropout layer reduces overfitting and improves the generalization ability of the network; The state representation passes through the fully connected layer FC to further extract features and make decisions; The fully connected layer of the Actor network outputs an action vector, which represents the decision of the agent; According to the action vector generated by the Actor network, the agent performs corresponding actions in the environment; After performing an action, the agent receives feedback from the environment, including rewards and a new state vector; The critic network uses the received reward and the new state to update the Q-value estimate; Use the Q value of the Critic network to evaluate the effect of the current strategy and guide the update of the Actor network; According to the gradient of the Q value and the performance of the strategy, the parameters of the Actor and Critic networks are updated to optimize the strategy.
8. A method for controlling the end position of a rope-driven flexible arm, characterized in that: The method of using the dynamic model obtained by the method described in any one of claims 1 to 7 and the reinforcement learning agent to control the end position of the rope-driven flexible arm comprises the following steps: I1. Real-time state acquisition: receiving and processing the real-time spatial position coordinates of the end of the flexible arm and the steering gear rotation value as the observation state of the intelligent agent at the current moment; I2. Dynamic model mapping: Using the trained dynamic model, the spatial position coordinates of the end of the flexible arm are predicted in real time according to the rotation value of the flexible arm servo in the current observation state; I3. Control action decision: The agent generates control actions, i.e., the precise rotation value of the servo, through the Actor network based on the prediction of the dynamics model and the current state; I4. Control action execution: The control actions generated by the Actor network are applied to the flexible arm to adjust the end position to track a predetermined trajectory or reach a specific goal.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the end position control method of the rope-driven flexible arm as described in any one of claims 1 to 8 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the end position control method of the rope-driven flexible arm as described in any one of claims 1 to 8 is implemented.
