Robot obstacle avoidance method based on WMSRL model
By combining SafeRL and the improved world model, online planning and Lagrangian methods are used to solve the problem of insufficient utilization efficiency of pose information and safety risks during robot movement, and achieve safe exploration and strategy convergence in the robot obstacle avoidance process. Improved security of reinforcement learning training and deployment.
Patent Information
- Application Number
- CN202410790268.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-07-10
- Filing Date
- 2024-06-19
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-06-19
AI Technical Summary
Existing model-free safety reinforcement learning methods do not utilize pose information efficiently during robot movement, making it difficult to achieve safe exploration. Moreover, traditional reinforcement learning algorithms have safety risks in the learning process, which may lead to the learning of dangerous strategies.
Using the WMSRL model, the SafeRL method is combined with the improved world model. By using online planning and temporal difference learning in the world model, combined with the Lagrangian method, the utilization efficiency of pose information during the robot movement is improved, and through the Dreamer V3 architecture Improve the accuracy of the cost model and achieve safe exploration during the robot's obstacle avoidance process.
It improves the policy convergence speed and security during robot movement, achieves security in the entire process of reinforcement learning training and deployment, and performs well in the Safety-Gymnasium benchmark test, with significant scalability and near-zero cost deployment. ability.
Smart Images

Figure CN118625809A
Abstract
Description
Technical Field
[0001] In this invention, the WMSRL model refers to the combination of the world model and the safe reinforcement learning method (SafeRL). The improved world model is used in the WMSRL model to fully improve the utilization efficiency of the posture information of the robot's motion process, so as to ensure the safety of the entire process of reinforcement learning training and deployment. Background Art
[0002] A mobile robot is a robot system composed of sensors, remote control operators and automatically controlled mobile carriers. Mobile robots have the function of mobility. They are more maneuverable and flexible than ordinary robots in replacing humans in dangerous and harsh environments and in environments that humans cannot reach. Robot obstacle avoidance is one of the most basic and key functions in robotics technology. It aims to ensure that robots do not collide during their movements. See "Mobile Robot System and Its Coordinated Control", author Cheng Lei, Huazhong University of Science and Technology Press, March 2014, pages 59-60 for an introduction to the coordinated control of robot motion. The motion coordination algorithm estimates the robot control output of the next cycle based on the current posture information of the robot, so as to solve the problem of avoiding collisions between robots or between robots and obstacles in the environment.
[0003] Traditional reinforcement learning algorithms need to explore during the learning process, exploring the environment without restrictions to generate the optimal control strategy. However, this unlimited exploration itself has extremely high safety risks, because the agent may learn dangerous strategies. Traditional reinforcement learning is learned in the entire parameter space, and safety cannot be guaranteed, that is, the strategy may exceed the safety boundary. Therefore, when developing reinforcement learning algorithms, it is necessary to pay attention to this safety risk and take necessary measures to ensure the safety of the strategy. For example, in the coordinated control of robot motion, if safety constraints are not considered, the robot may take dangerous actions, resulting in damage to the device, damage to surrounding objects, and even casualties. Therefore, when using deep reinforcement learning algorithms for control, safety constraints must be considered to ensure the safety of the strategy.
[0004] Reinforcement learning is a machine learning paradigm that maximizes numerical benefit signals through autonomous exploration. Unlike supervised learning, which is task-driven learning, and unsupervised learning, which is to find implicit structures in data, reinforcement learning strikes a balance between exploration and exploitation: in the exploration phase, the agent discovers more valuable action sequences and learns through interaction with the unknown environment; in the exploitation phase, the agent makes full use of existing experience data and learns strategies through these sampled data.
[0005] Safety reinforcement learning is a method that uses reinforcement learning methods to solve system safety problems. It combines technologies from the fields of reinforcement learning and security to ensure that the behavior of the agent during the learning process does not cause the system to be unsafe. In safety reinforcement learning, the agent learns how to make correct and safe decisions by interacting with the environment. The agent can be a single individual or multiple individuals. During the reinforcement learning process, the agent optimizes its strategy by performing actions and receiving reward signals. Safety reinforcement learning takes into account the impact of the agent's strategy on system safety and achieves a balance between optimal safety and utility by adopting different strategies. In safety reinforcement learning, it is also necessary to consider security measurements and modeling security threats to ensure that the system can make correct responses and decisions when facing different security threats. Summary of the invention
[0006] The present invention discloses a robot obstacle avoidance method based on the WMSRL model. Due to the insufficient utilization efficiency of the posture information in the robot motion process in the model-free safe reinforcement learning method (Safe Reinforcement Learning, SafeRL), it is difficult to achieve safe exploration. The present invention combines the SafeRL method with an improved world model (World Model), which aims to improve the utilization rate of posture information, thereby promoting the strategy convergence in the feasible domain faster, and minimizes the cost in the training and exploration process by using online planning in the world model.
[0007] A robot obstacle avoidance method based on the WMSRL model of the present invention is Figure 2 The WMSRL model is added to the robot motion coordination control module in the . The WMSRL model uses an improved world model to fully improve the utilization efficiency of the robot's motion posture information to ensure the safety of each posture of the robot's motion in the entire process of reinforcement learning training and deployment.
[0008] A robot obstacle avoidance method based on the WMSRL model of the present invention comprises the following steps:
[0009] Step 1: robot motion trajectory expansion and value estimation;
[0010] Step 2: The trade-off between rewards and costs of a safe trajectory;
[0011] Step 3: Safe online planning of robot motion trajectory based on Lagrangian method;
[0012] Step 4, construct the components of the world model of the robot's motion trajectory;
[0013] Step 5: Calculate the loss function of the world model;
[0014] Step 6: Strategy learning based on the actor-critic model. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a flow chart of the robot obstacle avoidance method based on the WMSRL model of the present invention.
[0016] Figure 2 It is a structural diagram of the coordinated control of robot motion.
[0017] Figure 3 These are the experimental results of SafeDreamer and baseline algorithms on visual input-based tasks.
[0018] Figure 4 SafeDreamer is compared with baseline algorithms in a visual roaming-based safety task.
[0019] Figure 5 SafeDreamer is compared with baseline algorithms in security tasks based on low-dimensional vector inputs. DETAILED DESCRIPTION
[0020] The present invention will be further described in detail below with reference to the accompanying drawings.
[0021] See also Figure 1 , Figure 2 As shown, a robot obstacle avoidance method based on the WMSRL model of the present invention is Figure 2 The WMSRL model is added to the robot motion coordination control module in the . The WMSRL model uses an improved world model to fully improve the utilization efficiency of the robot's motion process posture information to ensure the safety of the entire process of reinforcement learning training and deployment. The WMSRL model includes two parts. One part is the use of safe reinforcement learning methods in the process of safe exploration of robot posture information, and the other part is the application of the improved world model to the strategy learning of robot posture information.
[0022] See also Figure 1 As shown, a robot obstacle avoidance method based on the WMSRL model of the present invention includes the following steps:
[0023] 1. Safe reinforcement learning of robot posture information
[0024] Step 1: Robot motion trajectory expansion and reward value estimation and cost value estimation;
[0025] The present invention combines online planning and temporal difference learning to achieve safe exploration of robot motion during robot obstacle avoidance. In order to strike a balance between robot safe exploration and exploration performance, the present invention adopts the Lagrangian method. In addition, by using the Dreamer V3 (world model) architecture as a basis, the accuracy of the cost model of the world model is improved, thereby improving the robot's obstacle avoidance safety planning performance. Finally, the safe exploration algorithm processes vector and image inputs simultaneously, and has the versatility to process different types of data. The robot obstacle avoidance motion proposed in the present invention achieves cost minimization after training on the Safety-Gymnasium (translated as safety gymnasium) visual task benchmark by planning in a separately trained world model.
[0026] Compared with other algorithms (such as CPO, PPO-Lag), it has the following advantages:
[0027] (1) Our method is an algorithm that can effectively process low-dimensional input and visual input, and performs well in the Safety-Gymnasium benchmark test, achieving near-zero cost.
[0028] (2) The architecture of the proposed method has significant scalability, which is reflected in its compatibility with the original Lagrangian method and its seamless integration with the planning mechanism, giving full play to the ability of the world model to solve the problem of safe obstacle avoidance of the robot.
[0029] (3) The method of the present invention is an algorithm that achieves near-zero-cost deployment based on visual input.
[0030] In this paper, the safety reinforcement learning of robot obstacle avoidance based on the WMSRL model is modeled as a constrained Markov decision process (CMDP), namely , then at the current moment The state transition probability function under And the reward function .
[0031] Indicates taking action After that, from the current state Transfer to next state The transition probability.
[0032] Indicates the current state Execute an action and transfer to the next state Rewards received when.
[0033] In the present invention, let the state space Any state in , the initial state is recorded as .
[0034] In the present invention, let the action space Any action in .
[0035] Represents the state transition probability identifier.
[0036] Represents the reward set identifier.
[0037] represents the cost set, and ,in is the cost function, is the cost threshold, subscript Indicates the cost threshold identification number, represents the total number of cost thresholds. In the present invention, let the cost set Any cost is recorded as .
[0038] is the initial state distribution, and μ ( ⋅ ) : S → [ 0 , 1 ] .
[0039] is the discount factor, and .
[0040] is the current moment of the robot's motion.
[0041] is the moment before the robot moves.
[0042] is the last moment of the robot's movement.
[0043] In the present invention, a parameterized steady-state strategy is defined in The probability distribution of Also known as being in state Take action The probability of using Represents the set of all steady-state strategies, using Represents the state transition probability matrix. Any element in is represented by its state P π θ [ s t , s t + 1 ] ,and P π θ [ s t , s t + 1 ] = ∑ a ∈ A π θ ( a t ∣ s t ) ℙ ( s t + 1 ∣ s t , a t ) .
[0044] Represents the probability indicator under the steady-state strategy.
[0045] are the network parameters that need to be learned.
[0046] Indicates the real number space, the superscript Indicates the dimension.
[0047] P π θ [ s t , s t + 1 ] Represents the state element of the matrix.
[0048] Represents the actions taken under the steady-state strategy After that, from the current state Transfer to next state The state transition probability.
[0049] In the present invention, any element in the state transition probability matrix P π θ [ s t , s t + 1 ] By implementing a steady-state strategy From the current state Transfer to next state The probability of one-step state transition. When all elements complete one-step state transition, finally, As the initial state under the steady-state strategy The steady-state distribution of the Markov chain at the beginning, however, s 0 ∼ μ ( ⋅ ) [ d π θ μ ( s ) ] As the initial distribution under the steady-state strategy Discount status on access distribution.
[0050] represents the steady-state state of the Markov chain under the steady-state strategy.
[0051] Indicates the current time The discount factor below.
[0052] Indicates the current state under the steady-state strategy The transition probability.
[0053] is the initial state distribution, and μ ( ⋅ ) : S → [ 0 , 1 ] .
[0054] represents the initial distribution under the steady-state strategy Discount status on .
[0055] Among them, the infinite time discounted reward function is defined as:
[0056] J R ( π θ ) = [ ∑ t = 0 ∞ γ t R ( s t + 1 ∣ s t , a t ) ∣ s 0 ∼ μ , a t ∼ π θ ] ( 1 ) ;
[0057] represents the reward function.
[0058] [ ⋅ ] Indicates expected value.
[0059] Indicates the current time The discount factor below.
[0060] Indicates in status Execute an action and transfer to the next state Rewards received when.
[0061] is the initial state distribution, and μ ( ⋅ ) : S → [ 0 , 1 ] .
[0062] Represents the probability sign under the steady-state strategy.
[0063] Among them, the infinite time discounted cost function is defined as:
[0064] J i C ( π θ ) = [ ∑ t = 0 ∞ γ t c i ( s t + 1 ∣ s t , a t ) ∣ s 0 ∼ μ , a t ∼ π θ ] ( 2 ) ;
[0065] Subscript Indicates the cost threshold identification number.
[0066] Indicates in status Execute an action and transfer to the next state The discount price obtained when
[0067] Define a set of possible strategies for:
[0068] ;
[0069] is the cost threshold.
[0070] Among them, the goal of the constrained Markov model CMDP is to The optimal strategy for searching is:
[0071] ;
[0072] Represents the probability sign under the steady-state strategy.
[0073] Represents a set of feasible strategies.
[0074] represents the reward function.
[0075] In the present invention, according to the reward function in the constrained Markov model CMDP , combined with the coordinated control of multi-robot motion, Dreamer V3 (world model) is used to correct the state transition probability function of the robot motion obstacle avoidance process, and the safety reinforcement learning problem based on the robot world model is defined as follows:
[0076] ;
[0077] J ϕ R ( π θ ) = [ ∑ t = 0 ∞ γ t R ( s t + 1 ∣ s t , a t ) ∣ s 0 ∼ μ , s t + 1 ∼ ℙ ϕ ( ⋅ ∣ s t , a t ) , a t ∼ π θ ] ( 6 ) ;
[0078] J ϕ C ( π θ ) = [ ∑ t = 0 ∞ γ t c 定 ( s t + 1 ∣ s t , a t ) ∣ s 0 ∼ μ , s t + 1 ∼ ℙ ϕ ( ⋅ ∣ s t , a t ) , a t ∼ π θ ] ( 7 ) ;
[0079] Represents the probability sign under the steady-state strategy.
[0080] represents the set of all steady-state strategies, and .
[0081] Represents the reward function in the secure reinforcement learning model.
[0082] Represents the cost function in the secure reinforcement learning model.
[0083] Represents a specified obstacle avoidance safety constraint threshold.
[0084] Indicates in status Execute an action and transfer to the next state Rewards received when.
[0085] Indicates the initial state.
[0086] is the initial state distribution, and μ ( ⋅ ) : S → [ 0 , 1 ] .
[0087] is a parameterized world model.
[0088] Represents a specified cost function.
[0089] In the present invention, is a Parameterized world model, assuming the initial state From the true initial state distribution Then, . The world model will be used To sample trajectories, the sampled trajectories are used to estimate the rewards and costs required by the policy optimization algorithm. At the same time, the world model is used for online planning to ensure safer exploration.
[0090] In the present invention, the safety planning algorithm refers to the process of using the world model for online or offline planning to balance the reward return and cost reporting of the robot, where OSRP stands for Online Safety-Reward Planning and BSRP stands for Background Safety-Reward Planning. The design of OSRP is to combine model planning with safety constraints in safety tasks that rely only on vision. Specifically, the SR-MPC algorithm of the present invention uses the Constrained Cross-Entropy Method (CCEM) for planning and uses a reinforcement learning model to , , and In addition, the reward estimation is also used and price valuation and a reward-driven policy network π_θ to guide the planning process.
[0091] Represents a sequence of predicted states.
[0092] Represents the predicted kinetic state.
[0093] Represents the predicted reward value.
[0094] Represents the predicted cost value.
[0095] First, initialize the step length to The independent parameters of each action within the time range, that is, the action parameters ,in ; Next, use the world model to independently sample trajectories and estimate their infinite-time discounted rewards outside the planning horizon and the infinite time discounted cost , this estimate is obtained by introducing a bootstrap-based returns to achieve:
[0096] ;
[0097] ;
[0098] Indicates the current status.
[0099] Indicates the current status Reward value returns.
[0100] Superscript yes The value of returns.
[0101] Indicates the next state Reward value returns.
[0102] Represents the planning step length.
[0103] Indicates the current status The predicted reward value.
[0104] is the discount factor, and .
[0105] Indicates the next state The estimated reward return value.
[0106] Indicates to The estimated reward value for the state at this step.
[0107] In the present invention, the infinite time discount cost Can be used and to calculate.
[0108] In the present invention, the prediction of the cost model is used to To evaluate The total cost within the step is:
[0109] J ϕ C , H ( π θ ) = [ ∑ t t + H γ t C ϕ ( s t ) ∣ s t + 1 ∼ ( f ϕ , q ϕ ) , a t ∼ N ( μ J − 1 , ( σ J − 1 ) 2 × I ) ] ( 1 0 ) ;
[0110] Represents the planning step length.
[0111] Indicates the current time The discount factor below.
[0112] Represents a sequence model.
[0113] Indicates the current status The predicted cost value.
[0114] Represents the observation encoder.
[0115] Represents a normal distribution.
[0116] Represents the identity matrix.
[0117] is the action mean.
[0118] Superscript Indicates the total number of iterations, the number of iterations .
[0119] represents the action mean of the previous iteration.
[0120] represents the action variance of the previous iteration.
[0121] Use the cost value of all trajectories As An approximate estimate of is the round length. As a criterion for evaluating trajectory safety.
[0122] In the present invention, the reward values of all trajectories calculated in step 1 are and cost value It will be used in step 2.
[0123] Step 2: The trade-off between the reward value and cost value of the safe trajectory;
[0124] In the present invention, the trade-off between reward value and cost value is achieved in the following way: after calculating the cost value of all trajectories Afterwards, the number of safe trajectories is expressed as .if Lower than expected number of safe trajectories , it indicates that it is difficult to find a safe trajectory in the current state. Therefore, it becomes crucial to prioritize safety, and The value of becomes the sorting criterion, denoted as , and the entire set of sampled robot motion trajectories becomes the candidate action set On the contrary, if , it means that the trajectory that satisfies the safety constraints is relatively easy to find. Therefore, the reward value Used as sorting criteria , and the safe action trajectory The actions in the From the candidate action set , select the sorting criteria The corresponding maximum value, and the action sequence corresponding to the maximum value is used as the elite action ,in accordance with In the Get the first parameter in the iteration and the second parameter :
[0125] ;
[0126] ;
[0127] Represents the number of predefined elite actions.
[0128] Represents any predefined elite action.
[0129] After reaching the predetermined number of iterations After that, the robot motion planning process ends. At the current moment of each decision robot motion The mean of the first action of the planned action trajectory will be used as the action to be executed in the real environment.
[0130] Step 3: Safe online planning of robot motion trajectory based on Lagrangian method;
[0131] In the present invention, the criterion for evaluating the cost constraint in step 2 is , when the hazard detection field of view required in the robot's obstacle avoidance process exceeds the planning field of view, the planning process may not be able to ensure zero cost violations in complex vision-only tasks. To solve this problem, the present invention uses a cost critic to estimate the expected cost in the later stage of the planning process. In order to fully utilize the potential of the cost critic, the present invention integrates the PID Lagrangian method into the world model planning framework, thereby obtaining the Online Safety-Reward Planning (OSRP-Lag) algorithm of the present invention, which satisfies step 2 in step 2. Sorting criteria Adjust to ,in This means that when there are many safe trajectories in the robot motion planning process, the LAG-MPC algorithm of the present invention will dynamically adjust the Lagrange multiplier according to the robot's historical constraint violations, and continue to be cautious during safe exploration.
[0132] The robot motion data obtained using safe online planning in step 3 will be used to construct a world model of the robot's motion trajectory in step 4.
[0133] 2. Analyzing robot posture information using the improved world model
[0134] Step 4, construct the components of the world model of the robot's motion trajectory;
[0135] The improved world model is used to train the historical data of the robot's interaction with the environment from step 3. This data includes observations, actions, rewards, costs, and round continuation indicators, and the time length is , expressed as .
[0136] Indicates the current status.
[0137] Indicates the current action.
[0138] Indicates the next state.
[0139] Indicates the next reward.
[0140] Indicates the next generation price.
[0141] Indicates the continuation indicator of the next round.
[0142] In the present invention, the improved world model includes a sequential model denoted as , the observation encoder is denoted as The dynamic model is recorded as , the reward decoder is denoted as , the cost decoder is denoted as , the round continuation indicator decoder is recorded as and the observation decoder is denoted as .
[0143] represents the posterior distribution of the observed encoder predictions.
[0144] represents the prior distribution of the kinetic model predictions.
[0145] Represents the hidden state predicted by the sequence model.
[0146] Indicates the previous action.
[0147] Represents the observation state actually received in the environment.
[0148] Indicates the current reward.
[0149] Indicates the current price.
[0150] Indicates the continuation indicator of the current round.
[0151] A Gated Recurrent Unit (GRU) is used. For visual input, a Convolutional Neural Network (CNN) is used as the observation encoder. and observation decoder , while for low-dimensional inputs, a multi-layer perceptron (MLP) is used. The reward, cost, round continuation marker decoder and dynamics model are implemented using MLP. This world model can be understood as a sequence variational autoencoder VAE, where the output of the observation encoder acts as an approximate posterior, which first transforms the observation Encoded as the posterior distribution, i.e. Output , given the initial state and , and the previous action , loop status and , use the sequence model to predict the next cycle state during world model training However, during policy training or online planning, since there is no access to true future observations, the sequence model uses its last output As input instead of . Kinetics Utilization Predict the prior distribution, that is Output By and Connection is model training status , which the present invention uses to predict rewards, costs, and round continuation indicators.
[0152] Step 5: Calculate the loss function of the world model;
[0153] In this paper, all modules of the improved world model are jointly optimized. The loss function consists of two parts: KL divergence loss and decoder loss. Given a batch size of sequence , the model can be optimized end-to-end by minimizing the following loss:
[0154] ;
[0155] Loss Function It consists of the log-likelihood between the distributions generated by the decoder for observations, rewards, costs, and episode continuation markers and their corresponding labels:
[0156] ;
[0157] represents the loss function of the observation decoder.
[0158] Represents the weight coefficient of the loss function of the observation decoder.
[0159] represents the loss function of the reward decoder.
[0160] Represents the weight coefficient of the loss function of the reward decoder.
[0161] represents the loss function of the cost decoder.
[0162] Represents the weight coefficient of the loss function of the cost decoder.
[0163] represents the loss function of the turn continuation marker decoder.
[0164] Represents the weight coefficient of the loss function of the round continuation marker decoder.
[0165] When processing visual input, each weight coefficient , , and are all set to 1.0. However, in the case of low-dimensional vector inputs, since the prediction cost always depends on the accurate reconstruction of the observed values, is set to 5.0. Loss function It is calculated by measuring the KL divergence between the dynamics predictor and the observation encoder. The main goal is to train the sequence model and the dynamics predictor using The previously available information is used to generate a prior distribution that is as close as possible to the posterior distribution obtained using the encoder, which is achieved by minimizing At the same time, the observation encoder is trained to extract relevant information from the observations and enhance the predictive power of the dynamics predictor, which is achieved by minimizing The loss function is implemented by the first term in The calculation is as follows:
[0166] L K L ( ϕ ) = ν × K L [ q ϕ ( z t ∣ h t , o t ) ∥ s g ( p ϕ ( z t ∣ h t ) ) ] + δ × KL [ s g ( q ϕ ( z t ∣ h t , o t ) ) ∥ p ϕ ( z t ∣ h t ) ] (15) ;
[0167] K L [ · ] Represents the KL divergence between two elements of the distribution.
[0168] sg stands for stop gradient operator.
[0169] is the first constant coefficient.
[0170] is the second constant coefficient.
[0171] In the present invention, and are set to 0.5 and 0.1 respectively in all tasks.
[0172] In addition, the present invention also uses free bits technology to limit the KL divergence value to 1.0. This technology effectively alleviates the problem that the encoder output may lack sufficient information, which will cause the dynamic model and sequence model to collapse and make it impossible to make meaningful predictions.
[0173] Step 6: Strategy learning based on the actor-critic model;
[0174] In the present invention, in the strategy learning process based on the actor-critic model, Tagged as actor, Mark as reward critics, Mark as cost critic. Use the improved world model to train the model state Make predictions and get potential states Due to the sparsity and uneven distribution of costs in the environment, directly regressing the cost value makes it very difficult to learn the cost critic. This paper follows the approach of the world model framework DreamerV3 and adopts three techniques, namely discrete regression, twohot encoding and logarithmic symlog smoothing. This paper discretizes the target value that the critic needs to regress, and then trains the critic network to predict each discrete value Twohot softmax probability , the reward and cost critic networks are trained using the following loss functions:
[0175] ;
[0176] ;
[0177] ;
[0178] Indicates the number of predefined discrete values, using 255 discrete values, , B = [ − 20 ,..., 20 ] represents an array of discrete values of length 255, .
[0179] Twohot encoding extends the concept of onehot encoding to continuous values. Therefore, the target value can be predicted and recovered by the following formula:
[0180] V ψ ( s t ) = s y m e x p ( E p ψ ( b b i ∣ s t ) [ b b g ] ) = s y m e x p ( p ψ ( ⋅ ∣ s t ) T B ) ( 1 9 ) ;
[0181] in , the symexp function is the inverse function of symlog.
[0182] In the OSRP-Lag and OSRP algorithms of the present invention, an unsafe actor model is trained to guide the planning process, thereby achieving faster reward convergence. The objective function of the actor model is to maximize the expected reward and the entropy of the action. The present invention estimates the gradient of the first term using stochastic back-propagation, while the gradient of the second term is obtained by analytical calculation.
[0183] L ( θ ) = ∑ t = 1 T s g ( R λ ( s t ) ) − η H 熵 [ π θ ( a t ∣ s t ) ] ( 2 0 ) ;
[0184] is a fixed coefficient.
[0185] In addition, since online planning is usually very time-consuming, in order to meet certain scenarios that require fast response, the present invention also proposes an offline safety planning algorithm combined with the Lagrangian method (Background Safety-Reward Planningwith Lagrangian Method, BSRP-Lag) algorithm, which does not use the online planning process and directly generates actions in exploration through a safe actor strategy. The actor strategy is updated using the augmented Lagrangian method, and the main goal is to minimize the expected cost while maximizing the expected reward. Its loss function is as follows:
[0186] L ( θ ) = ∑ t = 1 T s g ( R λ ( s t ) ) − Ψ ( s g ( C λ ( s t ) ) , λ p p , ω , η ω ) − ( 2 1 ) η H 熵 [ π θ ( a t ∣ s t ) ] ;
[0187] ;
[0188] ;
[0189] express The reward value of the state returns.
[0190] express The cost value of the state returns.
[0191] Indicates the current gradient update round.
[0192] Represents the Lagrange multiplier for the current gradient update round.
[0193] Represents the Lagrangian penalty factor for the current gradient update round.
[0194] The difference between the method of the present invention and the similar algorithm LAMBDA
[0195] (1) World Model: In the LAMBDA experiment, the planning method failed to achieve satisfactory results. In contrast, the world model of the present invention performed well in utilizing online information for accurate prediction and enhanced safety.
[0196] In addition, the world model of the present invention is based on an improved version of DreamerV3, while the world model of LAMBDA is based on DreamerV1. Therefore, the algorithm of the present invention shows greater stability in terms of vector and visual input, and achieves low-cost violations.
[0197] (2) Cost model: In LAMBDA, a binary classifier is directly trained as the cost model. However, when the cost obtained from the environment feedback is sparse, the cost model may take longer to converge. On the other hand, in the BSRP-Lag algorithm of the present invention, more robust techniques such as logarithmic sign transformation, discrete regression and two-hot encoding are used to train the cost model, which can improve its performance even when the cost feedback is sparse.
[0198] (3) Trade-off between rewards and costs: Unlike LAMBDA, which uses optimistic and pessimistic estimates, it is found that in safety tasks using only vision, using these estimates will prevent the world model from accurately predicting policy behavior. Therefore, more data and additional training overhead are required. Therefore, this technique is not used in BSRP-Lag of the present invention.
[0199] Effects obtained by using the method of the present invention
[0200] The method of the present invention uses different robot agents in Safety-Gymnasium1 to evaluate the algorithm. The task of the environment is to navigate the robot to the specified location while avoiding collisions with obstacles. Safety-Gymnasium is an environment library designed specifically for SafeRL. The library is based on the basic Gymnasium API for extension design and uses the high-performance MuJoCo engine for physical simulation. The present invention conducted experiments in five different environments, namely SafetyPointGoal1, SafetyPointGoal2, SafetyPointPush1, SafetyPointButton1 and SafetyCarGoal1, and the evaluation indicators were evaluated in the experiment. The safety evaluation of the algorithm was based on three key indicators: Average Reward Return, Average Cost Return and Cost Rate. These indicators have been widely recognized in the SafeRL community as comparison criteria for evaluating agents. The average undiscounted reward return in E rounds and the average undiscounted cost return in E rounds.
[0201] The method of the present invention is calculated by averaging the cost and reward over 10 rounds, each round being 1000 in length, and the network is not updated during the evaluation.
[0202] (1). PPO-Lag, TRPO-Lag (no model): Lagrangian versions of PPO and TRPO.
[0203] (2). CPO (model-free): a policy search algorithm with near constraint satisfaction guarantees.
[0204] (3). Sauté PPO, TRPO (model-free): Train safety policies by eliminating safety constraints into state space and reshaping the objective function.
[0205] (4).Safe SLAC (model-based): a combination of SLAC and Lagrangian methods.
[0206] (5). LAMBDA (model-based): Based on the implementation in DreamerV1, it combines Bayesian and Lagrangian methods.
[0207] (6). MPC:sim (model-based): MPC is performed using a real simulator and the CCEM algorithm, called MPC:sim.
[0208] (7). MBPPO-Lag (model-based): Trains security policies by integrating Gaussian models and Lagrangian methods.
[0209] (8). DreamerV3 (model-based): A world-model-based reinforcement learning algorithm that performs well in various control areas.
[0210] like Figure 3 As shown, the evaluation is performed after the agent completes 2M training steps. Ours (OSRP-Lag), Ours (OSRP), and Ours (BSRP-Lag) are the algorithms proposed by the present invention. The present invention follows the standardized indicators proposed by Safety-Gym and uses the rliable library to calculate the median (Median), interquartile mean (IQM), and mean (Mean) of the standardized reward performance (Normalized Reward Performance at Convergence) and the standardized cost performance (Normalized Reward Performance at Convergence) after convergence of the algorithm. SafeDreamer (BSRP-Lag) obtained rewards similar to those of the model-based safety reinforcement learning method LAMBDA, and improved safety by 94.3%. The training curves of the experiment are shown in Figure 4 and Figure 5 Each experiment was run with 5 different random seeds. SafeDreamer achieves near-zero-cost performance and outperforms existing model-free and model-based algorithms.
[0211] The dual optimization objective achieves a balance between maximizing rewards and minimizing costs. Figure 4As shown, SafeDreamer achieves higher rewards while achieving the minimum cost. In contrast, due to the inaccuracy of the world model, model-based algorithms such as Safe SLAC reach a point where the cost stops decreasing after a certain level. On the other hand, in environments with denser or more dynamic obstacles, such as SafetyPointButton1, MPC:sim has difficulty ensuring the long-term safety of the agent due to the lack of a cost critic. From the beginning of training, the algorithm of the present invention exhibits safe behavior and ensures safe exploration. Specifically, in the SafetyPointGoal1 and SafetyPointPush1 environments, SafeDreamer achieves reward performance similar to DreamerV3 while maintaining a near-zero cost.
[0212] Supports vision and low-dimensional vector input tasks. Evaluation is performed in two low-dimensional input environments, Safety-PointGoal1(vector, vector input) and SafetyCarGoal1(vector, vector input) (see Figure 5 ). Although model-free algorithms can reduce the cost, they have difficulty in achieving higher rewards. This is because they rely entirely on learning safe policies through trial and error, lacking the assistance of world models, which makes it difficult for them to search for optimal solutions in limited data samples. Meanwhile, the reward of MBPPO-Lag stops increasing once the cost is reduced to a relatively low level. SafeDreamer surpasses them in both reward and cost.
Claims
1. A robot obstacle avoidance method based on the WMSRL model is to add the WMSRL model to the robot motion coordination control module; it is characterized by Robot obstacle avoidance includes the following steps: Step 1: Robot motion trajectory expansion and reward value estimation and cost value estimation; Setting the current moment in the WMSRL model The state transition probability function under And the reward function ; Indicates taking action After that, from the current state Transfer to next state The transition probability of Indicates the current state Execute an action and transfer to the next state Rewards received when represents the state space; Let the state space Any state in , the initial state is recorded as ; represents the action space; Action Space Any action in ; Indicates the state transition probability identifier; Represents the reward set identifier; represents the cost set, and ,in is the cost function, is the cost threshold, subscript Indicates the cost threshold identification number, Indicates the total number of cost thresholds; Order cost set Any cost is denoted as ; is the initial state distribution, and ; is the discount factor, and ; is the current moment of the robot's motion; is the moment before the robot moves; is the latter moment of the robot's motion; use represents the state transition probability matrix; Any element in is represented by its state ,and ; Represents the probability identifier under the steady-state strategy; are the network parameters that need to be learned; Indicates the real number space, the superscript Represents the dimension; Represents the state element of the matrix; Represents the actions taken under the steady-state strategy After that, from the current state Transfer to next state The state transition probability of Any element in the state transition probability matrix By implementing a steady-state strategy From the current state Transfer to next state The probability of one-step state transition; when all elements complete one-step state transition, finally, As the initial state under the steady-state strategy The steady-state distribution of the Markov chain at the beginning, however, As the initial distribution under the steady-state strategy The distribution of discount status visits on; represents the steady-state state of the Markov chain under the steady-state strategy; Indicates the current time Discount factor under ; Indicates the current state under the steady-state strategy The transition probability of is the initial state distribution, and ; represents the initial distribution under the steady-state strategy Discount status on ; Among them, the infinite time discounted reward function is defined as: ; represents the reward function; Indicates expected value; Indicates the current time Discount factor under ; Indicates in status Execute an action and transfer to the next state Rewards received when is the initial state distribution, and ; represents the probability sign under the steady-state strategy; Among them, the infinite time discounted cost function is defined as: ; Subscript Indicates the cost threshold identification number; Indicates in status Execute an action and transfer to the next state The discount price obtained when Define a set of possible strategies for: ; is the cost threshold; Among them, the goal of the constrained Markov model CMDP is to The optimal strategy for searching is: ; represents the probability sign under the steady-state strategy; represents a set of feasible strategies; represents the reward function; Modify the state transition probability function of the robot's obstacle avoidance process and define the safety reinforcement learning problem based on the robot world model as follows: ; ; ; represents the probability sign under the steady-state strategy; represents the set of all steady-state strategies, and ; Represents the reward function in the secure reinforcement learning model; Represents the cost function in the secure reinforcement learning model; Represents a specified obstacle avoidance safety constraint threshold; Indicates in status Execute an action and transfer to the next state Rewards received when Indicates the initial state; is the initial state distribution, and ; is a parameterized world model; Represents a specified cost function; The design of the safety planning algorithm OSRP is as follows: in the safety task that only relies on vision, the model planning is combined with the safety constraints; the SR-MPC algorithm uses the constrained cross entropy method CCEM for planning and uses the reinforcement learning model to , , and are predicted separately; in addition, the reward estimation is also used and price valuation and a reward-driven policy network π_θ to guide the planning process; represents the predicted state sequence; represents the predicted dynamic state; Represents the predicted reward value; represents the predicted cost value; First, initialize the step length to The independent parameters of each action within the time range, that is, the action parameters ,in ; Next, use the world model to independently sample trajectories and estimate their infinite-time discounted rewards outside the planning horizon and the infinite time discounted cost , this estimate is obtained by introducing a bootstrap-based returns to achieve: ; ; Indicates the current state; Indicates the current status Reward value returns; Superscript yes The value of returns; Indicates the next state Reward value returns; represents the planning step length; Indicates the current status The predicted reward value of is the discount factor, and ; Indicates the next state The estimated reward return value of Indicates to The estimated reward return value of the step state; Using the prediction of the cost model, given the state To evaluate The total cost within the step is: ; represents the planning step length; Indicates the current time Discount factor under ; Represents a sequence model; Indicates the current status The predicted cost value of represents the observation encoder; represents normal distribution; represents the identity matrix; is the action mean; Superscript Indicates the total number of iterations, the number of iterations ; represents the action mean of the previous iteration; represents the action variance of the previous iteration; Use the cost value of all trajectories As An approximate estimate of is the round length; at the same time, As a criterion for evaluating trajectory safety; Step 2: The trade-off between the reward value and cost value of the safe trajectory; The trade-off between reward and cost is achieved in the following way: after calculating the cost of all trajectories Afterwards, the number of safe trajectories is expressed as ;if Lower than expected number of safe trajectories , it indicates that it is difficult to find a safe trajectory in the current state; therefore, it becomes crucial to prioritize safety, while The value of becomes the sorting criterion, denoted as , and the entire set of sampled robot motion trajectories becomes the candidate action set On the contrary, if , it means that the trajectory that satisfies the safety constraint is relatively easy to find; therefore, the reward value Used as sorting criteria , and the safe action trajectory The actions in the ; From the candidate action set , select the sorting criteria The corresponding maximum value, and the action sequence corresponding to the maximum value is used as the elite action ,in accordance with In the Get the first parameter in the iteration and the second parameter : ; ; represents the number of predefined elite actions; Represents any predefined elite action; After reaching the predetermined number of iterations After that, the robot motion planning process ends; at the current moment of each decision robot motion The mean of the first action of the planned action trajectory will be used as the action to be executed in the real environment; Step 3: Safe online planning of robot motion trajectory based on Lagrangian method; When the hazard detection field of view required during the robot's obstacle avoidance process exceeds the planning field of view, the planning process may not be able to ensure zero cost violations in complex vision-only tasks. To address this problem, a cost critic is used to estimate the expected cost in the later stages of the planning process. To fully exploit the potential of the cost critic, the PID Lagrangian method is integrated into the world model planning framework, resulting in the OSRP-Lag algorithm, which satisfies the requirement in step 2. Sorting criteria Adjust to ,in is the Lagrange multiplier; this means that when there are many safe trajectories in the robot's motion planning process, the LAG-MPC algorithm will dynamically adjust the Lagrange multiplier based on the robot's historical constraint violations, and continue to be cautious during safe exploration; Step 4, construct the components of the world model of the robot's motion trajectory; The improved world model is used to train the historical data of the robot's interaction with the environment from step 3; this data includes observations, actions, rewards, costs, and round continuation indicators, and the time length is , expressed as ; Indicates the current state; Indicates the current action; Indicates the next state; Indicates the next reward; Indicates the next generation valence; Indicates the next moment round continuation indicator; The improved world model includes a sequential model denoted as , the observation encoder is denoted as The dynamic model is recorded as , the reward decoder is denoted as , the cost decoder is denoted as , the round continuation indicator decoder is recorded as and the observation decoder is denoted as ; represents the posterior distribution of the observed encoder predictions; represents the prior distribution of the kinetic model predictions; represents the hidden state predicted by the sequence model; Indicates the previous action; Indicates the observation state actually received in the environment; Indicates the current reward; Indicates the current price; Indicates the continuation indicator of the current round; Adopt Gated Recurrent Unit (GRU); for visual input, use Convolutional Neural Network (CNN) as observation encoder and observation decoder , and for low-dimensional inputs, a multilayer perceptron (MLP) is used; the reward, cost, round continuation marker decoder and dynamics model are implemented using MLP; this world model can be understood as a sequence variational autoencoder VAE, where the output of the observation encoder acts as an approximate posterior, which first transforms the observation Encoded as the posterior distribution, i.e. Output , given the initial state and , and the previous action , loop status and , use the sequence model to predict the next cycle state during world model training However, during policy training or online planning, since there is no access to true future observations, the sequence model uses its last output As input instead of ; Dynamics utilization Predict the prior distribution, that is Output ; By and Connection is model training status , which the present invention uses to predict rewards, costs, and round continuation indicators; Step 5: Calculate the loss function of the world model; All modules of the improved world model are jointly optimized; the loss function consists of two parts: KL divergence loss and decoder loss; given a batch size of sequence , the model can be optimized end-to-end by minimizing the following loss: ; Loss Function It consists of the log-likelihood between the distributions generated by the decoder for observations, rewards, costs, and episode continuation markers and their corresponding labels: ; represents the loss function of the observation decoder; Represents the weight coefficient of the loss function of the observation decoder; represents the loss function of the reward decoder; Represents the weight coefficient of the loss function of the reward decoder; represents the loss function of the cost decoder; Represents the weight coefficient of the loss function of the cost decoder; represents the loss function of the turn continuation marker decoder; represents the weight coefficient of the loss function of the round continuation marker decoder; When processing visual input, each weight coefficient , , and are all set to 1.0; however, in the case of low-dimensional vector inputs, since the prediction cost always depends on the accurate reconstruction of the observed values, is set to 5.0; the loss function It is calculated by measuring the KL divergence between the dynamics predictor and the observation encoder; the main goal is to train the sequence model and the dynamics predictor using The previously available information is used to generate a prior distribution that is as close as possible to the posterior distribution obtained using the encoder, which is achieved by minimizing At the same time, the observation encoder is trained to extract relevant information from the observations and enhance the predictive power of the dynamics predictor, which is achieved by minimizing The first item in is implemented; the loss function The calculation is as follows: ; Represents the KL divergence between the two distributed elements; sg means stop gradient operator; is the first constant coefficient; is the second constant coefficient; Step 6: Strategy learning based on the actor-critic model; In the strategy learning process based on the actor-critic model, Tagged as actor, Mark as reward critics, Mark as cost critic; use the improved world model to train the model state Make predictions and get potential states ; Discretize the target value that the critic needs to regress, and then train the critic network to predict each discrete value Twohot softmax probability , the reward and cost critic networks are trained using the following loss functions: ; ; ; Indicates the number of predefined discrete values, using 255 discrete values, , represents an array of discrete values of length 255, ; Two-hot encoding extends the concept of one-hot encoding to continuous values; therefore, the target value can be predicted and recovered by the following formula: ; where symexp . The symexp function is the inverse function of symlog; The objective function of the actor model is to maximize the expected reward and the entropy of the action ; The present invention uses stochastic back-propagation to estimate the gradient of the first term, while the gradient of the second term is obtained by analytical calculation; ; is a fixed coefficient; The actor strategy is updated using the augmented Lagrangian method. The main goal is to minimize the expected cost while maximizing the expected reward. The loss function is as follows: ; ; ; express The reward value of the state returns; express The cost value of the state returns; Indicates the current gradient update round; Represents the Lagrange multiplier of the current gradient update round; Represents the Lagrangian penalty factor for the current gradient update round.
2. The robot obstacle avoidance method based on the WMSRL model according to claim 1, characterized in that: The WMSRL model includes two parts: one is to use safe reinforcement learning to safely explore the robot's posture information; the other is to use the improved world model to learn the strategy of the robot's posture information.
3. The robot obstacle avoidance method based on the WMSRL model according to claim 1, characterized in that: and are set to 0.5 and 0.1 respectively in all tasks.
4. The robot obstacle avoidance method based on the WMSRL model according to claim 1, characterized in that: The WMSRL model adopts an improved world model to fully improve the utilization efficiency of the posture information of the robot's motion process to ensure the security of the entire process of reinforcement learning training and deployment.
Citation Information
Patent Citations
Hexapod robot obstacle avoidance method based on adaptive weight reinforcement learning
CN111552183A
Path planning method for obstacle avoidance mobile robot
CN115793634A
Unmanned aerial vehicle path planning method based on reverse reinforcement learning
CN115826601A
Code generation through reinforcement learning using code-quality rewards
US20230195428A1
Method and device for planning global path of unmanned vehicle
WO2021135554A1
Cited By
Safety management system and method for intelligent money box
CN119940939A
Method and system for constructing intelligent simulation data set of electric power scene
CN120822432A
Surgical robot suturing trajectory planning method based on world model and reinforcement learning
CN122805374A
