Route planning method and device, electronic equipment and storage medium
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-26
- Publication Date
- 2026-08-11
AI Technical Summary
[0003]目前,可以通过寻路算法(A*寻路算法-一种静态路网中求解最短路径最有效的直接搜索方法)规划地形图中道路的路线,然而,寻路算法在规划路线时需要耗费大量的计算资源,因此,寻路算法目前只适用于小尺寸地图的寻路
[0069]本申请实施例可以获取第一地形图;生成第一地形图的初始道路曲线;按照预设划分规则,将第一地形图划分成多个第一地形块,从多个第一地形块中确定第一目标地形块,第一目标地形块为包含初始道路曲线的曲线分段的第一地形块;根据第一目标地形块所包含的曲线分段,对第一目标地形块进行路线规划处理,得到第一目标地形块对应的子路线;根据所有第一目标地形块对应的子路线,确定第一地形图对应的目标路线。
Smart Images

Figure CN116637372B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically to a route planning method, apparatus, electronic device, and storage medium. Background Technology
[0002] Open-world games allow users to freely roam within a virtual world and choose when and how to complete game tasks, offering users a high degree of freedom. Compared to traditional video games, open-world games feature larger game maps that can include terrain, rivers, roads, vegetation, buildings, and other elements, enhancing the user experience of roaming within the open game world.
[0003] Currently, pathfinding algorithms (such as A* pathfinding algorithm, a direct search method for finding the shortest path in a static road network) can be used to plan road routes in a terrain map. However, these algorithms consume significant computational resources, limiting their applicability to small maps. Since open-world games typically have large map sizes, pathfinding algorithms cannot be used to plan road routes; routes must be manually set within the game, resulting in low efficiency. Summary of the Invention
[0004] This application provides a route planning method, apparatus, electronic device, and storage medium that can improve the efficiency of route planning.
[0005] This application provides a route planning method, including:
[0006] Obtain the first topographic map;
[0007] Generate the initial road curves for the first topographic map;
[0008] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the first target topographic block is determined from the multiple first topographic blocks. The first target topographic block is the first topographic block containing the curve segment of the initial road curve.
[0009] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0010] Determine the target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target terrain blocks.
[0011] This application embodiment also provides a route planning device, including:
[0012] The acquisition unit is used to acquire the first topographic map;
[0013] The generation unit is used to generate the initial road curves for the first topographic map;
[0014] The division unit is used to divide the first topographic map into multiple first topographic blocks according to a preset division rule, and to determine the first target topographic block from the multiple first topographic blocks. The first target topographic block is the first topographic block containing the curve segment of the initial road curve.
[0015] The planning unit is used to perform route planning on the first target terrain block based on the curve segments contained therein, and to obtain the sub-route corresponding to the first target terrain block.
[0016] The determination unit is used to determine the target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target terrain blocks.
[0017] In some embodiments, obtaining a first topographic map includes:
[0018] Obtain the second topographic map;
[0019] The second topographic map is resampled using a preset precision resampling coefficient to obtain the first topographic map. The precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map are the same size.
[0020] The method also includes:
[0021] The target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map.
[0022] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0023] Based on the endpoints of the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0024] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0025] Based on the voxel information of the first target terrain block, construct the anisotropic mesh corresponding to the first target terrain block;
[0026] Based on the endpoints of the curve segments contained in the first target terrain block, the start and end points of the sub-route corresponding to the first target terrain block are determined from the nodes of the anisotropic network.
[0027] Based on the starting point and the ending point, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0028] In some embodiments, route planning is performed on the first target terrain block based on the start and end points to obtain the sub-route corresponding to the first target terrain block, including:
[0029] Based on the starting point and the ending point, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0030] In some embodiments, the weight values of each line segment in the anisotropic network diagram are determined based on the terrain data of the first target terrain block;
[0031] Based on the start and end points, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block, including:
[0032] Based on the starting and ending points, as well as the weight values of each line segment in the anisotropic network, pathfinding processing is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0033] In some embodiments, generating initial road curves for the first topographic map includes:
[0034] The initial road curves of the first topographic map are generated based on preset reference points or reference curves.
[0035] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0036] Connect the starting and ending points of adjacent sub-routes on the first topographic map to obtain the target route corresponding to the first topographic map.
[0037] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0038] Connect the sub-paths corresponding to all the first target terrain blocks to obtain the initial route;
[0039] The initial route is smoothed to obtain the target route corresponding to the first topographic map.
[0040] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0041] Get the previous and next nodes associated with the intermediate node. The intermediate node is any node other than the endpoint of the initial route.
[0042] Determine the first vector and the second vector. The first vector is the direction vector from the middle node to the previous node, and the second vector is the direction vector from the middle node to the next node.
[0043] Determine the angle between the first vector and the second vector;
[0044] If the vector angle is not greater than the first preset angle value, the position of the intermediate node on the first topographic map is adjusted until the vector angle is greater than the first preset angle value. The route corresponding to the vector angle greater than the first preset angle value is the target route corresponding to the first topographic map.
[0045] In some embodiments, the first topographic map includes key points, and the initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0046] Identify the target key points, which are key points that are not on the initial route;
[0047] Identify the target points on the initial route that correspond to the target key points;
[0048] The target point is shifted towards the target key point to obtain the target route corresponding to the first terrain map.
[0049] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0050] Determine the target tangent, which is the tangent line that passes through the target node of the initial route. The target node can be any node.
[0051] Determine the target angle, which is the angle between the target tangent and the horizontal plane;
[0052] If the target angle is not less than the second preset angle value, the position of the target node on the first topographic map is adjusted until the target angle is less than the second preset angle value. The route corresponding to the target angle less than the second preset angle value is the target route corresponding to the first topographic map.
[0053] In some embodiments, the initial route includes multiple routes that intersect. The initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0054] Determine the target road segment of the target route. The target route is the route where the intersection is located, and the target segment is the road segment on the target route that is at a preset distance from the intersection.
[0055] Identify the target area of the target road segment on the first topographic map;
[0056] Based on the endpoints of the target road segment, route planning is performed on the target area to obtain the target route corresponding to the first topographic map.
[0057] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0058] The initial road curves are mapped onto the second topographic map to obtain the preliminary route corresponding to the second topographic map;
[0059] According to the preset division rules, the second topographic map is divided into multiple second topographic blocks, and the second target topographic block is determined from the multiple second topographic blocks. The second target topographic block is the second topographic block that contains the route segments of the initial screening route.
[0060] Based on the route segments contained in the second target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block;
[0061] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0062] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0063] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the second topographic map is divided into multiple second topographic blocks. The first topographic blocks and the second topographic blocks correspond one-to-one. The multiple first topographic blocks include the first target topographic block, which is the first topographic block containing the curve segment of the initial road curve.
[0064] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0065] Based on the endpoints of the sub-route corresponding to the first target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block. The second target terrain block is the second terrain block corresponding to the first target terrain block.
[0066] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0067] This application also provides an electronic device, including a memory storing multiple instructions; the processor loads instructions from the memory to execute steps in any of the route planning methods provided in this application.
[0068] This application also provides a computer-readable storage medium storing a plurality of instructions adapted for loading by a processor to execute steps in any of the route planning methods provided in this application.
[0069] This application embodiment can obtain a first topographic map; generate an initial road curve for the first topographic map; divide the first topographic map into multiple first topographic blocks according to a preset division rule; determine a first target topographic block from the multiple first topographic blocks, wherein the first target topographic block is a first topographic block containing curve segments of the initial road curve; perform route planning processing on the first target topographic block according to the curve segments contained in the first target topographic block to obtain the sub-route corresponding to the first target topographic block; and determine the target route corresponding to the first topographic map according to the sub-route corresponding to all the first target topographic blocks.
[0070] In this application, the first topographic map is divided into multiple first topographic blocks, such that the size of each first topographic block is smaller than the size of the first topographic map. By segmenting the initial road curves contained in the first target topographic block, the sub-route corresponding to the first target topographic block can be quickly planned. Furthermore, by using all the sub-route corresponding to the first target topographic map, the target route corresponding to the first topographic map can be quickly obtained. This improves the efficiency of route planning. Attached Figure Description
[0071] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0072] Figure 1a This is a schematic diagram of a scenario for the route planning method provided in an embodiment of this application;
[0073] Figure 1b This is a flowchart illustrating the route planning method provided in an embodiment of this application;
[0074] Figure 2 This is a schematic diagram illustrating the application of the route planning method provided in this application to plan routes in an open game world;
[0075] Figure 3 This is a schematic diagram of the route planning device provided in the embodiments of this application;
[0076] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0077] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0078] This application provides a route planning method, apparatus, electronic device, and storage medium.
[0079] Specifically, the route planning device can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet, smart Bluetooth device, laptop, or personal computer (PC); the server can be a single server or a server cluster consisting of multiple servers.
[0080] In some embodiments, the route planning device may also be integrated into multiple electronic devices, such as multiple servers, with multiple servers implementing the route planning method of this application.
[0081] In some embodiments, the server may also be implemented as a terminal.
[0082] When using the A* pathfinding algorithm, voxels at various locations on the terrain map need to be sampled into points. These points are then connected to form a network before search and computation can begin. The line segments connecting these points form an anisotropic network, and the angle between these line segments determines the smoothness of the final curve. Existing solutions address this by increasing the depth of anisotropy, expanding the number of nearby points connected to each point from 8 to 16 or even 32 to achieve smaller angles. However, this comes at the cost of significantly increasing computational resources. Similarly, as the area of the topographic map increases, the number of sampled points and the lines connecting them also increases dramatically. Even without adding more rules, the increased computational resources required by the A* pathfinding algorithm will lead to a geometric increase in computation time. Moreover, in practice, pathfinding rules are likely to be added as needed. This could result in a situation where a 1k-sized terrain map takes only 10 seconds to obtain a road curve using the A* pathfinding algorithm, while a 2k-sized map might take 5 minutes, and a 4k-sized map could take 30 minutes or even longer. This will significantly reduce the feasibility of implementing pathfinding on large-size topographic maps. In other words, current technical solutions can only achieve relatively good results when dealing with smaller terrain sizes, lower point connection depths, and fewer pathfinding rules. For larger terrains and more complex scenarios, new solutions are needed.
[0083] Considering that pathfinding algorithms cannot plan routes on large terrain maps, routes must be manually set in open-world games, resulting in low route planning efficiency. Therefore, refer to Figure 1a As shown, this application proposes a route planning method, including: acquiring a first topographic map; generating an initial road curve of the first topographic map; dividing the first topographic map into multiple first topographic blocks according to a preset division rule; determining a first target topographic block from the multiple first topographic blocks, wherein the first target topographic block is a first topographic block containing curve segments of the initial road curve; performing route planning processing on the first target topographic block according to the curve segments contained in the first target topographic block to obtain a sub-route corresponding to the first target topographic block; and determining a target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target topographic blocks.
[0084] The method involves dividing the first topographic map into multiple first topographic blocks, ensuring that the size of each block is smaller than the size of the first topographic map. By segmenting the initial road curves contained within each first target topographic block, sub-routes corresponding to the first target topographic block can be quickly planned. Furthermore, by analyzing all the sub-routes corresponding to the first target topographic map, the target route corresponding to the first topographic map can be quickly obtained. This improves the efficiency of route planning.
[0085] The following sections provide detailed descriptions of each example. It should be noted that the sequence numbers of the following embodiments are not intended to limit the preferred order of the embodiments.
[0086] In this embodiment, a route planning method is provided, such as Figure 1b As shown, the specific process of this route planning method can be as follows:
[0087] 110. Obtain the first topographic map.
[0088] The first topographic map is a topographic map of a region awaiting route planning, and it records topographic information. For example, the first topographic map could be a topographic map of a game scene awaiting route planning, or it could be a regional topographic map of a region where roads need to be planned, and so on.
[0089] 120. Generate the initial road curves for the first topographic map.
[0090] The initial road curve is used to restrict the locations that the planned route needs to pass through on the first topographic map. For example, the initial road curve can be a curve connecting important locations on the first topographic map during route planning. These important locations can be the location of checkpoints, rest stops, the start and end points of the route planning, etc. It can also be a curve pre-set by the user on the first topographic map to limit the locations that the route needs to pass through during route planning, and so on.
[0091] In some embodiments, in order to generate initial road curves for a first topographic map, and to limit the locations that the planned route of the first topographic map needs to pass through by the initial road curves, generating initial road curves for the first topographic map includes:
[0092] The initial road curves of the first topographic map are generated based on preset reference points or reference curves.
[0093] The preset reference points are locations that need to be referenced when planning routes on the first topographic map. For example, if the first topographic map is a topographic map in a game scene where a route is waiting to be planned, the preset reference points can be checkpoints, rest points, etc. in the game scene. If the first topographic map is a regional topographic map where a road needs to be planned, the preset reference points can be locations such as service areas and restaurants in the regional map.
[0094] The preset reference curve can be a pre-drawn curve, which can serve as the initial road curve for the first terrain map. The preset curve can be a curve set by game designers or relevant artists according to requirements.
[0095] In some embodiments, in order to limit the location of the reference curve in the first topographic map, generating an initial road curve for the first topographic map based on the reference curve includes:
[0096] Obtain the starting and ending points of the reference curve on the first topographic map;
[0097] Based on the curve's starting and ending points, a reference curve is set on the first topographic map to generate the initial road curve for the first topographic map.
[0098] The curve starting point is the starting point of the reference curve set on the first topographic map.
[0099] The endpoint of the curve is the endpoint of the reference curve set on the first topographic map.
[0100] For example, one end of the reference curve can be set at the curve start point and the other end of the reference curve can be set at the curve end point to set the reference curve in the first topographic map and generate the initial road curve of the first topographic map.
[0101] 130. According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the first target topographic block is determined from the multiple first topographic blocks. The first target topographic block is the first topographic block containing the curve segment of the initial road curve.
[0102] Among them, the preset division rules are the rules for dividing the topographic map in advance. For example, the preset division rules can divide the topographic map into multiple topographic blocks, or the preset division rules record the size of the topographic blocks so that the topographic map can be divided into topographic blocks according to the size.
[0103] The first topographic block contains a portion of the area in the first topographic map, and multiple first topographic blocks can be pieced together to form the first topographic map.
[0104] A curve segment is a portion of the initial road curve obtained according to a preset division rule. For example, the first target terrain block may contain one or more curve segments.
[0105] The first target terrain block is the first terrain block containing the curve segments of the initial road curve.
[0106] 140. Based on the curve segments contained in the first target terrain block, perform route planning processing on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0107] The sub-route corresponding to the first target terrain block is the route planned in the first target terrain block by segmenting curves.
[0108] For example, by adjusting the curve segments in the first target terrain block, the corresponding sub-route can be planned. Alternatively, the corresponding sub-route can be planned by using the parts of the first target terrain block located on the curve segments (endpoints, midpoints, checkpoints, etc.), and so on.
[0109] In some embodiments, to facilitate the planning of sub-routes within a first target terrain block, route planning is performed on the first target terrain block based on curve segments contained therein to obtain the sub-routes corresponding to the first target terrain block, including:
[0110] Based on the endpoints of the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0111] The endpoints of the curve segment can be points on the sub-route corresponding to the first target terrain block, used to define the scope of the planned sub-route corresponding to the first target terrain block. For example, the endpoints of the curve segment can serve as the start point, end point, and other points that need to be passed through in the sub-route corresponding to the first target terrain block, etc.
[0112] In some embodiments, in order to plan a sub-route corresponding to a first target terrain block based on the endpoints of curve segments, route planning processing is performed on the first target terrain block according to the curve segments contained therein to obtain the sub-route corresponding to the first target terrain block, including:
[0113] Based on the voxel information of the first target terrain block, construct the anisotropic mesh corresponding to the first target terrain block;
[0114] Based on the endpoints of the curve segments contained in the first target terrain block, the start and end points of the sub-route corresponding to the first target terrain block are determined from the nodes of the anisotropic network.
[0115] Based on the starting point and the ending point, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0116] Among them, multiple voxels in the voxel information can constitute the first target terrain block. This voxel can be understood as a three-dimensional pixel in the first target terrain block, which contains information such as position, size, color, and texture.
[0117] An anisotropic mesh can be constructed from multiple anisotropic line segments passing through voxels in the voxel information. For example, with a voxel as the center point, multiple anisotropic line segments passing through the voxel are set. These multiple anisotropic line segments have different depths, and each anisotropic line segment can pass through multiple voxels. By using all the multiple anisotropic line segments passing through each voxel, an anisotropic mesh can be obtained.
[0118] The more anisotropic line segments that pass through a voxel, the better it is to avoid large bends in the route planning.
[0119] The nodes of an anisotropic network graph are the endpoints of the anisotropic line segments in the anisotropic network graph.
[0120] The starting point is the endpoint of an anisotropic line segment that overlaps with one endpoint of a curve segment in the anisotropic network diagram.
[0121] The endpoint is the endpoint of an anisotropic line segment in the anisotropic network that overlaps with the other endpoint of the curve segment.
[0122] For example, by using the starting point and the ending point, a route between the starting point and the ending point can be planned, thereby obtaining the sub-route corresponding to the first target terrain block.
[0123] In some embodiments, in order to search for sub-routes corresponding to a first target terrain map, route planning is performed on the first target terrain block based on the start and end points to obtain the sub-routes corresponding to the first target terrain block, including:
[0124] Based on the starting point and the ending point, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0125] For example, routes passing through the first target terrain block can be searched from the anisotropic network map, and the routes passing through the starting point and the ending point can be used as the sub-routes corresponding to the first target terrain block.
[0126] In some embodiments, considering that anisotropic networks consist of multiple line segments, in order to filter multiple line segments to obtain the sub-route corresponding to the first target terrain map, the weight value of each line segment in the anisotropic network map is determined based on the terrain data of the first target terrain block.
[0127] Based on the start and end points, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block, including:
[0128] Based on the starting and ending points, as well as the weight values of each line segment in the anisotropic network, pathfinding processing is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0129] The terrain data of the first target terrain block can reflect the terrain of the first target terrain block. For example, the terrain data of the first target terrain block can be terrain layer masking data, which can include grassland, rivers, cliffs, etc., or the slope information of the first target terrain block.
[0130] The weight value of a line segment is used to reflect the difficulty of traversing that line segment. For example, if the terrain data of a line segment in the anisotropic network map is grassland on the first target terrain map, then the weight value of that line segment is high. A higher weight value indicates that the difficulty of traversing the line segment is low. Conversely, if the terrain data of a line segment on the first target terrain map is rivers, cliffs, etc., then the weight value of that line segment is low. A lower weight value indicates that the difficulty of traversing the line segment is high. Therefore, when planning the sub-route corresponding to the first target terrain block, the weight values of each line segment in the anisotropic network map can be used to filter the line segments. That is, during route planning, line segments with higher weight values are selected to form the sub-route corresponding to the first target terrain block.
[0131] In some embodiments, in order to search for sub-routes corresponding to the first target terrain map, pathfinding processing is performed on the anisotropic network map based on the start and end points and the weight values of each line segment in the anisotropic network map to obtain the sub-routes corresponding to the first target terrain block, including:
[0132] Based on the weight values of each line segment in the anisotropic network diagram, the main target line segment and intermediate target line segment are determined from the anisotropic network diagram. The main target line segment contains the line segment in the anisotropic network diagram with the starting point or the ending point, and the intermediate target line segment is the line segment in the anisotropic network diagram that connects the main target line segment.
[0133] The main target line segment and the intermediate target line segment are identified as the sub-routes corresponding to the first target topographic map.
[0134] For example, by using the main target line segment, intermediate target line segments connected to the main target line segment are determined from the anisotropic network map, so as to connect the main target line segment through the intermediate target line segment, thereby forming the sub-route corresponding to the first target topographic map.
[0135] For example, the main target line segment passing through the starting point q is q1, and the main target line segment passing through the intersection point z is z1. Obtain the line segments passing through the endpoint q1 in the anisotropic network graph, and obtain the line segments passing through the endpoint z1 in the anisotropic network graph. Then, using the weight values of each line segment in the anisotropic network graph, select the intermediate target line segment q2 from the line segments passing through the endpoint q1, and select the intermediate target line segment z2 from the line segments passing through the endpoint z1. If q2 and z2 can be the same line segment, then there is an intermediate target line segment connecting the two main target line segments. If q2 and z2 can also be two different line segments, then there are at least two intermediate target line segments connecting the two main target line segments.
[0136] If intermediate target line segments q2 and z2 cannot be connected, then it is necessary to continue to select intermediate target line segments q3 from the line segments passing through the endpoint q1 and z3 from the line segments passing through the endpoint z1 by using the weight values of each line segment in the anisotropic network diagram. Repeat the above steps until intermediate target line segments qn and zn are obtained. The sub-route corresponding to the first target terrain block is formed by the main target line segment q1, intermediate target line segment q2, ..., intermediate target line segment qn, intermediate target line segment zn, ..., intermediate target line segment z2, and main target line segment z1.
[0137] 150. Based on the sub-routes corresponding to all the first target terrain blocks, determine the target route corresponding to the first terrain map.
[0138] The target route is the route formed by stitching together the sub-routes corresponding to all the first target terrain blocks.
[0139] In some embodiments, in order to form a target route corresponding to a first topographic map by means of sub-routes corresponding to all first target terrain blocks, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0140] Connect the starting and ending points of adjacent sub-routes on the first topographic map to obtain the target route corresponding to the first topographic map.
[0141] In this context, adjacent sub-routes on the first topographic map are two sub-routes with overlapping endpoints. For example, if there are three sub-routes (sub-routes 1, 2, and 3), sub-routes 1 and 2 have overlapping endpoints, and sub-routes 2 and 3 have overlapping endpoints, then sub-routes 1, 2, and 3 are connected sequentially based on these overlapping endpoints.
[0142] In some embodiments, to make the sub-routes corresponding to the first target terrain patch smoother after stitching, the target route corresponding to the first terrain map is determined based on all the sub-routes corresponding to the first target terrain patch, including:
[0143] Connect the sub-paths corresponding to all the first target terrain blocks to obtain the initial route;
[0144] The initial route is smoothed to obtain the target route corresponding to the first topographic map.
[0145] The initial route is the route that is not smoothed after connecting all the sub-routes corresponding to the first target terrain blocks in sequence.
[0146] The target route is the initial route after smoothing. For example, the target route can have greater curvature and smaller slope, so that virtual characters in the open game world can easily pass through the target route, or that users can easily drive vehicles through the target route, etc.
[0147] In some embodiments, considering that the sub-routes corresponding to the two first target terrain blocks will have a large bending angle after splicing, in order to reduce the bending angle of the sub-routes corresponding to the two first target terrain blocks after splicing, the initial route includes multiple nodes, where each node is the endpoint of the sub-routes corresponding to the first target terrain block. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0148] Get the previous and next nodes associated with the intermediate node. The intermediate node is any node other than the endpoint of the initial route.
[0149] Determine the first vector and the second vector. The first vector is the direction vector from the middle node to the previous node, and the second vector is the direction vector from the middle node to the next node.
[0150] Determine the angle between the first vector and the second vector;
[0151] If the vector angle is not greater than the first preset angle value, the position of the intermediate node on the first topographic map is adjusted until the vector angle is greater than the first preset angle value. The route corresponding to the vector angle greater than the first preset angle value is the target route corresponding to the first topographic map.
[0152] Here, a node is the endpoint of a sub-route, and the number of nodes in the initial route is 2 * the number of sub-routes - 1.
[0153] An intermediate node is any node other than the endpoints of the initial route. For example, if the initial route includes 3 nodes (node 1, node 2, and node 3), then the intermediate node is node 2.
[0154] The previous node is any node on the previous sub-route that is connected to the intermediate node, excluding the intermediate node. For example, if the initial route includes 5 nodes (node 1, node 2, node 3, node 4, and node 5, sub-route 1 connects node 1 and node 2, sub-route 2 connects node 2 and node 3, sub-route 3 connects node 3 and node 4, and sub-route 4 connects node 4 and node 5), if the intermediate node is node 2, then the previous sub-route is sub-route 1, and the previous node is node 1. If the intermediate node is node 3, then the previous sub-route is sub-route 2, and the previous node is node 2, and so on.
[0155] The next node is the node on the next sub-route that is connected to the intermediate node, excluding the intermediate node. For example, if the initial route includes 5 nodes (node 1, node 2, node 3, node 4 and node 5, sub-route 1 connects node 1 and node 2, sub-route 2 connects node 2 and node 3, sub-route 3 connects node 3 and node 4, and sub-route 4 connects node 4 and node 5), if the intermediate node is node 2, then the next sub-route is sub-route 2 and the next node is node 3; if the intermediate node is node 3, then the next sub-route is sub-route 3 and the next node is node 4.
[0156] The first vector is the direction vector from the intermediate node to the previous node. For example, if the intermediate node is node 2 and the previous node is node 1, then the first vector is the direction vector from node 2 to node 1.
[0157] The second vector is the direction vector from the intermediate node to the next node. For example, if the intermediate node is node 2 and the next node is node 3, then the second vector is the direction vector from node 2 to node 3.
[0158] The angle between vectors is the angle between the first vector and the second vector. For example, if the first vector is vector E and the second vector is vector F, The angle between vectors is determined by the cosine value.
[0159] The first preset angle value is used to measure the angle between the first vector and the second vector.
[0160] For example, if the vector angle is not greater than the first preset angle value, it indicates that the initial route has a large bend in the road segment where the first and second vectors are located. In this way, the position of the intermediate node on the first topographic map is adjusted so that the vector angle between the updated first vector and the updated second vector is greater than the first preset angle value, so that the bend of the initial route in the road segment where the updated first vector and the updated second vector are located is smaller. Here, the updated first vector is the direction vector from the adjusted intermediate node to the previous node, and the updated second vector is the direction vector from the adjusted intermediate node to the next node.
[0161] In some embodiments, considering that when planning the sub-route corresponding to the first target terrain block, only the endpoints of the curve segments of the initial road curve are considered, and key points that may be located within the first target terrain block and need to be passed are not considered, key points may be rest points, checkpoints, etc. in the game scene, in order to ensure that the initial route can pass through key points, the first terrain map includes key points, and the initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0162] Identify the target key points, which are key points that are not on the initial route;
[0163] Identify the target points on the initial route that correspond to the target key points;
[0164] The target point is shifted towards the target key point to obtain the target route corresponding to the first terrain map.
[0165] Among them, the target key points are the key points that the initial route did not pass through in the first topographic map.
[0166] The target point is the location on the target route that is closest to the target key point.
[0167] For example, if there are target key points in the first topographic map, the target point can be shifted towards the target key point to guide the initial route through the target key point, thus achieving the target route.
[0168] In some embodiments, considering the difficulty in controlling the game character to traverse routes with steep inclines, in order to adjust the slope of the target route so that the game character can be controlled to traverse the target route, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain block. The initial route is then smoothed to obtain the target route corresponding to the first terrain map, including:
[0169] Determine the target tangent, which is the tangent line that passes through the target node of the initial route. The target node can be any node.
[0170] Determine the target angle, which is the angle between the target tangent and the horizontal plane;
[0171] If the target angle is not less than the second preset angle value, the position of the target node on the first topographic map is adjusted until the target angle is less than the second preset angle value. The route corresponding to the target angle less than the second preset angle value is the target route corresponding to the first topographic map.
[0172] The target tangent is tangent to the terrain where the target node is located in the first topographic map, and the target tangent passes through the target node of the target route.
[0173] The target angle is the angle between the target tangent and the horizontal plane.
[0174] The second preset angle value is used to measure the included angle of the target.
[0175] For example, if the target angle is not less than the second preset angle value, the position of the target node on the target route on the first topographic map is adjusted so that the target angle between the target node and the horizontal plane is less than the second preset angle value, thereby making the target route at the target node have a smaller slope.
[0176] In some embodiments, considering that the target route may have intersecting sections, and the distance between the intersecting sections may be very short, making it inconvenient to separate the intersecting sections, in order to increase the distance between the intersecting sections, the initial route includes multiple routes with intersections. The initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0177] Determine the target road segment of the target route. The target route is the route where the intersection is located, and the target segment is the road segment on the target route that is at a preset distance from the intersection.
[0178] Identify the target area of the target road segment on the first topographic map;
[0179] Based on the endpoints of the target road segment, route planning is performed on the target area to obtain the target route corresponding to the first topographic map.
[0180] Here, a route is a path in one direction within the initial route. For example, the initial route can consist of routes in multiple game scene directions, or routes in multiple geographical location directions, and multiple routes may intersect.
[0181] An intersection point is the point where two lines intersect.
[0182] The target route is the route where the intersection is located. For example, if the target route includes route 1 and route 2, and route 1 and route 2 have an intersection, then the target route is route 1 and route 2.
[0183] The target road segment is the road segment on the initial route that has a preset distance from the intersection. For example, if the target routes are route 1 and route 2, then endpoints 1 and 2 on route 1 have preset distances from the intersection, and endpoints 3 and 4 on route 2 have preset distances from the intersection. The target road segment includes the road segment between endpoints 1 and 2 on route 1, and the road segment between endpoints 3 and 4 on route 2.
[0184] The target area is the region surrounding the target road segment on the second topographic map, and the endpoint of the target road segment is located on the boundary of the target area.
[0185] For example, by using the endpoints of the target road segment, route planning is performed on the target area in the second topographic map, and the route replanned in the target area replaces the target road segment of the target route, so as to avoid the interval between the two target road segments being too close.
[0186] In some embodiments, considering that the topographic map for which the route needs to be planned has a high precision, in order to facilitate rapid route planning on the topographic map with a high precision, obtaining a first topographic map includes:
[0187] Obtain the second topographic map;
[0188] The second topographic map is resampled using a preset precision resampling coefficient to obtain the first topographic map. The precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map are the same size.
[0189] The method also includes:
[0190] The target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map.
[0191] The second topographic map indicates the same terrain as the first topographic map, has the same size as the first topographic map, and has a higher accuracy than the first topographic map.
[0192] The preset accuracy resampling coefficient is a pre-set coefficient used to reduce the accuracy of the second topographic map.
[0193] In some embodiments, in order to quickly plan routes on topographic maps with higher accuracy, the target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map, including:
[0194] The initial road curves are mapped onto the second topographic map to obtain the preliminary route corresponding to the second topographic map;
[0195] According to the preset division rules, the second topographic map is divided into multiple second topographic blocks, and the second target topographic block is determined from the multiple second topographic blocks. The second target topographic block is the second topographic block that contains the route segments of the initial screening route.
[0196] Based on the route segments contained in the second target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block;
[0197] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0198] The initial screening route is the route obtained by mapping the initial road curves onto the second topographic map.
[0199] The second topographic block contains a portion of the area in the second topographic map, and multiple second topographic blocks can be pieced together to form the first topographic map.
[0200] The second target terrain block is the second terrain block that contains the route segments of the initial screening route.
[0201] The sub-route corresponding to the second target terrain block is the route planned in the second target terrain block through the endpoints of the route segments.
[0202] In some embodiments, to facilitate the planning of sub-routes corresponding to the second target terrain block, route planning is performed on the second target terrain block according to the route segments contained therein to obtain the sub-routes corresponding to the second target terrain block, including:
[0203] Based on the voxel information of the second target terrain block, construct the anisotropic mesh corresponding to the second target terrain block;
[0204] Based on the endpoints of the route segments contained in the second target terrain block, determine the start and end points of the sub-route corresponding to the second target terrain block from the nodes of the anisotropic network graph.
[0205] Based on the starting point and ending point, as well as the weight values of each line segment in the anisotropic network graph, pathfinding processing is performed on the anisotropic network graph to obtain the sub-route corresponding to the second target terrain block. The weight values of each line segment in the anisotropic network graph are determined based on the terrain data of the second target terrain block.
[0206] Because the accuracy of the first topographic map is lower than that of the second topographic map, initial road curves can be quickly generated from the first topographic map. These initial road curves are then mapped onto the second topographic map to obtain preliminary routes. The second topographic map, mapped with these preliminary routes, is then divided into multiple second topographic blocks using preset partitioning rules. The size of each second topographic block is smaller than the size of the second topographic map itself. This facilitates the rapid planning of sub-routes corresponding to the second target topographic block by segmenting the routes within the first topographic block using the preliminary routes. Finally, the target route corresponding to the second topographic map can be quickly obtained using all the sub-routes. This improves the efficiency of route planning.
[0207] In some embodiments, in order to quickly plan routes on topographic maps with higher accuracy, the target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map, including:
[0208] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the second topographic map is divided into multiple second topographic blocks. The first topographic blocks and the second topographic blocks correspond one-to-one. The multiple first topographic blocks include the first target topographic block, which is the first topographic block containing the curve segment of the initial road curve.
[0209] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0210] Based on the endpoints of the sub-route corresponding to the first target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block. The second target terrain block is the second terrain block corresponding to the first target terrain block.
[0211] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0212] The first terrain block is the terrain block obtained by dividing the first terrain map according to the preset division rules.
[0213] The second terrain block is the terrain block obtained by dividing the second terrain map according to the preset division rules. The second terrain block corresponds one-to-one with the first terrain block.
[0214] The first target terrain block is the first terrain block containing the curve segments of the initial road curve.
[0215] The sub-route corresponding to the first target terrain block is the route planned in the first target terrain block by segmenting curves.
[0216] The sub-route corresponding to the second target terrain block is the route planned in the second target terrain block by passing through the endpoint of the sub-route corresponding to the first target terrain block.
[0217] In some embodiments, to facilitate the planning of sub-routes corresponding to the second target terrain block, route planning is performed on the first target terrain block based on the curve segments contained therein to obtain the sub-routes corresponding to the first target terrain block, including:
[0218] Based on the voxel information of the first target terrain block, construct the anisotropic mesh corresponding to the first target terrain block;
[0219] Based on the endpoints of the route segments contained in the first target terrain block, determine the start and end points of the sub-route corresponding to the first target terrain block from the nodes of the anisotropic network graph corresponding to the first target terrain block;
[0220] Based on the starting and ending points of the sub-route corresponding to the first target terrain block, and the weight values of each line segment in the anisotropic network graph corresponding to the first target terrain block, pathfinding processing is performed on the anisotropic network graph corresponding to the first target terrain block to obtain the sub-route corresponding to the first target terrain block. The weight values of each line segment in the anisotropic network graph corresponding to the first target terrain block are determined based on the terrain data of the first target terrain block.
[0221] In some embodiments, to facilitate the planning of sub-routes corresponding to the second target terrain block, route planning processing is performed on the second target terrain block based on the endpoints of the sub-routes corresponding to the first target terrain block to obtain the sub-routes corresponding to the second target terrain block, including:
[0222] Based on the voxel information of the second target terrain block, construct the anisotropic mesh corresponding to the second target terrain block;
[0223] Based on the endpoints of the sub-route corresponding to the first target terrain block, determine the start and end points of the sub-route corresponding to the second target terrain block from the nodes of the anisotropic network corresponding to the second target terrain block;
[0224] Based on the starting and ending points of the sub-route corresponding to the second target terrain block, and the weight values of each line segment in the anisotropic network graph corresponding to the second target terrain block, pathfinding processing is performed on the anisotropic network graph corresponding to the second target terrain block to obtain the sub-route corresponding to the second target terrain block. The weight values of each line segment in the anisotropic network graph corresponding to the second target terrain block are determined based on the terrain data of the second target terrain block.
[0225] For example, the first topographic map is first divided into multiple first topographic blocks, and the second topographic map is divided into multiple second topographic blocks. Then, the first topographic blocks are filtered by curve segmentation of the initial road curve to plan the sub-route corresponding to the first target topographic block. Then, based on the endpoints of the sub-route corresponding to the first target topographic block, the sub-route corresponding to the second target topographic block is planned. In this way, the computational resources required to plan the target route corresponding to the second topographic map can be reduced, thereby improving the efficiency of route planning.
[0226] As can be seen from the above, the embodiments of this application can obtain a first topographic map; generate an initial road curve for the first topographic map; divide the first topographic map into multiple first topographic blocks according to a preset division rule; determine a first target topographic block from the multiple first topographic blocks, wherein the first target topographic block is a first topographic block containing curve segments of the initial road curve; perform route planning processing on the first target topographic block according to the curve segments contained in the first target topographic block to obtain the sub-route corresponding to the first target topographic block; and determine the target route corresponding to the first topographic map according to the sub-route corresponding to all the first target topographic blocks.
[0227] In this scheme, the first topographic map is divided into multiple first topographic blocks, such that the size of the first topographic blocks is smaller than the size of the first topographic map. By segmenting the initial road curves contained in the first target topographic block, the sub-route corresponding to the first target topographic block can be quickly planned. Furthermore, by using all the sub-route corresponding to the first target topographic map, the target route corresponding to the first topographic map can be quickly obtained. This improves the efficiency of route planning. Based on the method described in the above embodiments, a further detailed explanation will follow.
[0228] In this embodiment, the method of this application embodiment will be described in detail using the example of planning routes in an open game world using three-dimensional computer graphics software (houdini).
[0229] like Figure 2 As shown, the specific process of a route planning method is as follows:
[0230] 210. Obtain the second topographic map;
[0231] 220. The second topographic map is resampled using a preset precision resampling coefficient to obtain a first topographic map. The precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map have the same size.
[0232] The specific implementation method of resampling is as follows: For input second topographic maps with large dimensions, based on the actual project requirements and the performance resources of the machine performing the calculations, the required accuracy resampling coefficients for the second topographic map are determined. Using the preset accuracy resampling coefficients, the accuracy of the second topographic map is reduced to obtain the first topographic map.
[0233] 230. Generate the initial road curves for the first topographic map.
[0234] For example, given the input second topographic map, after terrain precision resampling, a first topographic map is obtained, and an anisotropic mesh corresponding to the second topographic map is constructed. Based on the terrain slope and terrain layer shading data, the weight values of each line segment in the anisotropic mesh are set. According to preset reference points and the weight values of each line segment in the anisotropic mesh, pathfinding processing is performed on the anisotropic mesh to obtain the initial road curve of the first topographic map.
[0235] For example, given an input second topographic map, a first topographic map is obtained after topographic accuracy resampling. Based on the input preset sub-curves and preset reference points, the preset sub-curves are set on the first topographic map to obtain the initial road curves of the first topographic map.
[0236] 240. Map the initial road curve to the second topographic map to obtain the preliminary screening route corresponding to the second topographic map. Divide the second topographic map into multiple second topographic blocks according to the preset division rules. Determine the second target topographic block from the multiple second topographic blocks. The second target topographic block is the second topographic block that contains the route segment of the preliminary screening route.
[0237] For example, the second terrain map is divided into multiple second terrain blocks according to the preset division rules. The second terrain blocks after division are traversed, and one individual second terrain block is processed at a time. The multiple second terrain blocks include the second target terrain block. The second target terrain block contains the route segments of the initial screening route. Other points on the initial screening route except the endpoints of the route segments are deleted. Thus, the endpoints of the route segments are used as the start or end points of the second target terrain block.
[0238] 250. Based on the endpoints of the route segments, perform route planning on the second target terrain block to obtain the sub-route corresponding to the second target terrain block.
[0239] For example, perform sub-route pathfinding for each second target terrain block. Based on the endpoints of the route segments, traverse the voxels in the second target terrain block and construct an anisotropic network corresponding to the second target terrain according to the required accuracy. Select points in the anisotropic network as start or end points based on the endpoints of the route segments on each second target terrain block. Based on the slope and terrain layer shading data of the second target terrain block, set the weight values of each line segment in the anisotropic network. Using the endpoints (start and end points) of the route segments obtained above, use the improved pathfinding algorithm to perform pathfinding calculations on the second target terrain block to obtain the sub-routes corresponding to the second target terrain block.
[0240] 260. Merge all sub-routes corresponding to the second target terrain blocks, smooth the curves and adapt them to the terrain according to project requirements, and obtain the target route corresponding to the second terrain map.
[0241] The target route includes multiple nodes, where nodes are the endpoints of sub-routes. The smoothing method is as follows:
[0242] 1) Traverse the intermediate nodes on the merged line segment (i.e., each intermediate node has only 2 connected nodes), obtain the previous node and the next node connected to the intermediate node, subtract the previous node from the intermediate node to obtain the first vector, and subtract the next node from the intermediate node to obtain the second vector. Perform a dot product of the first vector and the second vector. If the dot product value is higher, their included angle is acute and needs to be averaged. Set the intermediate node close to the line connecting the previous node and the next node to prevent acute angle turns in the road curve.
[0243] 2) During the pathfinding process, due to the undulations of the terrain, the obtained curve may deviate to a certain extent from the key points provided at the beginning. It is necessary to choose whether to correct the road curve to the provided key points according to the actual needs of the project.
[0244] 3) Curve slope calculation: Calculate the angle between the target tangent of the target node on the curve and the target on the horizontal plane. Smooth the position of the part that exceeds the set value. The target node can be any node.
[0245] 4) Resampling at intersections: Set separate sampling intervals for target road segments near intersections to achieve different levels of accuracy at intersections.
[0246] As can be seen from the above, the beneficial effects that this solution can achieve are:
[0247] (1) The computational load of pathfinding is greatly reduced. Based on the actual situation, the terrain is divided into multiple second terrain blocks according to the pre-defined division rules. The roads calculated by the pathfinding algorithm within a certain size second terrain block have a meandering deviation that does not significantly exceed the size range. The original situation where the distance between the start and end points was large is transformed into multiple start and end points with relatively smaller distances. Pathfinding is performed one by one on the subdivided second terrain blocks. The calculation is isolated from other areas that are not currently being processed. The amount of computation required for each execution is greatly reduced. As a result, the total computational load of the entire terrain is also significantly reduced compared to before the splitting.
[0248] (2) Improved computational efficiency and accuracy. Each time, only the sub-route corresponding to the split second terrain patch needs to be calculated. Compared to the unsplit second terrain map, the area calculated per iteration is reduced, allowing for higher sampling accuracy. For the unsplit second terrain map, even areas far from the road's start and end points during pathfinding, which the actual target route will not pass through, are still considered by the algorithm, leading to unnecessary computation. After splitting, the endpoints of the route segments can be used to identify second terrain patches that do not require pathfinding calculations, allowing for skipping the calculations and significantly improving computational efficiency.
[0249] (3) The size of the topographic map reduces the limitations on pathfinding. By splitting the second topographic map and designing the start and end points of segments, the amount of pathfinding calculations per operation can be controlled within a reasonable range. Compared to before splitting, when the entire second topographic map needs to be calculated at once, after splitting, only a small second topographic block can be calculated at a time. After calculating a small second topographic block, the occupied memory and other computing resources can be released before the next calculation. The situation where the topographic map is too large or the computing hardware is insufficient to obtain results will no longer occur.
[0250] To better implement the above methods, this application also provides a route planning device, which can be integrated into an electronic device, such as a terminal or server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, or personal computer; the server can be a single server or a server cluster composed of multiple servers.
[0251] For example, in this embodiment, the method of this application embodiment will be described in detail by taking the route planning device specifically integrated into an electronic device as an example.
[0252] For example, such as Figure 3As shown, the route planning device may include an acquisition unit 310, a generation unit 320, a division unit 330, a planning unit 340, and a determination unit 350, as follows:
[0253] (I) Acquisition Unit 310.
[0254] Acquisition unit 310 is used to acquire the first topographic map.
[0255] In some embodiments, generating initial road curves for the first topographic map includes:
[0256] The initial road curves of the first topographic map are generated based on preset reference points or reference curves.
[0257] (II) Generation Unit 320.
[0258] Generation unit 320 is used to generate the initial road curves of the first topographic map.
[0259] (III) Divide into units 330.
[0260] The division unit 330 is used to divide the first topographic map into multiple first topographic blocks according to a preset division rule, and to determine the first target topographic block from the multiple first topographic blocks. The first target topographic block is the first topographic block containing the curve segment of the initial road curve.
[0261] (iv) Planning Unit 340.
[0262] Planning unit 340 is used to perform route planning processing on the first target terrain block according to the curve segments contained in the first target terrain block, and obtain the sub-route corresponding to the first target terrain block.
[0263] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0264] Based on the endpoints of the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0265] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0266] Based on the voxel information of the first target terrain block, construct the anisotropic mesh corresponding to the first target terrain block;
[0267] Based on the endpoints of the curve segments contained in the first target terrain block, the start and end points of the sub-route corresponding to the first target terrain block are determined from the nodes of the anisotropic network.
[0268] Based on the starting point and the ending point, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0269] In some embodiments, route planning is performed on the first target terrain block based on the start and end points to obtain the sub-route corresponding to the first target terrain block, including:
[0270] Based on the starting point and the ending point, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0271] In some embodiments, the weight values of each line segment in the anisotropic network diagram are determined based on the terrain data of the first target terrain block;
[0272] Based on the start and end points, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block, including:
[0273] Based on the starting and ending points, as well as the weight values of each line segment in the anisotropic network, pathfinding processing is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0274] (V) Determine Unit 350.
[0275] The determination unit 350 is used to determine the target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target terrain blocks.
[0276] In some embodiments, obtaining a first topographic map includes:
[0277] Obtain the second topographic map;
[0278] The second topographic map is resampled using a preset precision resampling coefficient to obtain the first topographic map. The precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map are the same size.
[0279] The method also includes:
[0280] The target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map.
[0281] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0282] Connect the starting and ending points of adjacent sub-routes on the first topographic map to obtain the target route corresponding to the first topographic map.
[0283] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0284] Connect the sub-paths corresponding to all the first target terrain blocks to obtain the initial route;
[0285] The initial route is smoothed to obtain the target route corresponding to the first topographic map.
[0286] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0287] Get the previous and next nodes associated with the intermediate node. The intermediate node is any node other than the endpoint of the initial route.
[0288] Determine the first vector and the second vector. The first vector is the direction vector from the middle node to the previous node, and the second vector is the direction vector from the middle node to the next node.
[0289] Determine the angle between the first vector and the second vector;
[0290] If the vector angle is not greater than the first preset angle value, the position of the intermediate node on the first topographic map is adjusted until the vector angle is greater than the first preset angle value. The route corresponding to the vector angle greater than the first preset angle value is the target route corresponding to the first topographic map.
[0291] In some embodiments, the first topographic map includes key points, and the initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0292] Identify the target key points, which are key points that are not on the initial route;
[0293] Identify the target points on the initial route that correspond to the target key points;
[0294] The target point is shifted towards the target key point to obtain the target route corresponding to the first terrain map.
[0295] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0296] Determine the target tangent, which is the tangent line that passes through the target node of the initial route. The target node can be any node.
[0297] Determine the target angle, which is the angle between the target tangent and the horizontal plane;
[0298] If the target angle is not less than the second preset angle value, the position of the target node on the first topographic map is adjusted until the target angle is less than the second preset angle value. The route corresponding to the target angle less than the second preset angle value is the target route corresponding to the first topographic map.
[0299] In some embodiments, the initial route includes multiple routes that intersect. The initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0300] Determine the target road segment of the target route. The target route is the route where the intersection is located, and the target segment is the road segment on the target route that is at a preset distance from the intersection.
[0301] Identify the target area of the target road segment on the first topographic map;
[0302] Based on the endpoints of the target road segment, route planning is performed on the target area to obtain the target route corresponding to the first topographic map.
[0303] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0304] The initial road curves are mapped onto the second topographic map to obtain the preliminary route corresponding to the second topographic map;
[0305] According to the preset division rules, the second topographic map is divided into multiple second topographic blocks, and the second target topographic block is determined from the multiple second topographic blocks. The second target topographic block is the second topographic block that contains the route segments of the initial screening route.
[0306] Based on the route segments contained in the second target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block;
[0307] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0308] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0309] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the second topographic map is divided into multiple second topographic blocks. The first topographic blocks and the second topographic blocks correspond one-to-one. The multiple first topographic blocks include the first target topographic block, which is the first topographic block containing the curve segment of the initial road curve.
[0310] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0311] Based on the endpoints of the sub-route corresponding to the first target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block. The second target terrain block is the second terrain block corresponding to the first target terrain block.
[0312] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0313] As can be seen from the above, the route planning device in this embodiment obtains a first topographic map by an acquisition unit; generates an initial road curve of the first topographic map by a generation unit; divides the first topographic map into multiple first topographic blocks by a division unit according to a preset division rule; determines a first target topographic block from the multiple first topographic blocks, wherein the first target topographic block is a first topographic block containing curve segments of the initial road curve; performs route planning processing on the first target topographic block according to the curve segments contained in the first target topographic block to obtain a sub-route corresponding to the first target topographic block; and determines the target route corresponding to the first topographic map by a determination unit based on the sub-routes corresponding to all the first target topographic blocks.
[0314] Therefore, the embodiments of this application can improve the efficiency of route planning.
[0315] Accordingly, this application also provides an electronic device, which can be a terminal or a server. The terminal can be a smartphone, tablet computer, laptop computer, touch screen, game console, personal computer, personal digital assistant (PDA) and other terminal devices.
[0316] like Figure 4 As shown, Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. The electronic device 400 includes a processor 410 with one or more processing cores, a memory 420 with one or more computer-readable storage media, and a computer program stored in the memory 420 and executable on the processor. The processor 410 is electrically connected to the memory 420. Those skilled in the art will understand that the electronic device structure shown in the figure does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0317] The processor 410 is the control center of the electronic device 400. It connects various parts of the electronic device 400 through various interfaces and lines. By running or loading software programs and / or modules stored in the memory 420, and calling data stored in the memory 420, it performs various functions of the electronic device 400 and processes data, thereby monitoring the electronic device 400 as a whole.
[0318] In this embodiment, the processor 410 in the electronic device 400 loads the instructions corresponding to the processes of one or more applications into the memory 420 according to the following steps, and the processor 410 runs the applications stored in the memory 420 to realize various functions:
[0319] A route planning method, comprising:
[0320] Obtain the first topographic map;
[0321] Generate the initial road curves for the first topographic map;
[0322] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the first target topographic block is determined from the multiple first topographic blocks. The first target topographic block is the first topographic block containing the curve segment of the initial road curve.
[0323] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0324] Determine the target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target terrain blocks.
[0325] In some embodiments, obtaining a first topographic map includes:
[0326] Obtain the second topographic map;
[0327] The second topographic map is resampled using a preset precision resampling coefficient to obtain the first topographic map. The precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map are the same size.
[0328] The method also includes:
[0329] The target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map.
[0330] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0331] Based on the endpoints of the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0332] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0333] Based on the voxel information of the first target terrain block, construct the anisotropic mesh corresponding to the first target terrain block;
[0334] Based on the endpoints of the curve segments contained in the first target terrain block, the start and end points of the sub-route corresponding to the first target terrain block are determined from the nodes of the anisotropic network.
[0335] Based on the starting point and the ending point, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0336] In some embodiments, route planning is performed on the first target terrain block based on the start and end points to obtain the sub-route corresponding to the first target terrain block, including:
[0337] Based on the starting point and the ending point, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0338] In some embodiments, the weight values of each line segment in the anisotropic network diagram are determined based on the terrain data of the first target terrain block;
[0339] Based on the start and end points, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block, including:
[0340] Based on the starting and ending points, as well as the weight values of each line segment in the anisotropic network, pathfinding processing is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0341] In some embodiments, generating initial road curves for the first topographic map includes:
[0342] The initial road curves of the first topographic map are generated based on preset reference points or reference curves.
[0343] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0344] Connect the starting and ending points of adjacent sub-routes on the first topographic map to obtain the target route corresponding to the first topographic map.
[0345] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0346] Connect the sub-paths corresponding to all the first target terrain blocks to obtain the initial route;
[0347] The initial route is smoothed to obtain the target route corresponding to the first topographic map.
[0348] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0349] Get the previous and next nodes associated with the intermediate node. The intermediate node is any node other than the endpoint of the initial route.
[0350] Determine the first vector and the second vector. The first vector is the direction vector from the middle node to the previous node, and the second vector is the direction vector from the middle node to the next node.
[0351] Determine the angle between the first vector and the second vector;
[0352] If the vector angle is not greater than the first preset angle value, the position of the intermediate node on the first topographic map is adjusted until the vector angle is greater than the first preset angle value. The route corresponding to the vector angle greater than the first preset angle value is the target route corresponding to the first topographic map.
[0353] In some embodiments, the first topographic map includes key points, and the initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0354] Identify the target key points, which are key points that are not on the initial route;
[0355] Identify the target points on the initial route that correspond to the target key points;
[0356] The target point is shifted towards the target key point to obtain the target route corresponding to the first terrain map.
[0357] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0358] Determine the target tangent, which is the tangent line that passes through the target node of the initial route. The target node can be any node.
[0359] Determine the target angle, which is the angle between the target tangent and the horizontal plane;
[0360] If the target angle is not less than the second preset angle value, the position of the target node on the first topographic map is adjusted until the target angle is less than the second preset angle value. The route corresponding to the target angle less than the second preset angle value is the target route corresponding to the first topographic map.
[0361] In some embodiments, the initial route includes multiple routes that intersect. The initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0362] Determine the target road segment of the target route. The target route is the route where the intersection is located, and the target segment is the road segment on the target route that is at a preset distance from the intersection.
[0363] Identify the target area of the target road segment on the first topographic map;
[0364] Based on the endpoints of the target road segment, route planning is performed on the target area to obtain the target route corresponding to the first topographic map.
[0365] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0366] The initial road curves are mapped onto the second topographic map to obtain the preliminary route corresponding to the second topographic map;
[0367] According to the preset division rules, the second topographic map is divided into multiple second topographic blocks, and the second target topographic block is determined from the multiple second topographic blocks. The second target topographic block is the second topographic block that contains the route segments of the initial screening route.
[0368] Based on the route segments contained in the second target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block;
[0369] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0370] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0371] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the second topographic map is divided into multiple second topographic blocks. The first topographic blocks and the second topographic blocks correspond one-to-one. The multiple first topographic blocks include the first target topographic block, which is the first topographic block containing the curve segment of the initial road curve.
[0372] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0373] Based on the endpoints of the sub-route corresponding to the first target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block. The second target terrain block is the second terrain block corresponding to the first target terrain block.
[0374] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0375] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0376] Optional, such as Figure 4 As shown, the electronic device 400 also includes: a touch display screen 430, a radio frequency circuit 440, an audio circuit 450, an input unit 460, and a power supply 470. The processor 410 is electrically connected to the touch display screen 430, the radio frequency circuit 440, the audio circuit 450, the input unit 460, and the power supply 470. Those skilled in the art will understand that... Figure 4 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0377] The touch display screen 430 can be used to display a graphical user interface (GUI) and receive operation commands generated by the user interacting with the GUI. The touch display screen 430 may include a display panel and a touch panel. The display panel can be used to display information input by the user or information provided to the user, as well as various graphical user interfaces of the electronic device. These graphical user interfaces can be composed of graphics, text, icons, video, and any combination thereof. Optionally, the display panel can be configured using a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar technologies. The touch panel can be used to collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel), generate corresponding operation commands, and execute the corresponding program according to the operation commands. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch location and the signal generated by the touch operation, transmitting the signal to the touch controller. The touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 410. It can also receive and execute commands from the processor 410. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it transmits the information to the processor 410 to determine the type of touch event. Subsequently, the processor 410 provides corresponding visual output on the display panel based on the type of touch event. In this embodiment, the touch panel and the display panel can be integrated into the touch display screen 430 to achieve input and output functions. However, in some embodiments, the touch panel and the touch display screen 430 can be implemented as two independent components to achieve input and output functions. That is, the touch display screen 430 can also be used as part of the input unit 460 to achieve input functions.
[0378] The radio frequency circuit 440 can be used to transmit and receive radio frequency signals to establish wireless communication with network devices or other electronic devices, and to transmit and receive signals with network devices or other electronic devices.
[0379] Audio circuitry 450 can be used to provide an audio interface between a user and an electronic device via a speaker and a microphone. Audio circuitry 450 can convert received audio data into electrical signals and transmit them to the speaker, where the speaker converts them into sound signals for output. Conversely, the microphone converts collected sound signals into electrical signals, which are then received by audio circuitry 450, converted back into audio data, and then processed by processor 410 before being transmitted via radio frequency circuitry 440 to, for example, another electronic device, or output to memory 420 for further processing. Audio circuitry 450 may also include an earphone jack to provide communication between peripheral headphones and electronic devices.
[0380] The input unit 460 can be used to receive input numbers, characters, or user characteristic information (such as fingerprints, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
[0381] Power supply 470 is used to power various components of electronic device 400. Optionally, power supply 470 can be logically connected to processor 410 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. Power supply 470 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0382] although Figure 4 As not shown in the diagram, the electronic device 400 may also include a camera, sensor, wireless fidelity module, Bluetooth module, etc., which will not be described in detail here.
[0383] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0384] As can be seen from the above, the electronic device provided in this embodiment can improve the efficiency of route planning.
[0385] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0386] Therefore, embodiments of this application provide a computer-readable storage medium storing a plurality of computer programs that can be loaded by a processor to execute steps in any of the route planning methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0387] A route planning method, comprising:
[0388] Obtain the first topographic map;
[0389] Generate the initial road curves for the first topographic map;
[0390] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the first target topographic block is determined from the multiple first topographic blocks. The first target topographic block is the first topographic block containing the curve segment of the initial road curve.
[0391] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0392] Determine the target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target terrain blocks.
[0393] In some embodiments, obtaining a first topographic map includes:
[0394] Obtain the second topographic map;
[0395] The second topographic map is resampled using a preset precision resampling coefficient to obtain the first topographic map. The precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map are the same size.
[0396] The method also includes:
[0397] The target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map.
[0398] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0399] Based on the endpoints of the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0400] In some embodiments, based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including:
[0401] Based on the voxel information of the first target terrain block, construct the anisotropic mesh corresponding to the first target terrain block;
[0402] Based on the endpoints of the curve segments contained in the first target terrain block, the start and end points of the sub-route corresponding to the first target terrain block are determined from the nodes of the anisotropic network.
[0403] Based on the starting point and the ending point, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
[0404] In some embodiments, route planning is performed on the first target terrain block based on the start and end points to obtain the sub-route corresponding to the first target terrain block, including:
[0405] Based on the starting point and the ending point, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0406] In some embodiments, the weight values of each line segment in the anisotropic network diagram are determined based on the terrain data of the first target terrain block;
[0407] Based on the start and end points, pathfinding is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block, including:
[0408] Based on the starting and ending points, as well as the weight values of each line segment in the anisotropic network, pathfinding processing is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
[0409] In some embodiments, generating initial road curves for the first topographic map includes:
[0410] The initial road curves of the first topographic map are generated based on preset reference points or reference curves.
[0411] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0412] Connect the starting and ending points of adjacent sub-routes on the first topographic map to obtain the target route corresponding to the first topographic map.
[0413] In some embodiments, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all first target terrain blocks includes:
[0414] Connect the sub-paths corresponding to all the first target terrain blocks to obtain the initial route;
[0415] The initial route is smoothed to obtain the target route corresponding to the first topographic map.
[0416] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0417] Get the previous and next nodes associated with the intermediate node. The intermediate node is any node other than the endpoint of the initial route.
[0418] Determine the first vector and the second vector. The first vector is the direction vector from the middle node to the previous node, and the second vector is the direction vector from the middle node to the next node.
[0419] Determine the angle between the first vector and the second vector;
[0420] If the vector angle is not greater than the first preset angle value, the position of the intermediate node on the first topographic map is adjusted until the vector angle is greater than the first preset angle value. The route corresponding to the vector angle greater than the first preset angle value is the target route corresponding to the first topographic map.
[0421] In some embodiments, the first topographic map includes key points, and the initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0422] Identify the target key points, which are key points that are not on the initial route;
[0423] Identify the target points on the initial route that correspond to the target key points;
[0424] The target point is shifted towards the target key point to obtain the target route corresponding to the first terrain map.
[0425] In some embodiments, the initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to a first target terrain patch. The initial route is smoothed to obtain the target route corresponding to the first terrain map, including:
[0426] Determine the target tangent, which is the tangent line that passes through the target node of the initial route. The target node can be any node.
[0427] Determine the target angle, which is the angle between the target tangent and the horizontal plane;
[0428] If the target angle is not less than the second preset angle value, the position of the target node on the first topographic map is adjusted until the target angle is less than the second preset angle value. The route corresponding to the target angle less than the second preset angle value is the target route corresponding to the first topographic map.
[0429] In some embodiments, the initial route includes multiple routes that intersect. The initial route is smoothed to obtain the target route corresponding to the first topographic map, including:
[0430] Determine the target road segment of the target route. The target route is the route where the intersection is located, and the target segment is the road segment on the target route that is at a preset distance from the intersection.
[0431] Identify the target area of the target road segment on the first topographic map;
[0432] Based on the endpoints of the target road segment, route planning is performed on the target area to obtain the target route corresponding to the first topographic map.
[0433] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0434] The initial road curves are mapped onto the second topographic map to obtain the preliminary route corresponding to the second topographic map;
[0435] According to the preset division rules, the second topographic map is divided into multiple second topographic blocks, and the second target topographic block is determined from the multiple second topographic blocks. The second target topographic block is the second topographic block that contains the route segments of the initial screening route.
[0436] Based on the route segments contained in the second target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block;
[0437] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0438] In some embodiments, determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes:
[0439] According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the second topographic map is divided into multiple second topographic blocks. The first topographic blocks and the second topographic blocks correspond one-to-one. The multiple first topographic blocks include the first target topographic block, which is the first topographic block containing the curve segment of the initial road curve.
[0440] Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block;
[0441] Based on the endpoints of the sub-route corresponding to the first target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block. The second target terrain block is the second terrain block corresponding to the first target terrain block.
[0442] Based on the sub-routes corresponding to all the second target terrain blocks, determine the target route corresponding to the second terrain map.
[0443] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0444] The storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0445] Since the computer program stored in the storage medium can execute the steps in any of the route planning methods provided in the embodiments of this application, the beneficial effects that any of the route planning methods provided in the embodiments of this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0446] The foregoing has provided a detailed description of a route planning method, apparatus, electronic device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A route planning method, characterized in that, include: Obtain a first topographic map; wherein, obtaining the first topographic map includes: obtaining a second topographic map; resampling the second topographic map using a preset precision resampling coefficient to obtain the first topographic map, wherein the precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map have the same size; The initial road curve of the first topographic map is generated based on preset reference points or reference curves; the preset reference points are the locations that need to be referenced in the planning of routes in the first topographic map, and the reference curves are pre-drawn curves. According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and a first target topographic block is determined from the multiple first topographic blocks. The first target topographic block is a first topographic block that includes the curve segment of the initial road curve. Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block. Based on the sub-routes corresponding to all the first target terrain blocks, determine the target route corresponding to the first terrain map; wherein, determining the target route corresponding to the first terrain map based on the sub-routes corresponding to all the first target terrain blocks includes: connecting all the sub-routes corresponding to the first target terrain blocks to obtain an initial route; and smoothing the initial route to obtain the target route corresponding to the first terrain map. The initial route includes multiple nodes, each node being the endpoint of a sub-route corresponding to the first target terrain patch. Smoothing the initial route to obtain the target route corresponding to the first terrain map includes: obtaining the previous and next nodes associated with intermediate nodes, where an intermediate node is any node other than the endpoint of the initial route; determining a first vector and a second vector, where the first vector is the direction vector from the intermediate node to the previous node, and the second vector is the direction vector from the intermediate node to the next node; determining the vector angle between the first vector and the second vector; if the vector angle is not greater than a first preset angle value, adjusting the position of the intermediate node on the first terrain map until the vector angle is greater than the first preset angle value, wherein the route corresponding to the vector angle greater than the first preset angle value is the target route corresponding to the first terrain map.
2. The method according to claim 1, characterized in that, The method further includes: The target route corresponding to the first topographic map is determined as the target route corresponding to the second topographic map.
3. The method according to claim 1, characterized in that, Based on the curve segments contained in the first target terrain patch, route planning is performed on the first target terrain patch to obtain the sub-route corresponding to the first target terrain patch, including: Based on the endpoints of the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
4. The method according to claim 1, characterized in that, Based on the curve segments contained in the first target terrain patch, route planning is performed on the first target terrain patch to obtain the sub-route corresponding to the first target terrain patch, including: Based on the voxel information of the first target terrain block, an anisotropic mesh corresponding to the first target terrain block is constructed; Based on the endpoints of the curve segments contained in the first target terrain block, the start and end points of the sub-route corresponding to the first target terrain block are determined from the nodes of the anisotropic network. Based on the starting point and the ending point, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block.
5. The method according to claim 4, characterized in that, Based on the starting point and ending point, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block, including: Based on the starting point and the ending point, pathfinding processing is performed on the anisotropic network to obtain the sub-route corresponding to the first target terrain block.
6. The method according to claim 5, characterized in that, The weight value of each line segment in the anisotropic network diagram is determined based on the terrain data of the first target terrain block. The step of performing pathfinding processing on the anisotropic network graph based on the start and end points to obtain the sub-route corresponding to the first target terrain block includes: The pathfinding process is performed on the anisotropic network graph based on the starting point and ending point, as well as the weight values of each line segment in the anisotropic network graph, to obtain the sub-route corresponding to the first target terrain block.
7. The method according to claim 1, characterized in that, The step of determining the target route corresponding to the first terrain map based on the sub-routes corresponding to all the first target terrain blocks includes: Connect the starting and ending points of adjacent sub-routes on the first topographic map to obtain the target route corresponding to the first topographic map.
8. The method according to claim 1, characterized in that, The first topographic map includes key points. The step of smoothing the initial route to obtain the target route corresponding to the first topographic map includes: Identify target key points, which are key points that are not on the initial route; Identify the target points on the initial route that correspond to the target key points; The target point is controlled to shift towards the target key point to obtain the target route corresponding to the first terrain map.
9. The method according to claim 1, characterized in that, The initial route includes multiple nodes, where each node is the endpoint of a sub-route corresponding to the first target terrain patch. Smoothing the initial route to obtain the target route corresponding to the first terrain map includes: Determine the target tangent, which is the tangent line passing through the target node of the initial route, and the target node is any one of the nodes; Determine the target angle, which is the angle between the target tangent and the horizontal plane; If the target angle is not less than the second preset angle value, the position of the target node on the first topographic map is adjusted until the target angle is less than the second preset angle value, wherein the route corresponding to the target angle less than the second preset angle value is the target route corresponding to the first topographic map.
10. The method according to claim 1, characterized in that, The initial route includes multiple routes that intersect. Smoothing the initial route to obtain the target route corresponding to the first topographic map includes: Determine the target road segment of the target route, wherein the target route is the route where the intersection is located, and the target road segment is a road segment on the target route that is at a preset distance from the intersection; Determine the target area of the target road segment on the first topographic map; Based on the endpoints of the target road segment, route planning is performed on the target area to obtain the target route corresponding to the first topographic map.
11. The route planning method as described in claim 2, characterized in that, The step of determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes: The initial road curve is mapped onto the second topographic map to obtain the preliminary screening route corresponding to the second topographic map; According to the preset division rules, the second topographic map is divided into multiple second topographic blocks, and a second target topographic block is determined from the multiple second topographic blocks. The second target topographic block is a second topographic block that contains the route segment of the initial screening route. Based on the route segments contained in the second target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block; The target route corresponding to the second topographic map is determined based on the sub-routes corresponding to all the second target terrain blocks.
12. The route planning method as described in claim 2, characterized in that, The step of determining the target route corresponding to the first topographic map as the target route corresponding to the second topographic map includes: According to the preset division rules, the first topographic map is divided into multiple first topographic blocks, and the second topographic map is divided into multiple second topographic blocks. The first topographic blocks and the second topographic blocks correspond one-to-one. The multiple first topographic blocks include a first target topographic block, which is a first topographic block containing the curve segment of the initial road curve. Based on the curve segments contained in the first target terrain block, route planning is performed on the first target terrain block to obtain the sub-route corresponding to the first target terrain block. Based on the endpoints of the sub-route corresponding to the first target terrain block, route planning is performed on the second target terrain block to obtain the sub-route corresponding to the second target terrain block. The second target terrain block is the second terrain block corresponding to the first target terrain block. The target route corresponding to the second topographic map is determined based on the sub-routes corresponding to all the second target terrain blocks.
13. A route planning device, characterized in that, include: An acquisition unit is used to acquire a first topographic map; wherein, acquiring the first topographic map includes: acquiring a second topographic map; resampling the second topographic map using a preset precision resampling coefficient to obtain the first topographic map, wherein the precision of the first topographic map is lower than that of the second topographic map, and the first topographic map and the second topographic map have the same size; The generation unit is used to generate the initial road curve of the first topographic map based on preset reference points or reference curves; the preset reference points are the locations that need to be referenced in the planning of routes in the first topographic map, and the reference curves are pre-drawn curves. The division unit is used to divide the first topographic map into multiple first topographic blocks according to a preset division rule, and to determine a first target topographic block from the multiple first topographic blocks. The first target topographic block is a first topographic block that includes the curve segment of the initial road curve. The planning unit is used to perform route planning processing on the first target terrain block according to the curve segments contained in the first target terrain block, and obtain the sub-route corresponding to the first target terrain block. A determining unit is configured to determine a target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target terrain blocks; wherein, determining the target route corresponding to the first topographic map based on the sub-routes corresponding to all the first target terrain blocks includes: connecting the sub-routes corresponding to all the first target terrain blocks to obtain an initial route; and smoothing the initial route to obtain the target route corresponding to the first topographic map. The initial route includes multiple nodes, each node being the endpoint of a sub-route corresponding to the first target terrain patch. Smoothing the initial route to obtain the target route corresponding to the first terrain map includes: obtaining the previous and next nodes associated with intermediate nodes, where an intermediate node is any node other than the endpoint of the initial route; determining a first vector and a second vector, where the first vector is the direction vector from the intermediate node to the previous node, and the second vector is the direction vector from the intermediate node to the next node; determining the vector angle between the first vector and the second vector; if the vector angle is not greater than a first preset angle value, adjusting the position of the intermediate node on the first terrain map until the vector angle is greater than the first preset angle value, wherein the route corresponding to the vector angle greater than the first preset angle value is the target route corresponding to the first terrain map.
14. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing multiple instructions; the processor loads instructions from the memory to perform the steps in the route planning method as described in any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a plurality of instructions adapted for loading by a processor to perform the steps of the route planning method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Map navigation method and device, storage medium and computer equipment
CN112742030A