Unmanned ship track control method based on SAC-PID

Through the unmanned boat track control method based on SAC-PID, the PID parameters are adaptively adjusted, which solves the problem of traditional methods relying on manual experience and local optimality, and achieves efficient and real-time track control.

CN118778646APending Publication Date: 2024-10-15DALIAN MARITIME UNIVERSITY
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202410801759.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

The traditional PID parameter tuning method relies on manual experience, is time-consuming and labor-intensive, is difficult to change after tuning, and does not have independent learning capabilities, resulting in high time and labor costs, poor real-time performance, and easy to fall into local optimality.

Method used

The unmanned boat track control method based on SAC-PID is adopted. By establishing the ship motion mathematical model and the state space of the SAC algorithm, the action space is determined, a reward function is established, and the PID track controller parameters are adaptively adjusted to realize the control of the unmanned boat. Track control.

Benefits of technology

It realizes the adaptive tuning of the unmanned ship's trajectory control, reduces time and labor costs, improves real-time performance, avoids local optimal problems, and has strong independent learning capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118778646A_ABST
    Figure CN118778646A_ABST
Patent Text Reader

Abstract

The invention discloses an unmanned ship track control method based on SAC-PID, and the method comprises the steps: obtaining a parameter set of a PID track controller of a water surface autonomous vehicle through the definition of a state space and an action space of an SAC algorithm; meanwhile, a reward function of the SAC algorithm is established, so that parameters of a PID track controller of the water surface autonomous vehicle are adjusted based on the SAC algorithm according to the state space of the SAC algorithm; the speed and the rudder angle of the ship are obtained through the PID track controller, and track control over the unmanned ship is achieved. According to the method, adaptive setting of PID controller parameters is achieved through the SAC algorithm, USV track control is finally achieved, local optimum is not likely to happen, and the method has the high autonomous learning ability. The problems that a traditional PID parameter setting method depends on manual experience for setting and is difficult to change after setting are solved, the time cost and the labor cost are remarkably reduced, and the real-time performance is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of unmanned boat track control, and in particular to an unmanned boat track control method based on SAC-PID. Background Art

[0002] Track control is to guide the ship to follow the path proposed by the track planning system, and then complete the navigation mission. Track tracking control capability is an important function of unmanned surface vehicles (USVs) and is the basis for it to complete tasks autonomously. In the past 80 years, the proportional-integral-differential (PID) control algorithm has been considered one of the most widely used choices in the industrial control industry and is often used for ship track control. However, PID parameter tuning is a very difficult task, which often requires manual adjustment based on human experience, which is time-consuming and labor-intensive. Common methods for PID parameter tuning include ZN method, heuristic algorithm, etc.

[0003] Traditional PID parameter tuning methods often need to rely on manual experience, and are difficult to change after tuning. They have high time and labor costs, poor real-time performance, and the tuned parameters are not optimal. Some subsequent parameter tuning methods combined with heuristic algorithms are prone to fall into local optimality and do not have autonomous learning capabilities. Summary of the invention

[0004] The invention discloses a SAC-PID-based unmanned boat track control method to overcome the above technical problems.

[0005] In order to achieve the above object, the technical solution of the present invention is:

[0006] A SAC-PID-based unmanned boat track control method comprises the following steps:

[0007] S1: Establish a mathematical model of ship motion to obtain the position and heading of the surface autonomous vehicle and determine the state space of the SAC algorithm;

[0008] S2: Determine the action space of the SAC algorithm to determine the parameter set of the PID track controller of the surface autonomous vehicle;

[0009] S3: Establish the reward function of the SAC algorithm to adjust the parameters of the PID track controller of the surface autonomous vehicle based on the SAC algorithm according to the state space of the SAC algorithm; then obtain the speed and rudder angle of the ship through the PID track controller to realize the track control of the unmanned boat.

[0010] Furthermore, the reward function of the SAC algorithm includes a traveled distance reward function, a navigation speed reward function, a track tracking error reward function, an arrival and collision reward function, and a rudder angle limit reward function;

[0011] The traveled distance reward function is as follows:

[0012] r distance =ρ d d(i),P t (i) = P target or e(i)>ζ'or△ψ1>θ

[0013] Where: r distance represents the reward value of the driving distance; ρ d represents the navigation distance coefficient; d(i) represents the distance traveled by the unmanned boat in the i-th iteration; P t (i) represents the position of the unmanned boat at time t during the i-th iteration; P target represents the end point of the desired track; e(i) represents the track error; ζ' is the maximum track error; △ψ1 represents the heading error with the first sampling point; θ is the maximum heading angle error;

[0014] The navigation speed reward function is as follows:

[0015] r velocity =ρ v V(i),P t (i) = P target or e(i)>ζ'or△ψ1>θ

[0016] Where: r velocity represents the navigation speed bonus value; ρ v represents the navigation speed coefficient; V(i) represents the average speed of the unmanned boat;

[0017] The track tracking error reward function is as follows:

[0018] r error =ρ e e(i)

[0019] Where: e represents the track error coefficient, which is selected as a negative number; e(i) represents the track error; r error Represents the track tracking error reward value.

[0020] The arrival and collision reward functions are as follows:

[0021]

[0022] Where: r p Represents the arrival and collision reward values, l represents the penalty term, that is, a positive reward value is given when reaching the target point, and a negative reward value is given when yaw.

[0023] The rudder angle limit reward function is as follows:

[0024]

[0025] Where: r d represents the value of the rudder angle limit reward function, δ t (i) represents the rudder angle of the i-th wheel at time t, with right rudder being positive and left rudder being negative; δ max represents the maximum rudder angle allowed by the unmanned boat; λ represents the penalty term;

[0026] In summary, the reward function of the SAC algorithm is established as follows:

[0027]

[0028] Furthermore, the mathematical model of ship motion is established as follows:

[0029]

[0030] Where: m represents the mass of the ship; Represents the attached coordinate system x b The fluid dynamics derivative of the time derivative of the forward velocity u in the axial direction; Represents the attached coordinate system y b The hydrodynamic derivative of the time derivative of the drift velocity v in the axial direction; represents the fluid dynamics derivative of the time derivative of the moment with respect to the drift velocity v; x OG X represents the center of gravity of the ship in the inertial coordinate system n Coordinate values ​​in the axis direction; Represents the attached coordinate system y b The hydrodynamic derivative of the time derivative of the yaw angular velocity r in the axial direction; represents the hydrodynamic derivative of the time derivative of the external moment about the vertical direction with respect to the yaw angular velocity r; represents the increment of the derivative of the forward speed u; X u Represents the attached coordinate system x b The fluid dynamics derivative in the axial direction with respect to the forward velocity u; Y v Represents the attached coordinate system y b The hydrodynamic derivative of the axial direction with respect to the drift velocity v; N v Y represents the fluid dynamics derivative of the external torque about the vertical direction with respect to the drift velocity v; r Represents the attached coordinate system y b The hydrodynamic derivative of the yaw angular velocity r in the axial direction; N r represents the hydrodynamic derivative of the external moment about the vertical direction with respect to the yaw angular velocity r; u0 represents the velocity of the ship in the inertial coordinate system O n X n The component on the upper side; △u represents the increment of the forward speed u; Yδ N represents the fluid dynamics derivative about the rudder angle δ in the horizontal direction; δ I represents the fluid dynamics derivative of the external torque about the rudder angle δ; δ represents the rudder angle; I zz Represents the moment of inertia.

[0031] Furthermore, the action space of the SAC algorithm is determined as follows:

[0032] a t =[k xp ,k xi ,k xd ,k yp ,k yi ,k yd ,k ψp ,k ψi ,k ψd ]

[0033] Where: a t represents the action set of the surface autonomous vehicle, that is, the parameter set of the PID track controller; k xp Indicates PID x The proportional coefficient of the controller; k xi Indicates PID x The integral coefficient of the controller; k xd Indicates PID x The differential coefficient of the controller; k yp Indicates PID y The proportional coefficient of the controller; k yi Indicates PID y The integral coefficient of the controller; k yd Indicates PID y The differential coefficient of the controller; k ψp Indicates PID ψ The proportional coefficient of the controller; k ψi Indicates PID ψ The integral coefficient of the controller; k ψd Indicates PID ψ Differential coefficient of the controller; PID x Represents the PID controller that receives the coordinate error of the x-axis direction in the inertial coordinate system; PID y Represents the PID controller that receives the coordinate error of the y-axis direction in the inertial coordinate system; PID ψ Represents the PID controller that receives the heading error.

[0034] Furthermore, the state space of the SAC algorithm is determined as follows:

[0035] s t=[△x1,△y1,△ψ1,△x2,△y2,△ψ2,△x3,△y3,△ψ3,V,r]

[0036] Where: s t represents the state set of the surface autonomous vehicle; △x1 represents the inertial coordinate system X between the current position of the surface autonomous vehicle and the first sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △y1 represents the inertial coordinate system Y between the current position of the surface autonomous vehicle and the first sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △ψ1 represents the heading error between the current position of the surface autonomous vehicle and the first sampling point closest to the ship according to the fixed step length sampling; △x2 represents the inertial coordinate system X of the current position of the surface autonomous vehicle and the second sampling point closest to the ship according to the fixed step length sampling n The coordinate error in the axis direction; △y2 represents the inertial coordinate system Y between the current position of the surface autonomous vehicle and the second sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △ψ2 represents the heading error between the surface autonomous vehicle and the second sampling point closest to the ship according to the fixed step length sampling; △x3 represents the inertial coordinate system X between the current position of the surface autonomous vehicle and the third sampling point closest to the ship according to the fixed step length sampling n △y3 represents the coordinate error in the Y axis direction of the current position of the surface autonomous vehicle and the inertial coordinate system Y of the third sampling point closest to the ship sampled at a fixed step length. n Δψ3 represents the heading error between the current position of the surface autonomous vehicle and the third sampling point closest to the ship sampled at a fixed step size; V represents the combined speed of the surface autonomous vehicle's forward speed u and its lateral drift speed v, and r is the bow angular velocity.

[0037] Beneficial effects: The unmanned boat track control method based on SAC-PID of the present invention obtains the parameter set of the PID track controller of the surface autonomous vehicle by defining the state space and action space of the SAC algorithm; at the same time, a reward function of the SAC algorithm is established to adjust the parameters of the PID track controller of the surface autonomous vehicle based on the SAC algorithm according to the state space of the SAC algorithm; and then the speed and rudder angle of the ship are obtained through the PID track controller to realize the track control of the unmanned boat. The present invention utilizes the SAC algorithm to realize the adaptive setting of the PID controller parameters, and finally realizes the USV track control. It is not easy to fall into the local optimum and has strong autonomous learning ability. It solves the problem that the traditional PID parameter setting method relies on manual experience setting and is difficult to change after setting. The time cost and labor cost are significantly reduced, and the real-time performance is strong. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0039] Figure 1 The flow chart of the unmanned boat track control method based on SAC-PID of the present invention is shown.

[0040] Figure 2 A schematic diagram of a mathematical model of ship motion in an embodiment of the present invention is shown.

[0041] Figure 3 A schematic diagram of an incremental PID controller group in an embodiment of the present invention is shown.

[0042] Figure 4 A schematic diagram of relevant parameters of the track control reward function in an embodiment of the present invention is shown.

[0043] Figure 5 A schematic diagram of a rudder angle variation curve of an unmanned boat in an embodiment of the present invention is shown.

[0044] Figure 6 A schematic diagram of a training flow chart of the SAC algorithm in an embodiment of the present invention is shown.

[0045] Figure 7 The overall framework diagram of the unmanned boat track control in an embodiment of the present invention is shown.

[0046] Figure 8 A comparison chart of the track control effect in the embodiments of the present invention is shown. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0048] This embodiment introduces a SAC-PID-based unmanned boat track control method as follows: Figure 1 As shown, the following steps are included:

[0049] S1: According to the motion characteristics of the surface autonomous vehicle, a mathematical model of ship motion is established to obtain the position and heading of the surface autonomous vehicle and determine the state space of the SAC algorithm;

[0050] Specifically, the motion of a ship generally includes six degrees of freedom, including heave motion, pitch motion, roll motion, forward motion, drift motion, and bowing motion. For most ship motion and control problems, the first three motion characteristics can be ignored, so only the forward speed u, the drift speed v, and the bowing angular velocity r need to be considered. The mathematical model of the ship motion used in this embodiment is as follows: Figure 2 As shown, O n -X n Y n Z n is the inertial coordinate system, O b -x b y b z b is the appendage coordinate system. ψ represents the heading angle, u, v, r represent the forward speed, the drift speed and the bow angular velocity respectively. The ship model used in the SAC algorithm training process is specifically expressed as:

[0051] Preferably, the ship motion mathematical model is established as follows:

[0052]

[0053] Where: m represents the mass of the ship; Represents the attached coordinate system x b The fluid dynamics derivative of the time derivative of the forward velocity u in the axial direction; Represents the attached coordinate system y b The hydrodynamic derivative of the time derivative of the drift velocity v in the axial direction; represents the fluid dynamics derivative of the time derivative of the moment with respect to the drift velocity v; x OG X represents the center of gravity of the ship in the inertial coordinate system n Coordinate values ​​in the axis direction; Represents the attached coordinate system y b The hydrodynamic derivative of the time derivative of the yaw angular velocity r in the axial direction; represents the hydrodynamic derivative of the time derivative of the external moment about the vertical direction with respect to the yaw angular velocity r; represents the increment of the derivative of the forward speed u; X u Represents the attached coordinate system x b The fluid dynamics derivative in the axial direction with respect to the forward velocity u; Y v Represents the attached coordinate system y b The hydrodynamic derivative of the axial direction with respect to the drift velocity v; N vY represents the fluid dynamics derivative of the external torque about the vertical direction with respect to the drift velocity v; r Represents the attached coordinate system y b The hydrodynamic derivative of the yaw angular velocity r in the axial direction; N r represents the hydrodynamic derivative of the external moment about the vertical direction with respect to the yaw angular velocity r; u0 represents the velocity of the ship in the inertial coordinate system O n X n The component on the upper side; △u represents the increment of the forward speed u; Y δ N represents the fluid dynamics derivative about the rudder angle δ in the horizontal direction; δ I represents the fluid dynamics derivative of the external torque about the rudder angle δ; δ represents the rudder angle; I zz represents the moment of inertia;

[0054] The longitudinal and transverse fluid dynamics and the external torque acting on the ship around the vertical direction are the forward speed u, the transverse drift speed v, the bow angular velocity r, and the time derivative A nonlinear function of the rudder angle δ and the propeller speed n.

[0055] In addition, we use the most commonly used Nomoto model to describe the relationship between the ship's rudder angle and heading. The Nomoto model is shown in formula (2):

[0056]

[0057] Wherein, K represents gain; T represents time constant; ψ(s) represents the complex frequency domain form of heading ψ; δ(s) represents the complex frequency domain form of rudder angle δ; s represents the complex frequency domain operator;

[0058] S2: Determine the action space of the SAC algorithm and obtain the parameter set of the PID track controller of the surface autonomous vehicle;

[0059] Specifically, the desired trajectory is added into the simulation environment of trajectory control, and the state space and action space of the SAC algorithm are defined, wherein the action space of the SAC algorithm is a parameter set of the PID trajectory controller.

[0060] Specifically, the expected trajectory is input into the simulation environment by the researcher through a mathematical function expression. For example, the expected trajectory we are talking about is a sine, straight line, sawtooth, and other unconventional curves represented by functions. For example: x = ysin(0.2y) / 4+ycos(0.6y) / 5+2sin(y). This embodiment uses three sets of incremental PID controllers to control the speed and rudder angle of the unmanned boat, such as Figure 3 shown.

[0061] Therefore, the action space of the SAC algorithm is obtained as follows:

[0062] a t =[k xp ,k xi ,k xd ,k yp ,k yi ,k yd ,k ψp ,k ψi ,k ψd ] (3)

[0063] Where: a t represents the action set of the surface autonomous vehicle, that is, the parameter set of the PID track controller; k xp Indicates PID x The proportional coefficient of the controller; k xi Indicates PID x The integral coefficient of the controller; k xd Indicates PID x The differential coefficient of the controller; k yp Indicates PID y The proportional coefficient of the controller; k yi Indicates PID y The integral coefficient of the controller; k yd Indicates PID y The differential coefficient of the controller; k ψp Indicates PID ψ The proportional coefficient of the controller; k ψi Indicates PID ψ The integral coefficient of the controller; k ψd Indicates PID ψ Differential coefficient of the controller; PID x The PID controller represents the coordinate error of the x-axis direction in the receiving inertial coordinate system, which is used to control the navigation speed; y Represents the PID controller that receives the coordinate error of the y-axis direction in the inertial coordinate system; PID ψ Represents the PID controller that receives the heading error; where PID y and PID ψ The output increments are used together for rudder angle control;

[0064] The above parameters correspond to the proportional, integral and differential coefficients of the three PID controllers respectively.

[0065] The state space of the SAC algorithm is obtained as follows:

[0066] s t =[△x1,△y1,△ψ1,△x2,△y2,△ψ2,△x3,△y3,△ψ3,V,r] (4)

[0067] Where: s t represents the state set of the surface autonomous vehicle; △x1 represents the inertial coordinate system X between the current position of the surface autonomous vehicle and the first sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △y1 represents the inertial coordinate system Y between the current position of the surface autonomous vehicle and the first sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △ψ1 represents the heading error between the current position of the surface autonomous vehicle and the first sampling point closest to the ship according to the fixed step length sampling; △x2 represents the inertial coordinate system X of the current position of the surface autonomous vehicle and the second sampling point closest to the ship according to the fixed step length sampling n The coordinate error in the axis direction; △y2 represents the inertial coordinate system Y between the current position of the surface autonomous vehicle and the second sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △ψ2 represents the heading error between the surface autonomous vehicle and the second sampling point closest to the ship according to the fixed step length sampling; △x3 represents the inertial coordinate system X between the current position of the surface autonomous vehicle and the third sampling point closest to the ship according to the fixed step length sampling n △y3 represents the coordinate error in the Y axis direction of the current position of the surface autonomous vehicle and the inertial coordinate system Y of the third sampling point closest to the ship sampled at a fixed step length. n The coordinate error in the axial direction; △ψ3 represents the heading error between the current position of the surface autonomous vehicle and the third sampling point closest to the ship sampled at a fixed step length; V represents the combined speed of the surface autonomous vehicle's forward speed u and the lateral drift speed v, and r is the bow angular velocity;

[0068] Specifically, the first sampling point, the second sampling point and the third sampling point in this embodiment are based on the current position of the ship, and the three points closest to the ship are sampled according to the set fixed step size on the expected track; based on these three sampling points, they are used as the stage goals of the ship's movement, and then the parameters of the PID track controller output by deep reinforcement learning are transmitted to the PID controller, and the PID controller outputs the speed and rudder angle to the surface vehicle, i.e., the unmanned boat, thereby forming a staged track tracking and control.

[0069] S3: According to the parameter set of the PID track controller of the surface autonomous vehicle, a reward function of the SAC algorithm is established to adjust the parameters of the PID track controller according to the state space of the SAC algorithm; and then the speed and rudder angle of the ship are obtained through the PID track controller to control the track of the unmanned boat. Among them, the PID track controller is the use of existing technology in the field, and will not be described in detail here.

[0070] Specifically, according to the action space of the SAC algorithm and the state space of the SAC algorithm, based on the SAC algorithm, a reward function for parameter tuning of the PID track controller is set to construct a reward function mechanism for track control. Preferably, the reward function of the SAC algorithm includes a traveled distance reward function, a navigation speed reward function, a track tracking error reward function, an arrival and collision reward function, and a rudder angle limit reward function;

[0071] The traveled distance reward function is as follows:

[0072] r distance =ρ d d(i),P t (i) = P target or e(i)>ζ'or△ψ1>θ

[0073] Where: r distance represents the reward value of the driving distance; ρ d represents the navigation distance coefficient; d(i) represents the distance traveled by the unmanned boat in the i-th iteration; P t (i) represents the position of the unmanned boat at time t during the i-th iteration; P target represents the end point of the desired track; e(i) represents the track error; ζ' is the maximum track error; △ψ1 represents the heading error with the first sampling point; θ is the maximum heading angle error;

[0074] Specifically, the reward function for the distance traveled indicates that when the ship reaches the target point or deviates, a corresponding reward value is given according to the distance traveled. The longer the distance of the expected track is tracked, the higher the reward value. This is equivalent to turning the trial and error of previous iterations into "experience", which is intended to give the algorithm a "memory" function, so that new strategies can be learned more quickly in subsequent iterations, thereby accelerating the convergence of the algorithm. Compared with the reward function that only considers the track error, the algorithm is trained faster and can better track and control long tracks.

[0075] The navigation speed reward function is as follows:

[0076] r velocity =ρ v V(i),P t (i) = P target or e(i)>ζ'or△ψ1>θ

[0077] Where: r velocity represents the navigation speed bonus value; ρ v represents the navigation speed coefficient; V(i) represents the average speed of the unmanned boat;

[0078] Specifically, the navigation speed reward function indicates that the faster the unmanned boat sails, the higher the reward value, which is intended to enable the unmanned boat to complete the track tracking control task at a faster navigation speed.

[0079] The track tracking error reward function is as follows:

[0080] r error =ρ e e(i)

[0081] Where: e represents the track error coefficient, which is selected as a negative number; e(i) represents the track error; r error Represents the track tracking error reward value.

[0082] Specifically, the track tracking error reward function indicates that the smaller the track tracking error is, the greater the reward value is after multiplying it by the track error coefficient. This is intended to reduce the error between the actual track of the unmanned boat and the expected track and improve the track tracking accuracy.

[0083] The arrival and collision reward functions are as follows:

[0084]

[0085] Where: r p Represents the arrival and collision reward values, l represents the penalty term, that is, a positive reward value is given when reaching the target point, and a negative reward value is given when yaw.

[0086] In one embodiment of the present invention, when e(i)>0.8 (unit: hundred meters), that is, the track error exceeds 80 meters, it is considered as deviation. This branch reward function is used to set the tone for the success or failure of the track tracking control task.

[0087] The rudder angle limit reward function is as follows:

[0088]

[0089] Where: r d represents the value of the rudder angle limit reward function, δ t (i) represents the rudder angle of the i-th wheel at time t, with right rudder being positive and left rudder being negative; δ max The maximum rudder angle allowed by the unmanned boat is generally set to 35 degrees; λ represents the penalty term, that is, when the rudder angle of the unmanned boat is within the rudder angle limit range, a positive reward value is given, and when the rudder angle of the unmanned boat exceeds the maximum limit rudder angle, a negative reward value is given. The rudder angle limit reward function is intended to keep the rudder angle of the unmanned boat within the limit range to ensure navigation safety. The rudder angle in the track tracking process is as follows Figure 5 shown.

[0090] In summary, the reward function of the SAC algorithm is established as follows:

[0091]

[0092] The visual representation of the parameters related to the trajectory control reward function is as follows: Figure 4 As shown in the figure, through the training of the deep reinforcement learning SAC algorithm, the algorithm tends to select actions that can lead to success, and finally converges to obtain a successful strategy, that is, action selection.

[0093] Specifically, the state space of the SAC algorithm is used as the input of the SAC algorithm, and the action space of the SAC algorithm is used as the output of the SAC algorithm.

[0094] Specifically, the SAC algorithm consists of five sub-networks, namely the evaluation network V1, V2, Q1, Q2 and the policy network π. The network objective function and network parameter update method of the SAC algorithm are as follows:

[0095] Evaluation Network V1:

[0096]

[0097] Where: J V (ζ) represents the objective function of evaluating network V1; Indicates state s t The expected value sampled from the experience replay pool D; s t represents the state at time t; D represents the experience replay pool; V ζ Represents the state value function of the evaluation network V1; Indicates action a t By Strategy π f (a t |s t ) to obtain the expected value; π f (a t |s t ) indicates strategy; Denotes the evaluation network Q i The action value function; μ represents the weight; ζ represents the network parameter of the evaluation network V1; θ i To evaluate the network Q i network parameters.

[0098] The structures of evaluation networks V1 and V2 are the same, among which the network parameters of evaluation network V2 are This is accomplished through a soft update as shown below:

[0099]

[0100] Where: τ represents the soft update coefficient;

[0101] The evaluation networks Q1 and Q2 have the same network structure and parameters, and their objective functions are as follows:

[0102]

[0103] Where: J Q (θ) represents the evaluation network Q i Objective function of (i=1,2); Represents a state-action pair (s t ,a t ) is the expected value sampled from the experience replay pool D; Q θ (s t ,a t ) represents the evaluation network Q i (i=1,2) action value function; r(s t ,a t ) represents the reward value obtained at time t; γ represents the discount factor; Indicates state s t+1 The expected value obtained by sampling from the experience replay pool D; Represents the state value function of the evaluation network V2;

[0104] Policy network objective function:

[0105]

[0106] Where: J π (φ) represents the objective function of the policy network; φ is the policy network parameter; Indicates state s t The expected value sampled from the experience replay pool D, where the noise term ε t Obeys normal distribution N; π φ (f φ (ε t ;s t )|s t ) represents the policy function; f φ (ε t ;s t ) is the reparameterization of actions through neural networks;

[0107] Specifically, this embodiment evaluates the effect of track control in the simulation environment by giving the PID controller with the currently set parameters of the SAC algorithm, that is, comprehensively considering whether there is deviation, track tracking error, navigation distance, etc., and evaluates the current action. Through the interaction between the unmanned ship and the simulation environment, the results such as whether there is deviation and track control error are obtained, and then evaluated through the reward function, and then the network parameters in the SAC are updated, the optimal ship control strategy is found, the training of the SAC algorithm is completed, and the PID track controller adaptive parameter setting is realized, thereby realizing track control. The specific implementation method is:

[0108] According to the planned trajectory, the recent route tracking points are sampled, and then the current state input and action selection are performed. By evaluating the reward function of reaching the target point, deviation and other situations, the SAC network parameters are continuously updated through the objective function, so as to find the strategy that can obtain the best action (that is, the optimal PID parameters) and realize the training process of the SAC algorithm, such as Figure 6 Specifically, the other situations in this embodiment are situations where the target point is reached and the deviation is excluded. That is to say, when the target point is not reached and the current track error does not exceed the maximum track error, it is not enough to be judged as a deviation. In other words, the destination is not reached and there is no deviation, which is a situation in the normal navigation process.

[0109] Finally, the framework diagram of the entire SAC-PID-based unmanned boat track control system is as follows: Figure 7 shown.

[0110] First, the preset expected track is input into the simulation environment of the SAC algorithm for environmental interaction, so as to realize the adaptive adjustment of the PID controller parameters through the training of the SAC algorithm, and finally realize track control. Specifically, this embodiment sets the simulation environment based on the PyBullet module in Python.

[0111] This embodiment combines the SAC algorithm with the PID control algorithm. By using the SAC algorithm to adjust the PID control parameters, the problem of parameters needing to be manually adjusted and difficult to change after adjustment is overcome, so that the parameters can be adjusted in real time and have better anti-interference. The combination of deep reinforcement learning and the classic PID control algorithm also circumvents the problem of "lack of explainability" in the current deep reinforcement learning SAC algorithm, reducing concerns about the safety of the controller designed by this method. This enables the system to be deployed on a real ship to complete the trajectory planning and control tasks of surface autonomous vehicles.

[0112] This embodiment uses traditional PID, genetic algorithm (GA), deep deterministic policy gradient (DDPG) and flexible action-criteria (SAC) for trajectory control PID parameter tuning. The trajectory control effects of each method are as follows: Figure 8 As shown, the quantitative track error is given in Table 1. It can be seen from the results that the track control error using the SAC-PID algorithm in this embodiment is smaller than the track control error using the traditional PID, GA-PID and DDPG-PID methods.

[0113] Table 1. Comparison of average track control errors of various methods

[0114]

[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A SAC-PID-based unmanned boat track control method, characterized in that: The steps include: S1: Establish a mathematical model of ship motion to obtain the position and heading of the surface autonomous vehicle and determine the state space of the SAC algorithm; S2: Determine the action space of the SAC algorithm to determine the parameter set of the PID track controller of the surface autonomous vehicle; S3: Establish the reward function of the SAC algorithm to adjust the parameters of the PID track controller of the surface autonomous vehicle based on the SAC algorithm according to the state space of the SAC algorithm; then obtain the speed and rudder angle of the ship through the PID track controller to realize the track control of the unmanned boat.

2. The unmanned boat track control method based on SAC-PID according to claim 1 is characterized in that: The reward functions of the SAC algorithm include a traveled distance reward function, a navigation speed reward function, a track tracking error reward function, an arrival and collision reward function, and a rudder angle limit reward function; The traveled distance reward function is as follows: r distance =ρ d d(i),P t (i)=P target or e(i)>ζ'or△ψ1>θ Where: r distance represents the reward value of the driving distance; ρ d represents the navigation distance coefficient; d(i) represents the distance traveled by the unmanned boat in the i-th iteration; P t (i) represents the position of the unmanned boat at time t during the i-th iteration; P target represents the end point of the desired track; e(i) represents the track error; ζ' is the maximum track error; △ψ1 represents the heading error with the first sampling point; θ is the maximum heading angle error; The navigation speed reward function is as follows: r velocity =ρ v V(i),P t (i)=P target or e(i)>ζ'or△ψ1>θ Where: r velocity represents the navigation speed bonus value; ρ v represents the navigation speed coefficient; V(i) represents the average speed of the unmanned boat; The track tracking error reward function is as follows: r error =ρ e e(i) Where: e represents the track error coefficient, which is selected as a negative number; e(i) represents the track error; r error Represents the track tracking error reward value; The arrival and collision reward functions are as follows: Where: r p represents the arrival and collision reward values, l represents the penalty term, that is, a positive reward value is given for reaching the target point, and a negative reward value is given for deviation; The rudder angle limit reward function is as follows: Where: r d represents the value of the rudder angle limit reward function, δ t (i) represents the rudder angle of the i-th wheel at time t, with right rudder being positive and left rudder being negative; δ max represents the maximum rudder angle allowed by the unmanned boat; λ represents the penalty term; In summary, the reward function of the SAC algorithm is established as follows:

3. The unmanned boat track control method based on SAC-PID according to claim 1 is characterized in that: The mathematical model of ship motion is established as follows: Where: m represents the mass of the ship; Represents the attached coordinate system x b The fluid dynamics derivative of the time derivative of the forward velocity u in the axial direction; Represents the attached coordinate system y b The hydrodynamic derivative of the time derivative of the drift velocity v in the axial direction; represents the fluid dynamics derivative of the time derivative of the moment with respect to the drift velocity v; x OG X represents the center of gravity of the ship in the inertial coordinate system n Coordinate values ​​in the axis direction; Represents the attached coordinate system y b The hydrodynamic derivative of the time derivative of the yaw angular velocity r in the axial direction; represents the hydrodynamic derivative of the time derivative of the external moment about the vertical direction with respect to the yaw angular velocity r; represents the increment of the derivative of the forward speed u; X u Represents the attached coordinate system x b The fluid dynamics derivative in the axial direction with respect to the forward velocity u; Y v Represents the attached coordinate system y b The hydrodynamic derivative of the axial direction with respect to the drift velocity v; N v Y represents the fluid dynamics derivative of the external torque about the vertical direction with respect to the drift velocity v; r Represents the attached coordinate system y b The hydrodynamic derivative of the yaw angular velocity r in the axial direction; N r represents the hydrodynamic derivative of the external moment about the vertical direction with respect to the yaw angular velocity r; u0 represents the velocity of the ship in the inertial coordinate system O n X n The component on the upper side; △u represents the increment of the forward speed u; Y δ N represents the fluid dynamics derivative about the rudder angle δ in the horizontal direction; δ I represents the fluid dynamics derivative of the external torque about the rudder angle δ; δ represents the rudder angle; I zz Represents the moment of inertia.

4. The unmanned boat track control method based on SAC-PID according to claim 1 is characterized in that: The action space of the SAC algorithm is determined as follows: a t =[k xp ,k xi ,k xd ,k yp ,k yi ,k yd ,k ψp ,k ψi ,k ψd ] Where: a t represents the action set of the surface autonomous vehicle, that is, the parameter set of the PID track controller; k xp Indicates PID x The proportional coefficient of the controller; k xi Indicates PID x The integral coefficient of the controller; k xd Indicates PID x The differential coefficient of the controller; k yp Indicates PID y The proportional coefficient of the controller; k yi Indicates PID y The integral coefficient of the controller; k yd Indicates PID y The differential coefficient of the controller; k ψp Indicates PID ψ The proportional coefficient of the controller; k ψi Indicates PID ψ The integral coefficient of the controller; k ψd Indicates PID ψ Differential coefficient of the controller; PID x Represents the PID controller that receives the coordinate error of the x-axis direction in the inertial coordinate system; PID y Represents the PID controller that receives the coordinate error of the y-axis direction in the inertial coordinate system; PID ψ Represents the PID controller that receives the heading error.

5. The unmanned boat track control method based on SAC-PID according to claim 1 is characterized in that: The state space of the SAC algorithm is determined as follows: s t =[△x1,△y1,△ψ1,△x2,△y2,△ψ2,△x3,△y3,△ψ3,V,r] Where: s t represents the state set of the surface autonomous vehicle; △x1 represents the inertial coordinate system X between the current position of the surface autonomous vehicle and the first sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △y1 represents the inertial coordinate system Y between the current position of the surface autonomous vehicle and the first sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △ψ1 represents the heading error between the current position of the surface autonomous vehicle and the first sampling point closest to the ship according to the fixed step length sampling; △x2 represents the inertial coordinate system X of the current position of the surface autonomous vehicle and the second sampling point closest to the ship according to the fixed step length sampling n The coordinate error in the axis direction; △y2 represents the inertial coordinate system Y between the current position of the surface autonomous vehicle and the second sampling point closest to the ship sampled at a fixed step length n The coordinate error in the axis direction; △ψ2 represents the heading error between the surface autonomous vehicle and the second sampling point closest to the ship according to the fixed step length sampling; △x3 represents the inertial coordinate system X between the current position of the surface autonomous vehicle and the third sampling point closest to the ship according to the fixed step length sampling n △y3 represents the coordinate error in the Y axis direction of the current position of the surface autonomous vehicle and the inertial coordinate system Y of the third sampling point closest to the ship sampled at a fixed step length. n Δψ3 represents the heading error between the current position of the surface autonomous vehicle and the third sampling point closest to the ship sampled at a fixed step size; V represents the combined speed of the surface autonomous vehicle's forward speed u and its lateral drift speed v, and r is the bow angular velocity.

Citation Information

Cited By

  • Ship autopilot control method based on PID parameter real-time adjustment

    CN119472249A

  • Course control method and device of trenching and cable laying robot and trenching and cable laying robot

    CN120335287A

  • Course control method and device for trenching and cable laying robot and trenching and cable laying robot

    CN120335287B

  • Unmanned aerial vehicle control system parameter setting method and device based on brain-like mechanism

    CN121028511A