A ship navigation route correction method, medium and electronic device
By constructing a digital twin scenario and predicting the target position, a correction path that conforms to the navigation rules is generated, which solves the problems of uneven path and delayed response in ship navigation in the existing technology, and realizes safe and efficient navigation planning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 上海漂视网络股份有限公司
- Filing Date
- 2026-05-06
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies struggle to generate smooth, safe, and compliant correction paths for ships during navigation, especially in complex waters where they exhibit lag in response and lack the ability to predict future movement trends.
By constructing a digital twin scenario with heading rules and obstacle information, the target position is predicted based on the ship's current yaw state, and a correction path that conforms to the navigation rules and can avoid obstacles is generated. By combining the grid cell attributes and dynamic obstacle information in the digital twin scenario, proactive planning and trend prediction are achieved.
It improves the smoothness, safety, and efficiency of navigation planning paths, ensures that paths comply with waterway rules and avoid obstacles, and reduces response lag and error accumulation in path planning.
Smart Images

Figure CN122130093A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of ship navigation, and specifically, the embodiments of this application relate to a ship navigation route correction method, medium, and electronic equipment. Background Technology
[0002] With the development of inland waterway and maritime transport, waterway traffic density is increasing and the navigation environment for ships is becoming more complex. Especially in narrow waterways, winding sections, or waters greatly affected by wind, waves, and currents, ships often find it difficult to follow the pre-planned route, making them prone to deviation and increasing the risk of grounding and collisions.
[0003] Currently, research and existing technologies for ship path correction mainly focus on the following aspects.
[0004] GPS-based route monitoring systems. Some existing waterway monitoring systems acquire vessel positions in real time via GPS and display them on electronic charts. When a vessel deviates from the preset route, the system issues an alarm. However, these systems only provide early warnings, merely indicating the deviation and not actively generating corrective paths.
[0005] Traditional methods for simulating ship motion are often based on simplified mathematical models. While these models offer high accuracy in academic research, they are difficult to apply in practical engineering applications due to the large computational load and complex parameter calibration. Consequently, they struggle to quickly generate smooth correction paths that conform to the waterway topography within fixed, short time intervals, taking into account real-time environmental data and the ship's current dynamic response.
[0006] The main problems with existing technologies include: response lag and path non-smoothness. This is because traditional feedback control can only correct yaw after it occurs and lacks the ability to predict short-term motion trends in the future, resulting in a violent correction process and difficulty in forming a smooth transition path that fits the actual physical environment. Insufficient spatiotemporal dimensional integration is also a problem because most existing solutions only focus on position correction at the current moment and cannot simulate the ship's motion trajectory in advance over a period of time.
[0007] Therefore, how to generate a correction path that is more in line with the characteristics of ship dynamics has become a technical problem that urgently needs to be solved in this field. Summary of the Invention
[0008] The purpose of this application is to provide a method, medium, and electronic device for correcting ship navigation routes. The embodiments of this application construct a digital twin scenario with heading rules and obstacle information, and predict the target position based on the ship's current yaw state to generate a correction path that conforms to the waterway rules and can avoid obstacles. This realizes the goal of changing the navigation route planning problem from passive early warning to active planning, and from instantaneous correction to trend prediction, and ultimately improves the smoothness, safety, and navigation efficiency of the navigation planning path.
[0009] In a first aspect, embodiments of this application provide a method for correcting a ship's navigation route. The method includes: constructing a digital twin scene corresponding to a waterway, wherein the digital twin scene includes a target centerline conforming to the shape of the waterway and grid cells with heading attributes and static obstacle markers, the digital twin scene being a digital twin waterway corresponding to the waterway; receiving motion data reported by a ship, wherein the motion data includes at least the ship's current position and current speed; converting the current position to the digital twin scene to obtain a first mapping point; determining the projection point of the first mapping point on the target centerline; and calculating... The distance from the first mapping point to the projection point is calculated as the lateral offset distance; based on the current speed and time interval, the projection point is pushed forward by an arc length along the target centerline and then laterally offset by the target offset distance to obtain the target position, wherein the target offset distance is the lateral offset distance or a preset offset distance determined according to the boundary of the channel; in the digital twin scenario, a target correction path from the first mapping point to the target position is generated based on the heading attribute of the grid cell, the static obstacle marker, and the dynamic obstacle information; the target correction path is provided to the ship to control the ship to navigate according to the target correction path.
[0010] The embodiments of this application construct a digital twin scenario with heading rules and obstacle information, and predict the target position based on the ship's current yaw state to generate a correction path that conforms to the waterway rules and can avoid obstacles. This achieves the goal of transforming the navigation path planning problem from passive early warning to active planning, and from instantaneous correction to trend prediction, and ultimately improves the smoothness, safety and navigation efficiency of the navigation planning path.
[0011] In some embodiments, the target offset distance is the lateral offset distance or a preset offset distance determined according to the boundary of the channel, including: moving forward by the arc length distance along the target centerline from the projection point to obtain a first position point, wherein the arc length distance is equal to the product of the current speed and the time interval; offsetting the first position point by the lateral offset distance along the normal direction of the target centerline at the first position point to obtain a second position point; and determining the target position based on the second position point.
[0012] Some embodiments of this application predict the future motion trend of a ship by advancing an arc length (the product of speed and time interval) along the target centerline in a digital twin scenario, so that the target position naturally conforms to the channel direction; by offsetting the normal direction, the current lateral yaw distance is maintained, avoiding path swaying caused by forced centering. Compared with the prior art, this method integrates the time dimension and the current yaw state into the target position prediction, realizing a transformation from passive correction to active prediction, improving the smoothness, safety, and conformity with channel rules of the correction path.
[0013] In some embodiments, determining the target position based on the second position point includes: verifying whether the second position point exceeds the boundary of the channel; if it is confirmed that the second position point does not exceed the boundary, then taking the second position point as the target position; if it is confirmed that the second position point exceeds the boundary, then offsetting the first position point along the normal direction of the target centerline at the first position point by a preset offset distance to obtain the target position, wherein the preset offset distance is predefined based on the boundary.
[0014] Some embodiments of this application, combined with boundary correction, ensure that the target location on the planned path always falls within the navigable area, thereby improving the feasibility of the planned route.
[0015] In some embodiments, constructing a digital twin scene corresponding to the waterway includes: determining a segment on the i-th centerline where the radius of curvature is less than the target turning radius, wherein the target turning radius is the minimum turning radius of the vessel, and i is an integer greater than or equal to 1; adding at least one control point within the segment and adjusting the position of the at least one control point to increase the radius of curvature of the corresponding segment to meet the minimum turning radius; fitting a curve corresponding to the segment based on the position of the at least one control point to obtain a curvature correction curve; calculating the target distance error between the curvature correction curve and the mapping point set corresponding to the original discrete point set, wherein the original discrete point set is the point set corresponding to the centerline of the waterway, and the target distance error is the maximum distance error; if it is confirmed that the target distance error exceeds a preset fitting threshold, adjusting the position of the control points on the curvature correction curve until the fitting meets the requirements to obtain the (i+1)-th centerline; repeating the above process until the target centerline is obtained.
[0016] Some embodiments of this application identify sections where the radius of curvature does not meet the minimum turning radius of a ship. Control points are added only to these sections, and local smoothing corrections are performed, rather than global refitting. This ensures that the curvature of the target centerline conforms to ship dynamics constraints while maintaining a high degree of fit between the overall curve and the original channel. Simultaneously, by iteratively verifying the radius of curvature and the degree of fit, an optimal balance is achieved between the two. Compared to existing technologies, the digital twin channel generated by this method avoids both the inability of ships to pass safely due to excessive curvature and the distortion of the channel direction caused by excessive smoothing, providing an accurate and executable baseline reference for subsequent real-time path planning.
[0017] In some embodiments, constructing a digital twin scene corresponding to a waterway further includes: generating a uniform grid array that at least covers the digital twin waterway to obtain a basic grid array; determining the boundary corresponding to the digital twin waterway, retaining grid cells whose center point is located within the boundary, removing grid cells completely located outside the boundary, and retaining all grid cells intersecting the boundary to obtain a set of grid cells within the waterway; adjusting the resolution of at least some grid cells in the set of grid cells within the digital twin waterway according to the geometric features of the waterway to obtain a modified grid cell set; confirming that all grid cells in the modified grid cell set are located within the boundary to obtain a target grid cell set; determining the heading attribute of each grid cell according to the relative positional relationship between each grid cell in the target grid cell set and the target centerline, wherein the heading attribute is used to characterize whether the corresponding grid cell belongs to uphill or downhill; and marking the grid cells in the target grid cell set corresponding to the area occupied by fixed physical obstacles within the waterway with static obstacle markers.
[0018] Some embodiments of this application ensure that all grid cells are located within the waterway through boundary overlay analysis, avoiding invalid grid cells; at the same time, the heading attributes (up / down) and static obstacle markers are directly embedded in the grid cells, enabling the digital twin scenario to have computable traffic rule semantics, providing a data foundation for subsequent rule-constrained path planning.
[0019] In some embodiments, determining the heading attribute of each grid cell based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline includes: identifying all grid cells not crossed by the target centerline from the target grid cell set to obtain a first grid cell set; calculating the signed distance from the center point of each grid cell in the first grid cell set to the target centerline; and determining the heading attribute of each grid cell in the first grid cell set based on the sign of the signed distance.
[0020] Some embodiments of this application use signed distance to quickly determine the heading affiliation of grid cells, transforming waterway traffic rules (uphill / downhill) into computable mathematical quantities, thus injecting rule semantics into digital twin scenarios. At the same time, this method is only used for grid cells that are not crossed by the target centerline, avoiding misjudgment of those that cross the grid, ensuring the accuracy of grid cell heading attribute division, and providing reliable grid attribute data for subsequent rule-constrained path search.
[0021] In some embodiments, the ship navigation route correction method further includes: defining a first direction of the target centerline as an uphill direction and a second direction opposite to the first direction as a downhill direction; determining the heading attribute of each grid cell in the first grid cell set based on the sign of the signed distance includes: if the sign of the signed distance is confirmed to be positive, then marking the corresponding grid cell as an uphill region; if the signed distance is confirmed to be negative, then marking the corresponding grid cell as a downhill region; assigning different colors to the uphill region and the downhill region for distinction.
[0022] Some embodiments of this application directly determine the uplink and downlink attributes of grid cells by using the sign of the signed distance, transforming waterway traffic rules into concise mathematical judgments. This approach is computationally efficient and suitable for real-time queries of large-scale grids. At the same time, different colors are assigned for visual differentiation, making the semantics of rules in digital twin scenarios more intuitive and clear, and providing a spatial constraint basis for forcing ships to travel in legal directions in subsequent path planning.
[0023] In some embodiments, determining the heading attribute of each grid cell based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline further includes: identifying all grid cells in the target grid cell set that are crossed by the target centerline to obtain a second grid cell set; calculating the area of each grid cell in the second grid cell set located on the upward side of the curve, denoted as the first area, wherein the upward side of the curve is the left side when traveling along the upward direction of the target centerline; calculating the area of each grid cell in the second grid cell set located on the downward side of the curve, denoted as the second area, wherein the downward side of the curve is the right side when traveling along the upward direction of the target centerline; if it is confirmed that the first area is greater than or equal to the second area, then the corresponding grid cell is marked as an upward region, otherwise it is marked as a downward region.
[0024] Some embodiments of this application determine the heading affiliation for grid cells traversed by the target centerline by calculating the area ratio of the grid cell located on the upside and downside of the target centerline. This avoids misjudgments that may result from relying solely on the center point position, ensuring the continuity and rationality of the heading attributes of the discretized grid at the channel boundary. This ensures that subsequent path planning will not result in path interruptions or rule conflicts due to ambiguity in the navigation attribute affiliation of grid cells, thereby improving the semantic accuracy and robustness of digital twin channels in complex boundary areas.
[0025] In some embodiments, adjusting the resolution of at least a portion of the grid cells in the digital twin waterway grid cell set according to the geometric features of the waterway to obtain a modified grid cell set includes: adaptively adjusting the side length of the grid cells in the corresponding region according to local curvature changes and / or local width changes of the waterway.
[0026] Some embodiments of this application adaptively adjust the resolution of the grid cells in the digital twin waterway based on the local geometric features (radius of curvature, channel width). For example, the grid cells are densified in key areas such as curves and narrow passages to improve the spatial resolution and obstacle avoidance accuracy of path planning, ensuring that ships can precisely avoid obstacles and stay close to the centerline in complex sections of the waterway. In straight and wide areas, the grid is sparsed to reduce the number of grid cells and lower the computational cost of real-time path search. This dynamic grid allocation strategy, based on demand, improves the computational efficiency and response speed of the digital twin scenario while ensuring navigational safety, resolving the contradiction of excessive computation or insufficient accuracy of fixed-resolution grids in complex waterways.
[0027] In some embodiments, the motion data is the initial position data reported for the first time; the ship navigation route correction method further includes: mapping the initial position data to the digital twin scene through coordinate transformation to obtain a second mapping point; placing a virtual ship model corresponding to the ship at the second mapping point; taking the point on the target centerline that is closest to the second mapping point as the initial anchor point; if the distance between the second mapping point and the initial anchor point is less than or equal to a preset threshold, the initial alignment is successful; if the distance between the second mapping point and the initial anchor point exceeds the preset threshold, the initial alignment is determined to be abnormal, triggering manual intervention or repositioning.
[0028] Some embodiments of this application accurately map the GPS position initially reported by the physical vessel to the digital twin scene through coordinate transformation, and automatically find the nearest point on the target centerline as the initial anchor point to achieve high-precision alignment of the virtual and real initial states; at the same time, the alignment result is verified by a preset threshold, and when the deviation exceeds the threshold, an alarm is triggered in time and manual intervention is requested to avoid initial positioning errors caused by GPS errors or data anomalies, establish a reliable starting point for subsequent real-time path planning, and ensure the accuracy and security of system operation.
[0029] In some embodiments, constructing a digital twin scene corresponding to the waterway further includes: segmenting the target centerline and recording information of each segment endpoint; the motion data includes the current heading, wherein converting the current position to the digital twin scene to obtain a first mapping point, determining the projection point of the first mapping point on the target centerline, and calculating the lateral offset distance from the first mapping point to the projection point includes: traversing all segment endpoints on the target centerline, calculating the distance from each segment endpoint to the first mapping point, obtaining a first distance set; selecting several segment endpoints from the first distance set as a first candidate set; for each segment endpoint in the first candidate set, obtaining... The tangent vector direction at the corresponding segment endpoints is determined; the tangent vector direction is compared with the current heading, and if they are inconsistent, the segment endpoint is deleted to obtain a second candidate set; the projection distance from the first mapping point to each segment endpoint in the second candidate set is calculated, and the segment endpoints with negative projection distances are deleted from the second candidate set to obtain a third candidate set; the local curve segments corresponding to the segment endpoints in the third candidate set are determined, and the local curve segments are sampled to obtain a set of sampling points; the projection point is determined according to the magnitude and sign of the projection distance from each sampling point in the set to the first mapping point; the vertical distance from the first mapping point to the projection point is calculated to obtain the lateral offset distance.
[0030] Some embodiments of this application first perform coarse screening based on uniformly segmented endpoints, and then combine the ship's current course to perform directional constraints and determine the positive or negative projection distance. This ensures that the tangent vector of the selected projection point is consistent with the course and located in front of the ship, avoiding planning errors caused by selecting rear points or reverse points. At the same time, the projection point is finely located through local curve sampling, balancing computational efficiency and positioning accuracy, providing an accurate yaw reference for subsequent target position determination and correction path generation.
[0031] In some embodiments, the ship navigation route correction method further includes: obtaining a unit tangent vector at the projection point, wherein the unit tangent vector is used to characterize the ship's legal navigation direction in the corresponding segment, and the unit tangent vector is used to determine the movement direction of the target position and the directional constraints of the path planning; the step of pushing the projection point forward along the target centerline and then laterally offsetting it by the lateral offset distance according to the current speed and time interval to obtain the target position includes: moving the projection point as the starting point along the target centerline by the arc length distance to reach the position point to be determined; if it is confirmed that the position point to be determined belongs to a point on the target centerline, then... The point to be determined is taken as the theoretical point; if it is confirmed that the point to be determined is a point on the extension line of the target centerline, then the endpoint of the target centerline is taken as the theoretical point; the theoretical point is moved by a target lateral distance along the first direction of the straight line containing the normal to obtain the offset point, wherein the normal is a straight line perpendicular to the unit tangent vector, the first direction is determined by the sign of the lateral offset distance, and the target lateral distance is the lateral offset distance or the maximum allowable offset; if it is confirmed that the grid cell where the offset point is located is unobstructed and is within the boundary of the channel, then the offset point is taken as the target position.
[0032] Some embodiments of this application predict the longitudinal motion trend of the ship by moving along the arc length of the target centerline and maintaining the current yaw distance along the normal direction, so that the target position conforms to the channel direction without being forced to return to center, avoiding unnecessary path swings; at the same time, a boundary verification and maximum allowable offset mechanism is introduced to ensure that the target position is always within the navigable area, solving the problem of the target point falling into the obstacle zone due to GPS drift or modeling deviation, and providing a reliable and reasonable endpoint for subsequent path planning.
[0033] In some embodiments, the ship navigation path correction method further includes: extracting a local curve segment from the projection point to the theoretical point from the target centerline; determining a predetermined offset distance, wherein the predetermined offset distance is preset based on the channel width; moving at least one point on the local curve segment by the predetermined offset distance in the opposite direction of the unit normal vector to obtain a set of downlink trajectory points, and moving at least one point on the local curve segment by the predetermined offset distance in the direction of the unit normal vector to obtain a set of uplink trajectory points, wherein the unit normal vector is perpendicular to the tangent vector of the corresponding point; fitting the set of downlink trajectory points into a downlink curve, and fitting the set of uplink trajectory points into an uplink curve; selecting a corresponding target curve from the downlink curve and the uplink curve according to the ship's current heading; determining the grid cells occupied by dynamic objects in the grid cells traversed by the target curve to obtain dynamic obstacle grid cells; marking the dynamic obstacle grid cells as temporarily occupied cells; marking the grid cells currently occupied by the ship itself as temporarily occupied cells; setting a validity period based on the object's movement speed for each temporarily occupied cell, wherein the validity period is used to determine whether the temporary occupied cell attribute of the corresponding grid cell needs to be adjusted.
[0034] Some embodiments of this application generate a target curve that conforms to the channel direction by extracting a local curve from the target centerline and offsetting it along the normal direction. This limits the spatial range of path planning to a strip area within the current channel segment, reducing the computational complexity of subsequent searches. At the same time, based on the position of dynamic objects and the size of the vessel itself, temporary occupied grids are marked in real time and given a dynamic validity period based on the movement speed. This enables dynamic obstacle fusion that is updated as soon as it is perceived, ensuring that path planning is always based on the latest traffic situation. This avoids collisions with dynamic obstacles and supports the reuse of channel resources when multiple vessels are running in parallel through an automatic validity period release mechanism, thereby improving the overall traffic efficiency of the channel.
[0035] In some embodiments, generating a correction path from the starting position to the target position in the digital twin scenario based on the heading attribute of the grid cell, the static obstacle marker, and the dynamic obstacle information includes: acquiring a local grid map, wherein the grid cells in the local grid map are labeled with the heading attribute, the static obstacle marker, and the marker of the temporarily occupied cell; performing a path search with the grid cell corresponding to the first mapping point as the starting point and the grid cell corresponding to the target position as the ending point; determining the single-step cost in the path search according to the following principles: assigning a first cost to passable grid cells that conform to the ship's heading, assigning a second cost greater than the first cost to grid cells that are going in the opposite direction, and assigning a third cost greater than the second cost to grid cells labeled with the static obstacle marker or the temporarily occupied cell; and determining the target correction path based on the single-step cost.
[0036] Some embodiments of this application embed the navigation rules and obstacle avoidance requirements directly into the cost function of the A* algorithm by setting a tiered cost for different grid types (normal low cost corresponding to the first cost, reverse travel cost corresponding to the second cost, and obstacle extremely high cost corresponding to the third cost). This ensures that the searched path satisfies the optimization objective of prioritizing obstacle avoidance over compliance and compliance over short distance, without the need for post-processing correction. Compared with existing technologies, this hierarchical cost design guarantees both path safety (obstacles are impassable) and rule compliance (reverse travel cost is much higher than normal), while also preserving space for path length optimization (based on normal travel cost), achieving an optimal balance among multiple objectives.
[0037] Secondly, some embodiments of this application provide a computer program readable storage medium having a computer program stored thereon, which, when executed, can implement the methods described in any of the embodiments included in the first aspect.
[0038] Thirdly, some embodiments of this application provide an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the method described in any of the embodiments included in the first aspect. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a diagram illustrating the architecture of a ship navigation route correction system provided in an embodiment of this application.
[0041] Figure 2 This is a flowchart illustrating the ship navigation route correction method according to an embodiment of this application.
[0042] Figure 3 A schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0043] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0044] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0045] To overcome the technical deficiencies pointed out in the background section, the embodiments of this application use real-time ship data to drive a digital twin scenario, actively planning a correction path in virtual space. The specific process includes: First, generating a target centerline with continuous curvature that meets the minimum turning radius of the ship as a navigation reference, and gridding the digital twin waterway and assigning up and down heading attributes and static obstacle markers, so that the digital twin scenario carries traffic rule semantics; then, combining the ship's current yaw state, i.e., lateral offset distance, with the motion trend, i.e., speed multiplied by time, and pushing forward along the target centerline while maintaining the yaw distance laterally, generating a target position that both conforms to the waterway direction and maintains the yaw trend, and ensuring that the target position is within the navigable area through boundary verification; finally, incorporating waterway rules and dynamic obstacle information into the cost function of path search, setting a stepped cost for normal passage, reverse passage, and obstacles, and realizing dynamic obstacle avoidance and resource reuse through grid temporary occupation markers and dynamic validity periods, generating an optimal target correction path that simultaneously meets compliance, obstacle avoidance, and smoothness.
[0046] Traditional solutions only issue alarms after a yaw. This application's embodiments, however, proactively generate correction paths by pre-simulating the ship's movement trend at future moments (represented by time intervals) using a digital twin scenario. Traditional feedback control only corrects the current deviation; this invention incorporates speed multiplied by time into target position prediction for a smooth transition. Traditional path planning only considers geometric obstacles; this invention embeds waterway traffic rules (e.g., grid cells are labeled with heading attributes; in the cost function of path search, uphill or downhill grids conforming to the ship's current heading are assigned a low cost, reverse grids (e.g., an uphill ship entering a downhill area) are assigned a medium cost higher than the low cost, and obstacle and temporary occupancy grids are assigned a very high cost far exceeding the medium cost) into the cost function, ensuring the planned path meets compliance requirements. Traditional grid maps contain only static information; this invention integrates dynamic obstacle markers in real time, achieving real-time updates upon perception. Traditional temporary markers lack a release mechanism, leading to resource congestion; this invention achieves automatic release and reuse of waterway resources through dynamic validity periods. Traditional solutions continue prediction after signal reconnection, causing error accumulation; some embodiments of this application force alignment to the latest GPS coordinates to break the error chain.
[0047] In summary, the embodiments of this application, through closed-loop control of physical-driven virtualization, virtual path planning, and path feedback to physicalization, integrate waterway rules, ship dynamics, and real-time dynamic perception into a unified digital twin scenario. This achieves a leap from passive early warning to proactive planning, from instantaneous correction to trend prediction, and from geometric obstacle avoidance to rule fusion, significantly improving the safety, smoothness, and efficiency of ship navigation.
[0048] Please refer to Figure 1 , Figure 1 The ship navigation route correction system provided in some embodiments of this application includes: a physical ship 100, a data receiving and processing module 111, an anomaly handling module 115, a digital twin scene construction module 120, a digital twin scene 125, a dynamic path planning module 130, and a motion control and feedback module 140.
[0049] Physical vessel 100 is the actual object controlled in this system, and the physical vessel is equipped with the following equipment:
[0050] GPS 101 can obtain the real-time geographical coordinates of a vessel. This GPS device is used to collect the current position of the relevant vessel at least.
[0051] Speed sensor 102 measures the instantaneous speed of a ship and reports the current speed of the corresponding ship so that subsequent steps can predict the motion trend based on the current speed.
[0052] The Automatic Identification System (AIS) 103 is a communication device used to acquire ship motion data and receive position information from other ships. It can also serve as a source of dynamic obstacle detection.
[0053] The motion control system 104 receives path commands and performs steering and acceleration / deceleration operations via servos and the main unit.
[0054] The communication unit 105 is used to report motion data 106 and other information.
[0055] The data access layer in some embodiments of this application includes a data receiving and processing module 111 and an exception handling module 115.
[0056] The data receiving and processing module 111 is used to receive motion data reported by the physical vessel 100 and convert it into a format usable in the digital twin scenario.
[0057] In some embodiments of this application, the data receiving and processing module 111 includes:
[0058] Data interface module 112 continuously receives and outputs motion data packets reported by physical vessels at fixed time intervals (e.g., once per second). Each motion data packet contains at least the current position, instantaneous speed, current heading, and timestamp. Data interface module 112 can receive data packets by listening to the communication port, record the reception time, and prepare for verification processing.
[0059] The data verification module 114 is used to perform integrity verification on the received motion data packets and output valid motion data packets that pass the verification. For example, in some embodiments of this application, the data verification module may employ a cyclic redundancy check mechanism. The data verification module 114 compares the checksum in the motion data packet with the checksum calculated based on the data content. If they match, the data packet is deemed valid; otherwise, it is discarded and a reception failure is recorded. If three consecutive reception failures occur, the exception handling module 115 is triggered to perform corresponding exception handling or alarm.
[0060] The coordinate transformation module 113 is used to convert the latitude and longitude coordinates reported by the physical vessel into a unified coordinate system (such as the Universal Transverse Mercator Projection or the Local Northeast Sky Coordinate System) used in the digital twin scene and output the coordinates of the mapped point in the digital twin scene. The coordinate transformation module 113 is configured to receive GPS latitude and longitude coordinates, output the coordinates in the digital twin scene through a coordinate transformation algorithm, and obtain the mapped point.
[0061] The digital twin scenario construction module 120 is used to pre-build digital twin waterways with traffic rule semantics, which is the basic data source for subsequent path planning.
[0062] In some embodiments of this application, the digital twin scene construction module 120 includes:
[0063] Centerline generation unit 121 generates a continuous, smooth centerline spline curve based on the geographical information of the waterway (i.e., the actual waterway), and outputs a target centerline with continuous curvature and a radius of curvature greater than the minimum turning radius of the ship at every point. Centerline generation unit 121 is configured to: perform denoising filtering and coordinate transformation on the original discrete point set (the acquisition method is described in the next paragraph); fit a continuous curve passing through all discrete points using cubic splines or non-uniform rational B-splines, and constrain the curvature to be continuous; calculate the radius of curvature point by point and compare it with the minimum turning radius of the ship; add control points to sections that do not meet the requirements for local smoothing correction, while maintaining the fit with the original discrete points; iterate until the entire curve meets the requirements to obtain the target centerline. In some embodiments of this application, the obtained target centerline is also uniformly segmented according to a fixed arc length, and the coordinates and tangent vectors of the endpoints of each segment are recorded to quickly query the nearest point and projection point in subsequent steps, improving the computational efficiency of position calculation and path planning.
[0064] It should be noted that, in some embodiments of this application, the original discrete point set refers to a series of discrete coordinate points representing the geometry of the channel centerline extracted from actual channel mapping data. The acquisition methods include the following four: First, extraction from electronic nautical charts. Electronic nautical charts contain vector data of the channel; discrete centerline points can be obtained by reading the channel centerline or recommended route data marked on them. Second, high-precision mapping data acquisition. A survey vessel equipped with a differential GPS or lidar is used to navigate along the channel centerline and record coordinate points at fixed intervals. Third, satellite imagery or aerial photogrammetry. Images of the channel area are acquired through high-resolution satellite imagery or UAV aerial photography; after image processing and georegistration, the waterway centerline is extracted and discretized into coordinate points. Fourth, digitization of existing channel design drawings. The channel design drawings are scanned and vectorized to convert the centerline on the drawings into a digital coordinate point set. The embodiments of this application do not limit the specific method for obtaining the original discrete point set.
[0065] The mesh generation and status labeling module 122 is used to discretize the constructed digital twin channel into mesh cells, assign heading attributes and static obstacle labels to each mesh cell, and output a set of mesh cells with uplink, downlink, or obstacle labels. The mesh generation and status labeling module 122 is configured to: generate a uniform mesh array covering the digital twin channel; overlay this array onto the digital twin channel boundary for analysis, retaining mesh cells located within the digital twin channel; adaptively adjust the resolution of the mesh cells according to the channel's geometric characteristics, for example, densifying the mesh in curves or narrow sections; label mesh cells as uplink or downlink regions using signed distance, with the target centerline as the boundary; determine the heading assignment of mesh cells crossed by the target centerline using an area percentage method; and label mesh cells outside the channel boundary and mesh cells occupied by fixed obstacles as obstacle cells (i.e., mark static obstacle labels). It should be noted that signed distance is used to represent the signed shortest distance from a point to a curve or surface, and the sign typically indicates which side of the curve or surface the point is on.
[0066] The static grid database 123 stores the static state of all grid cells, supports high-concurrency read / write and real-time querying, and outputs static grid state data. The static grid database 123 is configured to store the identifier, coordinate range, center point coordinates, heading attribute, and static obstacle markers of each grid cell. During subsequent path planning, the path planning module can quickly query this database and determine the state of the corresponding grid cell based on the data recorded in the database.
[0067] In some embodiments of this application, the dynamic path planning module 130 generates a target correction path from the mapping point of the current position in the digital twin scene to the target position based on the digital twin scene and real-time data, and sends the target correction path to the motion control and feedback module 140.
[0068] For example, in some embodiments of this application, the dynamic path planning module 130 includes:
[0069] The local spline extraction unit (not shown in the figure) is used to extract a local curve segment from the global centerline (i.e., the target centerline) from the projection point to the theoretical point, and generates an upward planning path (i.e., an upward curve) and a downward planning path (i.e., a downward curve) through lofting. The local spline extraction unit extracts a local curve segment from the global centerline with the projection point Cproj as the starting point and the theoretical point Ctarget as the ending point. According to the ship's heading, the curve segment is offset by a preset distance (i.e., a predetermined offset distance) along the normal direction to generate a local reference curve Llocal (including the upward curve and the downward curve) in the upward or downward direction.
[0070] The grid cell fusion state analysis module (including temporary obstacle management) 131 is used to overlay local reference curves with a static grid map, fuse dynamic obstacle information, and generate a local grid map with temporary occupancy markers. This module can output the fused local grid map, on which each grid cell has static attributes (upward, downward, obstacle cell) and a dynamic temporary occupancy marker. The grid cell fusion state analysis module is used to: determine the grid cells traversed by the local reference curve Llocal; obtain the real-time position of other dynamic objects, and mark the grid cells traversed by the local reference curve Local and occupied by dynamic objects as temporary occupancy cells; calculate the grid cells occupied by the ship itself based on the ship size and current heading, and also mark them as temporary occupancy cells; set a dynamic validity period for each temporary occupancy cell based on the object's movement speed; and store the temporary occupancy markers in a dynamic state cache, which together with the static grid database constitutes the local grid map.
[0071] The path search module 132 has a built-in cost function for performing path search on a local grid map, generating a grid path (i.e., the target correction path) that conforms to waterway rules and avoids obstacles. This module outputs a grid path (grid node sequence) from the starting point to the ending point. The path search module 132 performs path search starting from the grid cell corresponding to the ship's current position and ending at the grid cell corresponding to the target position. The cost function design in some embodiments of this application is as follows: a low cost (e.g., unit geometric distance) is assigned to passable grid cells that conform to the ship's course; a higher cost (e.g., 10 times the base cost) is assigned to reverse-flowing grid cells; and a very high cost (e.g., 10 to the power of 6) is assigned to obstacle cells (i.e., those marked with static obstacle markers) or temporarily occupied cells. The actual cost from the starting point to the current node is accumulated, and the heuristic cost from the current node to the ending point is estimated. The path with the smallest sum of the two is selected as the target correction path.
[0072] The path smoothing unit (not shown in the figure) is used to convert the discrete grid path output by the path search module into a continuous and smooth spline curve that satisfies the ship's dynamics constraints. The path smoothing unit uses the center points of the grid on the grid path as control points and generates a smooth curve using Bézier curves or B-spline curves. Constraints are applied: the curve's starting point is aligned with the ship's current position and heading, and the ending point is aligned with the target position. The curvature radius of the fitted curve is verified to meet the ship's minimum turning radius; if not, control points are added or their positions are adjusted before refitting. The target correction path Pnew obtained after processing by this module is a continuous, smooth spline curve whose curvature meets the requirements everywhere.
[0073] The motion control and feedback module 140 is used to send the planned path (i.e. the target correction path) to the physical ship for execution and manage the dynamic release of the grid cell state. The output of this module is the path command that the ship can execute.
[0074] In some embodiments of this application, the motion control and feedback module 140 includes:
[0075] The path distribution interface 141 is used to convert the target correction path 150 into a command format recognizable by the ship motion control module and distribute it to the physical ship. The path distribution interface 141 is configured to convert spline curves into discrete path point sequences or retain curve parameters, including the coordinates, tangent direction, and desired speed information of each point on the path. Commands are distributed through the control module interface, and the distribution time and path identifier are recorded.
[0076] The status reporting unit 142 is used to continuously receive the real-time position and speed reported by the physical vessel, and to update the digital twin scenario and the planning of subsequent command cycles. In some embodiments of this application, the status reporting unit 142 receives the current position and speed of the vessel at a fixed frequency (consistent with the data receiving frequency), which is used for real-time data reception in subsequent step 2.2 and for grid status release judgment in subsequent step 5.2.
[0077] The grid state reset unit 143 is used to update the state attribute information of grid cells in real time. For example, after a ship has completely passed through a grid cell, this module can restore the temporary occupancy marker of the corresponding grid cell to its original state. The grid state reset unit 143 is used to determine whether a ship has completely passed through a grid cell, based on whether the ship's current position has left the grid cell and whether the subsequent path will no longer use the grid cell. After the condition is met, the temporary occupancy marker of the grid cell is deleted from the dynamic state cache, restoring the grid cell to its original uplink or downlink state. The release timing can be triggered immediately or processed in batches at regular intervals.
[0078] The exception handling module 115 is used for detection, recovery and status reset in the event of communication exception.
[0079] In some embodiments of this application, the exception handling module includes:
[0080] Signal loss timer 116 is used to monitor the communication link status and determine signal loss conditions. This timer can output a signal loss flag. Signal loss timer 116 continuously monitors the ship's speed and data packet reception status. When the ship's speed drops to zero and no motion data packets are received for more than a preset time (e.g., 5 seconds), it is determined that the signal has been lost. After the determination, all path planning activities are stopped, and the virtual ship model remains in the last position.
[0081] The forced alignment trigger unit 117 is used to force the virtual ship to align to the nearest matching point on the target centerline of the latest GPS coordinates after communication is restored. The output of this unit is the aligned virtual ship's position and heading. The forced alignment trigger unit 117 is configured to: upon receiving GPS coordinates for the first time after signal recovery, obtain a mapping point through coordinate transformation; find the point on the target centerline closest to this mapping point whose tangent vector direction is consistent with the ship's current heading; and use this point as the matching point. The matching point is the reference point used for forced alignment, and its calculation method is the same as that of the projection point, but its use case is abnormal recovery after signal loss. The virtual ship model is forced to align to this matching point, and all historical temporary states are cleared.
[0082] Alarm unit 118 is used to trigger an alarm to prompt manual intervention when the alignment deviation exceeds a preset threshold. The output of this unit is an alarm message. Alarm unit 118 is configured to: calculate the distance between the mapping point and the matching point; if it exceeds a preset threshold (e.g., 10 meters), an alarm is triggered to prompt the operator to check the data or manually adjust the ship's position in the digital twin scenario.
[0083] Understandably, through Figure 1 The digital twin scene construction module 120 can output a constructed digital twin scene 125, which includes a target centerline and grid cells labeled with static obstacle markers and up / down heading attributes. The dynamic path planning module needs to obtain relevant information from the digital twin scene during path planning.
[0084] The following is combined with Figure 2 The present application provides exemplary methods for correcting ship navigation routes according to some embodiments.
[0085] like Figure 2 As shown, some embodiments of this application provide a ship navigation route correction method including:
[0086] S110, constructing a digital twin scenario corresponding to the waterway.
[0087] It should be noted that, in the embodiments of this application, the digital twin scene includes a target centerline that conforms to the shape of the waterway and grid cells with heading attributes (e.g., whether each grid cell belongs to uphill or downhill) and static obstacle markers. The digital twin scene is a digital twin waterway corresponding to the waterway.
[0088] S111 receives motion data reported by ships.
[0089] For example, in embodiments of this application, the motion data includes at least the ship's current position and current speed.
[0090] S112, the current position is converted to the digital twin scene to obtain a first mapping point, the projection point of the first mapping point on the center line of the target is determined, and the distance from the first mapping point to the projection point is calculated as the lateral offset distance.
[0091] S113, based on the current speed and time interval, the projection point is pushed forward by an arc length along the target centerline and then laterally offset by the target offset distance to obtain the target position. It is understood that the operation corresponding to this step is also performed in a digital twin scenario. In some embodiments of this application, the target offset distance is the lateral offset distance or a preset offset distance. The preset offset distance is preset based on the channel boundary. For example, in some embodiments of this application, if it is confirmed that the lateral offset distance exceeds the boundary, the lateral offset amount is adjusted from the lateral offset distance to the preset offset distance.
[0092] S114, in the digital twin scenario, a target correction path 150 is generated from the first mapping point to the target location based on the heading attribute of the grid cell, the static obstacle marker, and the dynamic obstacle information.
[0093] S115, provide the vessel with the target correction path to control the vessel to navigate according to the target correction path.
[0094] The following example illustrates... Figure 2 The implementation methods of the relevant steps and the ship navigation path correction method in the embodiments of this application include, except for Figure 2 Other processing steps besides those mentioned above.
[0095] The implementation process of S110 is illustrated below.
[0096] First, the process of obtaining the center line of the target in a digital twin scenario is illustrated by example, taking the i-th iteration as an example.
[0097] For example, in some embodiments of this application, the construction of the digital twin scene corresponding to the waterway in step S110 includes:
[0098] The first step is to determine the segment on the i-th centerline where the radius of curvature is less than the target turning radius, where the target turning radius is the minimum turning radius of the ship, and i is an integer greater than or equal to 1.
[0099] The second step is to add at least one control point within the section and adjust the position of the at least one control point so that the radius of curvature of the corresponding section increases to meet the minimum turning radius.
[0100] The third step is to fit the curve corresponding to the segment based on the position of the at least one control point to obtain the curvature correction curve.
[0101] The fourth step is to calculate the target distance error between the curvature correction curve and the mapping point set corresponding to the original discrete point set, wherein the original discrete point set is the point set corresponding to the centerline of the channel, and the target distance error is the maximum distance error.
[0102] It is understood that, in some embodiments of this application, the fourth step includes: converting the original discrete point set to a digital twin scene to obtain a mapped point set, and calculating the maximum distance error between the curvature correction curve and the mapped point set as the target distance error. For example, in some embodiments of this application, the fourth step includes: converting each point in the original discrete point set to a digital twin scene to obtain a mapped point set; calculating the target distance error between the curvature correction curve and the mapped point set, specifically: for each mapped point in the mapped point set, calculating the shortest distance from the mapped point to the curvature correction curve to obtain the fitting error value of each point, and taking the maximum value among all fitting error values as the target distance error.
[0103] Fifth step: If it is confirmed that the target distance error exceeds the preset fit threshold, then adjust the position of the control point on the curvature correction curve until the fit meets the requirements and the (i+1)th center line is obtained.
[0104] Repeat steps one through five above until the target centerline is obtained. It is understood that the target centerline in this embodiment is either the i-th centerline or the (i+1)-th centerline that meets the requirements.
[0105] In other words, some embodiments of this application can determine the target centerline through multiple iterations (the i-th centerline is determined through the i-th iteration). The curvature of each point on the target centerline determined through the iteration process is continuous, the radius of curvature is greater than the minimum turning radius of the ship, and the grid points meet the fitting requirements.
[0106] Secondly, the process of obtaining static attribute information of each grid unit in a digital twin scenario is illustrated by way of example.
[0107] For example, in some embodiments of this application, the construction of the digital twin scene corresponding to the waterway in step S110 further includes:
[0108] The first step is to generate a uniform grid array that at least covers the digital twin waterway, thus obtaining the basic grid array.
[0109] The second step is to determine the boundary corresponding to the digital twin channel, retain all grid cells whose center point is located within the boundary and grid cells whose center point is located outside the boundary and intersects with the boundary, and remove grid cells that are completely outside the boundary to obtain the set of grid cells within the channel.
[0110] The third step is to adjust the resolution of at least some of the grid cells in the digital twin waterway grid cell set according to the geometric characteristics of the waterway to obtain the target grid cell set.
[0111] For example, in some embodiments of this application, the third step of adjusting the resolution of at least some grid cells in the digital twin channel grid cell set according to the geometric features of the channel to obtain the target grid cell set includes: adaptively adjusting the side length of the grid cells in the corresponding region according to the local curvature changes and / or local width changes of the channel. For example, in some embodiments of this application, the third step includes: reducing the side length of the grid cells in regions with increased curvature or decreased width for densification, and increasing the side length of the grid cells in regions with decreased curvature or increased width for sparsification, to obtain the modified grid cell set. For example, reducing the side length of the grid cells in the curved region of the channel for densification according to the radius of curvature, reducing the side length of the grid cells in the narrow section of the channel for densification according to the channel width, and appropriately increasing the side length of the grid cells in the straight section of the channel for sparsification, to obtain the target grid cell set.
[0112] The third step is to determine the heading attribute of each grid cell based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline, wherein the heading attribute is used to characterize whether the corresponding grid cell belongs to uphill or downhill.
[0113] The implementation of this third step is illustrated below with two examples.
[0114] For example, in some embodiments of this application, the third step of determining the heading attribute of each grid cell based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline includes: identifying all grid cells not crossed by the target centerline from the target grid cell set to obtain a first grid cell set; calculating the signed distance from the center point of each grid cell in the first grid cell set to the target centerline; and determining the heading attribute of each grid cell in the first grid cell set based on the sign of the signed distance. For example, in some embodiments of this application, the ship navigation route correction method further includes: defining a first direction of the target centerline as the up direction and a second direction opposite to the first direction as the down direction; determining the heading attribute of each grid cell in the first grid cell set based on the sign of the signed distance includes: if the sign of the signed distance is confirmed to be positive, marking the corresponding grid cell as an up region; if the signed distance is confirmed to be negative, marking the corresponding grid cell as a down region; and assigning different colors to the up region and the down region for distinction.
[0115] For example, in some embodiments of this application, determining the heading attribute of each grid cell based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline further includes: identifying all grid cells in the target grid cell set that are crossed by the target centerline to obtain a second grid cell set; calculating the area of each grid cell in the second grid cell set located on the upward side of the curve, denoted as the first area, wherein the upward side of the curve is the left side when traveling along the upward direction of the target centerline; calculating the area of each grid cell in the second grid cell set located on the downward side of the curve, denoted as the second area, wherein the downward side of the curve is the right side when traveling along the upward direction of the target centerline; if it is confirmed that the first area is greater than or equal to the second area, then the corresponding grid cell is marked as an upward region, otherwise it is marked as a downward region.
[0116] The fourth step is to mark the grid cells in the target grid cell set that are occupied by physical obstacles fixed within the channel as static obstacle markers.
[0117] The implementation process of S113 is illustrated below.
[0118] In some embodiments of this application, step S113, which involves pushing the projection point forward along the target centerline and then laterally offsetting it by the lateral offset distance based on the current speed and time interval, to obtain the target position, includes:
[0119] The first step is to move forward an arc length distance along the target centerline in the digital twin scene, starting from the projection point, to obtain the first position point, wherein the arc length distance is equal to the product of the current speed and the time interval.
[0120] The second step is to offset the first position point by the lateral offset distance along the normal direction of the target centerline at the first position point to obtain the second position point.
[0121] The third step is to determine the target position based on the second position point. For example, in some embodiments of this application, the third step of determining the target position based on the second position point includes: verifying whether the second position point exceeds the boundary of the channel; if it is confirmed that the second position point does not exceed the boundary, then the second position point is taken as the target position; if it is confirmed that the second position point exceeds the boundary, then the first position point is offset by the maximum allowable offset (i.e., a preset offset distance) along the normal direction of the target centerline at the first position point to obtain the target position, wherein the maximum allowable offset is predefined based on the boundary.
[0122] It should be noted that in some embodiments of this application, the system needs to be aligned to the initial position when it starts up.
[0123] For example, in some embodiments of this application, the motion data is the initial position data reported for the first time;
[0124] The ship navigation route correction method further includes: mapping the initial position data to the digital twin scene through coordinate transformation to obtain a second mapping point; placing a virtual ship model corresponding to the ship at the second mapping point; taking the point on the target centerline that is closest to the second mapping point as the initial anchor point; if the distance between the second mapping point and the initial anchor point is less than or equal to a preset threshold, the initial alignment is successful; if the distance between the second mapping point and the initial anchor point exceeds the preset threshold, the initial alignment is determined to be abnormal, triggering manual intervention or repositioning.
[0125] The implementation process of S112 is illustrated below.
[0126] In some embodiments of this application, the construction of a digital twin scene corresponding to the waterway in S110 further includes: segmenting the target centerline and recording the information of each segment endpoint; the motion data in S111 includes the current heading. Correspondingly, the conversion of the current position to the digital twin scene to obtain a first mapping point, determining the projection point of the first mapping point on the target centerline, and calculating the lateral offset distance from the first mapping point to the projection point includes: traversing all segment endpoints on the target centerline, calculating the distance from each segment endpoint to the first mapping point, and obtaining a first distance set; selecting several segment endpoints with the smallest distance from the first distance set as a first candidate set; for each segment endpoint in the first candidate set, obtaining the tangent vector direction at the corresponding segment endpoint; comparing the tangent vector direction with the current heading, and deleting the segment endpoint if they are inconsistent. The method for determining inconsistencies can be referred to in the embodiments described in the next paragraph, to obtain a second candidate set; calculate the projection distance from the first mapping point to each segment endpoint in the second candidate set, and delete the segment endpoints with negative projection distances from the second candidate set (refer to the relevant examples described in the next paragraph), to obtain a third candidate set; determine the local curve segments corresponding to the segment endpoints in the third candidate set, and sample the local curve segments to obtain a set of sampling points; determine the projection point according to the magnitude and sign of the projection distance from each sampling point in the set to the first mapping point; calculate the vertical distance from the first mapping point to the projection point to obtain the lateral offset distance.
[0127] For example, in some embodiments of this application, the direction of the tangent vector is compared with the current heading. If the angle between the two is greater than or equal to 90 degrees, it is determined to be inconsistent, and the segment endpoint is deleted. For example, if the ship's current heading is from west to east, and the direction of the tangent vector at the segment endpoint is from east to west, it is determined to be inconsistent. For example, in some embodiments of this application, when calculating the projected distance from the first mapping point to the segment endpoint, if the projected distance is negative, it indicates that the segment endpoint is located behind the first mapping point and should be deleted. For example, if the ship's current position coordinates are 10, the segment endpoint coordinates are 8, and the ship's heading is positive, then the projected distance is negative 2, and the point is deleted.
[0128] The following example illustrates the process of obtaining the target location in S113.
[0129] In some embodiments of this application, the ship navigation route correction method further includes: obtaining a unit tangent vector at the projection point, wherein the unit tangent vector is used to characterize the legal navigation direction of the ship in the corresponding segment, and the unit tangent vector is used to determine the movement direction of the target position and the directional constraints of the path planning. The corresponding step S113, which involves moving the projection point forward along the target centerline and then laterally offsetting it by the lateral offset distance based on the current speed and time interval, to obtain the target position, includes: moving the projection point as the starting point along the target centerline by the arc length to reach the position to be determined; if the position to be determined is confirmed to be a point on the target centerline, then the position to be determined is taken as the theoretical point; if the position to be determined is confirmed to be a point on the extension line of the target centerline, then the end point of the target centerline is taken as the theoretical point; moving the theoretical point along the first direction of the straight line containing the normal by the target lateral distance to obtain the offset position point, wherein the normal is a straight line perpendicular to the unit tangent vector, the first direction is determined by the sign of the lateral offset distance, and the target lateral distance is the lateral offset distance or the maximum allowable offset; confirming that the grid cell where the offset position point is located has no static obstacle marker and is within the boundary of the channel, then the offset position point is taken as the target position.
[0130] In other words, in some embodiments of this application, starting from the projection point, the arc length is moved along the target centerline, where the arc length is equal to the product of the time interval and the current speed. If the moving distance does not exceed the total length of the target centerline, the point reached after the movement is taken as the theoretical point; if the moving distance exceeds the total length of the target centerline, the end point of the target centerline is taken as the theoretical point. The theoretical point is offset by the lateral offset distance along the normal direction to obtain the offset position point, where the normal direction is perpendicular to the unit tangent vector at the theoretical point, and the orientation of the offset is determined by the sign of the lateral offset distance. It is checked whether the grid cell where the offset position point is located is an obstacle cell (including static obstacle cells or temporarily occupied cells); if it is not an obstacle cell, the offset position point is taken as the target position; if it is an obstacle cell, the lateral offset distance is replaced with a predefined maximum allowable offset, the offset position point is recalculated, and the recalculated point is taken as the target position. It should be noted that the maximum permissible offset is a predefined safe offset limit value based on the distance between the channel boundary and the target centerline. It is used to limit the offset within this limit value when the lateral offset of the ship causes the target position to exceed the channel boundary, so as to ensure that the target point is within the navigable area.
[0131] The following example illustrates the process of acquiring dynamic obstacle information related to S114.
[0132] In some embodiments of this application, the ship navigation path correction method further includes: extracting a local curve segment from the projection point to the theoretical point from the target centerline; determining a predetermined offset distance, wherein the predetermined offset distance is preset based on the channel width; moving at least one point on the local curve segment by the predetermined offset distance in the opposite direction of the unit normal vector to obtain a set of downlink trajectory points, and moving at least one point on the local curve segment by the predetermined offset distance in the direction of the unit normal vector to obtain a set of uplink trajectory points, wherein the unit normal vector is perpendicular to the tangent vector of the corresponding point; and moving the downlink... The set of travel trajectory points is fitted into a downhill curve, and the set of travel trajectory points is fitted into an uphill curve; based on the ship's current course, a corresponding target curve is selected from the downhill and uphill curves; the grid cells occupied by dynamic objects in the grid cells traversed by the target curve are determined to obtain dynamic obstacle grid cells; the dynamic obstacle grid cells are marked as temporarily occupied cells; the grid cells currently occupied by the ship itself are marked as temporarily occupied cells; a validity period based on the object's movement speed is set for each temporarily occupied cell, wherein the validity period is used to determine whether the temporary occupied cell attribute of the corresponding grid cell needs to be adjusted.
[0133] The process of determining the target correction path for S114 is illustrated below.
[0134] In some embodiments of this application, S114, in the digital twin scenario, generating a correction path from the starting position to the target position based on the heading attribute of the grid cell, the static obstacle marker, and the dynamic obstacle information, includes:
[0135] The first step is to obtain a local grid map, wherein the grid cells in the local grid map are labeled with the heading attribute, the static obstacle marker, and the marker of the temporarily occupied cell.
[0136] It should be noted that, in some embodiments of this application, the local grid map is a temporary working view generated by extracting local areas from the digital twin scene and fusing real-time dynamic obstacle information; the digital twin scene is the static data basis of the local grid map. The digital twin scene includes: a target centerline and a set of grid cells with heading attributes and static obstacle markers.
[0137] The second step is to perform a path search, starting from the grid cell corresponding to the first mapping point and ending at the grid cell corresponding to the target location. In the path search, the single-step cost is determined according to the following principles: a first cost is assigned to passable grid cells that conform to the ship's course, a second cost greater than the first cost is assigned to grid cells that are going against the flow, and a third cost greater than the second cost is assigned to grid cells marked with the static obstacle mark or the temporary occupation mark.
[0138] The third step is to determine the target correction path based on the single-step cost.
[0139] For example, in some embodiments of this application, the implementation process of the third step includes: accumulating the single-step cost to obtain the total path cost, selecting the path with the minimum total cost, and obtaining the target correction path after smoothing.
[0140] As can be seen from the above description, some embodiments of this application provide a method for adaptive navigation and path correction of ships in waterways based on digital twins and dynamic mesh obstacle avoidance. This method aims to solve problems in existing technologies such as simulation clipping caused by modeling errors and coordinate drift, misalignment of motion trajectories with the waterway, and insufficient dynamic obstacle avoidance capabilities. By constructing a high-precision digital twin waterway environment and combining real-time data streams with intelligent path planning algorithms, this method enables ships to achieve high-fidelity and high-safety autonomous navigation in complex waterways.
[0141] The following example illustrates a ship navigation route correction method provided in some embodiments of this application. The method includes:
[0142] Step 1: Constructing the digital twin scenario, i.e., building the basic environment for the digital twin industry.
[0143] This step aims to create a high-precision digital twin scenario with traffic rule semantics, providing a foundation for subsequent route planning.
[0144] 1.1 Centerline spline curve generation (i.e., the process of obtaining the target centerline)
[0145] Based on the actual centerline geographic information of waterways or canals (such as extracted from electronic charts or high-precision surveying data), a target centerline is drawn in a digital twin scenario. This target centerline is a continuous, smooth spline curve that closely matches the shape of the waterway and has continuous curvature (G² continuity) to ensure smooth ship movement. The target centerline is uniformly divided into segments of fixed arc length (e.g., every 10 meters or dynamically adjusted according to ship length), and the three-dimensional coordinates (x, y, z, or latitude and longitude) of each segment endpoint are recorded. This target centerline serves as a reference line for ship navigation, used to determine the ship's legal navigation direction (upstream / downstream) and calculate lateral offset. It should be noted that the target centerline in this embodiment should cover the entire navigable waterway and must meet the requirement that the minimum radius of curvature is greater than the ship's minimum turning radius; otherwise, local corrections are required.
[0146] For example, in some embodiments of this application, the implementation steps corresponding to step 1.1 include:
[0147] 1.1.1 Obtain the discrete point set of the channel centerline (i.e., the original discrete point set), the minimum turning radius of the ship, and the segmented arc length parameters.
[0148] In some embodiments of this application, the discrete point set of the channel centerline is derived from electronic charts (ENC), mapping data, lidar point clouds, or satellite imagery. These image data are typically discrete sets of coordinate points (latitude and longitude or projected coordinates) used to represent the original geometry of the channel centerline.
[0149] The minimum turning radius of a ship is a minimum turning radius value (unit: meters) set according to the dynamic characteristics of the target ship. It is used to constrain the curvature of the spline curve to ensure that the generated path can be actually executed by the ship.
[0150] The segmented arc length parameter is the step size used to evenly divide the spline curve (i.e., the target centerline). It can be a fixed value (e.g., 10 meters) or dynamically adjusted according to the ship's length (e.g., half the ship's length).
[0151] 1.1.2. The discrete points in the discrete point set of the channel centerline are denoised and filtered, and the latitude and longitude coordinates of each point are converted into a unified coordinate system of the digital twin scene to obtain a preprocessed ordered discrete point set.
[0152] For example, in some embodiments of this application, the step includes: denoising and filtering the original discrete point set (i.e., the discrete point set of the channel centerline) using methods such as moving average to remove outliers; and uniformly converting the latitude and longitude coordinates to the coordinate system used in the digital twin scenario (such as UTM or local ENU coordinate system) to ensure the accuracy and consistency of subsequent calculations.
[0153] 1.1.3 Based on the ordered discrete point set, a continuous curve passing through all discrete points in the ordered discrete point set is fitted using cubic spline interpolation or non-uniform rational B-spline method. During the fitting process, the curve is forced to achieve curvature continuity, resulting in a parameterized centerline spline curve.
[0154] For example, in some embodiments of this application, the step includes: using cubic spline interpolation or NURBS (non-uniform rational B-spline) method to fit a continuous curve that passes through all discrete points in an ordered discrete point set, and forcibly constraining the fitted curve to achieve G² continuity (i.e., curvature continuity) to ensure that the ship will not experience impacts or an unfollowable trajectory due to abrupt curvature changes during its movement.
[0155] In some embodiments of this application, the fit between the fitted curve and the original channel shape is verified. If necessary, control points are added or node vectors are adjusted to ensure the curve accurately reflects the channel direction. For example, after fitting the spline curve, the shortest distance from each original discrete point to the fitted curve is calculated, yielding the fitting error value for each point. The maximum value among all fitting error values is taken. If this maximum value exceeds a preset threshold (e.g., 0.5 meters), the curve is deemed insufficiently fitted. In this case, control points are added or node vectors are adjusted in the section with the largest error, the curve is refitted, and the maximum fitting error value for all discrete points is recalculated. This process is repeated until the maximum fitting error value for all discrete points is less than or equal to the preset threshold; at this point, the curve accurately reflects the channel direction.
[0156] For example, in some embodiments of this application, the following technical solutions are adopted to achieve the goal of making the curve fit the shape of the waterway as closely as possible and ensuring continuous curvature:
[0157] Step 1: Initial Fitting
[0158] Based on the preprocessed ordered discrete point set, a preliminary curve passing through all discrete points is fitted using cubic spline interpolation or non-uniform rational B-spline methods. This step prioritizes ensuring that the curve passes through each discrete point to achieve a basic fit.
[0159] Step 2: Fit Check
[0160] After generating the corresponding centerline spline curve through a certain iteration, it is necessary to ensure that the curve fits geometrically well with the centerline of the actual waterway; otherwise, it will affect the accuracy of subsequent grid partitioning and path planning. This step ensures the fit through two processes: verification and correction.
[0161] 1. Fit test
[0162] The spline curve generated in this iteration (e.g., the (i+1)th centerline obtained after the i-th iteration) is compared with the actual centerline of the waterway (a discrete set of points given by high-precision surveying data). The nearest distance error of each point on the curve is calculated, and the average error of all sampled points is statistically analyzed. If the average error exceeds a preset threshold (e.g., 0.5 meters), it is determined that the fit is insufficient and correction is required.
[0163] 2. Curve Correction Method
[0164] Use one or a combination of the following two methods to adjust the spline curve to make it closer to the actual waterway centerline.
[0165] Method 1: Adjust the control points (suitable for situations where the overall error is relatively uniform)
[0166] Principle: The shape of a spline curve is determined by a series of control points. By moving the positions of these control points, the local shape of the curve can be changed.
[0167] The example operation process includes: (1) Calculating the offset between each sampling point on the curve and the corresponding point on the actual waterway. (2) Calculating the direction and distance that each control point needs to move based on the offset (the least squares method can be used to solve this). (3) Moving the control points according to the calculated displacement and regenerating the curve. (4) Repeating the above operation steps 1-3 until the average error between the curve and the actual waterway is less than the threshold.
[0168] Method 2: Adjust the node vector (suitable for cases with large local errors)
[0169] Principle: The node vector determines the distribution density of curve control points. Inserting more nodes in areas of severe curvature or large error increases the degrees of freedom of the curve in that area, thus better fitting the channel shape.
[0170] The operation process includes: (1) identifying curve segments where the error exceeds the local threshold. (2) inserting new node values within the node interval corresponding to the segment (e.g., uniform insertion or insertion at the error peak). (3) As the number of nodes increases, the number of control points will also increase accordingly. Recalculate the control point positions to make the curve approximate the actual waterway. (4) If the requirements are still not met, nodes can be inserted again until the fit meets the standard.
[0171] 3. Adjusting strategy selection
[0172] If the error along the entire curve is relatively uniform and the value is not large, the method of adjusting control points should be used first, as it requires less computation and converges quickly.
[0173] If the error is large only at individual curves or corners, the node vector adjustment method can be used to enhance the local fitting ability while maintaining the overall smoothness of the curve.
[0174] For very complex waterways, nodes can be inserted first to increase degrees of freedom, and then control points can be adjusted for global optimization.
[0175] Step 3: Curvature Continuity Verification and Smoothing Processing
[0176] After the fit meets the requirements, the curvature change is calculated point by point along the curve. If abrupt curvature changes or discontinuous curvature sections are found, local smoothing is performed on those sections. The smoothing process uses an energy minimization method, which, while maintaining the overall shape of the curve, fine-tunes the position of control points to make the curvature change more continuous, while constraining the distance error between the adjusted curve and the original discrete points to not exceed the fit threshold.
[0177] Step 4: Iterative Optimization
[0178] If the smoothing process causes the fit in certain sections to exceed the threshold, the process returns to step two. While maintaining curvature continuity constraints, the control points are readjusted until the curve simultaneously meets both the fit and curvature continuity requirements. Through this iterative balancing, a centerline spline curve that accurately reflects the channel direction and satisfies the requirements for smooth ship motion is finally obtained.
[0179] 1.1.4 Calculate the radius of curvature at each point of the centerline spline curve and compare it with the minimum turning radius. If there are sections with a radius of curvature smaller than the minimum turning radius, perform local smoothing correction, refit, and verify again until the radius of curvature at all points of the entire centerline spline curve meets the requirements, and obtain the spline curve corresponding to the target centerline.
[0180] For example, in some embodiments of this application, the curvature of each point is calculated by sampling along the centerline spline curve in small steps; the curvature radius (the reciprocal of the curvature) of each point is checked to see if it is greater than or equal to the minimum turning radius of the ship; if there is a section with a curvature radius less than the minimum turning radius, the section is locally smoothed (e.g., by inserting additional control points or applying the minimum energy curve for adjustment), refitted, and then verified again until the entire curve meets the turning radius constraint.
[0181] 1.1.5. Based on the segmented step length, starting from the starting point of the target centerline, take a point along the curve at every segmented step length, record the three-dimensional coordinates or latitude and longitude of the point and the tangent direction at the point, and obtain a list of uniformly segmented endpoints.
[0182] For example, in some embodiments of this application, the total arc length of the target centerline is calculated; starting from the starting point of the target centerline spline curve, the arc length is progressively advanced along the target centerline spline curve according to the set segmented arc length step size, and the three-dimensional coordinates (x, y, z) or latitude and longitude of each segment endpoint is recorded, as well as the tangent vector of that point (for subsequent direction determination); if the last segment is less than the step size, the end point of the curve is recorded as the last segment point.
[0183] It should be noted that the above processing yields the target centerline, the list of uniformly segmented endpoints, and the curve direction semantics. The target centerline is a continuous, smooth, curvature-continuous (G²) centerline curve with a radius of curvature greater than the minimum turning radius of the ship at every point. The coordinates, tangent vector, and curvature corresponding to any parameter can be calculated at any time. Each segment endpoint in the list of uniformly segmented endpoints contains: three-dimensional coordinates (or latitude and longitude), tangent vector, and arc length parameter, which are used for rapid projection and target position prediction in subsequent real-time position calculations. The curve direction semantics define the positive direction of the curve as the upward (or downward) direction, providing a benchmark for subsequent channel grid partitioning and unidirectional navigation constraints.
[0184] 1.2 Channel Grid Zoning and Marking
[0185] In embodiments of this application, the entire corresponding area of the digital twin waterway is divided into uniform planar grid cells on the top-view projection plane of the digital twin scene to obtain a basic grid array. The size of the grid cells is set according to the ship's dimensions and accuracy requirements. For example, in some embodiments of this application, the grid cell size can be selected as 50cm×50cm, or an adaptive resolution can be adopted according to the actual scene (densified in curves or narrow sections, and sparse in straight sections).
[0186] For example, in some embodiments of this application, the determination of the grid cell size needs to consider both the ship's size and speed. The setting principles include the following three:
[0187] First, the grid is determined based on the ship's dimensions, and its relationship with the ship's beam is: the grid side length should be ≤ half the ship's beam.
[0188] For example, if the ship's width is 10 meters, then the corresponding grid cell's side length is ≤ 5 meters. This is because if the grid cell is larger than the ship's width, the ship can easily fill a complete grid cell, making it impossible to accurately determine the grid cell temporarily occupied by the ship, thus causing collision detection to fail.
[0189] Relationship with ship length: The grid side length should be ≤ one-quarter of the ship length. For example, if the ship is 50 meters long, the grid side length should be ≤ 12.5 meters. This is to ensure that the ship occupies at least 4 grids in the direction of travel, so that the grid state changes more smoothly during movement and there are no frequent jumps.
[0190] Second, determine based on sailing speed
[0191] Movement distance constraint per step: Grid side length ≥ Ship speed × Data update interval ÷ 4 (empirical value). For example: If the ship speed is 5 m / s and the update interval is 1 second, then the side length of the grid cell ≥ 5 × 1 ÷ 4 = 1.25 meters. This is to prevent the ship from moving too far between two updates, skipping intermediate grids and missing obstacles. Braking safety constraint: Grid side length ≤ Braking distance ÷ 15 (empirical value). For example: Braking distance = Ship speed² ÷ (2 × deceleration), taking deceleration as 0.2 m / s², if the ship speed is 5 m / s, then the braking distance = 62.5 meters, and the corresponding grid cell side length ≤ 62.5 ÷ 15 ≈ 4.2 meters. This is to ensure that there are enough grids ahead so that the system can detect obstacles in advance and plan avoidance.
[0192] Third, the comprehensive value of the grid cell size.
[0193] For common ship types, please refer directly to the table below:
[0194] Type of vessel Length (m) Typical speed (knots) Grid length (m) Small boat 10-20 6-10 0.5 ~ 1.5 Inland cargo boat 40-80 8-12 1.5 ~ 3.0 Coastal cargo boat 100-150 10-14 3.0 ~ 5.0 Large boat 100-200 12-18 5.0 ~ 8.0
[0195] In some embodiments of this application, the mesh cell generation process includes:
[0196] S210: Determine the size of the grid cells based on the ship's dimensional parameters and accuracy requirements. Based on this, generate a uniform grid array covering the entire area within the minimum bounding rectangle of the channel's boundary polygon to obtain the basic grid array.
[0197] The channel boundary polygon is used to describe the closed boundary of the navigable waterway. It consists of a series of coordinate points and is used to determine the area to be divided by the grid.
[0198] Ship dimensional parameters, including the ship's length and width, are used to determine the basic size of the grid cells, ensuring that the grid granularity reflects the space occupied by the ship.
[0199] Accuracy requirements: The positioning accuracy requirements set according to the application scenario, such as centimeter or decimeter level, are used to guide the selection of grid cell size.
[0200] For example, in some embodiments of this application, the basic size of the grid cell is calculated based on the ship's dimensional parameters and accuracy requirements. Typically, a certain proportion of the ship's width (e.g., half or one-third) is used as the grid side length, while ensuring that this side length is not less than twice the positioning accuracy, ensuring that each grid cell can carry effective spatial information. For example, for a ship with a width of 20 meters, a grid with a side length of 5 meters can be selected; if higher accuracy is required, a grid with a side length of 1 meter or 0.5 meters can be selected.
[0201] For example, in some embodiments of this application, the process of generating the basic mesh array includes: on the top-view projection plane of the digital twin scene, based on the smallest bounding rectangle of the boundary polygon of the waterway, generating a uniform mesh array covering the entire rectangular area according to a determined mesh cell size. Each mesh cell is a square with a defined range of planar coordinates.
[0202] S220 involves overlaying the basic mesh array with the boundary polygon of the waterway, retaining mesh cells whose center point is located inside the boundary polygon of the waterway, removing mesh cells that are completely outside the boundary, and retaining all mesh cells that intersect with the boundary, thus obtaining the clipped set of mesh cells within the waterway.
[0203] S230. Based on the channel geometry, adaptively adjust the resolution of at least some network cells in the network cell set within the channel to obtain the target mesh cell set. The adjustment principle is as follows: in curved areas, reduce the mesh side length according to the radius of curvature to increase density; in narrow sections, reduce the mesh side length according to the channel width to increase density; and in straight sections, appropriately increase the mesh side length to decrease density, thus obtaining the adaptively adjusted target mesh cell set.
[0204] Channel geometry features are used to characterize the curvature and width variations at various points along the channel, and are used to determine denser or sparser regions during adaptive resolution adjustment.
[0205] For example, in some embodiments of this application, S230 is used to locally refine or sparse the mesh based on the channel geometry, specifically including:
[0206] In curved areas, the grid edge length is dynamically reduced based on the curvature. For example, the curvature radius of the channel centerline is calculated at various points, and when the curvature radius is less than a preset threshold, the grid edge length in that area is reduced to half or a quarter of its original length, and the grid cells for that area are regenerated.
[0207] In narrow waterways, the grid side length is dynamically reduced based on the channel width. For example, when the channel width is less than twice the width of a ship, the grid in that area is densified to improve the precision of path planning.
[0208] In wide, straight flight segments, the grid side length can be appropriately increased to reduce the total number of grids and improve computational efficiency.
[0209] S240 assigns a unique identifier to each grid cell in the target grid cell set, records its planar coordinate range and center point coordinates, and organizes all grid cells into a two-dimensional array or hash table structure to obtain a grid index model that supports fast coordinate lookup, which is used for grid status marking, dynamic obstacle fusion and path search in subsequent steps.
[0210] For example, in some embodiments of this application, S240 assigns a unique identifier to each grid cell and records its planar coordinate range, center point coordinates, and the region it is located in (up / down / obstacles will be marked in subsequent steps). The organization structure of the grid cells is stored as a two-dimensional array or hash table, supporting fast lookup of the grid cell based on planar coordinates.
[0211] It should be noted that by executing S210-S240 above, the following can be achieved: the continuous space of the waterway is transformed into a finite number of discrete grid cells, providing a unified data foundation for subsequent grid cell state labeling (upstream / downstream / obstacles), real-time dynamic obstacle fusion, and grid-based path search algorithms (such as the A* algorithm); the grid size is determined according to the ship's scale and accuracy requirements, ensuring that the grid granularity can accurately reflect the ship's space occupation, while avoiding excessive computation due to overly fine grids, thus achieving a balance between accuracy and efficiency; the grid is densified in key sections such as curves and narrow passages to improve the path planning accuracy in these areas, ensuring that ships can obtain more refined obstacle avoidance and correction paths in complex waters; the grid is sparse in straight sections to reduce computational resource consumption; and the constructed grid index supports millisecond-level coordinate positioning and grid queries, meeting the performance requirements of real-time systems.
[0212] In some embodiments of this application, the following marking operation is performed on each grid cell in the target grid cell set:
[0213] First, navigation attributes are labeled for each grid cell in the target grid cell set.
[0214] For heading zone marking of grid cells that do not cross the target centerline: using the spline curve generated in step 1.1 as the boundary, by calculating the signed distance of the center point of the grid cell relative to the curve (i.e., the target centerline), the grid cells located on both sides of the curve are marked as the upward region and the downward region, respectively, and assigned different visualization colors (such as green for upward and blue for downward) to distinguish them. The upward direction is defined as along the positive direction of the centerline (such as from upstream to downstream), and the opposite is downward.
[0215] In embodiments of this application, the marking process for the heading partition marker includes:
[0216] Using the spline curve (i.e., the target centerline) generated in step 1.1 as the boundary, calculate the signed distance of the center point of each grid cell relative to the curve. The sign of the signed distance indicates whether the center point of the grid cell is located to the left or right of the target centerline. Based on the defined upward direction (e.g., upward along the positive direction of the centerline), the grid cells on one side of the curve are marked as the upward region, and the other side is marked as the downward region.
[0217] Example 1
[0218] Assuming a channel centerline runs from west to east, we define west to east as the uphill direction. If the signed distance calculated at the center point of a grid cell north of (left of) the target centerline is positive, then these grid cells are marked as the uphill region; if the signed distance calculated at the center point of a grid cell south of (right of) the target centerline is negative, then they are marked as the downhill region. In a digital twin scenario, uphill grid cells are displayed in green, and downhill grid cells are displayed in blue for easy visual differentiation.
[0219] It is easy to understand that some embodiments of this application transform waterway traffic rules (upstream vessels travel on the left, downstream vessels travel on the right) into inherent attributes of grid cells through heading partition markings, providing a data foundation for rule constraints in subsequent path planning. When searching for a path, the A* algorithm can query the heading attributes of grid cells to ensure that the planned path always stays within the legal navigation area, avoiding violations such as going against the flow of traffic or occupying the lane.
[0220] For a grid cell that is crossed by the target centerline, calculate the area ratio of the grid cell located on the upward and downward sides of the curve. The grid cell is assigned to the upward or downward region based on the side with the larger area, thereby ensuring the rationality of the grid assignment at the channel boundary and avoiding channel path interruption due to discretization.
[0221] In some embodiments of this application, the marking process for boundary mesh processing includes: for mesh cells traversed by the target centerline spline curve (i.e., the curve passes through the inside of the mesh), the center point position of the mesh cell alone cannot accurately determine its affiliation. In this case, it is necessary to calculate the area ratio of the mesh cell located on the upward and downward sides of the target centerline, compare the two ratios, and assign the mesh cell to the side with the larger area. This processing method ensures the rationality of mesh affiliation at the channel boundary and avoids a break in affiliation at the curve boundary due to discretization.
[0222] Example 2
[0223] Suppose a grid with a side length of 1 meter is diagonally crossed by the target centerline. The area of the grid on the upward side is 0.7 square meters, and the area on the downward side is 0.3 square meters. By calculating the area proportions, the upward side accounts for 70%, and the downward side accounts for 30%. Therefore, this grid is marked as the upward region. If the grid is entirely located on one side of the target centerline, the area proportion calculation automatically assigns it to the corresponding side.
[0224] It is easy to understand that the boundary mesh processing in this application addresses the problem of ambiguous boundary assignment caused by mesh discretization. Without such processing, meshes crossed by curves may be incorrectly assigned due to their center point being on one side, or they may be missed, leading to interruptions in the waterway path. Some embodiments of this application use area proportion algorithms to ensure a smooth transition of mesh regions on both sides of the waterway centerline at the boundary, preventing planning failures or path distortions due to abrupt changes in mesh assignment during path planning.
[0225] Secondly, based on the distribution of static obstacles, the occupied grid cells in the target grid cell set are marked with static obstacles.
[0226] In some embodiments of this application, the static obstacle marking process includes: marking grid cells outside the channel boundary and grid cells occupied by fixed physical obstacles (such as reefs, bridge piers, shoals, etc.) within the channel as obstacle cells (i.e., marking static obstacle cells), and displaying them in gray. The location of obstacles can be obtained through pre-imported obstacle layers or manual annotation. The status of all grids (upstream / downstream / obstacles) is stored in a grid status database, supporting real-time querying and updating. The grid status database needs to have high-concurrency read / write capabilities to support rapid updates of dynamic status.
[0227] For example, in some embodiments of this application, the marking process for static barrier markers includes:
[0228] Two types of grid cells are marked as obstacle cells: the first type consists of grids located outside the channel boundary polygon, corresponding to land or non-navigable waters; the second type consists of grids occupied by fixed physical obstacles within the channel, such as reefs, bridge piers, shoals, and shipwrecks. The location information of obstacles can be obtained through pre-imported obstacle layers (such as obstacle markers on electronic charts) or manual annotation. Grids marked as obstacle cells are typically displayed in gray during visualization, providing a sharp contrast to navigable areas.
[0229] Example 3
[0230] A bridge pier exists in a certain section of the waterway, and its planar projection covers three grid cells. The system pre-obtains the center position and dimensions of the pier from the pier layer, calculates the range of the grid cells it covers, and marks these grid cells as obstacle cells. In addition, the grid cells outside the waterway boundary, being located on the shore, are automatically marked as obstacle cells by the system based on the waterway boundary polygon.
[0231] It is easy to understand that some embodiments of this application explicitly mark impassable areas using static obstacle markers, ensuring that the path planning algorithm does not plan paths to these areas. In the A* algorithm, obstacle grids are given a high cost, and the algorithm automatically avoids these grids, thus achieving obstacle avoidance. This pre-marking method improves the efficiency of path planning and avoids repeatedly calculating static obstacles during real-time runtime.
[0232] It should be noted that the three state identifiers (upward, downward, or static obstacle markers) in this application embodiment collectively constitute the static basic state database of the channel grid. The upward and downward regions are used to define the legal heading attributes of each grid within the navigable area. Obstacle grids are used to define impassable grid areas, including areas outside the channel and fixed obstacles. Boundary grid processing, as a supplementary rule to the heading partition markers, ensures that grids crossed by curves are properly assigned.
[0233] In some embodiments of this application, the states of all grid cells in the target grid cell set are calculated all at once during the system initialization phase and stored in the grid state database. This database supports high-concurrency read and write operations, and subsequent steps (such as path planning in step 4) can query the grid state in real time. Meanwhile, the dynamic obstacle fusion in step 4.2 will temporarily mark temporarily occupied cells (temporary obstacles) based on this, but will not modify the static basic state.
[0234] The above steps result in a set of grid cells covering the entire navigable area of the waterway. Each grid cell contains the following information: grid identifier, planar coordinate range (e.g., lower left and upper right corner coordinates), center point coordinates, and original state (upward zone, downward zone, or obstacle cell).
[0235] Step 2: System Initialization and Real-Time Data Alignment
[0236] This step ensures that the initial position of the virtual ship in the digital twin scenario is consistent with that of the real physical ship, and establishes a real-time data reception mechanism.
[0237] 2.1 Initial Position Alignment
[0238] Upon system startup, it receives the initial GPS coordinate data (including initial position, speed, and time) reported by the physical vessel. Using a coordinate transformation algorithm (such as Gauss-Krüger projection), the GPS coordinates are mapped to the digital twin scene coordinate system, and the virtual vessel model is placed in the corresponding position. Simultaneously, using the target centerline from step 1.1, the nearest centerline point to this mapped position is found and used as the vessel's initial anchor point in the virtual scene. The tangent direction and current lateral offset distance of this point are recorded. If the nearest point's distance exceeds a preset threshold (e.g., 5 meters), it is considered an initial alignment anomaly, requiring manual intervention or repositioning.
[0239] In some embodiments of this application, the initial position alignment process includes:
[0240] S310 uses a coordinate transformation algorithm (such as Gauss-Kruger projection or Universal Transverse Mercator projection) to map the global positioning system coordinates (latitude and longitude) reported by the physical ship to a unified coordinate system (such as the northeast-sky coordinate system or local plane coordinate system) used in the digital twin scene, thus obtaining the initial position coordinates of the virtual ship in the scene.
[0241] S320, based on the converted initial position coordinates, place the virtual ship model at the corresponding position in the digital twin scene, ensuring that the geometric center of the virtual ship coincides with the coordinate point. At this point, the virtual ship is presented in the scene for the first time, and its initial posture can be initially set based on the tangent direction calculated subsequently.
[0242] S330: Calculate the distance from the current position of the virtual ship to every point on the target centerline, find the point with the smallest distance value, take this point as the centerline point closest to the current position, and use it as the initial anchor point of the ship in the virtual scene.
[0243] S340, after finding the nearest centerline point, record the following information: the tangent direction of the point, used to determine the legal navigation direction of the ship in this segment; the current lateral offset distance, that is, the vertical distance from the ship's current position to the nearest centerline point, which has a directional attribute (e.g., positive for the left and negative for the right), used to indicate the ship's yaw state relative to the centerline.
[0244] S350: Calculate the distance (i.e., the absolute value of the lateral offset distance) from the ship's current position to the nearest target centerline point, and compare this distance with a preset threshold (e.g., 5 meters). If the distance is less than or equal to the preset threshold, the initial alignment is considered successful, and the system enters normal operation. If the distance exceeds the preset threshold, the initial alignment is considered abnormal, and the system triggers a manual intervention request or a repositioning process, allowing operators to check data accuracy or manually adjust the ship's initial position.
[0245] By executing S310-S350 above, the following can be obtained:
[0246] The initial position of the virtual ship, and the precise coordinates of the virtual ship model in the digital twin scenario.
[0247] Initial anchor point information: including the coordinates of the nearest target centerline point, the tangent direction of that point, and the lateral offset distance from the ship's current position to that point.
[0248] Alignment status indicator: success or exception. If it is an exception, the corresponding processing flow will be triggered.
[0249] It is easy to understand that the following technical objectives can be achieved by performing the above initial position alignment operation:
[0250] To achieve virtual-real synchronization, the position of the real ship is mapped to the digital twin scene through coordinate transformation, ensuring that the initial position of the virtual ship is consistent with that of the physical ship, thus establishing an accurate starting point for subsequent real-time data-driven and path correction.
[0251] Establish a centerline reference by finding the nearest centerline point and recording the tangent direction and lateral offset to provide a benchmark for subsequent position calculation (step 3), enabling the system to calculate the ship's yaw state relative to the channel in real time.
[0252] To ensure the reliability of initial positioning, an alignment anomaly detection mechanism is used to promptly detect initial positioning deviations caused by GPS errors, coordinate transformation errors, or data anomalies, avoiding subsequent path planning from incorrect starting points and ensuring the safety of system operation.
[0253] Supports subsequent real-time updates: After initialization, the system will continuously receive real-time motion data and continuously update the ship's position and course based on the current initial state, forming continuous dynamic tracking.
[0254] 2.2 Real-time data stream reception
[0255] The system continuously receives motion data packets reported by the physical ship at fixed time intervals (e.g., per second). Each data packet contains at least the current position at time t (represented as Pt in the first mapping point of the digital twin scenario in subsequent examples; in some embodiments, Pt is simplified to the current position for ease of description), instantaneous velocity Vt, and timestamp Tt. This data will serve as input to drive the virtual ship's motion and trigger path correction. The motion data packets must be verified for integrity using a verification mechanism (such as CRC). If three consecutive reception failures occur, the exception handling in step 6 is triggered.
[0256] For example, the system performs the following ordered processing on the input data to ensure that the received data is reliable and can be used to drive the virtual ship's motion:
[0257] Step 1: Receiving motion data packets
[0258] The system continuously listens to the communication port at fixed time intervals (e.g., every second), waiting for motion data packets reported by physical vessels. When a data packet is received, the system records the reception time and prepares for verification processing.
[0259] Step 2: Data packet integrity verification
[0260] The received data packet undergoes integrity verification using cyclic redundancy check (CRC) or other verification mechanisms. The checksum in the data packet is compared with the checksum calculated based on the data content. If they match, the data packet is considered complete and valid, and the process proceeds to step three. If they do not match, the data packet is considered corrupted, discarded, and a reception failure is recorded.
[0261] Step 3: Data Parsing and Storage
[0262] For motion data packets that pass integrity verification, the current position coordinates, instantaneous velocity, and timestamp are parsed. This data is then organized according to the system's internal data structure, ready to be used to drive the virtual ship's motion and trigger path correction.
[0263] Step 4: Receive Failure Count Management
[0264] The system maintains a consecutive reception failure counter. Each time a valid data packet is successfully received and parsed, the counter is reset to zero. Each time a data packet is not received due to verification failure or timeout, the counter is incremented. When the number of consecutive reception failures reaches a preset threshold (e.g., three consecutive times), the system determines that the communication link is abnormal and triggers the exception handling process in step 6 (signal loss handling and state reset).
[0265] Step 5: Data Output Preparation
[0266] The parsed motion data (current position coordinates, instantaneous velocity, timestamp) is marked as valid input data for the current cycle and prepared to be passed to step 3 (real-time position calculation and target determination based on the target centerline) for processing.
[0267] This step yields: valid motion data, a current-moment motion data packet that has passed integrity verification and successful parsing, containing position coordinates, instantaneous velocity, and timestamp, used to drive the virtual ship's motion and path correction; and a reception status indicator, indicating either normal reception or continuous reception failures reaching a threshold, the latter triggering exception handling.
[0268] The embodiments of this application employ an integrity verification mechanism to ensure that the data used to drive the virtual ship and path planning is complete and tamper-proof, preventing virtual ship position errors or path planning failures due to data corruption. Real-time synchronization is achieved by receiving data at fixed time intervals, ensuring that the virtual ship in the digital twin scenario keeps pace with the physical ship, providing continuous input for subsequent real-time position calculation and dynamic path correction. Communication anomalies are detected promptly through a continuous reception failure counting mechanism, quickly identifying communication link interruptions or equipment failures and triggering anomaly handling procedures in a timely manner, preventing the system from continuing to operate without data input and resulting in loss of control. Supporting subsequent processing flows, the output valid motion data serves as the foundational input for steps 3 (real-time position calculation) and 4 (dynamic path planning), ensuring the closed-loop operation of the entire system.
[0269] Step 3 can calculate the ship's current position and target position in the digital twin scenario based on real-time data.
[0270] 3.1 Calculation of the current projection point
[0271] For the received coordinates Pt of the mapped point in the digital twin scene representing the current position, find the nearest point on the target centerline generated in step 1.1 as the projection point Cproj. The search process must incorporate the direction constraints from step 7 to ensure that the tangent vector direction at Cproj is consistent with the ship's current heading (inferred from historical trajectories). Calculate the offset distance Loffset from Pt to Cproj, which is signed (e.g., positive for port and negative for starboard). Simultaneously, obtain the unit tangent vector Tvec at Cproj, which indicates the ship's legal heading in that segment.
[0272] The inputs for step 3 include:
[0273] The ship's coordinates at the current moment: The coordinates of the physical ship's position at the current moment, obtained from step 2.2, are denoted as Pt in the first mapping point of the digital twin scenario.
[0274] Step 1.1 generates a target centerline, which is a continuous, smooth curve characterizing the channel centerline and used to determine the projected position of ships on the channel. It includes pre-stored uniformly segmented endpoints and the parametric equations of the curve.
[0275] Current heading of the vessel: The direction of the vessel's navigation inferred from its historical trajectory, such as uphill or downhill. It is used for directional filtering when searching for the nearest point to ensure that the projection point is in front of the vessel rather than behind it.
[0276] In some embodiments of this application, the calculation of the current projection point in 3.1 includes:
[0277] The system performs the following ordered processing on the input data to calculate the projection point of the ship on the target centerline and related parameters:
[0278] Step 1: Coarse screening of candidate points
[0279] On the target centerline generated in step 1.1, traverse all segment endpoints and calculate the distance from each segment endpoint to the ship's current position (essentially the mapping point position of the current position in the digital twin scene) Pt, obtaining the first distance set. Select several candidate points with smaller distances from this set as the first candidate set to reduce the computational load of subsequent direction filtering.
[0280] Step 1.1 involves uniformly dividing the target centerline into segments and recording the coordinates of the segment endpoints, which enables rapid nearest-point search. Its specific function is as follows:
[0281] Accelerating nearest point localization: Directly solving for the exact nearest point on the entire continuous spline curve (i.e., the target centerline) involves a large amount of computation, which is difficult to meet real-time requirements. By pre-discretizing (uniformly segmenting), we can first use the segment endpoints for coarse screening: calculate the distance from all endpoints to the ship's current position Pt, and select the segment endpoints with the smallest distance (e.g., the 3 to 5 smallest distances) as candidate regions.
[0282] Narrowing the fine-grained search range: In the vicinity of the candidate endpoints obtained from the coarse screening (e.g., within the two segmented intervals before and after the endpoint), perform precise nearest point calculations on the continuous curves (such as using the bisection method or gradient descent method). This ensures positioning accuracy while reducing computational load.
[0283] Balancing real-time performance and accuracy: The selection of segment length (e.g., 10 meters) requires a trade-off. Closer segments result in more accurate coarse screening but increase storage and computational load; sparser segments may cause the closest point to be missed during coarse screening. Typically, the segment length is set to ≤ 1 / 2 of the minimum expected turning radius, or dynamically adjusted based on ship speed.
[0284] In other words, along the target centerline, all pre-stored uniformly segmented endpoints are traversed, and the distance from each endpoint to the ship's current position Pt is calculated. From this, several endpoints with smaller distances are selected as the first candidate set. The purpose of this step is to narrow the search range from the entire curve to a local region, thereby improving computational efficiency.
[0285] The second step, directional constraint filtering, involves obtaining the tangent vector direction for each preliminary candidate point in the first candidate set. This tangent vector direction is compared with the ship's current heading to determine if they are substantially consistent (i.e., the angle between them is less than 90 degrees). If the tangent vector direction is opposite to the ship's current heading (the tangent vector direction is inconsistent with the current heading), the candidate point is deleted, resulting in the second candidate set. This filtering ensures that the projected point is located ahead of the ship's legal direction of travel, avoiding the misselection of points behind the ship as projected points.
[0286] Step 3: Determining the Projection Distance
[0287] For candidate points filtered by direction constraints, the projection distance from the mapping point Pt of the ship's current position in the digital twin scene to the candidate point (i.e., the endpoints of each segment in the second candidate set) is further calculated. The projection distance is calculated by multiplying the vector from the ship's current position to the candidate point by the tangent vector at the candidate point, obtaining the projection distance of the ship's position relative to the candidate point along the direction of the tangent vector. If the projection distance is negative, it indicates that the candidate point is located behind the ship. Even if the direction of the tangent vector is consistent with the heading, the point should be deleted, resulting in the third candidate set. This determination further ensures that the projection point is located in front of the ship.
[0288] Step 4: Fine-tune the projection point
[0289] For the third candidate set consisting of candidate points filtered by direction constraints and with non-negative projected distances, determine the local curve segment corresponding to each candidate point in this set. Within this local curve segment, sample curve parameters, i.e., take points at parameter intervals smaller than the segment endpoints, and calculate the projected distance from these sampled points to Pt (again, determine if the projected distance is non-negative). Among all candidate points, select the point with the smallest projected distance as the final projected point Cproj. If multiple points have similar projected distances, select the point with the closest geometric distance.
[0290] Step 5: Calculate the offset distance
[0291] Calculate the vertical distance from the first mapped point Pt corresponding to the ship's current position to the projected point Cproj to obtain the lateral offset distance Loffset. This lateral offset distance is signed and assigned a positive or negative value depending on whether the ship is to the left or right of the target centerline. For example, the offset distance is positive when the ship is to the port side of the target centerline and negative when it is to the starboard side. The sign information is used to maintain the offset direction when determining the target position later.
[0292] Step 6: Obtain the tangent vector
[0293] Obtain the unit tangent vector Tvec at the projection point Cproj. This vector represents the legal navigation direction of the ship in this segment and is used in subsequent steps to determine the direction of movement of the target position and the directional constraints of path planning.
[0294] The following output was obtained by executing 3.1:
[0295] Projection point Cproj: The coordinates of the projection point of the ship's current position on the target centerline. This point is located in front of the ship, and the direction of the tangent vector at this point is consistent with the ship's current course.
[0296] Lateral offset distance Loffset: The vertical distance from the ship's current position to the projection point, with a sign indicating the degree and direction of the ship's yaw relative to the target centerline.
[0297] Unit tangent vector Tvec: The unit tangent vector at the projection point, representing the legal navigation direction of the ship in this segment.
[0298] It should be noted that performing the steps in section 3.1 above has the following technical advantages:
[0299] Ensure the correct orientation of the projection point: By using directional constraints and projection distance determination, ensure that the selected projection point is located in front of the ship and that the tangent vector is consistent with the ship's heading, thus avoiding the problem of reverse or backward movement caused by using the rear point as the projection point. This is the core manifestation of improvement point five.
[0300] Quantitative yaw degree: By calculating the offset distance with a sign, the system can clearly know the distance and direction of the ship's deviation from the centerline, providing a quantitative basis for whether and how to correct the yaw when determining the target position.
[0301] Provide a legal course reference: The obtained tangent vector indicates the legal navigation direction of the ship in this segment, which is used in subsequent steps to determine the direction of movement and calculate the directional cost of path planning when determining the target position, ensuring that the correction path complies with the waterway traffic rules.
[0302] Balancing efficiency and accuracy: A two-stage strategy of coarse screening at segmented endpoints and fine search by sampling local parameters is adopted, which ensures both real-time computation efficiency and the accuracy of the projected points.
[0303] 3.2 Target Location Determination
[0304] By combining the ship's current speed Vt, the time interval Δt (i.e., the time difference between the previous reception and the current reception, usually equal to a fixed interval), and the current lateral offset Loffset, the target position that the ship should reach in the next moment is estimated. The specific steps are as follows:
[0305] Starting from the projection point Cproj, move forward along the target centerline curve by an arc length S = Vt × Δt to obtain the theoretical point Ctarget on the target centerline. If the moving distance exceeds the length of the centerline, then take the endpoint of the target centerline as the theoretical point Ctarget.
[0306] The theoretical point Ctarget is offset laterally by a distance Loffset along the normal direction (perpendicular to T_vec) to obtain the target position Ptarget. Ensure Ptarget falls within the channel boundary (i.e., the grid cell is not an obstacle cell). If it exceeds the boundary, the lateral offset distance Loffset of the target position needs to be adjusted to the maximum allowable offset (approximately half the channel width - half the ship's width - safety margin (0.5~5.0 meters)), and must not exceed the value stipulated by channel management regulations. Comprehensive calculation formula (recommended)
[0307] Lmax = min(D_boundary - B / 2 - S_safe, L_rule)
[0308] Where: Dboundary: distance from the target centerline to the channel boundary (meters), B: ship beam (meters), Ssafe: safety margin (recommended 0.5~5.0 meters), Lrule: maximum yaw distance allowed by channel management regulations (if applicable, for example, not exceeding 5 meters).
[0309] The method described in this application embodiment ensures that the target position always conforms to the direction of the target centerline and maintains the original offset as much as possible, thereby avoiding clipping caused by GPS errors or modeling deviations. The target position is obtained by offsetting the theoretical point by a lateral distance along the normal direction and confirming it through the boundary. The theoretical point is a point located on the centerline of the target spline obtained by moving the projected point along the target curve by a unit distance from the current position. The unit distance is the product of the current speed and the time interval.
[0310] It should be noted that, in some embodiments of this application, the inputs for step 3.2 include:
[0311] Projection point Cproj (theoretical point): The projection point of the ship's current position on the centerline obtained from step 3.1, including the coordinates of the point.
[0312] Unit tangent vector Tvec: The unit tangent vector at the projection point Cproj, representing the legal navigation direction of the ship in this segment.
[0313] Ship current speed Vt: The instantaneous speed of the physical ship at the current moment, received and parsed from step 2.2.
[0314] Time interval Δt: The time difference between the last received motion data packet and the current received packet, which is usually equal to the fixed time interval set by the system.
[0315] Current lateral offset distance Loffset: The signed offset distance of the ship's current position relative to the centerline, calculated from step 3.1.
[0316] Target centerline: The complete curve generated in step 1.1 is used to determine the endpoint of the curve.
[0317] Channel grid status database: The grid database established in step 1.2 is used to query whether the grid at a specified coordinate is an obstacle grid.
[0318] Maximum permissible offset: A predefined safe offset limit based on the distance between the channel boundary and the centerline.
[0319] In some embodiments of this application, the target location determination process in section 3.2 includes:
[0320] Step 1: Calculate the theoretical point of the target centerline
[0321] Starting from the projection point Cproj, move a distance along the target centerline. This distance is equal to the product of the ship's current speed and the time interval. The resulting point on the centerline is called the theoretical point Ctarget. If the ship moves beyond the endpoint of the target centerline during the movement, the endpoint of the target centerline is taken as the theoretical point Ctarget.
[0322] Step 2: Preliminary calculation of the desired target location
[0323] Offset the theoretical point Ctarget along the normal direction by the current lateral offset distance Loffset to obtain the preliminary desired target position Ptarget (i.e., the offset position point). The normal direction refers to the direction perpendicular to the unit tangent vector, and the specific direction of the offset is determined by the sign of Loffset (e.g., a positive sign indicates an offset to the left of the center line, and a negative sign indicates an offset to the right).
[0324] Step 3: Boundary Validation and Adaptive Correction
[0325] Query the grid cell corresponding to the location of Ptarget and determine whether the grid is an obstacle cell using the grid state database established in step 1.2. If the grid is not an obstacle cell, Ptarget is directly used as the target location. If the grid is an obstacle cell, it means that the initially calculated target location falls into an impassable area (such as on the shore, bridge piers, or shallows). In this case, the lateral offset needs to be limited to the maximum allowable offset, that is, the current Loffset is replaced with the maximum allowable offset, and the target location is recalculated. The maximum allowable offset is usually taken as the distance from the channel boundary to the centerline at this location minus a safety margin, ensuring that the corrected target location falls exactly inside the channel boundary.
[0326] Step 4: Output target position
[0327] The target position after boundary verification and correction is output as the expected target point of the current instruction cycle.
[0328] Step 4: Dynamic Path Correction and Obstacle Avoidance Planning
[0329] This step generates a safe and smooth path that conforms to the centerline and avoids both static and dynamic obstacles, based on the current location, the target location, and the channel grid information.
[0330] 4.1 Local Spline Curve Topology
[0331] Starting from the projection point Cproj obtained in step 3.1 and ending from the theoretical point Ctarget (the point on the center line) obtained in step 3.2, a local curve is extracted from the global center line spline curve according to the starting point, ending point and offset, and then the curve is lofted up and down to form a new curve Llocal (i.e., the up curve and the down curve).
[0332] Lofting refers to using the center line of the target as a reference and offsetting it a certain distance to the left and right along its normal direction to generate two trajectory lines, one upward and one downward, corresponding to the upward curve and the other downward curve, respectively.
[0333] For example, in some embodiments of this application, the layout process includes:
[0334] Determine the predetermined offset distance d (e.g., d = half the width of the channel × 0.3, or d = the width of the ship / 2 + 1m).
[0335] Calculate the offset position point by point: For each parameter point C on the target centerline, calculate the unit normal vector N (pointing to the left), then:
[0336] Downward trajectory point = C + d × (-N) (right offset)
[0337] Upward trajectory point = C - d × (-N) (leftward offset)
[0338] Fitting to generate new curves: Fit the offset point set into two independent spline curves, which are used as the path references for the upstream and downstream ships, respectively.
[0339] The input parameters for step 4.1 include:
[0340] Projection point Cproj: The projection point of the ship's current position on the centerline obtained from step 3.1, including the coordinates of the point and the arc length parameter on the centerline.
[0341] Theoretical point Ctarget: The theoretical target point on the centerline (i.e., the target centerline spline curve) obtained from step 3.2, including the coordinates of the point and the arc length parameter on the centerline.
[0342] Global centerline spline curve (i.e. target centerline): The complete centerline curve (i.e. target centerline spline curve) generated in step 1.1 includes its parametric equation and uniformly segmented endpoints.
[0343] Current lateral offset Loffset: The signed offset distance of the ship's current position relative to the target centerline (i.e., the target centerline spline curve) obtained from step 3.1.
[0344] In some embodiments of this application, 4.1 the input data is processed in the following order to generate a local reference curve connecting the start and end points, specifically including:
[0345] Step 1: Determine the arc length interval
[0346] Based on the arc length parameters of the projected point Cproj and the theoretical point Ctarget on the target centerline, determine the arc length interval from Cproj to Ctarget. If the arc length of Cproj is less than the arc length of Ctarget, the interval is from Cproj to Ctarget; if the arc length of Cproj is greater than the arc length of Ctarget, it means that the ship has already passed the theoretical target point. In this case, the interval from Cproj to the end point on the target centerline is taken as a backup, but usually, in the normal navigation direction, Cproj comes first and Ctarget comes second.
[0347] It should be noted that the system operates according to the most intuitive logic; however, under boundary conditions and abnormal situations, a backup plan ensures that the system will not crash and can still output a valid local curve, providing a basis for continued operation of subsequent steps. This design improves the robustness and reliability of the system.
[0348] Step 2: Extract the centerline curve segment
[0349] From the global centerline spline curve (i.e. the target centerline), extract the curve segment corresponding to the above arc length interval to obtain a local curve segment of the centerline. The starting point of this curve segment is Cproj, the ending point is Ctarget, and the curve direction is completely consistent with the target centerline.
[0350] Step 3: Generate a local curve with offset.
[0351] The extracted local curve segment of the centerline is offset by a predetermined amount along the normal direction of each point to generate two new local spline curves Llocal (i.e., the upward curve and the downward curve).
[0352] During the offset, the normal direction of each point is kept consistent (i.e., offset towards the same side of the centerline), so that the entire curve maintains the same offset trend relative to the centerline. If the offset curve locally exceeds the channel boundary, it will be trimmed or adjusted according to the boundary constraints. However, only the basic offset curve is generated here, and subsequent path planning will be further corrected by combining the grid.
[0353] Step 4: Output local reference curve
[0354] The generated local spline curve Llocal is output as the local reference curve for the current instruction cycle.
[0355] The technical advantages of implementing 4.1 include:
[0356] Narrowing the planning space: By extracting local curve segments between the current projection point and the theoretical target point, the scope of path planning is narrowed from the entire channel to the current segment, significantly reducing the search complexity of the subsequent A* algorithm and improving real-time performance.
[0357] Providing path reference: The generated local curve Llocal reflects the ideal trajectory of the ship in the absence of dynamic obstacles (i.e., maintaining the current offset along the centerline), providing a heuristic reference for the A* algorithm and helping to search for a correction path that better fits the course.
[0358] Maintain course trend: By superimposing the offset onto the centerline, the local curve is made consistent with the ship's current yaw state, avoiding the planned path from forcibly pulling the ship back to the centerline and reducing unnecessary turning maneuvers.
[0359] Supporting dynamic obstacle avoidance: This local curve serves as the benchmark for subsequent mesh state fusion and A* search, ensuring that the obstacle avoidance path is locally adjusted while satisfying the channel geometry constraints, maintaining the correctness of the general direction while having the flexibility to bypass dynamic obstacles.
[0360] 4.2 Dynamic Obstacle Fusion and Temporary Obstacle Marking
[0361] The local curve Llocal is overlaid and analyzed with the waterway grid map established in step 1.2.
[0362] Temporary Occupation Marking: Based on the real-time positions of other ships or dynamic objects in the current scene (obtained via VHF / AIS or other sensing methods), grid cells occupied by other objects within the grid cells traversed by the Llocal are temporarily marked as temporarily occupied grid cells (also displayed in gray, treated uniformly with static obstacles). Simultaneously, during the ship's operation, the grid cells currently occupied by the ship itself (the grid set covered based on the ship's size and heading) are also marked as temporarily occupied grid cells to prevent self-intersections or conflicts during path planning. The validity period of the temporary occupancy marking is dynamically set by the system based on the object's movement speed (e.g., estimated passage time plus a safety margin).
[0363] Grid state update: Store the temporarily occupied grid state into the dynamic state cache and participate in subsequent path search.
[0364] The inputs for step 4.2 include:
[0365] Local curve Llocal: The local spline curve generated in step 4.1 represents the planned corridor of the ship in the current command cycle.
[0366] Channel grid map: The grid status database established in step 1.2 contains static markers for each grid (upstream area, downstream area, or obstacle grid).
[0367] Real-time position of other dynamic objects: Position, size and motion information of surrounding ships, floating objects and other dynamic targets obtained through Automatic Identification System (AIS), VHF communication or other sensing means.
[0368] The vessel's dimensional parameters include its length and width, used to calculate the grid area it occupies during navigation.
[0369] The vessel's current heading: used to determine the vessel's orientation on the grid map.
[0370] In some embodiments of this application, 4.2 includes:
[0371] Step 1: Overlay analysis of local curves and mesh
[0372] The local curve Llocal is projected onto the channel grid map to determine all the grid cells it passes through. This step calculates the set of grid cells traversed by the curve by analyzing the grid cells containing discrete sampling points on the local curve. These grid cells represent the potential areas that ships will pass through in subsequent path planning.
[0373] Step 2: Temporary occupancy markers for other dynamic objects
[0374] For other ships or dynamic objects in the current scene, obtain their real-time positions and coverage areas, and determine the set of grid cells currently occupied by each dynamic object. Perform an intersection operation on these grid cells and the set of grid cells traversed by the local curve to find the grid cells that are both located on the local curve and occupied by other dynamic objects. Temporarily mark these grid cells as temporarily occupied cells. Occupied cells are usually displayed in gray in the visualization, using the same display method as static obstacle cells, for easy and consistent processing.
[0375] Step 3: Temporary occupancy markers for the grid occupied by this vessel
[0376] Based on the vessel's dimensions and current heading, calculate the set of grid cells covered by the vessel at its current position. Considering the vessel's length and width, its occupied grid is not limited to the single grid cell at its center point, but rather covers a rectangular area. All grid cells within this area are temporarily marked as temporarily occupied cells. This step aims to prevent the path planning algorithm from planning paths that conflict with itself, such as self-intersecting paths that cross the vessel's hull.
[0377] Step 4: Setting the validity period of the temporary occupancy marker
[0378] For each grid cell temporarily marked as temporarily occupied, the validity period of the mark is dynamically set based on the movement speed of the object occupying that grid cell. The validity period is calculated as follows: the sum of the side length of the grid cell and the length of the object, divided by the object's movement speed, plus a preset safety margin. For grid cells occupied by the vessel itself, the validity period is set to the estimated time for the vessel to pass through the grid plus the safety margin. The validity period is used to control the automatic clearing time of temporary occupancy marks, preventing the grid from being incorrectly marked as occupied even after the object has left.
[0379] Step 5: Grid State Update and Storage
[0380] All the temporarily occupied grid states are stored in a dynamic state cache. The dynamic state cache and the static grid state database are stored separately, but both participate in path searching. When querying the state of a grid, the temporary occupied markers in the dynamic state cache are used first; if there are no markers in the dynamic state cache, the state in the static grid state database is used. This separation design allows temporary occupied markers to be added and released at any time without affecting the static underlying data.
[0381] The output obtained after executing 4.2:
[0382] Merged grid state: A complete grid state view composed of a static grid state database and a dynamic state cache. The state of each grid may be an up region, a down region, an obstacle cell, or a temporarily occupied cell, with the temporarily occupied cell having the highest priority.
[0383] Dynamic state cache: A list of grids containing temporary occupancy markers, each with expiration information for subsequent pathfinding and automatic release.
[0384] The technical advantages of implementing 4.2 include:
[0385] Real-time dynamic obstacle avoidance: By converting the real-time positions of other dynamic objects into temporary occupancy markers, the path planning algorithm can perceive the existence of dynamic obstacles and actively avoid them when planning the path, thus achieving dynamic obstacle avoidance.
[0386] Preventing self-intersection of paths: By marking the grid occupied by the vessel itself as temporarily occupied, the planned path avoids passing through the vessel itself, thus preventing the generation of self-intersection paths and ensuring the safety and feasibility of the path.
[0387] Supporting dynamic resource reuse: By setting a dynamic expiration date for temporary occupancy markers, an automatic release mechanism for occupied grids is implemented. When a dynamic object leaves, the grid automatically returns to its original state, supporting the reuse of channel resources when multiple ships are sailing in parallel and avoiding channel congestion caused by the accumulation of temporary markers. This is the core manifestation of improvement point four.
[0388] Improve planning accuracy: Temporary occupancy markers and static obstacle grids adopt a unified display and processing method, enabling the path planning algorithm to avoid all impassable grids equally, whether they are static or dynamic obstacles, thus ensuring the consistency between the planning results and the actual navigation environment.
[0389] Ensuring real-time planning: Through the design of separating dynamic state caching from static database, the addition and release of temporary tags will not affect the static basic data, ensuring the real-time response capability of path planning in dynamically changing environments.
[0390] 4.3 The A* algorithm is used to search for obstacle avoidance paths, generating a smooth correction path that conforms to the navigation rules and avoids obstacles, thus obtaining the target correction path.
[0391] On a local grid map composed of grids (including up, down, obstacle grids (i.e., static obstacle markers), and temporarily occupied grids), the A* path search algorithm is initiated, starting from the grid corresponding to the ship's current position and ending at the grid corresponding to the target position.
[0392] The cost function design of this embodiment is as follows: The cost function of Algorithm A is f(n) = g(n) + h(n), where g(n) is the actual cost from the starting point to the current node n, and h(n) is the heuristically estimated cost from the current node to the destination (such as Euclidean distance). The actual cost g(n) considers not only the geometric length of the path but also incorporates channel rule costs and obstacle penalties. Specifically, a unit distance cost of 1 is assigned to grid cells belonging to the up or down direction; a very large cost (such as 10^6) is assigned to obstacle cells or temporarily occupied cells, thereby ensuring that the searched path strictly follows the channel separation rules and avoids all obstacles. In addition, a direction consistency cost can be added, assigning a higher cost to grid cells in the opposite direction (normally 1, reverse 10) to avoid reverse travel.
[0393] For example, in some embodiments of this application, the cost g(n) formula introduces a normal cell as 1, an obstacle cell (e.g., 10^6), and a reverse direction cell (10). The cost is calculated by adding the costs of each cell and determining the optimal path when the cost is minimized.
[0394] Path smoothing: The path output by the A* algorithm is a grid sequence. It needs to be smoothed using a Bézier curve or B-spline curve fitting algorithm to generate a new spline curve path Pnew (i.e., the target correction path) that meets dynamic constraints such as the ship's minimum turning radius. This curve is the correction path for the current command cycle. During fitting, it is necessary to ensure that the curve's starting point is aligned with the ship's current position and heading, and the ending point is aligned with the target position.
[0395] The input parameters for 4.3 include:
[0396] Local Grid Map: A merged grid state view generated in step 4.2, containing static markers (upward region, downward region, or obstacle cell) and dynamic temporary occupancy markers for each grid cell. The map's extent is limited to the area covered by the local curve Llocal generated in step 4.1 and its vicinity. This local grid map extends outwards from the local curve Llocal by a certain width (e.g., a multiple of the ship's width or half the channel width) to cover the set of grid cells. For example, the acquisition of the local grid map includes: determining the grid cells the curve passes through: projecting the local curve Llocal onto the grid map to obtain all the grid cells the curve passes through. Expanding to both sides: based on the ship's width and the channel width, expanding the grid cells the curve passes through to both sides by several layers (e.g., expanding by 5 grid cells to the left and right), forming a strip-shaped area. The purpose of this expansion is to provide maneuvering space for the A* algorithm, allowing the ship to shift left and right to avoid obstacles. Clipping boundaries: removing grid cells that extend beyond the channel boundaries or obstacles after expansion to ensure that the local grid map's extent always remains within the navigable area.
[0397] The grid corresponding to the ship's current position: Based on the ship's current position Pt calculated in step 3.1, determine the grid cell in the local raster map where it is located, and use it as the starting point for path search.
[0398] The grid corresponding to the target location: The grid cell in the local raster map where the target location is located is determined from the target location calculated in step 3.2, and it serves as the endpoint of the path search.
[0399] Current ship heading: The current ship heading obtained from step 3.1 is used to calculate the direction consistency cost.
[0400] Centerline tangent vector information: Obtain the tangent vector direction corresponding to each grid position from the centerline spline curve in step 1.1, which is used to calculate the direction consistency cost.
[0401] Minimum turning radius of a ship: a ship dynamics parameter used as a constraint for path smoothing.
[0402] In some embodiments of this application, 4.3 includes:
[0403] Step 1: Construct the A* search space
[0404] Based on a local raster map, a search space for the A* algorithm is constructed. Each node in the search space corresponds to a grid cell, and the connection between nodes is that of adjacent grid cells (usually using eight-neighbor or four-neighbor connections). For each grid node, its coordinates, grid type (upward region, downward region, obstacle cell, or temporary occupied cell), and the direction of its corresponding centerline tangent vector are recorded.
[0405] Step 2: Define the cost function
[0406] The A* algorithm evaluates the merits of each search path using a cost function. This step defines three types of costs: geometric distance cost, route rule cost, and direction consistency cost.
[0407] Geometric distance cost: When moving from the current grid to an adjacent grid, the movement distance is the Euclidean distance between the grid centers. For grids belonging to the up or down region, this movement distance is recorded as the base cost for each step.
[0408] For example, the base cost refers to the actual distance traveled when moving from the current grid to an adjacent grid. Its value depends on the geometry of the adjacent grids.
[0409] Four-neighbor movement (up, down, left, right): When movement in four orthogonal directions is allowed, the distance between the center points of adjacent grids is equal to the grid's side length. If the grid side length is 1 meter, the base cost is 1.
[0410] Eight-neighbor movement (including diagonal): When movement in eight directions (including diagonal) is allowed: Orthogonal movement (up, down, left, right): The base cost is the grid side length, i.e., 1 meter with a value of 1; Diagonal movement: The base cost is √2 times the grid side length, i.e., approximately 1.414 meters with a value of 1.414.
[0411] The principle for determining the base cost: The base cost directly reflects the actual geometric length of the path, enabling the A* algorithm to accurately compare the lengths of different paths when optimizing the path, and tends to select the path with the minimum total travel distance.
[0412] Channel rule cost: The cost of movement is adjusted based on the heading attribute of the grid. If the ship's current heading is uphill, the search prioritizes grids marked as uphill. If forced to enter a downhill grid, a significant additional cost (e.g., one hundred times the unit distance) is added to that movement. Conversely, the same applies when the ship is heading downhill. This design ensures that the searched path strictly follows channel traffic rules and avoids going against the flow of traffic.
[0413] Orientation Consistency Cost: In each movement step, calculate the angle between the movement direction and the tangent vector of the centerline at that grid location. The larger the angle, the more severely the path deviates from the centerline, incurring an additional cost proportional to that angle. This design encourages paths to align as closely as possible with the waterway direction, avoiding paths with severe lateral swaying.
[0414] In the A* path search algorithm of this application, the geometric distance cost, the route rule cost, and the direction consistency cost together constitute the actual cost function from the starting point to the current node. There is a clear hierarchical relationship and synergistic effect among the three:
[0415] First layer: Geometric distance cost as the basic cost
[0416] Geometric distance cost is a fundamental component of the cost function, reflecting the actual length of the path. Regardless of the ship's navigation state, each step forward incurs a geometric distance cost proportional to the distance traveled. This cost ensures that the algorithm, while satisfying constraints, tends to choose the path with the shortest length.
[0417] Second layer: The cost of waterway rules as a mandatory constraint
[0418] The channel rule cost is a penalty term added on top of the geometric distance cost, used to enforce traffic rules for ships. When a ship attempts to enter a grid that does not conform to its current course, a significant additional cost is incurred. This cost has a much higher weight than the geometric distance cost, meaning that even if a path that violates the rules has a shorter geometric distance, its total cost will be much higher than that of a path that complies with the rules, thus guiding the algorithm to prioritize compliant paths.
[0419] Third layer: Directional consistency cost as an optimization constraint
[0420] The directional consistency cost is an optimization term superimposed on the previous two, used to improve path smoothness. When the ship's direction of movement deviates from the centerline tangent, an additional cost proportional to the deviation angle is added. The weight of this cost is lower than the channel rule cost but higher than the fine-tuning range of the geometric distance cost, allowing the algorithm to further select a path that is consistent with the channel direction and has a gentler turn, while still complying with regulations.
[0421] The synergistic relationship among the three is as follows: geometric distance cost is the foundation, ensuring a reasonable path length; waterway rule cost is a rigid constraint, ensuring path compliance; and directional consistency cost is flexible optimization, ensuring a smooth path.
[0422] The three elements work together in a coordinated manner, prioritizing compliance over smoothness and smoothness over shortest path, to ultimately generate a correction path that is both compliant with traffic rules and smooth and of reasonable length.
[0423] In some embodiments of this application, the actual cost from the starting point to the current node is equal to the sum of the costs of all movement steps on the path from the starting point to the current node, wherein the movement cost of each step (i.e., single-step cost) is composed of the basic cost, the channel rule cost, and the direction consistency cost.
[0424] In some embodiments of this application, the process of determining the single-step cost includes:
[0425] The first step is to calculate the geometric distance to move from the current grid to the adjacent grid, which serves as the base cost.
[0426] The second step is to determine whether the heading attribute of the target grid is consistent with the ship's current heading. If they are inconsistent, a larger channel rule cost is added.
[0427] The third step is to calculate the angle between the moving direction and the tangential direction of the centerline at the target grid, and add a directional consistency cost proportional to the angle based on the size of the angle.
[0428] The fourth step is to add the base cost, the route rule cost, and the direction consistency cost together to obtain the total cost of this move.
[0429] If the target grid is an obstacle grid or a temporarily occupied grid, the cost of this move is set to an extremely large value, and the geometric distance cost, the course rule cost, and the direction consistency cost are no longer calculated.
[0430] Step 3: Perform A* path search
[0431] Starting with the grid corresponding to the ship's current position and ending with the grid corresponding to the target position, the A* algorithm is executed on the local raster map. The algorithm maintains two sets: an open set (nodes to be evaluated) and a closed set (evaluated nodes). Starting from the beginning, the algorithm repeatedly selects the node with the lowest cost in the open set for expansion, calculates the cost of its neighboring nodes, and updates the open set until the target is added to the closed set. After the search is complete, starting from the target, the algorithm backtracks step-by-step along the parent node pointers recorded by each node back to the beginning, arranging the traversed nodes in order from the beginning to the target, resulting in a series of grid nodes that form a grid path from the beginning to the target.
[0432] For example, in some embodiments of this application, the third step of performing the A* path search process includes:
[0433] Starting with the grid corresponding to the ship's current position as the starting point and the grid corresponding to the target position as the ending point, the A* algorithm is executed on a local raster map. The algorithm maintains two sets: an open set (nodes to be evaluated) and a closed set (nodes already evaluated). Starting from the starting point, the algorithm first sets the actual cost of the starting point to zero and calculates the heuristically estimated cost from the starting point to the ending point. Then, the algorithm repeatedly executes the following steps: First, it selects the node from the open set whose actual cost and heuristically estimated cost are minimized as the current node. The actual cost refers to the total cost incurred from the starting point along a predetermined path to the current node. This cost has already occurred and is obtained by accumulating the cost of each step along the path. In the A* algorithm, the actual cost is denoted as g(n), where n represents the current node. The heuristically estimated cost refers to the remaining cost predicted from the current node to the ending point using a certain estimation method. This cost has not yet occurred and is a reasonable guess about the future path. In the A* algorithm, the heuristically estimated cost is denoted as h(n). A common heuristic estimation method is to calculate the Euclidean distance (straight-line distance) from the current node to the destination, because the straight-line distance is the lower bound that no path can be shorter than. The second step is to move the current node from the open set to the closed set. The third step is to traverse all adjacent grid nodes of the current node. For each adjacent node, the movement cost from the current node to that adjacent node is calculated according to the cost function. The movement cost is calculated as follows: first, the geometric distance of movement is calculated as the base cost; then, it is determined whether the heading attribute of the adjacent node is consistent with the ship's current heading. If not, the channel rule cost is added; then, the angle between the movement direction and the tangential direction of the centerline at the adjacent node is calculated, and the direction consistency cost is added according to the size of the angle. If the adjacent node is an obstacle cell or a temporarily occupied cell, the movement cost is directly set to the maximum value, and no other costs are calculated. The fourth step is to calculate the cumulative actual cost from the starting point through the current node to the adjacent node, which is the actual cost of the current node plus the movement cost calculated in the third step. The fifth step is to determine whether the adjacent node is already in the open set. If the node is not found in the open set, its cumulative actual cost and heuristically estimated cost are recorded, and its parent node is recorded as the current node. If the node is already in the open set, the newly calculated cumulative actual cost is compared to the original cumulative actual cost of the node. If it is less, the cumulative actual cost of the node and its parent node are updated. The algorithm repeats the above steps until the endpoint is added to the closed set. After the search is completed, the node is traced back from the endpoint along its parent node to the starting point, resulting in a series of grid nodes that form a grid path from the starting point to the endpoint. The cumulative actual cost of this path is the total cost of moving along this path from the starting point to the endpoint. This total cost comprehensively reflects the cumulative effects of geometric distance cost, channel rule cost, and direction consistency cost.
[0434] Step 4: Grid path smoothing
[0435] The mesh path output by the A* algorithm is a polyline formed by connecting the center points of the meshes. Its turning points may not conform to the ship's dynamic constraints (such as minimum turning radius). Therefore, it is necessary to transform the mesh path into a smooth spline curve. The specific steps are as follows:
[0436] Using the center points of the grid along the grid path as control points, a smooth curve that passes through or approximates these control points is generated by fitting Bézier curves or B-spline curves.
[0437] During the fitting process, the following constraints are applied: the starting point of the curve must be aligned with the current position of the ship, and the tangent direction of the curve at the starting point must be consistent with the current course of the ship; the ending point of the curve must be aligned with the target position Ptarget.
[0438] Verify whether the fitted curve meets the minimum turning radius requirement of the ship. If the radius of curvature of a certain segment of the curve is less than the minimum turning radius, add control points near that segment or adjust the positions of the control points, and refit until the entire curve meets the dynamic constraints.
[0439] Step 5: Output the correction path
[0440] The smoothed spline curve is used as the target correction path for this command cycle, denoted as Pnew. This path is a continuous, smooth curve with a gentle curvature change, which not only conforms to waterway traffic rules, but also avoids all static and dynamic obstacles, and satisfies the ship's kinematic constraints.
[0441] Step 5: Motion Execution and Mesh State Management
[0442] This step distributes the planned path to the ship model for execution and manages the dynamic changes in the grid state.
[0443] 5.1 Path Distribution and Following
[0444] The new spline curve path Pnew generated in step 4.3 is used as the motion path for the current command cycle and sent to the ship motion control module. The virtual ship will follow Pnew and continuously report its current position and speed (reporting frequency is consistent with data receiving frequency). The ship will use existing tracking control methods (such as PID, model predictive control, pure tracking control, etc.) to ensure that the deviation between the actual trajectory and the planned path is within the allowable range (e.g., 0.5 meters).
[0445] The planned path (spline curve Pnew) is a continuous spatial trajectory, while the PID / MPC controller requires real-time input of the deviation between the desired and actual values. The key to this integration lies in converting the path into a reference signal that the controller can understand and setting the controller parameters to adapt to the dynamic changes in the path.
[0446] 1. Signal conversion from path to controller
[0447] Extracting the desired value: In each control cycle (e.g., 0.1 seconds), based on the ship's current position, find the nearest point on Pnew as the desired position, and obtain the desired heading (tangential direction) of that point.
[0448] Calculate the deviation:
[0449] Lateral deviation: The distance from the current position to the desired position (signed, positive on the left and negative on the right).
[0450] Heading deviation: The difference between the current heading and the desired heading.
[0451] Input controller: Takes lateral deviation and / or heading deviation as input to the PID controller and outputs rudder angle command.
[0452] 2. Connection between controller parameters and path characteristics
[0453] The PID parameters (Kp, Ki, Kd) need to be adjusted according to the curvature of the path and the ship's speed to ensure tracking accuracy and stability. For example, a set of baseline PID parameters (e.g., for a straight path and a speed of 5 knots) can be calibrated offline, and then the parameters can be adjusted in real time according to the path curvature and the current speed by looking up a table or using linear interpolation.
[0454] The inputs for 5.1 include:
[0455] The new spline path Pnew: The correction path generated in step 4.3 is a continuous, smooth spline curve whose curvature meets the minimum turning radius requirement of the ship everywhere and avoids all static and dynamic obstacles.
[0456] Ship motion control module interface: A communication interface used to transmit path commands to ship actuators, supporting the distribution of path data and the sending of control commands.
[0457] Ship current status: includes the ship's position coordinates and instantaneous speed at the current moment, used for the initial state setting of the motion control module.
[0458] Tracking control algorithm parameters: relevant parameters set according to the tracking control method used (such as PID control, model predictive control or pure tracking control), including control gain, prediction time domain, look-forward distance, etc.
[0459] In some embodiments of this application, 5.1 includes:
[0460] Step 1: Path data format conversion
[0461] The newly generated spline curve path Pnew from step 4.3 is converted into a data format recognizable by the ship motion control module. This conversion includes transforming the mathematical description of the spline curve (such as control points and node vectors) into a discrete sequence of path points, or retaining the curve parameter form for the control module to parse. The converted path data includes the coordinates, tangent direction, and desired velocity information of each point on the path.
[0462] Step 2: Issuing Path Commands
[0463] The converted path command is sent to the ship's actuators via the ship motion control module interface. The sent information includes the geometric information of the new spline curve path Pnew, the desired speed, and the start time of path execution. The system also records the time of path issuance and the path identifier for subsequent status monitoring and command cycle management.
[0464] Step 3: Virtual Ship Tracking Motion
[0465] In the digital twin scenario, the virtual ship follows a newly issued spline curve path Pnew. The position of the virtual ship at each moment is determined by the corresponding point on the path curve. The system updates the virtual ship's display position in the scene at the same frequency as the data reception (e.g., once per second) to keep the virtual ship synchronized with the path.
[0466] Step 4: Actual Ship Tracking and Control
[0467] The physical ship's motion control system, based on the received path commands, uses a new spline curve path Pnew as the desired trajectory and employs existing tracking control methods (such as PID control, model predictive control, or pure tracking control) to calculate the required rudder angle and main engine speed commands, controlling the ship to navigate along the planned path. The tracking control method compares the ship's current position with the desired position on the new spline curve path Pnew and adjusts the control inputs in real time to keep the deviation between the ship's actual trajectory and path Pnew within an acceptable range.
[0468] Step 5: Deviation Monitoring and Adjustment
[0469] The system continuously monitors the deviation between the ship's actual position and the new spline curve path Pnew. This deviation is calculated by the distance between the actual position obtained from GPS or other positioning devices and the corresponding point on the path Pnew. If the deviation exceeds a preset allowable range (e.g., 0.5 meters), the system records a deviation alarm message, but usually does not immediately trigger replanning. Instead, it relies on the tracking control algorithm to automatically adjust the ship's attitude to return to the path Pnew. If the deviation continues to increase or exceeds a safety threshold, the replanning process in step 4 is triggered.
[0470] Step 6: Status Reporting and Synchronization
[0471] The ship motion control module continuously reports the ship's current position and speed at a fixed frequency (consistent with the data reception frequency). This data is used for both real-time data reception in step 2.2 and grid state release determination in step 5.2. This closed-loop feedback mechanism ensures that the virtual ship in the digital twin scenario remains synchronized with the actual physical ship.
[0472] The output of executing 5.1 includes:
[0473] Path execution status: indicates whether the vessel is currently following the new spline curve path Pnew, whether it has reached the destination, or whether a deviation has exceeded the limit.
[0474] Real-time ship position and speed: Continuously reported ship status data, used for position calculation and path planning in subsequent command cycles.
[0475] Deviation record: Deviation data between the actual trajectory and the new spline curve path Pnew, used for system monitoring and subsequent optimization.
[0476] The technical advantages of implementing version 5.1 include:
[0477] Achieving a closed loop between planning and execution: The new spline curve path Pnew generated in step 4.3 is transformed into a motion command that the ship can execute, so that the planning results can truly guide the ship's navigation, forming a complete closed loop from perception to planning to execution.
[0478] Ensuring path following accuracy: By employing mature tracking control methods (such as PID control, model predictive control, or pure tracking control), and using the new spline curve path Pnew as the desired trajectory, the deviation between the actual ship trajectory and the planned path is ensured to be within the allowable range, thus realizing the value of the planned path.
[0479] Maintaining virtual-real synchronization: By continuously reporting the ship's position and speed, the virtual ship in the digital twin scenario can follow the movement of the actual ship, providing accurate input data for position calculation and path planning in the next instruction cycle.
[0480] Supports dynamic adjustment and anomaly handling: Through the deviation monitoring mechanism, deviations between the actual trajectory and the planned path Pnew can be detected in a timely manner, providing a basis for triggering replanning when necessary and enhancing the robustness of the system.
[0481] Ensuring navigation safety: By converting the planned path Pnew into actual control commands and using high-precision tracking control to ensure that the ship sails along the predetermined path, deviations and risks that may occur with manual steering are avoided, thus improving navigation safety.
[0482] 5.2 Dynamic Release of Mesh State
[0483] As a ship moves along Pnew, once it has completely traversed a certain path segment (determined by the ship leaving the grid and the subsequent path no longer using that grid), the system restores the previously temporarily marked "occupied grids" (including those occupied by the ship itself) to their original state (upward / downward). Release can be triggered immediately after the ship leaves the grid, or timed batch processing can be used to improve efficiency. This mechanism enables dynamic resource release, avoiding permanent blockage.
[0484] The inputs for section 5.2 include:
[0485] New spline path Pnew: The correction path generated in step 4.3 is used to determine which grids the ship will subsequently pass through.
[0486] Real-time vessel location: The vessel's current location coordinates are continuously reported from step 5.1, used to determine the current grid the vessel is in and whether it has left a grid.
[0487] Dynamic state cache: A list of temporary occupancy tags generated in step 4.2, containing the grid cell identifiers marked as temporarily occupied and their expiration information.
[0488] Static grid database: The grid state database established in step 1.2 stores the original state of each grid (upward region, downward region, or obstacle grid), which is used to query the original state during recovery.
[0489] Step 5.2 includes:
[0490] Step 1: Determine whether the ship has completely passed through a grid.
[0491] The system determines the current grid cell where the ship is located based on its real-time position. For each grid cell on the path Pnew, the system continuously tracks whether the ship has completed its passage through that grid cell. The determination that a ship has completely passed through a grid cell is based on two conditions:
[0492] The first condition is that the ship's current position has left the grid, meaning the ship's coordinates are no longer within the grid's planar range. The second condition is that the subsequent path no longer uses the grid, meaning that the grid is no longer included in any of the path points forward from the ship's current position along path Pnew. Only when both conditions are met does the system determine that the ship has completely passed through the grid. This mechanism ensures that the temporary occupancy marker of a grid is released only when the ship has completely left it and is not returning, avoiding premature release that could lead to path conflicts.
[0493] Step 2: Identify the grid that needs to be released.
[0494] The system iterates through all temporary occupancy markers in the dynamic state cache. For each marked grid, it checks whether the conditions for a ship to pass completely are met. If the conditions are met, the grid is added to the list of grids to be released.
[0495] Step 3: Perform grid state restoration
[0496] For each grid in the list to be released, the system queries the static grid database for the grid's original state (upstream or downstream area). Then, it removes the temporary occupancy marker from the dynamic state cache, restoring the grid to its original state. The restored grid becomes a passable, legal navigation area again, available for use by the ship's subsequent path or by other vessels.
[0497] Step 4: Choosing the right time to release
[0498] The system provides two methods for handling the release timing:
[0499] Immediate release method: Once it is determined that a vessel has completely passed through a grid, the state restoration operation for that grid is executed immediately. This method offers the fastest response and can release channel resources most promptly, but it may increase the system's processing load.
[0500] Scheduled batch processing: The system collects all grids that have met the release conditions at fixed time intervals (e.g., once per second) and releases them in batches. This method reduces the frequency of state updates, improves system efficiency, and is suitable for scenarios with a large number of grids and low resource contention.
[0501] The system can be configured to use a release method according to actual scenario requirements, or dynamically adjusted according to real-time load.
[0502] Step 5: Update the dynamic state cache
[0503] After the grid status is restored, the system updates the dynamic status cache to ensure that the latest grid status can be retrieved during subsequent path searches. Released grids are no longer considered temporarily occupied grids and become passable uplink or downlink areas again.
[0504] 5.3 Destination Parking and Instruction Update
[0505] After the vessel reaches the destination Pnew, if no new path instructions are received, a deceleration and stopping procedure is executed, with deceleration at a preset value (e.g., 0.1 m / s²) until the speed reaches zero. If new real-time data is continuously received during the movement, steps 3 to 5 are repeated to form a continuous adaptive navigation cycle.
[0506] The inputs for section 5.3 include:
[0507] The endpoint coordinates of the new spline curve path Pnew: The endpoint position of the correction path generated in step 4.3 represents the target point that the ship needs to reach within this command cycle.
[0508] Real-time position and speed of the vessel: The current position and instantaneous speed of the vessel continuously reported from step 5.1 are used to determine whether the destination has been reached and to execute the stopping procedure.
[0509] No new instruction received: System status indicator, indicating whether a new motion data packet has been received after the current instruction cycle ends, used to determine whether to enter the parking procedure or start a new planning cycle.
[0510] Preset parameters for stopping and deceleration: Preset deceleration values (e.g., 0.1 meters per second) are used to control the ship to decelerate smoothly from its current speed to a stop.
[0511] In some embodiments of this application, 5.3 includes:
[0512] Step 1: Determine if the destination of the path has been reached.
[0513] The system continuously monitors the distance between the ship's current position and the coordinates of the endpoint of the new spline curve path Pnew. When this distance is less than a preset arrival threshold (e.g., 1 meter), the system determines that the ship has reached the target position for this instruction cycle. At this time, the system records the arrival time and prepares to execute subsequent operations at the endpoint.
[0514] Step 2: Check if new motion data packets have been received.
[0515] The system checks whether it continuously receives new motion data packets reported by the physical vessel during the vessel's movement along path Pnew (step 2.2). If new real-time data is continuously received during the movement, it indicates that the vessel is still sailing and the system needs to continue planning the subsequent path; if no new instructions are received after reaching the destination, it indicates that the current voyage mission is about to end or communication has been interrupted.
[0516] Step 3: Branch 1: Execute the loop as new data is continuously received.
[0517] If new real-time data is continuously received during the navigation process, the system determines that the ship needs to continue sailing. At this point, the system does not execute a stop procedure. Instead, it uses the state at the end of the current command cycle as the initial state for the next command cycle, automatically returning to step 3 (real-time position calculation and target determination based on the centerline) to restart position calculation, path planning, and motion execution, forming a continuous adaptive navigation cycle. This cycle enables the system to continuously respond to changes in the ship's motion at fixed time intervals, achieving dynamic path correction.
[0518] Step 4: Branch 2: Execute the parking procedure if no new instructions are received.
[0519] If the ship does not receive a new motion data packet after reaching the end of the path, the system determines that the current voyage mission has ended or communication has been interrupted. At this time, the system initiates a shutdown procedure: based on the ship's current speed, it calculates the required deceleration time and distance according to a preset deceleration rate (e.g., 0.1 meters per second), generates a deceleration command, and sends it to the ship's motion control module. The motion control module executes the deceleration operation, causing the ship's speed to decrease smoothly until it reaches zero and the ship comes to a complete stop.
[0520] Step 5: Confirm and record parking status
[0521] Once the ship's speed reaches zero, the system confirms that the ship has come to a complete stop. The system records the stopping position, stopping time, and final state, storing this information in the system log for subsequent analysis and task traceability. If any abnormality occurs during the stopping process (such as failure to execute a deceleration command or failure to reduce speed as expected), the system triggers an alarm and records the abnormal information.
[0522] Step 6: Wait for the next cycle or end the task.
[0523] After parking is complete, the system enters standby mode, awaiting the next startup command or a new task assignment. If a new motion data packet is received during standby, the system will re-execute the initialization and alignment procedure in step 2 to begin a new navigation task.
[0524] Step 6: Exception Handling and State Reset
[0525] This step provides a recovery mechanism for abnormal situations such as signal loss.
[0526] 6.1 Signal Loss Detection
[0527] If the system detects that the ship's speed has decreased to zero, and no new motion data packets are received for more than a preset time (e.g., 5 seconds), it determines that the signal has been lost. During this period, the system stops path planning, and the ship model remains in its last position.
[0528] The inputs for step 6.1 include:
[0529] Ship real-time speed: The ship's current instantaneous speed is obtained by parsing the motion data packets continuously received in step 2.2, and is used to determine whether the ship is stationary.
[0530] Motion data packet reception status: Data packet reception status information maintained by the system, including the timestamp of the most recent successful data packet reception, the number of consecutive reception failures, and whether the current reception status is normal.
[0531] Preset time threshold: A pre-set signal loss judgment time (e.g., 5 seconds) used to determine whether the communication interruption has reached a level that requires triggering abnormal handling.
[0532] In some embodiments of this application, 6.1 includes:
[0533] Step 1: Monitor ship speed status
[0534] The system continuously monitors the real-time speed information of the ship received from step 2.2. When the ship's speed drops to zero, the system records this moment as the zero-speed time point and enters the signal loss monitoring state. Zero speed is one of the prerequisites for signal loss judgment, because even if communication is briefly interrupted during normal navigation, the system can still perform interpolation prediction based on historical motion trends; however, when the ship has stopped, communication interruption means that the system cannot obtain the ship's status and needs to enter anomaly handling.
[0535] Step 2: Monitor data packet reception status
[0536] The system continuously tracks the time of the most recent successful reception of a motion data packet. Each time a data packet is successfully received, the system updates the most recent reception timestamp and resets the continuous reception failure counter to zero. If no data packet is received within a certain data packet reception period, the system increments the continuous reception failure counter and records the current time.
[0537] Step 3: Determine the conditions for signal loss
[0538] The system determines that a signal has been lost when both of the following conditions are met:
[0539] Condition 1: The ship's speed has been reduced to zero (i.e., the ship is stationary).
[0540] Condition 2: No new motion data packets are received for more than a preset time threshold (e.g., 5 seconds) starting from the moment the speed returns to zero.
[0541] Both conditions must be met simultaneously to ensure the accuracy of the judgment. If the ship is still in motion, the system can continue operating based on historical data even if communication is briefly interrupted; if the ship has stopped but communication is quickly restored, a signal loss judgment will not be triggered, avoiding false judgments. Only when the ship has actually stopped and its status cannot be obtained for an extended period of time will it be judged as a signal loss.
[0542] Step 4: Perform operations during signal loss
[0543] Once the signal loss determination is triggered, the system immediately performs the following operations:
[0544] Stop all route planning activities and stop executing the route planning process from steps 3 to 5.
[0545] The virtual ship model is kept at the last known position, and no further attempts are made to update or predict the ship's position;
[0546] Record the time of signal loss, the ship's last position, and related status information, and store them in the system log;
[0547] The system enters a waiting recovery state and no longer responds to regular path planning requests, only continuously listening to the data receiving port.
[0548] Step 5: Continuous Monitoring and Status Maintenance
[0549] During the signal loss, the system continuously monitors the data receiving port, waiting for communication to resume. Simultaneously, the system maintains the virtual ship model at its last known position and keeps the temporary occupancy markers in the dynamic state buffer intact, so that forced alignment can be performed based on the current actual state after communication is restored.
[0550] The technical benefits of implementing 6.1 include:
[0551] Accurately distinguishing between communication interruptions and normal ship stops: By setting two conditions, "speed to zero" and "continuous timeout without data received," the system can accurately distinguish between communication interruptions after a ship has stopped normally and communication interruptions during ship movement. Even if communication is interrupted after a ship has stopped normally, it will not be mistakenly judged as a signal loss requiring emergency handling, thus avoiding unnecessary abnormal processing.
[0552] Preventing invalid path planning: Path planning is stopped during signal loss, avoiding the continued generation of invalid or erroneous correction paths without input data and preventing system state divergence.
[0553] Maintaining system stability: Keeping the virtual ship in its last known position to avoid virtual ship position drift caused by incorrect interpolation or prediction due to lack of data, and ensuring accurate alignment after communication is restored.
[0554] Creating conditions for abnormal recovery: By recording the signal loss status and the ship's last position, the necessary information basis is provided for the forced alignment and status reset in step 6.2, enabling the system to quickly resume normal operation after communication is restored.
[0555] Ensuring navigation safety: The signal loss detection mechanism enables the system to detect communication anomalies in a timely manner and adopt conservative safety strategies (stop planning, maintain position) to avoid issuing incorrect navigation instructions during communication interruptions, thus ensuring the safety of ship navigation.
[0556] 6.2 Forced Alignment During Reconnection
[0557] When the signal is restored and the system receives the GPS coordinates reported by the ship again, it no longer relies on the previous interpolation prediction of the position. Instead, it forcibly aligns the position of the ship model in the digital twin scenario to the nearest matching point on the centerline corresponding to the latest received GPS coordinates (calculated according to step 3.1). If the distance to the nearest point is greater than a preset threshold (e.g., 10 meters), an alarm is triggered, prompting manual intervention. After alignment, all historical temporary states are cleared, and the normal process restarts.
[0558] The inputs for step 6.2 include:
[0559] GPS coordinates received after signal recovery: When communication is restored, the first GPS coordinate data (including position, speed, and timestamp) reported by the physical vessel serves as the reference data for re-establishing virtual-real synchronization.
[0560] Step 1.1 generates a spline curve: a continuous smooth curve representing the centerline of the waterway, used to determine the projection points of GPS coordinates on the waterway and the nearest matching points.
[0561] The signal loss flag output in step 6.1 indicates that the system is currently in a signal loss state. When communication is restored, this flag will be cleared and trigger the execution of this step.
[0562] Preset distance threshold: The maximum allowable alignment deviation distance (e.g., 10 meters) is set in advance to determine whether the ship's position after forced alignment is reasonable. If the deviation exceeds this threshold, manual intervention is required.
[0563] In some embodiments of this application, step 6.2 includes:
[0564] Step 1: Detect communication recovery and triggering conditions
[0565] The system continuously monitors the data receiving port. When the signal loss flag is detected as valid and the system successfully receives the GPS coordinates reported by the physical vessel for the first time, it determines that communication has been restored and triggers the forced alignment process. At this point, the system abandons all interpolation predictions based on historical data during the signal loss period and prepares to reset the state based on the latest received real data.
[0566] Step 2: Coordinate Transformation and Calculation of Nearest Matching Point
[0567] The newly received GPS coordinates are then transformed using the same coordinate transformation algorithm as in step 2.1 (e.g., Gauss-Kruger projection or Universal Transverse Mercator projection) to map the latitude and longitude coordinates into the unified coordinate system of the digital twin scene, obtaining the ship's actual position coordinates within the scene. Then, following the method in step 3.1, the nearest matching point corresponding to this position is calculated on the centerline spline curve. The calculation process must incorporate the direction constraints from step 7 to ensure that the tangent vector direction at the nearest matching point is consistent with the ship's current heading, and that the projected distance is non-negative, thus guaranteeing that the matching point is located ahead of the ship rather than behind it.
[0568] Step 3: Force Alignment of Virtual Ship Model
[0569] The virtual ship model in the digital twin scenario is forcibly aligned to the nearest matching point calculated in the previous step, rather than to the mapped position of the original GPS coordinates. This design ensures that the virtual ship is always located on or near the navigable centerline, avoiding the virtual ship appearing on the shore or among obstacles due to GPS coordinate drift or modeling deviations. Simultaneously, the initial course of the virtual ship is set according to the tangent vector direction at the nearest matching point, aligning it with the course of the waterway.
[0570] Step 4: Alignment Deviation Judgment and Alarm Handling
[0571] The system calculates the distance between the ship's actual position (i.e., its position after GPS coordinate mapping) and the nearest matching point, and compares this distance with a preset threshold (e.g., 10 meters). If the distance is less than or equal to the preset threshold, the alignment is considered successful, and the system prepares to enter normal operation. If the distance exceeds the preset threshold, it indicates that the ship's actual position deviates too far from the centerline, possibly due to GPS errors, mapping data deviations, or severe ship yaw. In this case, the system triggers an alarm, prompting manual intervention in the digital twin scenario. The operator checks the data accuracy or manually adjusts the ship's position, and can only continue after confirming safety.
[0572] Step 5: Clear all historical temporary states
[0573] After successful alignment, the system performs a state reset operation, clearing all temporary data accumulated during the signal loss period, specifically including:
[0574] Clear all temporary occupancy flags in the dynamic state buffer, as the position of dynamic objects is no longer reliable during signal loss and needs to be re-established; clear any unexecuted path planning data that may remain from step 4.3; reset the intermediate variables and buffer data used in steps 3 and 4; reset the continuous reception failure counter to zero; clear the signal loss flag and restore the system to normal working status.
[0575] Step 6: Restart the normal process
[0576] After the state reset is completed, the system will take the current aligned virtual ship position as the new initial state, use the latest received GPS coordinates as the real-time data input for step 2.2, and restart the real-time data stream reception in step 2.2, the position calculation in step 3, the path planning in step 4, and the motion execution in step 5 to form a complete normal navigation cycle.
[0577] The technical effects of implementing 6.2 include:
[0578] Completely sever the error propagation chain: By discarding all interpolation predictions and historical states during the signal loss period, and directly using the latest received true GPS coordinates for forced alignment, accumulated errors are eliminated. This is the core manifestation of improvement point six.
[0579] To ensure the credibility of the virtual ship's position: the alignment position is forcibly set to the nearest matching point on the centerline, rather than the original GPS coordinate mapping point, which effectively avoids the "clipping" phenomenon caused by GPS coordinate drift or modeling deviation, and ensures that the virtual ship is always within the navigable waterway area.
[0580] Provides a safe manual intervention mechanism: When the alignment deviation exceeds the preset threshold, the system does not automatically resume operation, but triggers an alarm to wait for manual intervention, preventing the continued execution of automatic planning under abnormal data conditions from causing safety risks.
[0581] The system achieves autonomous recovery capability: After communication is restored, the system can automatically complete state reset and virtual-real synchronization, and can resume normal operation without manual intervention, which greatly reduces operation and maintenance costs and improves system availability.
[0582] To ensure the accuracy of subsequent route planning: By clearing all historical temporary states, ensure that the planning of subsequent steps 3 to 5 is based entirely on the latest and most accurate state information, and avoid outdated data from interfering with route planning.
[0583] Step 7: One-way navigation constraints and reverse point exclusion
[0584] To ensure that vessels strictly adhere to waterway traffic rules, this method incorporates directional filtering during step 3.1 when searching for the nearest centerline point:
[0585] If the current ship's heading (uphill or downhill) is known, then when searching for the nearest point Cproj, only the centerline segment whose tangent vector direction is consistent with the current heading is considered. In practice, the tangent vector of each segment endpoint can be pre-calculated and the uphill / downhill identifier can be stored.
[0586] For a candidate nearest point, calculate the projected distance from that point along the tangent vector direction to the ship's current position (i.e., the dot product of the vector (ship position - candidate point) and the tangent vector). If the projected distance is negative, it means the candidate point is behind the ship, and the point should be excluded. Then, search forward along the current heading for the next suitable point (e.g., finding the closest point ahead of the ship on a curve). This mechanism prevents reverse or backward navigation during path planning.
[0587] Some embodiments of this application provide a computer program readable storage medium having a computer program stored thereon, which, when executed, can implement the ship navigation route correction method as described in any of the above embodiments.
[0588] like Figure 3 As shown, some embodiments of this application provide an electronic device 400, which includes, for example, a memory 410, a processor 420, and a computer program stored in the memory 410 and executable on the processor 420. When the processor 420 reads the program through a bus 430 and executes the computer program, it can implement the ship navigation route correction method as described in the above embodiments.
[0589] Processor 420 can process digital signals and may include various computing architectures. For example, it may be a complex instruction set computer architecture, a reduced instruction set computer architecture, or an architecture that implements multiple instruction set combinations. In some examples, processor 420 may be a microprocessor.
[0590] Memory 410 can be used to store instructions executed by processor 420 or data related to the execution of instructions. These instructions and / or data may include code used to implement some or all of the functions of one or more modules described in the embodiments of this application. The processor 420 of the embodiments of this disclosure can be used to execute the instructions in memory 410 to implement… Figure 2 The method shown. Memory 410 includes dynamic random access memory, static random access memory, flash memory, optical memory, or other memory well known to those skilled in the art.
[0591] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0592] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0593] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for correcting a ship's navigation route, characterized in that, The ship navigation route correction method includes: Construct a digital twin scene corresponding to the waterway, wherein the digital twin scene includes a target centerline that conforms to the shape of the waterway and grid cells with heading attributes and static obstacle markers, and the digital twin scene is a digital twin waterway corresponding to the waterway; Receive motion data reported by the vessel, wherein the motion data includes at least the vessel's current position and current speed; The current position is transformed into the digital twin scene to obtain the first mapping point, the projection point of the first mapping point on the center line of the target is determined, and the distance from the first mapping point to the projection point is calculated as the lateral offset distance. Based on the current speed and time interval, the projection point is pushed forward by an arc length along the target centerline and then laterally offset by the target offset distance to obtain the target position, wherein the target offset distance is the lateral offset distance or a preset offset distance determined according to the boundary of the channel; In the digital twin scenario, a target correction path digital twin scenario is generated from the first mapping point to the target location based on the heading attribute of the grid cell, the static obstacle marker, and the dynamic obstacle information. The target correction path is provided to the vessel to control the vessel to navigate in accordance with the target correction path.
2. The ship navigation route correction method as described in claim 1, characterized in that, The step of advancing the projection point along the target centerline by an arc length based on the current speed and time interval, and then laterally offsetting it by the target offset distance to obtain the target position includes: Starting from the projection point, move forward along the target centerline by the arc length distance to obtain the first position point, wherein the arc length distance is equal to the product of the current speed and the time interval; The first position point is offset by the lateral offset distance along the normal direction of the target centerline at the first position point to obtain the second position point; The target location is determined based on the second location point.
3. The ship navigation route correction method as described in claim 2, characterized in that, Determining the target location based on the second location point includes: Verify whether the second location point exceeds the boundary of the waterway; If it is confirmed that the second location point does not exceed the boundary, then the second location point is taken as the target location; If it is confirmed that the second position point exceeds the boundary, then the first position point is offset by the preset offset distance along the normal direction of the target center line at the first position point to obtain the target position, wherein the preset offset distance is predefined according to the boundary.
4. The ship navigation route correction method as described in claim 1, characterized in that, The construction of the digital twin scenario corresponding to the waterway includes: Identify the segment on the i-th centerline where the radius of curvature is less than the target turning radius, where the target turning radius is the minimum turning radius of the ship, and i is an integer greater than or equal to 1; Add at least one control point within the section and adjust the position of the at least one control point so that the radius of curvature of the corresponding section increases to meet the minimum turning radius; A curvature correction curve is obtained by fitting a curve corresponding to the segment based on the position of the at least one control point; Calculate the target distance error between the curvature correction curve and the mapping point set corresponding to the original discrete point set, wherein the original discrete point set is the point set corresponding to the centerline of the channel, and the target distance error is the maximum distance error; If it is confirmed that the target distance error exceeds the preset fit threshold, the position of the control point on the curvature correction curve is adjusted until the fit meets the requirements and the (i+1)th center line is obtained. Repeat the above process until the target centerline is obtained.
5. The method for correcting a ship's navigation route as described in any one of claims 1-4, characterized in that, The construction of the digital twin scenario corresponding to the waterway also includes: Generate a uniform grid array that at least covers the digital twin waterway to obtain the basic grid array; Determine the boundary corresponding to the digital twin waterway, retain all grid cells whose center point is located within the boundary and grid cells whose center point is located outside the boundary and intersects with the boundary, and remove grid cells that are completely outside the boundary to obtain the set of grid cells within the waterway; The resolution of at least some of the grid cells in the set of grid cells within the digital twin waterway is adjusted according to the geometric features of the waterway to obtain the target set of grid cells; The heading attribute of each grid cell is determined based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline, wherein the heading attribute is used to characterize whether the corresponding grid cell belongs to up or down. The static obstacle markers are marked with grid cells corresponding to the areas occupied by fixed physical obstacles within the waterway in the target grid cell set.
6. The ship navigation route correction method as described in claim 5, characterized in that, The step of determining the heading attribute of each grid cell based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline includes: Identify all grid cells from the target grid cell set that are not crossed by the target centerline to obtain a first grid cell set; Calculate the signed distance from the center point of each grid cell in the first grid cell set to the target centerline; The heading attribute of each grid cell in the first set of grid cells is determined based on the sign of the signed distance.
7. The ship navigation route correction method as described in claim 6, characterized in that, The ship navigation route correction method also includes: The first direction of the target centerline is defined as the upward direction, and the second direction opposite to the first direction is defined as the downward direction; Determining the heading attribute of each grid cell in the first grid cell set based on the sign of the signed distance includes: If the sign of the signed distance is confirmed to be positive, the corresponding grid cell is marked as an uplink region; if the sign of the signed distance is confirmed to be negative, the corresponding grid cell is marked as a downlink region. Different colors are assigned to the uplink region and the downlink region to distinguish them.
8. The method for correcting a ship's navigation route as described in any one of claims 6-7, characterized in that, The step of determining the heading attribute of each grid cell based on the relative positional relationship between each grid cell in the target grid cell set and the target centerline further includes: Identify all grid cells in the target grid cell set that are crossed by the target centerline to obtain a second grid cell set; Calculate the area of each grid cell in the second grid cell set located on the upward side of the curve, and denot it as the first area, wherein the upward side of the curve is the left side when traveling along the upward direction of the target centerline; Calculate the area of each grid cell in the second grid cell set located on the downward side of the curve, and denot it as the second area, wherein the downward side of the curve is the right side when traveling along the upward direction of the target centerline; If it is confirmed that the first area is greater than or equal to the second area, the corresponding grid cell is marked as the up-row region; otherwise, it is marked as the down-row region.
9. The ship navigation route correction method as described in claim 5, characterized in that, The step of adjusting the resolution of at least a portion of the grid cells in the digital twin waterway grid cell set according to the geometric features of the waterway to obtain a corrected grid cell set includes: The side length of the grid cells in the corresponding region is adaptively adjusted based on the local curvature and / or local width changes of the waterway.
10. The method for correcting a ship's navigation route as described in claim 1, characterized in that, The motion data is the initial position data reported for the first time; The ship navigation route correction method also includes: The initial position data is mapped to the digital twin scene through coordinate transformation to obtain the second mapping point; Place the virtual ship model corresponding to the ship at the second mapping point; The point on the target centerline that is closest to the second mapping point is taken as the initial anchor point; If the distance between the second mapping point and the initial anchor point is less than or equal to a preset threshold, then the initial alignment is successful; If the distance between the second mapping point and the initial anchor point exceeds a preset threshold, the initial alignment is determined to be abnormal, triggering manual intervention or repositioning.
11. The ship navigation route correction method as described in claim 3, characterized in that, The construction of the digital twin scenario corresponding to the waterway also includes: The target centerline is segmented and the information of the endpoints of each segment is recorded. The motion data includes the current heading, wherein, The step of converting the current position to the digital twin scene to obtain a first mapping point, determining the projection point of the first mapping point on the target center line, and calculating the lateral offset distance from the first mapping point to the projection point includes: Traverse all segment endpoints on the target centerline, calculate the distance from each segment endpoint to the first mapping point, and obtain the first distance set; Select several segment endpoints from the first distance set as the first candidate set; For each segment endpoint in the first candidate set, obtain the tangent vector direction at the corresponding segment endpoint; compare the tangent vector direction with the current heading, and if they are inconsistent, delete the segment endpoint to obtain the second candidate set. Calculate the projection distance from the first mapping point to each segment endpoint in the second candidate set, and delete the segment endpoints with negative projection distances from the second candidate set to obtain the third candidate set; Identify the local curve segments corresponding to the segment endpoints in the third candidate set, and sample the local curve segments to obtain a set of sampling points; The projection point is determined based on the magnitude and sign of the projection distance from each sampling point in the sampling point set to the first mapping point; Calculate the vertical distance from the first mapping point to the projection point to obtain the lateral offset distance.
12. The ship navigation route correction method as described in claim 11, characterized in that, The ship navigation route correction method also includes: Obtain the unit tangent vector at the projection point, wherein the unit tangent vector is used to characterize the legal navigation direction of the ship in the corresponding segment, and the unit tangent vector is used to determine the movement direction of the target position and the directional constraints of the path planning; The step of moving the projection point forward along the target centerline and then laterally offsetting it by the lateral offset distance based on the current speed and time interval to obtain the target position includes: Starting from the projection point, move the arc length distance along the target centerline to reach the position point to be determined; If it is confirmed that the location point to be determined belongs to a point on the target center line, then the location point to be determined is taken as the theoretical point; if it is confirmed that the location point to be determined is a point on the extension line of the target center line, then the end point of the target center line is taken as the theoretical point. The theoretical point is moved by a target lateral distance along the first direction of the straight line containing the normal to obtain the offset position point. Here, the normal is a straight line perpendicular to the unit tangent vector, the first direction is determined by the sign of the lateral offset distance, and the target lateral distance is the lateral offset distance or the preset offset distance. If it is confirmed that the grid cell containing the offset position is unobstructed and located within the boundary of the channel, then the offset position is taken as the target position.
13. The ship navigation route correction method as described in claim 12, characterized in that, The aforementioned method for correcting ship navigation routes also includes: Extract a local curve segment from the projection point to the theoretical point from the target centerline; Determine a predetermined offset distance, wherein the predetermined offset distance is preset based on the channel width; At least one point on the local curve segment is moved by the predetermined offset distance in the opposite direction of the unit normal vector to obtain a set of downlink trajectory points, and at least one point on the local curve segment is moved by the predetermined offset distance in the direction of the unit normal vector to obtain a set of uplink trajectory points, wherein the unit normal vector is perpendicular to the tangent vector of the corresponding point; The set of downlink trajectory points is fitted into a downlink curve, and the set of uplink trajectory points is fitted into an uplink curve; Based on the ship's current course, select the corresponding target curve from the downhill curve and the uphill curve; The grid cells occupied by dynamic objects in the grid cells through which the target curve passes are determined to obtain the dynamic obstacle grid cells; The dynamic obstacle grid cell is marked as a temporarily occupied cell; The grid cell currently occupied by the vessel is marked as a temporarily occupied cell; Each temporary occupied cell is assigned a validity period based on the object's movement speed, wherein the validity period is used to determine whether the temporary occupied cell attribute of the corresponding grid cell needs to be adjusted.
14. The ship navigation route correction method as described in claim 13, characterized in that, In the digital twin scenario, generating a correction path from the starting position to the target position based on the heading attributes of the grid cells, the static obstacle markers, and the dynamic obstacle information includes: Obtain a local raster map, wherein the grid cells in the local raster map are labeled with the heading attribute, the static obstacle marker, and the marker for temporarily occupied grid cells; Starting from the grid cell corresponding to the first mapping point and ending at the grid cell corresponding to the target location, a path search is performed. In the path search, the single-step cost is determined according to the following principles: a first cost is assigned to passable grid cells that conform to the ship's course, a second cost greater than the first cost is assigned to grid cells that are going in the opposite direction, and a third cost greater than the second cost is assigned to grid cells marked with the static obstacle marker or the temporary occupied grid. The target correction path is determined based on the single-step cost.
15. A computer program readable storage medium, characterized in that, The computer program is stored on the computer program readable storage medium, and when the computer program is executed, it can implement the method as described in any one of claims 1-14.
16. An electronic device, characterized in that, The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, can implement the method as described in any one of claims 1-14.