Obstacle avoidance path planning method and system for robotic arm based on reinforcement learning

Through methods based on deep reinforcement learning, combined with Q learning, RRT* algorithm and polynomial interpolation algorithm, the path planning and trajectory optimization of the robotic arm are optimized, solving the problem of obstacle avoidance path planning of the robotic arm in complex environments, improving sampling efficiency and stability.

CN118386252BActive Publication Date: 2024-10-22CHINA UNIV OF MINING & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410823132.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-10-22
Estimated Expiration
2044-06-25

Smart Images

  • Figure CN118386252B_ABST
    Figure CN118386252B_ABST
Patent Text Reader

Abstract

The present invention belongs to the field of robot arm path planning, and is specifically related to a robot arm obstacle avoidance path planning method and system based on reinforcement learning, wherein the method includes establishing a robot arm DH model according to an initial state, inputting a robot arm movement starting position, an obstacle position, and a target position; based on reinforcement learning, performing path planning at the end of the robot arm, incorporating an improved RRT* algorithm, and improving autonomous obstacle avoidance efficiency; incorporating a 3-5-3 polynomial interpolation algorithm to perform trajectory planning for each joint, setting the speed, acceleration, and jerk constraints of each joint of the robot arm, and improving the Seagull algorithm, fitting the discrete path points obtained by path planning to obtain a smooth and fast joint trajectory. The present invention can solve the problems of high time cost of existing reinforcement learning algorithm training and low success rate of autonomous obstacle avoidance when both impact optimization and time optimization are required.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of robot arm path planning, and specifically relates to a robot arm obstacle avoidance path planning method and system based on reinforcement learning. Background Art

[0002] With the development of robots in various fields of industry and society, sampling machines with robotic arms as the core have received more and more attention. They can actively sample coal accurately, sensitively, efficiently and labor-savingly, and can adapt to complex sampling scenarios of trains, trucks, and coal piles in coal yards, power plants, ports, etc. The mobile multi-axis robotic arm can obtain the position and shape of the coal pile based on sensor data, drive the sampling head through motion planning and control, and achieve efficient and accurate sampling of coal piles of different forms.

[0003] The present invention studies the motion planning and control technology among the seven key technologies of intelligent robots for the application scenario of coal sampling. The scenario of coal sampling is complex and changeable. When sampling coal from train cars, it is first necessary to identify the carriages, their sizes and distances, and calculate the sampling points according to the mechanized coal sampling standards. The robotic arm needs to plan a collision-free global path and control the movement of each joint along the path based on the sampling points, the identified environment and the current positions of the joints of the robotic arm. The motion planning and control accuracy of the robotic arm directly affect its operating capabilities. In order for the robotic arm to autonomously plan motion paths and accurately execute them in complex environments, path planning, trajectory planning and trajectory tracking control are essential technologies. Path planning is the first step in autonomous motion control, including global path planning and local obstacle avoidance, in which obstacle avoidance is to adjust the path in real time in response to environmental changes during motion to adapt to complex dynamic environments. The second step is trajectory planning, which converts the planned Cartesian path into an accurately trackable joint motion curve, plans the joint's velocity, acceleration and other motion variables to ensure the continuity of the motion process, and optimizes time, energy, etc. according to actual requirements. In order to improve sampling efficiency, especially dynamic sampling, higher requirements are placed on the speed of the robot's motion planning.

[0004] By comprehensively considering coal sampling scenarios and procedures, robot arm kinematic constraints, uncertain factors, optimization and other aspects, the robot arm can quickly plan a feasible, smooth and optimal motion path in a complex environment and execute it accurately, so as to further enhance the stability, accuracy and speed of the robot arm movement and improve production efficiency. Summary of the invention

[0005] In response to the above-mentioned technical problems, the present invention proposes an autonomous obstacle avoidance trajectory planning and control method for a six-legged robotic arm based on deep reinforcement learning, which can enable the six-degree-of-freedom robotic arm to perform autonomous obstacle avoidance and path planning in an environment with multiple obstacles, thereby improving the sampling efficiency of the robotic arm and meeting the sampling needs of coal mines.

[0006] In order to achieve the above-mentioned object of the invention, the present invention provides a robot arm obstacle avoidance path planning method based on reinforcement learning as described below, which is implemented by executing the following steps:

[0007] According to the initial state of the robot arm, the DH model of the robot arm is established using the DH method. The starting position, obstacle position and target position of the robot arm are input in the form of three-dimensional coordinates. The obstacles are simplified using the AABB bounding box method. At the same time, the cylindrical connecting rod model of the robot arm is expanded by a predetermined radius, and the collision detection is optimized in combination with the cylindrical connecting rod model of the robot arm.

[0008] Based on Q learning, the path planning of the end of the robot arm is carried out, the state and action set of the end of the robot arm are defined, and the reward function is established to ensure that the robot arm can effectively move to the target point while avoiding obstacles. Strategy for action selection, while introducing triple obstacle avoidance strategy;

[0009] The 3-5-3 polynomial interpolation algorithm is used to plan the trajectory of each joint of the robotic arm, and the speed, acceleration and jerk constraints are set. The discrete path points obtained by path planning are fitted to obtain a smooth and fast joint trajectory. The Seagull algorithm is improved and the improved Seagull algorithm is used to optimize the joint trajectory.

[0010] As a preferred technical solution of the present invention, path planning for the end of the robot arm based on Q learning includes the following steps:

[0011] The coordinate state S of the end of the robot arm is set to:

[0012] ,

[0013] Among them, x, y, z are the coordinates of the end of the robot in space, n is the number of times the end of the robot moves in space, and the end of the robot moves one step in the positive or negative direction of each coordinate axis. The movement action set A is defined as follows: ,in, Respectively represent the moving step lengths of the end of the robot arm in the X, Y, and Z axis directions;

[0014] Based on a first real-time distance between the obstacle at the end of the robotic arm and a second real-time distance between the end of the robotic arm and the target point, establishing a reward function to guide the robotic arm to move away from the obstacle and toward the target point;

[0015] During the movement of the robotic arm, the reward function is updated by using the Euclidean distance from the end of the robotic arm to the target point to speed up the learning speed;

[0016] In Q-learning, according to the next state , select the maximum Q value that can be obtained in the next state Multiply by the discount factor plus the reward value As the latest Q value, the rule for updating the Q value is defined as:

[0017] ,

[0018] in, is the learning rate of Q learning, is the discount factor, The maximum Q value that can be obtained by taking an action for the next state, Indicates the actions that can be taken in the next state. refers to the next state, A represents the action taken in the current state, S refers to the current state, refers to the reward value calculated according to the reward function;

[0019] Based on the Q value and the reward function, The action selection strategy selects the next action by setting a greedy threshold Determine how each action is selected. The value range is from 0 to 1;

[0020] When the robot is trapped in a local optimum and cannot find an escape path through environmental rewards, a triple obstacle avoidance strategy is introduced. According to the real-time distance between the end of the robot arm and the obstacle, the greediness and step size of the Q learning algorithm are dynamically adjusted, and the RRT* algorithm is used to avoid obstacles and obtain an escape path. Then, Q learning is used to continue exploring the optimal path.

[0021] After finding a collision-free path through Q learning, the path of each joint is obtained by inverse dynamics and a trajectory is generated. The connecting rod of the robot arm is subjected to collision detection based on each point on the trajectory. If there is no collision, all groups of kinematic inverse solutions are sorted from small to large according to the size of the angle change, and the group of kinematic inverse solutions with the smallest angle change is selected. If a collision occurs, the next group of kinematic inverse solutions is selected for collision detection until there is no collision. If all groups of kinematic inverse solutions will collide, the corresponding points are regarded as obstacles and the path planning is re-performed.

[0022] As a preferred technical solution of the present invention, the reward rule of the reward function is:

[0023] Calculate the first real-time distance between the end of the robotic arm and the obstacle using the first formula , the first formula is:

[0024] ,

[0025] in, are the coordinate positions of the end of the robot arm at the i-th moment, are the coordinate positions of the center points of the obstacles respectively, and the reward function R is expressed by the second formula, which is:

[0026] ,

[0027] in, is the first real-time distance between the end of the robotic arm and the obstacle, is the safe distance between the end of the robotic arm and the obstacle, is the coordinate position of the end of the robotic arm at the i-th moment, is the coordinate position of the target point. If the end of the robot reaches the target point, that is, When setting rewards If the first real-time distance is less than or equal to the safety distance, set a penalty If the first real-time distance is greater than the safety distance, it is considered as an empty run and a penalty is set. .

[0028] As a preferred technical solution of the present invention, the Euclidean distance from the end of the robot arm to the target point is used to update the reward function to speed up the learning speed, including the following steps:

[0029] The starting distance from the starting point of the end of the robot arm to the target point is calculated using the third formula , the third formula is:

[0030] ,

[0031] in, is the coordinate of the starting point of the robot arm,

[0032] The fourth formula is used to calculate the Euclidean distance from the end of the robot arm to the target point at the i-th moment, and the Euclidean distance also refers to the second real-time distance , the fourth formula is:

[0033] ,

[0034] in, is the coordinate of the target point;

[0035] In order to guide the end of the robot arm to move toward the target point, the reward function is updated. The specific update rule is expressed by the fifth formula:

[0036] ,

[0037] in, As a reward coefficient to assist learning, Euclidean distance is used to assist learning. Rewards are given based on the difference between the real-time distance between the state and the target point and the fixed linear distance. The closer the current state is to the target, the more rewards are obtained. When the real-time distance is greater than the initial distance, the reward value becomes a penalty, thereby motivating the state to move toward the target point and improving learning efficiency.

[0038] As a preferred technical solution of the present invention, The action selection strategy selects the next action, which includes the following steps:

[0039] Generate a random number between 0 and 1 , and the greedy threshold Compare, if Less than or equal to , randomly select an action from the set of mobile actions Execution, indicating random exploration of the environment, if Greater than , select the action with the largest Q value from the mobile action set to execute, which means the utilization of existing experience. The strategy is expressed by the sixth formula, which is:

[0040] ,

[0041] Expressed by the seventh formula, the seventh formula is:

[0042] ,

[0043] Among them, k is the number of explorations, is the actual number of learning times, and M is the specified number of iterations.

[0044] As a preferred technical solution of the present invention, the triple obstacle avoidance strategy includes the following steps:

[0045] Obtaining the first real-time distance between the end of the robotic arm and the obstacle , compared with the With the first threshold , the second threshold and the third threshold The size of , increase the greedy threshold ,like , reduce the moving step size, if , start the RRT* escape strategy, use the RRT* algorithm to obtain the escape path to avoid collision, the strategy randomly selects a direction and explores a node with a step length p along the direction, gradually constructs a local random number, and then , and when the distance to the target point is closer, the RRT* escape strategy is stopped and exited, a path is provided to leave the obstacle and approach the target point, and the optimal path is continued to be explored using Q learning.

[0046] As a preferred technical solution of the present invention, a 3-5-3 polynomial interpolation algorithm is selected for time optimization, including the following steps:

[0047] Determine the positions of the starting point, intermediate path points and end points of the joint motion. According to the design and performance of the robot arm, set the maximum speed, maximum acceleration and maximum jerk of each joint. For joint i, use the 3-5-3 polynomial interpolation formula to describe the angular position change of the joint i in three time periods. The polynomial interpolation formula is:

[0048] ,

[0049] in, are the joint angle positions of joint i in three time periods, are the unknown coefficients of the polynomial interpolation formula, t is the time variable, and the relationship between the unknown coefficients and the interpolation points is derived based on the conditions of the trajectory planning problem: , where the mathematical model of X is:

[0050] ,

[0051] The mathematical model is:

[0052] ,

[0053] The mathematical model of type F is:

[0054] ,

[0055] Among them, F is the function matrix about time t, X is the interpolation point vector, are the 4 path points of joint i, is the coefficient vector;

[0056] The time-impact optimal trajectory planning uses time and impact as the variables to be optimized and satisfies the speed and acceleration constraints:

[0057] ,

[0058] in, is the maximum velocity of the jth joint, is the maximum acceleration of the jth joint, is the maximum jerk of the jth joint, and the overall running time of the robot is set to:

[0059] ,

[0060] The total impact value of each joint of the robot arm is set as:

[0061] ,

[0062] Where T is the total running time, is the acceleration. To ensure that the actual movement speed and acceleration of the robot arm are within the specified range, a convention function is set:

[0063] ,

[0064] in, are the actual velocity and acceleration of the i-th joint, is the constraint value of the actual speed, is the acceleration constraint value. To ensure the stability of the trajectory, the initial speed of the robot arm and initial acceleration All are set to 0;

[0065] The weight method is used to transform the multi-objective optimization problem into a single-objective optimization problem. The mathematical model of the weight method is:

[0066] ,

[0067] in, is the weight of the time term, , As coefficient, introduce coefficient Make the order of magnitude of the time term and the impact term consistent, and f(t) is the comprehensive optimization value of the time term and the impact term.

[0068] As a preferred technical solution of the present invention, the Seagull algorithm is improved, including the following steps:

[0069] Use cubic chaotic mapping to generate the chaotic sequence of the initial population to obtain the chaotic sequence points and set the control parameters , and generate a chaotic sequence according to the control parameters, and search for the global optimal solution through the following formula:

[0070] ,

[0071] in, is the control parameter, n is the number of iterations, and x is the chaotic sequence generated. The chaotic sequence points are converted into reverse points through the lens imaging reverse refraction mechanism, and the fitness value of the reverse points is evaluated. The population is sorted according to the fitness value, and the optimal reverse point is selected from the sorted reverse points as the initial solution.

[0072] As a preferred technical solution of the present invention, the Seagull optimization algorithm is improved, and the following steps are also included:

[0073] The migration of seagulls meets three conditions: avoiding collision, advancing direction and seagulls approaching the optimal position. The conditional model for avoiding collision is:

[0074] ,

[0075] ,

[0076] in, refers to a new position where it will not collide with other seagulls. represents the attack position of the seagull, H is the behavior variable, k represents the number of iterations, m represents the maximum number of iterations, and the introduction of parameters To control the frequency of H by Linearly decreases to 0, the conditional model in the forward direction is:

[0077] ,

[0078] ,

[0079] in, is the current moving direction of the seagull, This is the best position found by the seagull. b represents the best. B is introduced to balance local and global exploration. is a random coefficient and , the mathematical model of the seagull approaching the optimal position is:

[0080] ,

[0081] in, For the new position reached by the seagull, the attack position of the seagull is optimized and updated through the following mathematical model:

[0082] ,

[0083] ,

[0084] ,

[0085] in, To improve the position of the attack of the rear seagull, Indicates improvement, D k-1 is the position of the seagull at the last moment, is the three-dimensional coordinate of the seagull, Because the attack position of the seagull at this moment has not been improved, The optimal position found by the seagull at the last moment, is the historical optimal position of the seagull at the last moment, G represents the past time, To determine the threshold for the update method, Both The random number inside, is the inertia weight, is the learning rate.

[0086] The present invention also provides a robot arm obstacle avoidance path planning system based on reinforcement learning, comprising the following modules:

[0087] The model building module uses the DH method to build the DH model of the robot arm according to the initial state of the robot arm, inputs the starting position of the robot arm, the obstacle position and the target position in the form of three-dimensional coordinates, uses the AABB bounding box method to simplify the obstacles, and expands the cylindrical connecting rod model of the robot arm by a predetermined radius, and optimizes the collision detection in combination with the cylindrical connecting rod model of the robot arm;

[0088] The path planning module plans the path of the end of the robot arm based on Q learning, defines the state and action set of the end of the robot arm, and establishes a reward function to ensure that the robot arm can effectively move to the target point while avoiding obstacles. Strategy for action selection, while introducing triple obstacle avoidance strategy;

[0089] The trajectory optimization module uses a 3-5-3 polynomial interpolation algorithm to plan the trajectory of each joint of the robotic arm, sets speed, acceleration and jerk constraints, fits the discrete path points obtained by path planning to obtain a smooth and fast joint trajectory, improves the Seagull algorithm, and uses the improved Seagull algorithm to optimize the joint trajectory.

[0090] Compared with the prior art, the beneficial effects of the present invention are at least as follows:

[0091] 1. The Q-learning-based path planning greatly improves the efficiency of calculating the walking trajectory of the end of the robotic arm from the starting point to the end point.

[0092] 2. The triple obstacle avoidance strategy is adopted to ensure the smoothness of the robot arm's walking trajectory to the greatest extent, and fully realize the robot arm's autonomous obstacle avoidance.

[0093] 3. The 3-5-3 polynomial interpolation algorithm is integrated to plan the trajectory of each joint, and the Seagull algorithm is improved to fit the discrete path points obtained by path planning to obtain a smooth and fast joint trajectory, which reduces the impact of the robot arm and improves the movement efficiency of the robot arm. BRIEF DESCRIPTION OF THE DRAWINGS

[0094] Figure 1A flowchart of the steps of the robot arm obstacle avoidance path planning method based on reinforcement learning according to the present invention;

[0095] Figure 2 It is a schematic diagram of the DH modeling method of the present invention;

[0096] Figure 3 It is a schematic diagram of the six-degree-of-freedom robot arm connecting rod coordinate system of the present invention;

[0097] Figure 4 It is a schematic diagram of the Q learning algorithm flow of the present invention;

[0098] Figure 5 A simplified modeling diagram for the electrified train sampling scenario of the present invention;

[0099] Figure 6 The end path diagram of the mechanical arm of the electric train sampling simulator of the present invention;

[0100] Figure 7 It is a Q-learning reward iteration graph of the present invention;

[0101] Figure 8 It is a schematic diagram of the improved seagull method process of the present invention;

[0102] Fig. 9 It is a comparison diagram before and after optimization of each joint position of the present invention;

[0103] Fig.10 It is a comparison diagram before and after the optimization of each joint speed of the present invention;

[0104] Fig.11 It is a comparison diagram before and after the optimization of the acceleration of each joint of the present invention;

[0105] Fig.12 It is a comparison diagram before and after the optimization of each joint jerk of the present invention;

[0106] Fig.13 This is a structural diagram of the robot arm obstacle avoidance path planning system based on reinforcement learning according to the present invention. DETAILED DESCRIPTION

[0107] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0108] It is understood that the terms "first", "second", etc. used in this application may be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish a first element from another element. For example, without departing from the scope of this application, a first xx script may be referred to as a second xx script, and similarly, a second xx script may be referred to as a first xx script.

[0109] The present invention provides Figure 1 The obstacle avoidance path planning method for a robotic arm based on reinforcement learning is implemented by executing the following steps:

[0110] Step S1, using the DH method to establish the DH model of the robot arm according to the initial state of the robot arm, input the starting position, obstacle position and target position of the robot arm in the form of three-dimensional coordinates, use the AABB bounding box method to simplify the obstacles, and at the same time expand the cylindrical connecting rod model of the robot arm by a predetermined radius, and optimize the collision detection in combination with the cylindrical connecting rod model of the robot arm.

[0111] Specifically, Figure 2 The figure shows a schematic diagram of the DH modeling method. The DH modeling method is used to establish the kinematic model of each robot arm. The coordinate system is built at the next joint of the connecting rod. The connecting rod transformation matrix is ​​obtained from the four connecting rod parameters, and then the position and posture of the end of the robot arm are gradually derived. The spatial position relationship between the calculated cylinder and the cuboid is transformed into the position relationship between the calculated line segment and the cuboid, which reduces the calculation complexity and improves the efficiency of collision detection. Figure 3 Shown is a schematic diagram of the six-degree-of-freedom robotic arm link coordinate system.

[0112] Step S2: Based on Q learning, the path of the end of the robot arm is planned, the state and action set of the end of the robot arm are defined, and a reward function is established to ensure that the robot arm can effectively move to the target point while avoiding obstacles. The strategy is used to select actions and a triple obstacle avoidance strategy is introduced.

[0113] Specifically, by using Q learning to plan the path of the end of the robot arm, define the state and action set of the end of the robot arm, set the reward function, and update the reward function in the process of the robot arm moving to act on the reinforcement learning algorithm, give rewards when reaching the target point, and give penalties when encountering obstacles. The closer the distance to the target point, the more rewards are given, ensuring that the robot arm can effectively move to the target point while avoiding obstacles. The details will be explained in detail later. The strategy is used to select actions, and a triple obstacle avoidance strategy is introduced to dynamically adjust the greediness, step size and RRT* algorithm to avoid obstacles. The triple obstacle avoidance strategy can effectively avoid local optimal solutions while ensuring safety, improve the success rate and efficiency of path planning, and significantly enhance the autonomous obstacle avoidance capability of the robot arm in complex environments.

[0114] Step S3, use the 3-5-3 polynomial interpolation algorithm to plan the trajectory of each joint of the robotic arm, set the speed, acceleration and jerk constraints, fit the discrete path points obtained by path planning to obtain a smooth and fast joint trajectory, improve the Seagull algorithm, and use the improved Seagull algorithm to optimize the joint trajectory.

[0115] Specifically, the 3-5-3 polynomial interpolation algorithm can generate a smooth, efficient trajectory for the robot that meets all motion constraints, thereby improving the operating performance and accuracy of the robot. Speed, acceleration and jerk constraints are set to ensure that the trajectory is smooth and meets physical constraints. Because trajectory optimization involves complex multi-objective optimization problems, the algorithm needs to have a strong search capability. By optimizing the trajectory using the improved Seagull algorithm, the optimal solution to the problem can be effectively found, which is particularly important for the trajectory optimization problem of the robot.

[0116] Furthermore, path planning for the end of the robot arm is performed based on Q learning, including the following steps:

[0117] Set the coordinate state S of the end of the robot arm to:

[0118] ,

[0119] Among them, x, y, and z are the coordinates of the end of the robot in space, n is the number of times the end of the robot moves in space, and the end of the robot moves one step in the positive or negative direction of each coordinate axis. The moving action set A is defined as follows: ,in, Respectively represent the moving step length of the end of the robot arm in the X, Y, and Z axis directions;

[0120] Based on a first real-time distance between obstacles at the end of the robotic arm and a second real-time distance between the end of the robotic arm and the target point, a reward function is established to guide the robotic arm to move away from the obstacle and toward the target point;

[0121] During the movement of the robot arm, the Euclidean distance from the end of the robot arm to the target point is also used to update the reward function to speed up learning;

[0122] In Q-learning, according to the next state , select the maximum Q value that can be obtained in the next state Multiply by the discount factor plus the reward value As the latest Q, the rule for updating the Q value is defined as:

[0123] ,

[0124] in, is the learning rate of Q learning, is the discount factor, The maximum Q value that can be obtained by taking an action for the next state, Indicates the actions that can be taken in the next state. refers to the next state, A represents the action taken in the current state, S refers to the current state, Refers to the reward value calculated according to the reward function;

[0125] Based on the Q value and reward function, The action selection strategy selects the next action. The action selection strategy sets the greedy threshold Determine how each action is selected. The value range is from 0 to 1;

[0126] When the robot is trapped in a local optimum and cannot find an escape path through environmental rewards, a triple obstacle avoidance strategy is introduced. According to the real-time distance between the end of the robot arm and the obstacle, the greediness and step size of the Q learning algorithm are dynamically adjusted, and the RRT* algorithm is used to avoid obstacles and obtain an escape path. Then, Q learning is used to continue exploring the optimal path.

[0127] After finding a collision-free path through Q learning, the path of each joint is obtained by inverse dynamics and a trajectory is generated. The connecting rod of the robot arm is checked for collision based on each point on the trajectory. If there is no collision, all groups of kinematic inverse solutions are sorted from small to large according to the size of the angle change, and the group of kinematic inverse solutions with the smallest angle change is selected. If a collision occurs, the next group of kinematic inverse solutions is selected for collision detection until there is no collision. If all groups of kinematic inverse solutions will collide, the corresponding points will be regarded as obstacles and the path planning will be re-performed.

[0128] Specifically, Figure 4 The following is a flow chart of the Q learning algorithm: Figure 5 The following is a simplified modeling diagram of an electrified train sampling scenario. Figure 6 Sample the simulated robot end path diagram for the electric train. S represents the coordinate state of the robot end. The robot can move one step in the positive or negative direction of each coordinate axis. There are 6 actions in total, which constitute the mobile action set A. Initialize the Q table to store the Q value of the state-action pair and set the learning rate , discount factor ,based on The next action is selected based on the current state, the selected action is executed, and the reward and the new state are observed. The Q value of the state-action pair is updated using the Q learning finer rules, and the Q value is checked to see if it converges or reaches the predetermined number of iterations. If the Q value converges or the number of iterations reaches the upper limit, the learning is stopped. Otherwise, the next action is selected based on the current state, such as Figure 7 Shown is a graph of Q-learning reward iterations.

[0129] In the process of path planning using the Q-learning algorithm, the probability of action selection may lead to collisions. When trapped in the local optimum and unable to find an escape path through environmental rewards, a triple obstacle avoidance strategy is introduced. According to the real-time distance between the end of the robot arm and the obstacle, the greediness and step size of the Q-learning algorithm are dynamically adjusted, and the RRT* algorithm is used to avoid obstacles and obtain an escape path, thereby improving the obstacle avoidance efficiency. Q-learning is then used to continue exploring the optimal path.

[0130] The path generation trajectory of each joint is obtained through inverse dynamics, collision detection is performed on each point on the trajectory, and the collision-free kinematic inverse solution is selected.

[0131] Since the robot arm can move one step in the positive or negative direction of each coordinate axis, there are a total of 6 actions that make up the moving action set A. A reward function BR is established to guide the robot arm away from obstacles and move toward the target point. The reward function focuses on the distance between the robot arm and the obstacle, with the purpose of avoiding collision. The reward given is based on whether the safe distance is reached to ensure the safety of path planning. The specific rules of the reward function will be explained in detail later. The Euclidean distance from the end of the robot arm to the target point is also used to update the reward function to speed up learning.

[0132] The action selection strategy helps the algorithm learn efficiently and make optimal decisions in complex environments by finding a balance between exploration and exploitation.

[0133] Through the above implementation steps, data is collected during the execution process to strengthen the learning of the Q learning algorithm. Through continuous learning and adaptation, the obstacle avoidance strategy and path planning of the robot arm are optimized to improve the overall performance.

[0134] Furthermore, the reward rule of the reward function is:

[0135] Use the first formula to calculate the first real-time distance between the end of the robotic arm and the obstacle , the first formula is:

[0136] ,

[0137] in, are the coordinate positions of the end of the robot arm at the i-th moment, are the coordinate positions of the center points of the obstacles respectively, and the reward function is expressed by the second formula:

[0138] ,

[0139] in, is the first real-time distance between the end of the robotic arm and the obstacle, is the safe distance between the end of the robot arm and the obstacle, is the coordinate position of the end of the robot arm at the i-th moment, is the coordinate position of the target point. If the end of the robot reaches the target point, that is When setting rewards If the first real-time distance is less than or equal to the safety distance, set a penalty If the first real-time distance is greater than the safety distance, it is considered as an empty run and a penalty is set. .

[0140] Specifically, by comparing the first real-time distance and the safety distance, if the end of the robot arm reaches the target point, a larger reward is given; if the first real-time distance is less than or equal to the safety distance, it means that the end of the robot arm is closer to the obstacle and a penalty is given; if the second real-time distance is greater than the safety distance but the target point is not reached, it means that the distance between the end of the robot arm and the obstacle is less than the distance to the target point but the target point is not reached, which is considered as an empty run and a small penalty is given to ensure the safety of path planning.

[0141] Furthermore, the Euclidean distance from the end of the robot arm to the target point is used to update the reward function to speed up the learning speed, including the following steps:

[0142] Use the third formula to calculate the starting distance from the starting point of the end of the robot arm to the target point , the third formula is:

[0143] ,

[0144] in, is the coordinate of the starting point of the robot arm,

[0145] Use the fourth formula to calculate the Euclidean distance from the end of the robot arm to the target point at the i-th moment. The Euclidean distance is also the second real-time distance , the fourth formula is:

[0146] ,

[0147] in, is the coordinate of the target point;

[0148] In order to guide the end of the robot arm to move toward the target point, the reward function is updated. The specific update rule is expressed by the fifth formula:

[0149] ,

[0150] in, As a reward coefficient to assist learning, Euclidean distance is used to assist learning. Rewards are given based on the difference between the real-time distance between the state and the target point and the fixed linear distance. The closer the current state is to the target, the more rewards are obtained. When the real-time distance is greater than the initial distance, the reward value becomes a penalty, thereby motivating the state to move toward the target point and improving learning efficiency.

[0151] Specifically, Euclidean distance is used to assist learning, and rewards are given according to the difference between the second real-time distance between the current state of the end of the robotic arm and the target point and the starting distance. The closer the end of the robotic arm is to the target point, the more rewards are obtained. When the second real-time distance is greater than the starting distance, the reward value becomes a penalty, thereby motivating the state to move toward the target point and improving learning efficiency.

[0152] Furthermore, using The action selection strategy selects the next action, which includes the following steps:

[0153] Generate a random number between 0 and 1 , and the greedy threshold Compare, if Less than or equal to , randomly select an action from the set of mobile actions Execution, indicating random exploration of the environment, if Greater than , select the action with the largest Q value from the mobile action set to execute, indicating the utilization of existing experience, The strategy is expressed by the sixth formula, which is:

[0154] ,

[0155] Expressed using the seventh formula, the seventh formula is:

[0156] ,

[0157] Among them, k is the number of explorations, is the actual number of learning times, and M is the specified number of iterations.

[0158] Specifically, Parameters in action selection strategy The setting reflects the balance of the "exploration-exploitation" trade-off in the reinforcement learning process. Taking a larger value can improve the randomness of action selection, which is conducive to fully exploring the environment. As learning deepens, Gradually decreases, the agent tends to choose actions with higher Q values ​​in previous learning, and turns to the stage of using existing experience. The dynamic adjustment of the value realizes the organic unity of exploration and utilization and ensures the convergence of the Q learning algorithm.

[0159] Furthermore, the triple obstacle avoidance strategy includes the following steps:

[0160] Get the first real-time distance between the end of the robotic arm and the obstacle ,Compare With the first threshold , the second threshold and the third threshold The size of , increase the greedy threshold ,like , reduce the moving step size, if , start the RRT* escape strategy, use the RRT* algorithm to obtain the escape path to avoid collision, the strategy randomly selects a direction and explores a node with a step length p along the direction, gradually constructing local random numbers, , and when the distance to the target point is closer, stop the RRT* escape strategy and exit, provide a path to leave the obstacle and approach the target point, and use Q learning to continue exploring the best path.

[0161] Specifically, the triple obstacle avoidance strategy selects an obstacle avoidance strategy according to the distance to the obstacle, and avoids obstacles by dynamically adjusting the greediness, step size, and RRT* algorithm of the Q-learning algorithm. It combines the advantages of Q-learning and sampling optimization, and effectively solves the problem of possible collision and falling into local optimality in Q-learning during path planning. Since the obstacle avoidance strategy is only activated after a collision is detected, the randomness of the obstacle avoidance strategy can be reduced, which can reduce the adverse effects on the convergence of Q-learning, thereby ensuring the safety and effectiveness of the algorithm in the path planning process.

[0162] Furthermore, the 3-5-3 polynomial interpolation algorithm is selected for time optimization, including the following steps:

[0163] Determine the starting point, intermediate path point and end point of the joint motion. According to the design and performance of the robot arm, set the maximum speed, maximum acceleration and maximum jerk of each joint. For joint i, use the 3-5-3 polynomial interpolation formula to describe the angular position change of joint i in three time periods. The polynomial interpolation formula is:

[0164] ,

[0165] in, are the joint angle positions of joint i in three time periods, are the unknown coefficients of the general polynomial formula, t is the time variable, and the relationship between the unknown coefficients and the interpolation points is derived based on the conditions of the trajectory planning problem: , where the mathematical model of X is:

[0166] ,

[0167] The mathematical model is:

[0168] ,

[0169] The mathematical model of type F is:

[0170] ,

[0171] Among them, F is the function matrix about time t, X is the interpolation point vector, are the 4 path points of joint i, is the coefficient vector;

[0172] The time-impact optimal trajectory planning uses time and impact as the variables to be optimized and satisfies the speed and acceleration constraints:

[0173] ,

[0174] in, is the maximum velocity of the jth joint, is the maximum acceleration of the jth joint, is the maximum jerk of the jth joint, and the overall running time of the robot is set to:

[0175] ,

[0176] The total impact value of each joint of the robot arm is set as:

[0177] ,

[0178] Where T is the total running time, is the acceleration. To ensure that the actual movement speed and acceleration of the robot arm are within the specified range, a convention function is set:

[0179] ,

[0180] in, are the actual velocity and acceleration of the i-th joint, is the constraint value of the actual speed, is the acceleration constraint value. To ensure the stability of the trajectory, the initial speed of the robot arm and initial acceleration All are set to 0;

[0181] The weight method is used to transform the multi-objective optimization problem into a single-objective optimization problem. The mathematical model of the weight method is:

[0182] ,

[0183] in, is the weight of the time term, , As coefficient, introduce coefficient Make the order of magnitude of the time term and the impact term consistent, and f(t) is the comprehensive optimization value of the time term and the impact term.

[0184] Specifically, the polynomial interpolation method in step 3-5-3 can not only generate a smooth trajectory for the robot, but also optimize the movement time of the robot and improve the operation efficiency under the premise of satisfying dynamic constraints. Fig. 9 The following is a comparison of the joint position before and after optimization. Fig.10 The following is a comparison of the joint speeds before and after optimization. Fig.11 The following is a comparison of the acceleration of each joint before and after optimization. Fig.12 The figure shows the comparison of the acceleration of each joint before and after optimization.

[0185] Furthermore, the Seagull algorithm is improved, including the following steps:

[0186] Use cubic chaotic mapping to generate the chaotic sequence of the initial population to obtain the chaotic sequence points and set the control parameters , and generate a chaotic sequence according to the control parameters, and search for the global optimal solution through the following formula:

[0187] ,

[0188] in, is the control parameter, n is the number of iterations, and the chaotic sequence generated by x is converted into reverse points through the lens imaging reverse refraction mechanism. The fitness value of the reverse point is evaluated, the population is sorted according to the fitness value, and the optimal reverse point is selected from the sorted reverse points as the initial solution.

[0189] Specifically, the control parameters Taking 2.595, the initialization process of the Seagull optimization algorithm is improved, and a population initialization method combining cubic chaotic mapping and lens imaging reverse refraction is designed, which can obtain a more uniform and better initial population and improve the global search performance of the algorithm. Among them, the cubic chaotic mapping can produce a population distribution with randomness and divergence, covering different areas of the search space and increasing population diversity. The reverse refraction mechanism can generate a new population with the opposite distribution from the current population, expand the coverage, and avoid premature convergence of the population. The fitness sorting retains the better solution, which can improve the overall quality of the initial population and create a good starting point for subsequent iterations. The two mechanisms are used together to obtain an initial population with both diversity and quality, which is conducive to improving the global search capability of the algorithm.

[0190] Furthermore, the Seagull optimization algorithm is improved, and the following steps are also included:

[0191] The migration of seagulls meets three conditions: avoiding collisions, advancing direction, and seagulls approaching the optimal position. The conditional model for avoiding collisions is:

[0192] ,

[0193] ,

[0194] in, refers to a new position where it will not collide with other seagulls. represents the attack position of the seagull, H is the behavior variable, k represents the number of iterations, m represents the maximum number of iterations, and the introduction of parameters To control the frequency of H by Linearly decreases to 0, the conditional model in the forward direction is:

[0195] ,

[0196] ,

[0197] in, is the current moving direction of the seagull, This is the best position found by the seagull. b represents the best. B is introduced to balance local and global exploration. is a random coefficient and , the mathematical model of the seagull approaching the optimal position is:

[0198] ,

[0199] in, For the new position reached by the seagull, the attack position of the seagull is optimized and updated through the following mathematical model:

[0200] ,

[0201] ,

[0202] ,

[0203] in, To improve the position of the attack of the rear seagull, Indicates improvement, D k-1 is the position of the seagull at the last moment, is the three-dimensional coordinate of the seagull, Because the attack position of the seagull at this moment has not been improved, The optimal position found by the seagull at the last moment, is the historical optimal position of the seagull at the last moment, G represents the past time, To determine the threshold for the update method, Both The random number inside, is the inertia weight, is the learning rate.

[0204] Specifically, based on the improvement of the seagull optimization algorithm, a trajectory optimization based on the improved seagull algorithm is designed, and a new seagull position attack method is proposed. The principle is to simulate the two most important behavior modes of seagulls, migration and attack. During the migration process, seagulls will fly in different positions to avoid collisions. In a group, each seagull will move towards the location with the most abundant food to change its own position. In the process of looking for food, seagulls often attack other migratory birds. The migration and attack behaviors of seagulls can be described by the following three mathematical models, namely avoiding collisions, forward direction and seagulls approaching the optimal position. The seagull algorithm is improved by the above three models. Take 0.8, Take 1.5 for both. Figure 8 Shown is a schematic diagram of the improved Seagull method process.

[0205] According to another aspect of the embodiment of the present invention, Fig.13 As shown, a robot arm obstacle avoidance path planning system based on reinforcement learning is also provided, including a model building module, a path planning module and a trajectory optimization module, which are used to implement the robot arm obstacle avoidance path planning method based on reinforcement learning as described above. The specific functions of each module are as follows:

[0206] The model building module uses the DH method to build the DH model of the robot arm according to the initial state of the robot arm, inputs the starting position of the robot arm, the obstacle position and the target position in the form of three-dimensional coordinates, uses the AABB bounding box method to simplify the obstacles, and expands the cylindrical connecting rod model of the robot arm by a predetermined radius, and optimizes the collision detection in combination with the cylindrical connecting rod model of the robot arm;

[0207] The path planning module plans the path of the end of the robot arm based on Q learning, defines the state and action set of the end of the robot arm, and establishes a reward function to ensure that the robot arm can effectively move to the target point while avoiding obstacles. Strategy for action selection, while introducing triple obstacle avoidance strategy;

[0208] The trajectory optimization module uses the 3-5-3 polynomial interpolation algorithm to plan the trajectory of each joint of the robot arm, sets the velocity, acceleration and jerk constraints, fits the discrete path points obtained by path planning to obtain a smooth and fast joint trajectory, improves the Seagull algorithm, and uses the improved Seagull algorithm to optimize the joint trajectory.

[0209] In summary, the method and system for obstacle avoidance path planning of a manipulator based on reinforcement learning of the present invention include establishing a manipulator DH model according to the initial state, inputting the starting position of the manipulator movement, the obstacle position and the target position; based on reinforcement learning, performing path planning of the end of the manipulator, incorporating the improved RRT* algorithm, and improving the efficiency of autonomous obstacle avoidance; incorporating the 3-5-3 polynomial interpolation algorithm to plan the trajectory of each joint, setting the speed, acceleration and jerk constraints of each joint of the manipulator, and improving the Seagull algorithm, fitting the discrete path points obtained by path planning to obtain a smooth and fast joint trajectory. The present invention can solve the problems of high time cost of training the existing reinforcement learning algorithm and low success rate of autonomous obstacle avoidance when both impact optimization and time optimization are required.

[0210] It should be understood that, although each step in the flow chart of each embodiment of the present invention is shown in sequence according to the indication of the arrow, these steps are not necessarily performed in sequence according to the order indicated by the arrow. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, at least a portion of the steps in each embodiment may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0211] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0212] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0213] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

[0214] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A robot arm obstacle avoidance path planning method based on reinforcement learning, characterized in that: The steps include: According to the initial state of the robot arm, the DH model of the robot arm is established using the DH method. The starting position, obstacle position and target position of the robot arm are input in the form of three-dimensional coordinates. The obstacles are simplified using the AABB bounding box method. At the same time, the cylindrical connecting rod model of the robot arm is expanded by a predetermined radius, and the collision detection is optimized in combination with the cylindrical connecting rod model of the robot arm. Based on Q learning, the path planning of the end of the robot arm is carried out, the state and action set of the end of the robot arm are defined, and the reward function is established to ensure that the robot arm can effectively move to the target point while avoiding obstacles. Strategy for action selection, while introducing triple obstacle avoidance strategy; The trajectories of the joints of the robot arm are planned by using a 3-5-3 polynomial interpolation algorithm, and speed, acceleration and jerk constraints are set. The discrete path points obtained by path planning are fitted to obtain smooth and fast joint trajectories, and the Seagull algorithm is improved, and the joint trajectories are optimized by using the improved Seagull algorithm. Among them, the path planning of the end of the robot arm based on Q learning includes the following steps: The coordinate state S of the end of the robot arm is set to: , Among them, x, y, z are the coordinates of the end of the robot in space, n is the number of times the end of the robot moves in space, and the end of the robot moves one step in the positive or negative direction of each coordinate axis. The movement action set A is defined as follows: ,in, Respectively represent the moving step lengths of the end of the robot arm in the X, Y, and Z axis directions; Based on a first real-time distance between the obstacle at the end of the robotic arm and a second real-time distance between the end of the robotic arm and the target point, establishing a reward function to guide the robotic arm to move away from the obstacle and toward the target point; During the movement of the robotic arm, the reward function is updated by using the Euclidean distance from the end of the robotic arm to the target point to speed up the learning speed; In Q-learning, according to the next state , select the maximum value that can be obtained in the next state value Multiply by the discount factor plus the reward value As the latest Q value, the rule for updating the Q value is defined as: , in, is the learning rate of Q learning, is the discount factor, The maximum Q value that can be obtained by taking an action for the next state, Indicates the actions that can be taken in the next state. refers to the next state, A represents the action taken in the current state, S refers to the current state, refers to the reward value calculated according to the reward function; Based on the Q value and the reward function, The action selection strategy selects the next action by setting a greedy threshold Determine how each action is selected. The value range is from 0 to 1; When the robot is trapped in a local optimum and cannot find an escape path through environmental rewards, a triple obstacle avoidance strategy is introduced. According to the real-time distance between the end of the robot arm and the obstacle, the greediness and step size of the Q learning algorithm are dynamically adjusted, and the RRT* algorithm is used to avoid obstacles and obtain an escape path. Then, Q learning is used to continue exploring the optimal path. After finding a collision-free path through Q learning, the path of each joint is obtained by inverse dynamics and a trajectory is generated. The connecting rod of the robot arm is subjected to collision detection based on each point on the trajectory. If there is no collision, all groups of kinematic inverse solutions are sorted from small to large according to the size of the angle change, and a group of kinematic inverse solutions with the smallest angle change is selected. If a collision occurs, the next group of kinematic inverse solutions is selected for collision detection until there is no collision. If the kinematic inverse solutions of all groups collide, the corresponding points are regarded as obstacles and the path planning is performed again. Among them, the reward rule of the reward function is: Calculate the first real-time distance between the end of the robotic arm and the obstacle using the first formula , the first formula is: , in, are the coordinate positions of the end of the robot arm at the i-th moment, are the coordinate positions of the center points of the obstacles respectively, and the reward function is expressed by the second formula, which is: , in, is the first real-time distance between the end of the robotic arm and the obstacle, is the safe distance between the end of the robotic arm and the obstacle, is the coordinate position of the end of the robotic arm at the i-th moment, is the coordinate position of the target point. If the end of the robot arm reaches the target point, that is, When setting rewards If the first real-time distance is less than or equal to the safety distance, set a penalty If the first real-time distance is greater than the safety distance, it is considered as an empty run and a penalty is set. ; Wherein, using the Euclidean distance from the end of the robot arm to the target point to update the reward function to speed up the learning speed includes the following steps: The third formula is used to calculate the starting distance from the starting point of the end of the robot arm to the target point. , the third formula is: , in, is the coordinate of the starting point of the robot arm, The fourth formula is used to calculate the Euclidean distance from the end of the robot arm to the target point at the i-th moment, and the Euclidean distance also refers to the second real-time distance , the fourth formula is: , in, is the coordinate of the target point; In order to guide the end of the robot arm to move toward the target point, the reward function is updated. The specific update rule is expressed by the fifth formula: , in, The reward coefficient is used to assist learning. The Euclidean distance is used to assist learning. Rewards are given based on the difference between the real-time distance between the state and the target point and the fixed linear distance. The closer the current state is to the target, the more rewards are obtained. When the real-time distance is greater than the initial distance, the reward value becomes a penalty, thereby motivating the state to move toward the target point and improving learning efficiency. Among them, the use of The action selection strategy selects the next action, which includes the following steps: Generate a random number between 0 and 1 , and the greedy threshold Compare, if Less than or equal to , randomly select an action from the set of mobile actions Execution, indicating random exploration of the environment, if Greater than , select the action with the largest Q value from the mobile action set to execute, which means the utilization of existing experience. The strategy is expressed by the sixth formula, which is: , Expressed by the seventh formula, the seventh formula is: , Among them, k is the number of explorations, is the actual number of learning times, and M is the specified number of iterations; The triple obstacle avoidance strategy includes the following steps: Obtaining the first real-time distance between the end of the robotic arm and the obstacle , compared with the With the first threshold , the second threshold and the third threshold The size of , increase the greedy threshold ,like , reduce the moving step size, if , start the RRT* escape strategy, use the RRT* algorithm to obtain the escape path to avoid collision, the strategy randomly selects a direction and explores a node with a step length p along the direction, gradually constructs a local random number, and then , and when the distance to the target point is closer, stop the RRT* escape strategy and exit, provide a path to leave the obstacle and approach the target point, and continue to explore the best path using Q learning; Among them, the 3-5-3 polynomial interpolation algorithm is used for time optimization, including the following steps: Determine the positions of the starting point, intermediate path points and end points of the joint motion. According to the design and performance of the robot arm, set the maximum speed, maximum acceleration and maximum jerk of each joint. For joint i, use the 3-5-3 polynomial interpolation formula to describe the angular position change of the joint i in three time periods. The polynomial interpolation formula is: , in, are the joint angle positions of joint i in three time periods, are the unknown coefficients of the polynomial interpolation formula, t is the time variable, and the relationship between the unknown coefficients and the interpolation points is derived based on the conditions of the trajectory planning problem: , where the mathematical model of X is: , The mathematical model is: , The mathematical model of type F is: , Among them, F is the function matrix about time t, X is the interpolation point vector, are the 4 path points of joint i, is the coefficient vector; The time-impact optimal trajectory planning uses time and impact as the variables to be optimized and satisfies the speed and acceleration constraints: , in, is the maximum velocity of the jth joint, is the maximum acceleration of the jth joint, is the maximum jerk of the jth joint, and the overall running time of the robot is set to: , The total impact value of each joint of the robot arm is set as: , Where T is the total running time, is the acceleration. To ensure that the actual movement speed and acceleration of the robot arm are within the specified range, a convention function is set: , in, are the actual velocity and acceleration of the i-th joint, is the constraint value of the actual speed, is the acceleration constraint value. To ensure the stability of the trajectory, the initial speed of the robot arm and initial acceleration All are set to 0; The weight method is used to transform the multi-objective optimization problem into a single-objective optimization problem. The mathematical model of the weight method is: , in, is the weight of the time term, , As coefficient, introduce coefficient Make the order of magnitude of the time term and the impact term consistent, and f(t) is the comprehensive optimization value of the time term and the impact term.

2. The method according to claim 1, characterized in that The improvement of the Seagull algorithm includes the following steps: Use cubic chaotic mapping to generate the chaotic sequence of the initial population to obtain the chaotic sequence points and set the control parameters , and generate a chaotic sequence according to the control parameters, and search for the global optimal solution through the following formula: , in, is the control parameter, n is the number of iterations, and x is the chaotic sequence generated. The chaotic sequence points are converted into reverse points through the lens imaging reverse refraction mechanism, and the fitness value of the reverse points is evaluated. The population is sorted according to the fitness value, and the optimal reverse point is selected from the sorted reverse points as the initial solution.

3. The method according to claim 1, wherein the Seagull optimization algorithm is improved, further comprising the following steps: The migration of seagulls meets three conditions: avoiding collision, advancing direction and seagulls approaching the optimal position. The conditional model for avoiding collision is: , , in, refers to a new position where it will not collide with other seagulls. represents the attack position of the seagull, H is the behavior variable, k represents the number of iterations, m represents the maximum number of iterations, and the introduction of parameters To control the frequency of H by Linearly decreases to 0, the conditional model in the forward direction is: , , in, is the current moving direction of the seagull, This is the best position found by the seagull. b represents the best. B is introduced to balance local and global exploration. is a random coefficient and , the mathematical model of the seagull approaching the optimal position is: , in, For the new position reached by the seagull, the attack position of the seagull is optimized and updated through the following mathematical model: , , , in, To improve the position of the attack of the rear seagull, Indicates improvement, D k-1 is the position of the seagull at the last moment, is the three-dimensional coordinate of the seagull, Because the attack position of the seagull at this moment has not been improved, The optimal position found by the seagull at the last moment, is the historical optimal position of the seagull at the last moment, G represents the past time, To determine the threshold for the update method, Both The random number inside is the inertia weight, is the learning rate.

4. A robot arm obstacle avoidance path planning system based on reinforcement learning, used to implement the method according to any one of claims 1 to 3, characterized in that: Includes the following modules: The model building module uses the DH method to build the DH model of the robot arm according to the initial state of the robot arm, inputs the starting position of the robot arm, the obstacle position and the target position in the form of three-dimensional coordinates, uses the AABB bounding box method to simplify the obstacles, and expands the cylindrical connecting rod model of the robot arm by a predetermined radius, and optimizes the collision detection in combination with the cylindrical connecting rod model of the robot arm; The path planning module plans the path of the end of the robot arm based on Q learning, defines the state and action set of the end of the robot arm, and ensures that the robot arm moves effectively to the target point while avoiding obstacles through the reward function. Strategy for action selection, while introducing triple obstacle avoidance strategy; Among them, the path planning of the end of the robot arm based on Q learning includes the following steps: The coordinate state S of the end of the robot arm is set to: , Among them, x, y, z are the coordinates of the end of the robot in space, n is the number of times the end of the robot moves in space, and the end of the robot moves one step in the positive or negative direction of each coordinate axis. The movement action set A is defined as follows: ,in, Respectively represent the moving step lengths of the end of the robot arm in the X, Y, and Z axis directions; Based on a first real-time distance between the obstacle at the end of the robotic arm and a second real-time distance between the end of the robotic arm and the target point, establishing a reward function to guide the robotic arm to move away from the obstacle and toward the target point; During the movement of the robotic arm, the reward function is updated by using the Euclidean distance from the end of the robotic arm to the target point to speed up the learning speed; In Q-learning, according to the next state , select the maximum value that can be obtained in the next state value Multiply by the discount factor plus the reward value As the latest Q value, the rule for updating the Q value is defined as: , in, is the learning rate of Q learning, is the discount factor, The maximum Q value that can be obtained by taking an action for the next state, Indicates the actions that can be taken in the next state. refers to the next state, A represents the action taken in the current state, S refers to the current state, refers to the reward value calculated according to the reward function; Based on the Q value and the reward function, The action selection strategy selects the next action by setting a greedy threshold Determine how each action is selected. The value range is from 0 to 1; When the robot is trapped in a local optimum and cannot find an escape path through environmental rewards, a triple obstacle avoidance strategy is introduced. According to the real-time distance between the end of the robot arm and the obstacle, the greediness and step size of the Q learning algorithm are dynamically adjusted, and the RRT* algorithm is used to avoid obstacles and obtain an escape path. Then, Q learning is used to continue exploring the optimal path. After finding a collision-free path through Q learning, the path of each joint is obtained by inverse dynamics and a trajectory is generated. The connecting rod of the robot arm is subjected to collision detection based on each point on the trajectory. If there is no collision, all groups of kinematic inverse solutions are sorted from small to large according to the size of the angle change, and a group of kinematic inverse solutions with the smallest angle change is selected. If a collision occurs, the next group of kinematic inverse solutions is selected for collision detection until there is no collision. If the kinematic inverse solutions of all groups collide, the corresponding points are regarded as obstacles and the path planning is performed again. Among them, the reward rule of the reward function is: Calculate the first real-time distance between the end of the robotic arm and the obstacle using the first formula , the first formula is: , in, are the coordinate positions of the end of the robot arm at the i-th moment, are the coordinate positions of the center points of the obstacles respectively, and the reward function is expressed by the second formula, which is: , in, is the first real-time distance between the end of the robotic arm and the obstacle, is the safe distance between the end of the robotic arm and the obstacle, is the coordinate position of the end of the robotic arm at the i-th moment, is the coordinate position of the target point. If the end of the robot arm reaches the target point, that is, When setting rewards If the first real-time distance is less than or equal to the safety distance, set a penalty If the first real-time distance is greater than the safety distance, it is considered as an empty run and a penalty is set. ; Wherein, using the Euclidean distance from the end of the robot arm to the target point to update the reward function to speed up the learning speed includes the following steps: The starting distance from the starting point of the end of the robot arm to the target point is calculated using the third formula , the third formula is: , in, is the coordinate of the starting point of the robot arm, The fourth formula is used to calculate the Euclidean distance from the end of the robot arm to the target point at the i-th moment, and the Euclidean distance also refers to the second real-time distance , the fourth formula is: , in, is the coordinate of the target point; In order to guide the end of the robot arm to move toward the target point, the reward function is updated. The specific update rule is expressed by the fifth formula: , in, The reward coefficient is used to assist learning. The Euclidean distance is used to assist learning. Rewards are given based on the difference between the real-time distance between the state and the target point and the fixed linear distance. The closer the current state is to the target, the more rewards are obtained. When the real-time distance is greater than the initial distance, the reward value becomes a penalty, thereby motivating the state to move toward the target point and improving learning efficiency. Among them, the use of The action selection strategy selects the next action, which includes the following steps: Generate a random number between 0 and 1 , and the greedy threshold Compare, if Less than , randomly select an action from the set of mobile actions Execution, indicating random exploration of the environment, if Greater than , select the action with the largest Q value from the mobile action set to execute, which means the utilization of existing experience. The strategy is expressed by the sixth formula, which is: , Expressed by the seventh formula, the seventh formula is: , Among them, k is the number of explorations, is the actual number of learning times, and M is the specified number of iterations; The triple obstacle avoidance strategy includes the following steps: Obtaining the first real-time distance between the end of the robotic arm and the obstacle , compared with the With the first threshold , the second threshold and the third threshold The size of , increase the greedy threshold ,like , reduce the moving step size, if , start the RRT* escape strategy, use the RRT* algorithm to obtain the escape path to avoid collision, the strategy randomly selects a direction and explores a node with a step length p along the direction, gradually constructs a local random number, and then , and when the distance to the target point is closer, stop the RRT* escape strategy and exit, provide a path to leave the obstacle and approach the target point, and continue to explore the best path using Q learning; The trajectory optimization module uses a 3-5-3 polynomial interpolation algorithm to plan the trajectory of each joint of the robotic arm, sets speed, acceleration and jerk constraints, fits the discrete path points obtained by path planning to obtain a smooth and fast joint trajectory, improves the Seagull algorithm, and uses the improved Seagull algorithm to optimize the joint trajectory; Among them, the 3-5-3 polynomial interpolation algorithm is used for time optimization, including the following steps: Determine the positions of the starting point, intermediate path points and end points of the joint motion. According to the design and performance of the robot arm, set the maximum speed, maximum acceleration and maximum jerk of each joint. For joint i, use the 3-5-3 polynomial interpolation formula to describe the angular position change of the joint i in three time periods. The polynomial interpolation formula is: , in, are the joint angle positions of joint i in three time periods, are the unknown coefficients of the polynomial interpolation formula, t is the time variable, and the relationship between the unknown coefficients and the interpolation points is derived based on the conditions of the trajectory planning problem: , where the mathematical model of X is: , The mathematical model is: , The mathematical model of type F is: , Among them, F is the function matrix about time t, X is the interpolation point vector, are the 4 path points of joint i, is the coefficient vector; The time-impact optimal trajectory planning uses time and impact as the variables to be optimized and satisfies the speed and acceleration constraints: , in, is the maximum velocity of the jth joint, is the maximum acceleration of the jth joint, is the maximum jerk of the jth joint, and the overall running time of the robot is set to: , The total impact value of each joint of the robot arm is set as: , Where T is the total running time, is the acceleration. To ensure that the actual movement speed and acceleration of the robot arm are within the specified range, a convention function is set: , in, are the actual velocity and acceleration of the i-th joint, is the constraint value of the actual speed, is the acceleration constraint value. To ensure the stability of the trajectory, the initial speed of the robot arm and initial acceleration All are set to 0; The weight method is used to transform the multi-objective optimization problem into a single-objective optimization problem. The mathematical model of the weight method is: , in, is the weight of the time term, , As coefficient, introduce coefficient Make the order of magnitude of the time term and the impact term consistent, and f(t) is the comprehensive optimization value of the time term and the impact term.