An unmanned ship obstacle avoidance method and system based on an improved Bug2 algorithm
By using millimeter-wave radar and camera sensors on unmanned vessels, combined with an improved Bug2 algorithm, the obstacle avoidance strategy is dynamically adjusted, solving the problem of fixed obstacle avoidance direction in the traditional Bug2 algorithm and achieving a more efficient and stable obstacle avoidance effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-26
- Publication Date
- 2026-03-27
AI Technical Summary
The existing Bug2 algorithm requires the obstacle avoidance motion to rejoin the m-line after obstacle avoidance before it can end. The obstacle avoidance direction is fixed and cannot be automatically selected according to different obstacles, which increases the obstacle avoidance length and navigation instability.
Employing millimeter-wave radar and cameras as sensors, combined with an improved Bug2 algorithm, the system calculates the distance and size between obstacles and the unmanned vessel, optimizes the obstacle avoidance heading angle and turning direction, dynamically selects detour strategies, and adjusts the course in real time to avoid obstacles.
It improves obstacle avoidance efficiency and success rate, reduces navigation path length, enhances navigation stability and real-time performance, and avoids collision risks caused by single sensor failure.
Smart Images

Figure CN116795113B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of unmanned ship water surface navigation obstacle avoidance, in particular, relates to an unmanned ship obstacle avoidance method and system based on an improved Bug2 algorithm. BACKGROUND
[0002] The ocean not only contains very abundant material resources, but also is a key channel for trade between countries. With the advent of the new century, the trend of global economic integration is becoming increasingly apparent, and countries attach great importance to the development of the ocean. Unmanned ships, due to their unmanned and intelligent nature, have become a new hotspot in the international maritime industry for research and attention.
[0003] An unmanned ship (USV) is an unmanned ship that is controlled by a manual control or an automatic control to control the intelligent control system of the unmanned ship sailing on the water surface. Autonomous obstacle avoidance is a core technology for the unmanned ship to achieve complete autonomous navigation, and the intelligent level of the unmanned ship to a certain extent represents the level of the intelligent level of the unmanned ship system. When the unmanned ship encounters an obstacle while sailing according to the established global route during the execution of the task, making an effective collision avoidance decision is an important guarantee for the safety of the unmanned ship sailing and executing the task. In order to ensure the safety and standardization of the collision avoidance decision, the obstacle avoidance algorithm is combined with the unmanned ship system, thereby improving the efficiency of the obstacle avoidance path of the unmanned ship and the safety of the sailing. In a complex and vast sea, the real-time performance of the obstacle avoidance algorithm is crucial, and an effective obstacle avoidance strategy can be quickly developed for a sudden obstacle.
[0004] The traditional Bug2 algorithm simplifies the obstacle avoidance movement into two movement modes, i.e. straight running and round running. When there is no obstacle within the safety distance of the unmanned ship, the unmanned ship runs straight to the target point, otherwise the unmanned ship runs along the boundary of the obstacle to avoid the obstacle. The Bug2 algorithm avoids complex calculations during execution. However, due to its simplicity, some shortcomings are also inevitable. When the unmanned ship runs along the boundary of the obstacle to avoid the obstacle, it must rejoin the m-line to end the obstacle avoidance movement. Moreover, the Bug2 algorithm selects a fixed obstacle avoidance direction along the boundary of the obstacle, which cannot be automatically selected according to different obstacles, greatly increasing the length of the obstacle avoidance path of the unmanned ship and leading to instability of the sailing of the unmanned ship. SUMMARY
[0005] The technical problem to be solved by the present application is:
[0006] In order to solve the problem that the existing Bug2 algorithm needs to rejoin the m-line to end the obstacle avoidance movement after obstacle avoidance, and the obstacle avoidance direction is fixed and cannot be automatically selected according to different obstacles, which increases the length of the obstacle avoidance and leads to instability of the sailing.
[0007] The application adopts the technical scheme for solving the above technical problems:
[0008] The application provides an unmanned ship obstacle avoidance method based on an improved Bug2 algorithm, and comprises the following steps:
[0009] Step one, start the upper computer and the unmanned ship system, initialize the sensor and system parameters, and the sensor comprises a millimeter wave radar and a camera;
[0010] Step two, according to satellite map information, plan a global route on the upper computer to avoid known static obstacles;
[0011] Step three, when an obstacle appearing outside the map or a moving obstacle appears, acquire the environment information around the ship body by using the millimeter wave radar and the camera, including acquiring the distance information between the obstacle and the unmanned ship by the millimeter wave radar, and calculating the size of the obstacle by image recognition technology;
[0012] Step four, calculate and find out the obstacle closest to the unmanned ship within the set unmanned ship sailing safety distance as the priority avoidance object;
[0013] Step five, when the minimum value is less than or equal to the safety distance, take the obstacle as the obstacle avoidance object, calculate the bypass strategy based on the angle calculation scheme of the improved Bug2 algorithm, and the bypass strategy comprises the calculation of the obstacle avoidance heading angle and the determination of the turning direction;
[0014] Step six, control the motion of the unmanned ship according to the bypass strategy of the improved Bug2 algorithm in the step, decide the motion strategy at the next moment in the process of moving along the obstacle boundary, including moving along the obstacle boundary and advancing straight to the target point;
[0015] Step seven, re-calculate and plan the bypass strategy from step three to step six until the target point is reached, and the unmanned ship sailing task is completed.
[0016] Further, in step two, the specific steps comprise: acquiring the regional map information of the area where the unmanned ship is located through the upper computer according to the position of the unmanned ship, and planning a global route of the unmanned ship from the starting point to the end point on the map; when the unmanned ship sails according to the planned route, known static obstacles can be avoided, and when an obstacle appearing outside the map or a moving obstacle appears, the improved Bug2 algorithm needs to be used for obstacle avoidance.
[0017] Further, in step four, according to the distance information of each obstacle detected by the millimeter wave radar and the unmanned ship, the minimum value of the distance is found in the detection result, and the size of the minimum value and the set unmanned ship navigation safety distance is taken as the unmanned ship obstacle avoidance condition. When the minimum value is greater than the safety distance, the deviation distance and deviation heading angle of the unmanned ship from the planned route are taken as the input of the PID algorithm to control the unmanned ship to travel along the established route; when the minimum value is less than or equal to the safety distance, the obstacle is taken as the obstacle avoidance object for the next obstacle avoidance operation.
[0018] Further, when the unmanned ship does not need to avoid obstacles, it travels along the established route, and the specific implementation method is:
[0019] Let the spatial coordinate position of the unmanned ship be (x1, y1), the starting point coordinate be (x2, y2), and the target point coordinate be (x3, y3). The straight line equation of the planned route is:
[0020] (x3-x2)y-(y3-y2)x-(x3-x2)y2+y3-y2=0
[0021] Let A=(x3-x2), B=(y3-y2), and C=-(x3-x2)y2+y3-y2. According to the straight line equation of the planned route and the position coordinate of the unmanned ship, the deviation distance d is calculated as:
[0022]
[0023] The calculation method of the deviation heading angle φ is:
[0024] φ=arctan{(y3-y1)÷(x3-x1)cos((x3+x1)÷2)}
[0025] Where cos((x3+x1)÷2) is the latitude correction amount.
[0026] Secondly, the offset data is taken as the input of the PID algorithm, and the discrete form of the PID algorithm is:
[0027]
[0028] Where k is the time; e[k] is the error amount at the current time, i.e. the offset data; e[k-1] is the error amount at the previous time; K p is the proportional coefficient; K d is the differential coefficient; K i is the integral coefficient; and u[k] is the ideal moving distance and turning heading angle of the unmanned ship.
[0029] Further, the method for calculating the obstacle avoidance heading angle comprises: calculating the angles between the left and right boundaries of the obstacle and the line connecting the unmanned ship and the target point, i.e. θ1 and θ2, according to the distance information and the obstacle size information of the two sensors in step three, and selecting the smaller one of the two angles as the direction of the obstacle avoidance, i.e. the obstacle avoidance direction, and setting the position of the unmanned ship as the starting point of the obstacle avoidance;
[0030] After determining the obstacle avoidance direction, the minimum turning angle is calculated, including: after the unmanned ship turns left by θ3 at point O, point H can just pass through point E, at this time, the position of the bow is point F, and it is assumed that F_G is parallel to FE after the unmanned ship turns, and F_G = FE = L, OH = L1, and OF = L2, wherein L1 and L2 can be obtained by measurement, and the method for calculating the angle θ3 is as follows:
[0031] θ3 = ∠F_OE + ∠EOF = ∠EOF + ∠OEH
[0032] θ2 = ∠OEF + ∠EOF
[0033] θ4 = ∠OEF + ∠FEH
[0034] θ2 + θ4 - θ3 = ∠FEO
[0035] Therefore, θ2 + θ4 can be used instead of θ3 as the angle value of the obstacle avoidance turning of the unmanned ship, wherein θ4 = tan -1 (L1 ÷ (L + L2)), when it is determined that the unmanned ship turns left as the obstacle avoidance direction, the direction of the unmanned ship in the subsequent obstacle boundary movement process is counterclockwise turning; when it is determined that the unmanned ship turns right as the obstacle avoidance direction, the direction of the unmanned ship in the subsequent movement process is clockwise turning; when the angles between the left and right boundaries of the obstacle and the unmanned ship are equal, i.e. θ1 = θ2, the default direction of the unmanned ship for obstacle avoidance is left movement.
[0036] Further, the switching of the two bypass strategies in step six is realized by a decision condition: assuming that the unmanned ship determines the next step movement at any position in the environment, whether there is an obstacle blocking the direction of the connection between the current position and the target position of the unmanned ship within the sensor detection range, that is, whether the unmanned ship can reach the destination from the current position by straight sailing through the mastered environmental information, if so, the current position of the unmanned ship is set as a new starting point, which is also the escape point of obstacle avoidance movement, a new target route is determined, then the unmanned ship adjusts the heading to face the target point and sails straight to the target point; if not, the obstacle boundary movement strategy is selected, and the shortest distance between the unmanned ship and the obstacle and the safety distance are used to control the movement of the unmanned ship around the obstacle together with the obstacle avoidance direction, and the decision-making is performed again after each step movement of the unmanned ship to ensure the real-time of the planning scheme.
[0037] Further, whether the bypass is ended is determined by whether one of the following two conditions is met, that is, there is no obstacle between the current position of the unmanned ship and the target point within the sensor detection range; the unmanned ship returns to the obstacle avoidance starting point after one round around the obstacle or the unmanned ship is located between the obstacle avoidance starting point and the target point, which indicates that the target point is unreachable, and then the movement is stopped and the task failure of the upper computer is fed back.
[0038] Further, the horizontal detection angle of the millimeter wave radar is 120°, the vertical detection angle is 30°, and electromagnetic waves with a frequency of 76GHZ to 81GHZ are sent within the range, and the ranging range is 0.1m to 50m.
[0039] Further, the millimeter wave radar and the camera are both arranged at the bow of the ship.
[0040] An unmanned ship obstacle avoidance system based on an improved Bug2 algorithm, which has program modules corresponding to the above steps, and executes the steps in the above-mentioned unmanned ship obstacle avoidance method based on the improved Bug2 algorithm when running.
[0041] Compared with the prior art, the beneficial effects of the present application are:
[0042] (1) The millimeter wave radar and the camera are used as the ship body detection device, and the use of two sensors for detection can effectively avoid the failure of a single sensor, so that the unmanned ship loses the perception of the surrounding environment, leading to a collision accident of the unmanned ship, and the distance information and the contour information of the obstacle can be accurately detected through the above-mentioned sensors, and hardware device support is provided for realizing the obstacle avoidance of the unmanned ship.
[0043] (2) The detection device used in the application can detect the area within the range of 0.1 m to 50 m through millimeter wave radar at a long distance, can perceive the obstacle at a long distance in advance, and can monitor the obstacle at a short distance by using a camera and calculating the size of the obstacle through image recognition technology; the combination of the two can accurately perceive the environmental information around the ship body;
[0044] (3) The application uses Bug2 algorithm as the basis for obstacle avoidance of the unmanned ship, discards the traditional Bug2 algorithm turning method, and uses the improved turning strategy method, so that the obstacle avoidance is more efficient;
[0045] (4) The application uses the angle optimization strategy and the turning motion strategy to analyze and calculate the sensor data, effectively solves the problems of fixed avoidance direction and excessive path redundancy of the traditional Bug2 algorithm, and retains the real-time characteristics of the Bug2 algorithm; when facing complex sea areas, the obstacle avoidance success rate of the application is higher, and the application can be widely popularized in the field of unmanned ships on water and the like. BRIEF DESCRIPTION OF DRAWINGS
[0046] Figure 1 It is a flowchart of the improved Bug2 algorithm-based unmanned ship obstacle avoidance method in the embodiments of the application;
[0047] Figure 2 It is an obstacle angle diagram in the embodiments of the application;
[0048] Figure 3 It is a minimum obstacle avoidance turning angle diagram in the embodiments of the application;
[0049] Figure 4 It is a path diagram planned by the traditional Bug2 algorithm in the embodiments of the application;
[0050] Figure 5 It is a path diagram planned by the improved Bug2 algorithm in the embodiments of the application.
[0051] BRIEF DESCRIPTION OF DRAWINGS
[0052] In Figure 2 , S is the starting point; A, B, C and D are all obstacles; T is the terminal point; in Figure 3 , O is the center of the ship body; F is the position of the ship bow without turning; F_ is the position of the ship bow after turning; H is the rightmost side of the ship body without turning; H_ is the rightmost side of the ship body after turning; E is the leftmost side of the obstacle; G is the position of the ship bow when the rightmost side of the ship body after turning passes through the point E; Figure 4 and Figure 5 are the unmanned ship navigation routes planned by the traditional Bug2 algorithm and the improved Bug2 algorithm respectively in the same map environment. DETAILED DESCRIPTION
[0053] In the description of the present application, it should be explained that the terms of nouns such as "upper", "lower", "front", "rear", "left", "right" and the like in each embodiment indicate the words of orientation, only for the purpose of simplifying the description of the position relationship based on the drawings, and do not represent that the elements and devices and the like must be operated according to the specific orientation and the defined operation and method, structure, and the like, and such orientation terms do not constitute a limitation on the present application.
[0054] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the specific embodiments of the present application will be described in detail below with reference to the drawings.
[0055] Specific implementation scheme one: combined Figures 1 to 5 As shown in the figure, the present application provides an unmanned ship obstacle avoidance method based on improved Bug2 algorithm, comprising the following steps:
[0056] Step one, start the host computer and the unmanned ship system, initialize the sensor module and system parameters, the sensor module includes millimeter wave radar and camera;
[0057] Step two, according to the satellite map information, plan the global route on the host computer, and avoid the known static obstacles;
[0058] Specifically, according to the position of the unmanned ship, the local area map information is obtained through the host computer, and the global route of the unmanned ship from the starting point to the terminal point is planned on the map; The unmanned ship can avoid known static obstacles according to the planned route, and when obstacles appear outside the map or moving obstacles appear, the improved Bug2 algorithm is used for obstacle avoidance;
[0059] Step three, adopt millimeter wave radar and camera to obtain the environmental information around the ship body;
[0060] Specifically, the distance information between the obstacle and the unmanned ship is obtained through the millimeter wave radar; the size of the obstacle is calculated by using image recognition technology;
[0061] The horizontal detection angle of the millimeter wave radar is 120°, the vertical detection angle is 30°, electromagnetic waves are sent at a frequency of 76GHZ to 81GHZ within this range, and the ranging range is 0.1m to 50m;
[0062] The millimeter wave radar and the camera are both arranged at the bow of the ship;
[0063] Step four, calculate and find out the obstacle closest to the unmanned ship within the set safety distance of the unmanned ship navigation as the priority avoidance object;
[0064] Specifically, according to the distance information of each obstacle detected by the millimeter wave radar and the unmanned ship, the minimum value of the distance is found in the detection result, and the size of the minimum value and the set unmanned ship navigation safety distance is taken as the unmanned ship obstacle avoidance condition: when the minimum value is greater than the safety distance, the deviation distance and deviation heading angle of the unmanned ship from the planned route are taken as the input of the PID algorithm, and the unmanned ship is controlled to travel along the planned route; when the minimum value is less than or equal to the safety distance, the obstacle is taken as an obstacle avoidance object for the next obstacle avoidance operation;
[0065] When the unmanned ship does not need to avoid obstacles, it travels along the planned route, and the specific implementation method is as follows:
[0066] Let the spatial coordinate position of the unmanned ship be (x1, y1), the starting point coordinate be (x2, y2), and the target point coordinate be (x3, y3). Then the straight line equation of the planned route is:
[0067] (x3-x2)y-(y3-y2)x-(x3-x2)y2+y3-y2=0
[0068] Let A=(x3-x2), B=(y3-y2), and C=-(x3-x2)y2+y3-y2. According to the straight line equation of the planned route and the position coordinate of the unmanned ship, the deviation distance d is calculated as:
[0069]
[0070] The calculation method of the deviation heading angle φ is as follows:
[0071] φ=arctan{(y3-y1)÷(x3-x1)cos((x3+x1)÷2)}
[0072] Where cos((x3+x1)÷2) is the latitude correction amount.
[0073] Secondly, the offset data is taken as the input of the PID algorithm, and the discrete form of the PID algorithm is as follows:
[0074]
[0075] Where k is the time; e[k] is the error amount at the current time, i.e. the offset data; e[k-1] is the error amount at the previous time; K p is the proportional coefficient; K d is the differential coefficient; K i is the integral coefficient; and u[k] is the ideal moving distance and turning heading angle of the unmanned ship.
[0076] Step five, when the minimum value is less than or equal to the safety distance and the obstacle is taken as an obstacle avoidance object, the avoidance heading angle is calculated based on the angle calculation scheme of the improved Bug2 algorithm, as follows: Figure 2The obstacle avoidance object is determined according to step four, the angles of the left and right boundaries of the obstacle and the line connecting the unmanned ship and the target point are calculated according to the data information of the two sensors in step three, i.e. the distance information and the obstacle size information, i.e. θ1 and θ2, and according to the calculated angle information, the side with the smaller angle is selected as the movement direction around the obstacle boundary; at this time, the position of the unmanned ship is set as the starting point of obstacle avoidance, after the obstacle avoidance direction is determined, the minimum turning angle is calculated, such as Figure 3 As shown in the figure, the darker triangle represents the position of the unmanned ship when starting obstacle avoidance, and the lighter triangle represents the position of the unmanned ship after turning the angle θ3.
[0077] After the unmanned ship turns left by θ3 around point O, point H can pass through point E, at this time, the position of the bow is point F, and F_G is parallel to FE, and F_G = FE = L. OH = L1, OF = L2, wherein L1 and L2 can be obtained by measurement, and the calculation method of the angle θ3 is as follows:
[0078] θ3 = ∠F_OE + ∠EOF = ∠EOF + ∠OEH
[0079] θ2 = ∠OEF + ∠EOF
[0080] θ4 = ∠OEF + ∠FEH
[0081] θ2 + θ4 - θ3 = ∠FEO
[0082] Therefore, θ2 + θ4 can be used instead of θ3 as the angle value of the turning of the unmanned ship for obstacle avoidance, wherein θ4 = tan -1 (L1 ÷ (L + L2)), when it is determined that the unmanned ship turns left as the obstacle avoidance direction, then in the subsequent movement around the obstacle boundary, the movement direction of the unmanned ship is counterclockwise turning; when it is determined that the unmanned ship turns right as the obstacle avoidance direction, then in the subsequent movement of the unmanned ship, the movement direction is clockwise turning; when the angles of the left and right boundaries of the obstacle and the unmanned ship are equal, i.e. θ1 = θ2, the default obstacle avoidance direction of the unmanned ship is left movement;
[0083] Step six: in the process of movement around the obstacle boundary, the movement of the unmanned ship is controlled by the improved Bug2 algorithm in step five, and the unmanned ship determines the movement at the next moment according to the movement strategy in the process of movement around the obstacle boundary;
[0084] Specifically, the movement scheme of the improved Bug2 algorithm contains two strategies: one is to move along the boundary of the obstacle; the other is to move straight to the target point.
[0085] The switching between the two strategies is realized by a decision condition, which is: assuming that the unmanned ship determines the next movement at any position in the environment, whether there is an obstacle blocking the direction of the line connecting the current position of the unmanned ship and the target position in the sensor detection range, that is, whether the unmanned ship can reach the target point in a straight line from the current position through the environment information mastered, if so, the current position of the unmanned ship is set as a new starting point, which is also the obstacle avoidance movement escape point, a new target route is determined, then the unmanned ship adjusts the heading to face the target point and moves in a straight line to the target point, if not, the obstacle boundary movement strategy is selected, when tracking the obstacle boundary movement, the unmanned ship moves around the obstacle under the joint control of the difference between the shortest distance between the unmanned ship and the obstacle and the safety distance and the obstacle avoidance direction, after each movement of the unmanned ship, the decision is made again to ensure the real-time of the planning scheme;
[0086] One of the following two conditions should be met when the unmanned ship obstacle avoidance movement ends, that is, there is no obstacle between the current position of the unmanned ship and the target point in the sensor detection range, or the unmanned ship returns to the obstacle avoidance starting point after moving around the obstacle or the unmanned ship is located between the obstacle avoidance starting point and the target point, which indicates that the target point is unreachable, then the movement is stopped and the upper computer task failure is fed back.
[0087] Step seven, recalculate steps three to six until the target point is reached, and the unmanned ship navigation task is completed.
[0088] Combined with Figure 4 and Figure 5 As shown, the unmanned ship cannot effectively avoid the obstacles in the path planned by the traditional Bug2 algorithm, the unmanned ship can effectively avoid the obstacles in the path planned by the improved Bug2 algorithm, and the path with shorter length is selected for navigation in the avoidance process, which ensures effective avoidance and reduces the path length.
[0089] Specific implementation scheme two: combined with Figures 1 to 5 As shown, the present application provides an unmanned ship obstacle avoidance system based on an improved Bug2 algorithm, which has program modules corresponding to the above steps, and executes the steps in the above-mentioned unmanned ship obstacle avoidance method based on the improved Bug2 algorithm when running. The other combinations and connection relationships of this embodiment are the same as those of the first specific implementation scheme.
[0090] Although the present application is disclosed as above, the protection scope of the present application is not limited to this. The person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application, and these changes and modifications will fall within the protection scope of the present application.
Claims
1. An obstacle avoidance method for unmanned surface vessels based on an improved Bug2 algorithm, characterized in that, Includes the following steps: Step 1: Start the host computer and unmanned vessel system, and initialize the sensors and system parameters. The sensors include millimeter-wave radar and cameras. Step 2: Based on satellite map information, plan the global flight path on the host computer to avoid known static obstacles; Step 3: When obstacles appear outside the map or moving obstacles appear, use millimeter-wave radar and cameras to obtain information about the environment around the ship, including obtaining distance information between the obstacles and the unmanned ship through millimeter-wave radar. The size of the obstacle is calculated using image recognition technology; Step 4: Calculate and identify the obstacle closest to the unmanned vessel within the set safe navigation distance as the priority to avoid; Step 5: When the minimum value is less than or equal to the safe distance and the obstacle is taken as the obstacle avoidance object, a detour strategy is calculated based on the angle calculation scheme of the improved Bug2 algorithm. The detour strategy includes the calculation of the obstacle avoidance heading angle and the determination of the turning direction. The method for calculating the obstacle avoidance heading angle includes: based on the data information from the two sensors in step three, namely distance information and obstacle size information, calculating the angles between the left and right boundaries of the obstacle and the line connecting the unmanned vessel and the target point, namely θ1 and θ2; based on the calculated angle information, selecting the side with the smaller angle as the direction of movement around the obstacle boundary, namely the obstacle avoidance direction; and setting the position of the unmanned vessel as the obstacle avoidance starting point. After determining the obstacle avoidance direction, the minimum turning angle is calculated. This includes the following: after the unmanned surface vessel (USV) turns left by θ3 around point O, point H_ can just pass through point E. At this point, the bow position is point F_. Assume that after the USV turns, F_G is parallel to FE, and F_G=FE=L, OH=L1, OF=L2. L1 and L2 can both be obtained through measurement. The calculation method for angle θ3 is as follows: Therefore, θ2+θ4 can be used to replace θ3 as the angle value for obstacle avoidance steering of the unmanned surface vessel, where When the unmanned vessel is determined to turn left as the obstacle avoidance direction, its movement direction will be counterclockwise during the subsequent movement around the obstacle boundary; when the unmanned vessel is determined to turn right as the obstacle avoidance direction, its movement direction will be clockwise; when the angle between the left and right boundaries of the obstacle and the unmanned vessel is equal, i.e., θ1=θ2, the unmanned vessel's obstacle avoidance direction defaults to moving to the left. Step 6: Control the movement of the unmanned vessel according to the detour strategy of the improved Bug2 algorithm in the previous step. During the movement around the obstacle boundary, the movement strategy at the next moment is determined according to the detour strategy, including moving along the obstacle boundary and moving in a straight line towards the target point. Step 7: Repeat the calculations from Steps 3 to 6 and plan the detour strategy until the target point is reached, thus completing the unmanned vessel navigation mission.
2. The obstacle avoidance method for unmanned surface vessels based on the improved Bug2 algorithm according to claim 1, characterized in that, In step two, the specific steps include: based on the location of the unmanned vessel, obtaining local area map information through the host computer, and planning a global route for the unmanned vessel from the starting point to the destination on the map; when the unmanned vessel travels along the planned route, it can avoid known static obstacles. When obstacles appear outside the map or moving obstacles appear, obstacle avoidance needs to be performed by improving the Bug2 algorithm.
3. The obstacle avoidance method for unmanned surface vessels based on the improved Bug2 algorithm according to claim 2, characterized in that: In step four, based on the distance information between each obstacle and the unmanned vessel detected by the millimeter-wave radar, the minimum distance is found in the detection results. The minimum distance and the set safe distance for unmanned vessel navigation are used as the obstacle avoidance condition for the unmanned vessel. When the minimum distance is greater than the safe distance, the deviation distance and deviation heading angle between the unmanned vessel and the planned route are used as inputs to the PID algorithm to control the unmanned vessel to travel along the predetermined route. When the minimum distance is less than or equal to the safe distance, the obstacle is treated as the obstacle to be avoided and the next obstacle avoidance operation is performed.
4. The obstacle avoidance method for unmanned surface vessels based on the improved Bug2 algorithm according to claim 3, characterized in that, In step four, the obstacle closest to the unmanned vessel within the safe distance is calculated and identified as the priority avoidance target. Specifically, based on the distance information between each obstacle and the unmanned vessel detected by millimeter-wave radar, the minimum value is found in the detection results, and the minimum value and the set safe travel distance of the unmanned vessel are used as the obstacle avoidance condition of the unmanned vessel. When the minimum value is greater than the safe distance, the deviation distance and deviation heading angle between the unmanned vessel and the planned route are used as inputs to the PID algorithm to control the unmanned vessel to travel along the predetermined route; otherwise, the obstacle is treated as an obstacle avoidance target. When the unmanned surface vessel does not need to avoid obstacles, it travels along a predetermined route. The specific method for achieving this is as follows: Let the spatial coordinates of the unmanned surface vessel be (x1, y1), the starting point coordinates be (x2, y2), and the target point coordinates be (x3, y3). Then the equation of the straight line of the planned route is: Let A = (x³ - x²), B = (y³ - y²), C = -(x³ - x²)y² + y³ - y². Based on the straight-line equation of the planned route and the position coordinates of the unmanned vessel, the deviation distance d is calculated as follows: The deviation heading angle φ is calculated as follows: Where cos((x3+x1)÷2) is the latitude correction amount; Secondly, the offset data is used as the input to the PID algorithm. The discrete form of the PID algorithm is as follows: Where k is time; e[k] is the error at the current time, i.e., the offset data; e[k-1] is the error at the previous time; K p K is the proportionality coefficient. d K represents the differential coefficient; i is the integral coefficient; u[k] represents the ideal moving distance and turning angle of the unmanned vessel.
5. The obstacle avoidance method for unmanned surface vessels based on the improved Bug2 algorithm according to claim 4, characterized in that, The switching between the two detour strategies in step six is achieved by decision conditions. The decision conditions are as follows: assuming the unmanned surface vessel (USV) determines its next movement at any position in the environment, whether there is an obstacle blocking the line connecting the current position and the target position within the sensor detection range. That is, by using the environmental information already obtained, it is checked whether the USV can travel in a straight line from its current position to the destination. If it can, the current position of the USV is set as the new starting point, which is also the obstacle avoidance departure point. A new target route is determined, and then the USV adjusts its course to face the target point and moves in a straight line towards the target point. If it cannot, the obstacle boundary movement strategy is selected. When tracking the obstacle boundary, the difference between the shortest distance and the safe distance between the USV and the obstacle, as well as the obstacle avoidance direction, are used to control the USV's movement around the obstacle. After each step of the USV's movement is completed, a decision is made again to ensure the real-time performance of the planning scheme.
6. The obstacle avoidance method for unmanned surface vessels based on the improved Bug2 algorithm according to claim 5, characterized in that: Whether the detour is completed is determined by whether one of the following two conditions is met: there are no obstacles between the current position of the unmanned vessel and the target point within the sensor's detection range; or the unmanned vessel returns to the obstacle avoidance starting point after circling the obstacle once, or the unmanned vessel is located between the obstacle avoidance starting point and the target point. If the target point is unreachable, the movement is stopped and the host computer is notified of the task failure.
7. The obstacle avoidance method for unmanned surface vessels based on the improved Bug2 algorithm according to claim 6, characterized in that: The millimeter-wave radar has a horizontal detection angle of 120° and a vertical detection angle of 30°. Within this range, it transmits electromagnetic waves at a frequency of 76GHz to 81GHz, and its ranging range is from 0.1 m to 50 m.
8. The obstacle avoidance method for unmanned surface vessels based on the improved Bug2 algorithm according to claim 7, characterized in that: Both the millimeter-wave radar and the camera are located at the bow of the ship.
9. An unmanned surface vessel obstacle avoidance system based on an improved Bug2 algorithm, characterized in that: The system has a program module corresponding to the steps of any one of the claims 1-8 above, and executes the steps in the above-described unmanned vessel obstacle avoidance method based on the improved Bug2 algorithm when it is run.