Indoor unmanned aerial vehicle dynamic obstacle avoidance method and device, medium and program product
By improving the A* algorithm and node search strategy, and combining 4D mesh coding and directional heuristic pruning, the problems of real-time path planning and dynamic obstacle avoidance for indoor UAVs with tens of millions of meshes were solved, achieving efficient and safe indoor UAV path planning.
Patent Information
- Application Number
- CN202511086323.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-11-21
AI Technical Summary
Existing indoor drone path planning algorithms struggle to meet real-time path planning requirements when dealing with tens of millions of grid cells. Furthermore, dynamic obstacle changes in the indoor environment increase the complexity of path planning, making it difficult to achieve efficient obstacle avoidance.
An improved A* algorithm and node search strategy are adopted, combined with directional heuristic pruning and 4D mesh encoding, to process dynamic obstacles in segments, replan the path locally, and optimize the path planning by combining the cost function of UAV flight constraints and distance penalty.
Achieving millisecond-level path planning in a grid of tens of millions of cells effectively avoids dynamic obstacles, maintains optimal path length and stability, adapts to dynamic changes in the indoor environment, and ensures the efficiency and safety of drone delivery missions.
Smart Images

Figure CN120993932A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, and in particular, to a method and device for dynamic obstacle avoidance of indoor unmanned aerial vehicle, computer readable medium and computer program product. BACKGROUND
[0002] When the unmanned aerial vehicle flies in the complex space-time environment indoors, the flight direction possibility, turning cost and other factors of different unmanned aerial vehicle types need to be considered, so as to more accurately model the flight state of the unmanned aerial vehicle. When the indoor space is modeled in a fine-grained grid, a large amount of grid data brings problems of coding storage and path planning algorithm calculation complexity. The current indoor complex space-time scene modeling based on the grid only meets the indoor dynamic path planning of the order of magnitude of seconds under the order of magnitude of ten thousand grids. When the number of grids is further increased to the order of magnitude of ten million, the algorithm is difficult to meet the real-time path planning requirement.
[0003] In addition, compared with the open outdoor environment, the indoor environment has certain space-time complexity, and there are many narrow spaces and irregular dynamic obstacles, such as the opening and closing of doors and windows, which bring dynamic changes of the scene, and bring challenges to indoor modeling and indoor unmanned aerial vehicle path planning. SUMMARY
[0004] Aspects of the present application provide a method, device, computer readable medium and computer program product for dynamic obstacle avoidance of indoor unmanned aerial vehicle.
[0005] In an aspect of the present application, a method for dynamic obstacle avoidance of indoor unmanned aerial vehicle is provided, wherein the method comprises: obtaining an initial planning path, wherein the initial planning path is obtained by using an improved A-star algorithm and a node search strategy to plan a path, the improved A-star algorithm uses a cost function containing flight constraints and distance penalties, and the node search strategy adopts a directional heuristic pruning; obtaining an obstacle detection result by performing dynamic obstacle detection, wherein the obstacle detection result comprises 4D grid codes corresponding to grid cells where one or more detected dynamic obstacles are located; segmenting the initial planning path based on the 4D grid codes of the one or more dynamic obstacles, and determining one or more target segments in the initial path that need to be re-planned; re-planning the target segments by using the improved A-star algorithm and the node search strategy, and merging the re-planned segments with other segments in the initial planning path to obtain a final path planning result.
[0006] In an aspect of the present application, a device for dynamic obstacle avoidance of indoor unmanned aerial vehicle is provided, wherein the device comprises: An initial path obtaining module is configured to obtain an initial planning path, wherein the initial planning path is obtained by using an improved A-star algorithm and a node search strategy to plan a path, the improved A-star algorithm uses a cost function containing flight constraints and distance penalties, and the node search strategy adopts a directional heuristic pruning; A dynamic obstacle detection module is configured to obtain an obstacle detection result by performing dynamic obstacle detection, wherein the obstacle detection result includes 4D grid codes corresponding to grid cells where one or more detected dynamic obstacles are located. A path segmenting module is configured to segment the initial planning path based on the 4D grid codes of the one or more dynamic obstacles, and determine one or more target segments in the initial path that need to be re-planned.
[0007] A path updating executing module is configured to re-plan the target segments by using the improved A-star algorithm and the node search strategy, combine the re-planned segments with other segments in the initial planning path, and obtain a final path planning result.
[0008] In another aspect of the present application, an electronic device is provided, which includes at least one processor, and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of the embodiments of the present application.
[0009] In another aspect of the present application, a computer readable storage medium is provided, which stores computer program instructions executable by a processor to implement the method of the embodiments of the present application.
[0010] In another aspect of the present application, a computer program product is provided, which includes a computer program executable by a processor to implement the method of the embodiments of the present application.
[0011] In the scheme provided in the embodiments of the present application, an indoor unmanned aerial vehicle dynamic obstacle avoidance algorithm is provided, which effectively deals with sudden dynamic obstacles in an indoor environment, such as a person or a door that is suddenly opened. The dynamic obstacle avoidance algorithm segments the original path according to obstacles, filters out the path segments that need to be re-planned, and then determines a new starting point before the obstacle and a safe target point after the obstacle according to the re-planned path segments, to achieve local path re-planning by using an improved A-star path planning algorithm. Finally, the local re-planned path and the front and rear segments of the original path are spliced to achieve path adjustment during dynamic obstacle avoidance, which significantly improves the algorithm performance of unmanned aerial vehicle end delivery. The dynamic obstacle avoidance algorithm can maintain the optimality of the path length and the stability of the overall path while avoiding obstacles dynamically, and has good adaptability to the appearance of dynamic obstacles or dynamic changes in the scene in the indoor environment, thereby effectively ensuring the efficiency and safety of indoor delivery tasks of the unmanned aerial vehicle. In the embodiments, the improved A-star algorithm is used for path planning. On the basis of the traditional A-star algorithm, the flight constraints of the unmanned aerial vehicle and the distance penalty are introduced to improve the cost function, the direction-priority heuristic pruning strategy is adopted, and the priority queue and the open dictionary are introduced to optimize the data structure. The flight characteristics of the multi-rotor unmanned aerial vehicle are fully incorporated into the cost function, so that the path planning is more suitable for the actual flight capability of the unmanned aerial vehicle, and ten-millisecond-level path planning is achieved under a million-grid cell map. In the node search process, the direction heuristic pruning is performed on the node expansion, which solves the problem of a large number of node expansions caused by multi-directional search, reduces the search space, and improves the search efficiency. BRIEF DESCRIPTION OF DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0013] Other features, objects and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments, which is made with reference to the accompanying drawings: Figure 1 A flowchart of a method for indoor unmanned aerial vehicle dynamic obstacle avoidance provided by the embodiments of the present application is shown; Figure 2 A schematic diagram of an example indoor partition type time 4D grid encoding structure and bit field allocation according to the present application is shown; Figure 3 A flowchart of planning an initial planning path by using an improved A-star algorithm and node search strategy of the embodiments of the present application is shown; Figure 4A schematic diagram of a 26-neighborhood of an exemplary UAV according to the present application is shown, as well as a schematic diagram of a grid occupancy after flight; Figure 5 A structural schematic diagram of an apparatus for dynamic obstacle avoidance of an indoor UAV provided by an embodiment of the present application is shown; Figure 6 A structural schematic diagram of an apparatus suitable for implementing the scheme in an embodiment of the present application is shown.
[0014] The same or similar reference signs in the drawings represent the same or similar components. DETAILED DESCRIPTION
[0015] To make the objectives, technical schemes and advantages of the embodiments of the present application clearer, the technical schemes in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0016] In a typical configuration of the present application, the devices of the terminal and the service network each include one or more processors (CPU), input / output interfaces, network interfaces and memories.
[0017] The memory can include a non-permanent memory in a computer readable medium, random access memory (RAM) and / or non-volatile memory such as read only memory (ROM) or flash memory (flash RAM). The memory is an example of the computer readable medium.
[0018] The computer readable medium includes permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. The information can be computer program instructions, data structures, program modules or other data. Examples of the storage medium of the computer include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information accessible to a computing device.
[0019] Figure 1A flowchart of a method for dynamic obstacle avoidance of an indoor unmanned aerial vehicle is shown. The method comprises at least steps S101, S102, S103 and S104.
[0020] In actual scenarios, the execution subject of the method can be a computer device, or an application program running on the computer device. The computer device includes a user device or a network device. The user device includes, but is not limited to, computers, mobile phones, tablets, smart watches, wristbands and various terminal devices, and the network device includes, but is not limited to, network hosts, single network servers, multiple network server sets or computer sets based on cloud computing, etc. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, wherein cloud computing is a kind of distributed computing, and a virtual computer is composed of a group of loosely coupled computer sets.
[0021] In some embodiments, the execution subject of the method is a terminal or a server providing unmanned aerial vehicle route planning services. In some embodiments, the route planning method of the present application can be realized by computer programs or executable instructions running on terminals or servers. These programs or instructions can be operating system native programs (such as dedicated route planning programs), software modules, or modules embedded in other programs (such as instant messaging, photo albums, electronic maps, navigation clients, etc.). It can also be a locally installed application (APP).
[0022] The embodiments of the present application provide an indoor subdivision type 4D encoding model, define the space-time relationship of the subdivision type 4D grid and its calculation, and combine the flight dynamics characteristics of the multi-rotor unmanned aerial vehicle which is the most widely used in current end-to-end logistics distribution application, optimize the overall cost function, and adopt a directional heuristic search strategy and optimize the data structure when searching nodes, to propose an improved A-star path planning algorithm for a certain time slice, which is used for 3D path planning between space grid cells in the same 1D time coding of the subdivision type.
[0023] In the present embodiment, the subdivision type 4D encoding model is a subdivision type 4D grid encoding model for indoor complex space-time environment. The basic unit of the subdivision type 4D encoding model is a grid cell, each cell contains three-dimensional space information and one-dimensional time information, which together maps the space-time information of the physical space to the grid coding of the virtual space.
[0024] In some embodiments, the subdivision type 4D encoding model adopts GeoSOT (Geographical coordinate Subdivision grid with One dimension integral coding on The GeoSOT-3D spatial subdivision framework and the BDTime Code 1D time subdivision framework are combined to realize efficient and unified spatiotemporal computation.
[0025] In the scene of unmanned aerial vehicle intelligent distribution, spatiotemporal data organization and retrieval of indoor dynamic complex environment pay great attention to spatial position and time attribute of obstacles, and positioning and path planning of the unmanned aerial vehicle also need unique spatiotemporal coding support to complete obstacle avoidance. Therefore, the combination of the GeoSOT-3D spatial subdivision framework and the BDTime Code 1D time subdivision framework is very suitable for the scene requirement and can realize efficient and unified spatiotemporal computation.
[0026] For indoor uncertain dynamic obstacles, if the obstacles appear on the original global planning path, the spatial 3D coding of the spatiotemporal cell on the original planning path remains unchanged, but the time 1D coding of the spatiotemporal cell is the same as the time coding corresponding to the dynamic obstacle. For such a dynamic scene, in order to avoid the route change and time overhead caused by applying the improved A-star path planning algorithm again in front of the obstacle, the indoor unmanned aerial vehicle dynamic obstacle avoidance algorithm is proposed. The original path is segmented according to the obstacle, the segment path that needs to be re-planned is selected, the new starting point in front of the obstacle and the safe target point behind the obstacle are determined according to the re-planned path segment, the improved A-star path planning algorithm is used to realize local path re-planning, and finally the local re-planned path and the front and rear segments of the original path are spliced to realize path adjustment in dynamic obstacle avoidance.
[0027] Reference Figure 1 In step S101, an initial planning path is obtained, the initial planning path is obtained by using an improved A-star algorithm and a node search strategy to plan a path, the improved A-star algorithm uses a cost function containing flight constraints and distance penalties, and the node search strategy adopts a directional heuristic pruning.
[0028] The improved A-star algorithm and the node search strategy implemented by the present application, and the process of path planning based on the improved A-star algorithm and the node search strategy will be described below with reference to the part shown in Figure 3
[0029] In step S102, by performing dynamic obstacle detection, an obstacle detection result is obtained, the obstacle detection result including a 4D grid code corresponding to a grid cell pair where one or more detected dynamic obstacles are located.
[0030] The 4D grid code is used to uniquely identify an indoor grid cell. The basic unit of the 4D coding model is a grid cell, each grid cell containing three-dimensional space information and one-dimensional time information, which collectively maps the space-time information of a physical space into a grid code in a virtual space.
[0031] The grid cell refers to the smallest addressable space-time unit obtained by recursive subdivision under an indoor-outdoor integrated coordinate framework. The three-dimensional scale of the grid cell is determined by a spatial resolution of centimeter or millimeter level, and the time scale is determined by a time resolution of microsecond level, so that each grid cell has a unique spatial code and a unique time code.
[0032] The method determines the time subdivision range of the indoor space-time subdivision range according to the characteristics of the indoor environment of the building, the indoor positioning accuracy requirement, and the maximum endurance time of the unmanned aerial vehicle and the instant delivery requirement.
[0033] The maximum endurance time of the unmanned aerial vehicle refers to the longest time that the unmanned aerial vehicle can continuously fly in a full power state. The instant delivery requirement refers to the requirement to complete the delivery of goods within a certain time. For example, for emergency medical material delivery, delivery may need to be completed within a few minutes. The path planning time consumption refers to the time required to plan an optimal path from a starting point to an ending point. The minimum scale grid flight time consumption refers to the time required for the unmanned aerial vehicle to fly once in the minimum scale grid. These factors jointly determine the division accuracy and coverage range of the time grid.
[0034] Currently, indoor path planning of unmanned aerial vehicles can achieve millisecond-level planning. Combined with the highest speed of currently statistical small and medium-sized multi-rotor unmanned aerial vehicles, which is more than 40 meters per second, and the minimum grid size of 3.75 millimeters, the shortest time for the unmanned aerial vehicle to pass through a single grid is also in the millisecond level. Based on this, the 25th level (time granularity of 128 microseconds) of the precise time recording type Beidou subdivision time code is selected as the 26th level grid of the indoor subdivision type 1D grid code in the embodiments of the present application.
[0035] The 4D grid code structure is a triple, including a 3D space grid code, a 1D time grid code, and a passing attribute code. The passing attribute code is used to identify the occupancy state of the dynamic obstacle, i.e., whether it is passable. According to an implementation, the passing attribute code is 0 or 1, 0 indicating passable and 1 indicating impassable.
[0036] According to one embodiment, the 4D grid coding structure is designed based on the GeoSOT-3D spatial partitioning framework and the Beidou 1D time partitioning framework, as shown in Figure 2 Referring to Figure 2 , the indoor partitioning type 4D coding structure is constructed in a triple structure, the longest code element length is 61 bits, and is stored in the structure of "{indoor partitioning type spatial 3D grid coding, indoor partitioning type time 1D grid coding, passable attribute coding}". Each grid cell has a unique spatial and time coding, and the simplified 0 / 1 coding can record the passable attribute information of the grid, where 0 represents passable and 1 represents impassable. The structure can efficiently describe the indoor dynamic space-time environment, and the passable attribute coding can effectively record the grid occupation of the obstacle, fully reflecting the "situation" information and providing data foundation support for real-time path planning of the unmanned aerial vehicle.
[0037] According to one example, continuing to refer to the coding structure shown in Figure 2 , the process of obtaining the mathematical expression of the 4D grid coding of each grid cell is as follows: The 4D grid cell is defined using a mathematical expression set. The indoor spatial 3D grid coding set can be represented as: (1) Wherein, represents the complete set of indoor spatial partitioning type spatial 3D grid coding of a certain building. N represents the total number of grid cells.
[0038] Next, the indoor time 1D grid coding set can be represented as: (2) Wherein, represents the complete set of partitioning type time 1D grid coding of the unmanned aerial vehicle during the flight in the indoor space of a certain building, and M represents the number of discrete time periods.
[0039] Accordingly, the indoor partitioning type 4D coding can be represented as: (3) Wherein, represents the spatial 3D coding of the kth grid cell, represents the time 1D coding of the kth grid cell at a certain time (or time period), represents the passable attribute coding (0 represents passable for the unmanned aerial vehicle, and 1 represents impassable).
[0040] The coding set of the space-time grid cell in the building is represented as: (4) Wherein, in order to maintain the uniform format, there are P grid cells in total, and each cell is stored in the highest 61 binary one-dimensional grid code.
[0041] According to an embodiment, the method describes the dynamic grid situation at any moment in time slice form based on the 4D grid code of each grid cell.
[0042] Based on the foregoing example, the indoor space-time slice at a certain moment is obtained, and the dynamic grid situation at time t can be expressed as: (5) Among them, represents all grid cells that have "spatiotemporal changes" and their passing attributes at time slice t.
[0043] Among them, the dynamic obstacle includes various uncertain obstacles in the indoor environment, such as the opening and closing of doors and windows, which brings dynamic changes to the scene, moving personnel, flying objects, etc. If the dynamic obstacle appears on the original global planning path, that is, the spatial 3D code of the grid cell corresponding to the original planning path does not change, but the time 1D code is the same as the time code corresponding to the dynamic obstacle.
[0044] Among them, the dynamic obstacle detection method includes but is not limited to using sensors to detect or using image processing technology to monitor object motion in the environment in real time.
[0045] According to an embodiment, a dynamic obstacle set is generated based on the detected dynamic obstacles. In the dynamic obstacle set, each obstacle is represented by the 4D grid code of the spatiotemporal cell it is in. These 4D grid codes can accurately describe the position of each dynamic obstacle in time and space.
[0046] For example, the obstacle coordinates can be obtained by UWB positioning tags, combined with the YOLOv5 model to identify the moving human body contour, and the coordinates and timestamps are mapped to 4D grid codes.
[0047] Continue to refer to Figure 1 In step S103, based on the 4D grid code of the one or more dynamic obstacles, the initial planning path is segmented, and one or more target sections in the initial path that need to be re-planned are determined.
[0048] According to an embodiment, step S103 includes steps S1031 to S1033.
[0049] In step S1031, based on the 4D grid code of the one or more dynamic obstacles, the distance between the path points in the original planning path and each dynamic obstacle is calculated, and whether the safe close distance condition is met is evaluated.
[0050] Specifically, when determining whether the distance between the path point and any obstacle is greater than or equal to a preset safety distance threshold, if yes, it is determined that the path point meets the safety distance condition.
[0051] In step S1032, based on the safety distance evaluation result of the path point, the safety start point index, the safety end point index, and the local re-planning end point index are determined. The safety start point index is the last point before the obstacle that meets the safety distance condition, and the safety end point index is the first point after the obstacle that meets the safety distance condition.
[0052] The local re-planning end point index is the smaller one of the safety end point index plus the smooth extension length (K) and the total path length (N), so as to avoid the problem of index out of bounds. The smooth extension length K refers to taking K points after the safety point to ensure smooth connection of the path.
[0053] In step S1033, based on the safety start point index and the local re-planning end point index, one or more target road segments in the initial path that need to be re-planned are determined.
[0054] Specifically, the original path is divided into multiple paragraphs according to the safety start point index and the local re-planning end point index, and the affected paragraph (i.e., the part that needs to be re-planned) is marked as a target road segment for subsequent local path re-planning.
[0055] According to the first example of the present application, the initial planning path is denoted as: (6) wherein, represents the original global path, which consists of N+1 discrete 4D grid cells. represents the 4D grid code corresponding to the i-th grid cell. represents the 4D grid code corresponding to the i-th grid cell.
[0056] When detecting that the spatial distance between the index and the time 1D code of the dynamic obstacle is less than the threshold, it is necessary to ensure that both the start point and the end point of the re-planning meet the safety distance.
[0057] The calculation steps of the safety start point index, the safety end point index, and the local re-planning end point index in this example are as follows:
[0058] wherein, is the set of detected dynamic obstacles, and each obstacle represents the 4D grid code corresponding to the grid cell where the obstacle is located. represents the Manhattan distance metric, and the Manhattan distance between any two grid cells is calculated based on formula (11) in the following. is a safety distance threshold, when the distance between a path point and any obstacle is greater than or equal to , it is considered "safe". is a smooth extension length, taking points after the safety point to ensure smooth connection of the path. is a safety start index, the last point before the obstacle that meets the safety distance condition. is a safety end index, the first point after the obstacle that meets the safety distance condition. is a local replanning end index, taking to avoid border crossing.
[0059] Then, the original path is divided into three segments according to the indexes and (the first point after the safety end).
[0060] Among them, is the reserved segment of the original path, from the start point to the point before the safety start point. is the middle segment affected by the dynamic obstacle, from the safety start point to the local replanning end point after the extended length of the safety end point. is the reserved segment from the local replanning end point to the final end point.
[0061] Based on the algorithm in the above example, in actual application scenarios, for example, when a door closing (as a dynamic obstacle occupies the path point , the safety start point (2 meters in front of the door), the safety end point (1 meter behind the door), the extension length K=3, and the replanning segment is obtained by bypassing the door and smoothly splicing with the original path , , thereby obtaining the obstacle-avoiding path.
[0062] In step S104, the improved A-star algorithm and node search strategy are used to re-plan the target road segment, and the re-planned road segment is combined with other road segments in the initial planning path to obtain the final path planning result.
[0063] Specifically, the improved A-star algorithm and node search strategy are used to re-perform path planning on the one or more target road segments to obtain an updated road segment corresponding to each target road segment; then, the obtained one or more updated road segments are combined with other road segments outside the target road segments in the initial planning path to obtain the final path planning result.
[0064] Among them, the final path planning result has real-time obstacle avoidance capability while maintaining the global path optimality, and can effectively avoid all detected dynamic obstacles.
[0065] Continue to illustrate the first example, only the middle segment Call GeoIndoor4D-A algorithm for local re-planning, get new segment , then spliced to get the final path : (9)
[0066] Among them, GeoIndoor4D-A algorithm is an improved A-star algorithm based on the embodiments of the present application, which will be described later with reference to Figure 3 part. Indoor4D-A algorithm is executed path planning algorithm search, return path list. Indoor4D-A . is the final path after merging, only the affected interval is re-planned, and the rest remains unchanged.
[0067] The method of the embodiments of the present application provides an indoor unmanned aerial vehicle dynamic obstacle avoidance algorithm, which effectively deals with sudden dynamic obstacles in the indoor environment, such as sudden appearance of people or opening of doors. The dynamic obstacle avoidance algorithm segments the original path according to the obstacles, filters out the segment that needs to be re-planned, then determines the new starting point before the obstacle and the safe target point after the obstacle according to the re-planned path segment, and uses the improved A-star path planning algorithm to realize local path re-planning. Finally, the local re-planned path and the front and rear segments of the original path are spliced to realize path adjustment during dynamic obstacle avoidance, which significantly improves the algorithm performance of unmanned aerial vehicle end delivery. The dynamic obstacle avoidance algorithm can maintain the optimality of the path length and the stability of the overall path while avoiding obstacles dynamically, and has good adaptability to the appearance of dynamic obstacles in the indoor environment or dynamic changes in the scene, thereby effectively guaranteeing the efficiency and safety of indoor delivery tasks of unmanned aerial vehicles.
[0068] Figure 3 shows a flowchart of using the improved A-star algorithm and node search strategy of the embodiments of the present application to plan the initial planning path. The flowchart includes steps S301 to S303.
[0069] Referring to Figure 3In step S301, in response to the path planning instruction of the UAV in the indoor environment, the 4D grid code corresponding to the start position and the end position of the UAV is obtained.
[0070] The indoor environment includes indoor environments of various single buildings. For example, office buildings, shopping malls, airport terminals, hospitals, factory buildings, warehouses, residential buildings, hotels, sports venues, and other building structures with indoor space.
[0071] In step S302, based on the UAV position and the obstacle position, the collision risk is evaluated by space-time relationship calculation, which includes spatial relationship and temporal relationship.
[0072] The spatial relationship refers to the relative position relationship between two grid body elements, including intersection, adjacency, and separation. The temporal relationship refers to whether the time codes of two grid body elements are equal, i.e., whether they are on the same time level.
[0073] According to an embodiment, the rules for evaluating the collision risk based on the UAV position and the obstacle position by space-time relationship calculation include: If the space-time relationship of the two is spatial intersection, a collision conflict will occur between the UAV and the obstacle; If the space-time relationship of the two is spatial adjacency, there is a collision risk between the UAV and the obstacle; If the space-time relationship of the two is spatial separation, the UAV can safely pass through without additional obstacle avoidance; If the two are on the same fixed time level and spatially satisfy intersection, it is determined as a space-time conflict. Wherein, being on the same fixed time level means being at the same time.
[0074] According to an embodiment, the grid body element is constructed by recursive bisection in three dimensional directions, and the octree encoding order is adopted, so that when each octal one-dimensional code is converted to binary three-dimensional code, the corresponding three codes represent longitude (L), latitude (B), and height (H) in three directions.
[0075] By the parent-child relationship between the space grid body elements, by intercepting the prefix of the fine-grained grid code, it is judged whether the prefix is the same as the coarse-grained grid code to define intersection. When two space grid body elements are on the same level, by the coding distance on a single dimension being 0, equal to 1 and greater than 1, it can be judged whether the grid body elements on a single dimension are the same, adjacent or separated. When two space grid body elements are not on the same level, reference can be made to the judgment of intersection, the fine-grained grid prefix is first intercepted and converted to the same parent grid level, and then the grid codes on the same level are subtracted for judgment.
[0076] According to an embodiment, the step S302 comprises steps S3021 to S3024.
[0077] In step S3021, the three-dimensional space coordinates and time stamp of the current position of the unmanned aerial vehicle are acquired.
[0078] Embodiments of the present application can acquire the position of the unmanned aerial vehicle in various ways. For example, through the Ultra Wide Band positioning technology (UWB), by mounting an UWB positioning tag on the unmanned aerial vehicle, and deploying multiple UWB positioning base stations within the space range, the flight position of the unmanned aerial vehicle is accurately determined.
[0079] In step S3022, according to the pre-constructed octree grid index, the three-dimensional space coordinates and time stamp are respectively converted into corresponding 4D grid cell encoding and time level encoding.
[0080] In step S3023, the obstacle space-time position information is acquired, the obstacle space-time information includes the three-dimensional space coordinates of one or more target obstacles in the indoor environment and the time stamp corresponding to the motion trajectory, and the three-dimensional space coordinates and time stamp are respectively converted into corresponding 4D grid cell encoding and time level encoding.
[0081] In step S3024, taking the uniform space level and time level as the reference, the space-time relationship calculation is performed on the grid cells of the unmanned aerial vehicle and the one or more target obstacles, the spatial relationship (intersection / adjacent / separated) and the time relationship (whether the time encoding is equal) of the two are obtained, and then the collision risk is evaluated.
[0082] The above space-time relationship is expressed below in conjunction with an exemplary mathematical expression, and the symbol expression of the grid encoding is defined, which specifically includes: In the split-type space 3D encoding, the longitude, latitude, and height one-dimensional binary encoding under the level is used, and in the split-type time 1D encoding, the 1D time encoding under the fixed time level v is used. The expression "prefix" operation is expressed as , which means taking the high bit prefix (1 to 26 bits) of the indoor grid encoding (representing the indoor 3D grid code of a building) in the split-type 4D grid encoding or the 26-bit MTC encoding in the split-type time 1D grid encoding. In order to judge the adjacent or separated relationship, ΔL, ΔB, and ΔH are defined to represent the integer difference of the space cell in each dimension encoding under the same level.
[0083] The determination methods corresponding to the three spatial relationships (spatial intersection, spatial adjacency, and spatial separation) and the time relationship (time equality) between the grid cells include: 1) Spatial intersection: If there are two levels that satisfy: and and , then the three-dimensional encoding of the fine-grained three-dimensional grid s 1 is the high-bit prefix of the fine-grained three-dimensional grid s 2 encoding, indicating that the fine grid is completely contained within the coarse grid. The two constitute a "parent-child" relationship, and geometrically, the cells overlap, which needs to be determined as a collision conflict.
[0084] 2) Spatial adjacency; If there are levels that satisfy: , , , then the following conditions are met: When (Δ L ,Δ B ,Δ H )∈{(1,0,0),(0,1,0),(0,0,1)}, they are face-adjacent; When (Δ L ,Δ B ,Δ H )∈{(1,1,0),(0,1,1),(1,0,1)}, they are edge-adjacent; When (Δ L ,Δ B ,Δ H )=(1,1,1), they are point-adjacent.
[0085] 3) Spatial separation; If there are levels that satisfy: and and and not simultaneously equal, meaning that the three-dimensional encoding is at least 2 grid widths apart in longitude, latitude, or height, then it is determined as spatially separated.
[0086] 4) Time equality; If two grid cells are in the same fixed time level ν , i.e., "simultaneous time", and their time encoding satisfies , then it is determined as time equal.
[0087] In the embodiments of the present application, the spatio-temporal relationship calculation includes spatial orientation calculation and spatial distance calculation, which will be described below.
[0088] 1) Spatial orientation calculation; In the spatial 3D grid coding system, the coding inherits from the GeoSOT-3D spatial subdivision framework, and adopts the octree Z-order subdivision method. This subdivision method naturally brings order between the grid codes, and the orientation relationship between the corresponding grid cells can be directly derived according to the coding order, which provides great convenience for the organization and analysis of three-dimensional spatial data.
[0089] Under the octree Z-order subdivision framework, each bit of the three-dimensional code is written in the order of "longitude L → latitude B → height H", and follows the rule of high bit first and low bit last. When the relative orientation of two cells needs to be determined, if the two grid cells are at the same level s, the corresponding bit values of the two cells can be compared from high to low, so as to accurately determine their relative orientation relationship in the x, y and z axes. If the levels of the two grid cells are different, the common prefix level s_min is intercepted first, and then the bit comparison is carried out based on this, which is consistent with the cross-level adjacent determination idea mentioned in the foregoing.
[0090] Taking the coding sequence of the northeast hemisphere as an example, the mapping relationship between the bit difference and the orientation is as follows: in the longitude L bit, if the coding difference is 0, it means that the grid cell is located on the west side; if the coding difference is 1, it means that it is located on the east side. In the latitude B bit, the coding difference of 0 means the south side, and the coding difference of 1 means the north side. In the height H bit, the coding difference of 0 means the lower layer, and the coding difference of 1 means the upper layer. This orientation determination method based on coding bit difference is simple and efficient, which can quickly and accurately determine the spatial position relationship between the grid cells, and provides strong support for the processing and analysis of three-dimensional spatial data.
[0091] 2) Spatial distance calculation; The embodiments of the present application select a multi-rotor unmanned aerial vehicle commonly used in unmanned aerial vehicle terminal logistics distribution as the flight modeling object. The multi-rotor unmanned aerial vehicle has the characteristics of flexibility and vertical lift, and has 6 degrees of freedom, including yaw (Yaw), pitch (Pitch), roll (Roll), surge (Surge), sway (Sway) and heave (Heave).
[0092] In order to more accurately simulate the movement characteristics of the multi-rotor unmanned aerial vehicle, the present application sets 26 extensible grid neighborhoods for the multi-rotor unmanned aerial vehicle. These neighborhoods include 8 horizontal directions, 8 upward directions, 8 downward directions and 2 pure vertical directions.
[0093] Among them, the 8 horizontal directions include north (N), northeast (NE), east (E), southeast (SE), south (S), southwest (SW), west (W) and northwest (NW). The 8 upward directions include upper north (UN), upper northeast (UNE), upper east (UE), upper southeast (USE), upper south (US), upper southwest (USW), upper west (UW) and upper northwest (UNW). The 8 downward directions include lower north (DN), lower northeast (DNE), lower east (DE), lower southeast (DSE), lower south (DS), lower southwest (DSW), lower west (DW) and lower northwest (DNW). The 2 pure vertical directions include up (U) and down (D). This neighborhood setting can cover all possible moving directions of the UAV in the three-dimensional space, making the flight path closer to the actual situation. Referring to Figure 4 , the UAV is located at the center grid body element and has a vertical downward flight trend. The 26-neighborhood of the UAV and the grid occupation after flight are shown in Figure 4
[0094] The distances commonly used in spatial calculation include Manhattan distance, Euclidean distance, Chebyshev distance and diagonal distance. In the subsequent algorithm of the embodiments of the present application, considering that the turning cost of the UAV is large, the UAV is preferentially kept moving in a straight line when designing the UAV algorithm, which actually moves according to the calculation direction of the Euclidean distance. However, the calculation of the Euclidean distance involves square sum and square root operations, which is difficult to directly express through bit operations of grid coding, which will increase the calculation complexity in actual algorithm implementation.
[0095] The embodiments of the present application adopt a combination of diagonal distance and Manhattan distance to improve the heuristic function. Diagonal distance can effectively handle diagonal movement, while Manhattan distance is suitable for horizontal and vertical movement. By combining these two distance measurement methods, the present application can more accurately simulate the flight path of the UAV while ensuring calculation efficiency, thereby optimizing the path planning algorithm of the logistics distribution and improving the distribution efficiency and accuracy.
[0096] For a point in a three-dimensional space, the calculation formulas of the diagonal distance and the Manhattan distance are as follows:
[0097] The above formulas only use addition and multiplication operations in mathematical algebra, and do not involve square sum and square root operations of the Euclidean distance, so the calculation speed is fast.
[0098] In the spatial grid coding system, in order to efficiently calculate the spatial distance between any two grid cells, the application proposes a spatial distance calculation method based on grid coding. This method converts mathematical algebraic calculation into binary bit operation, avoiding the complex square sum and square root operation in Euclidean distance calculation, thereby significantly improving the calculation speed. This method is particularly suitable for scenarios based on subdivision type spatial 3D coding, and can quickly calculate the diagonal distance and Manhattan distance.
[0099] Specifically, the spatial distance calculation method between any two grid cells is defined by an algorithm, which converts the mathematical algebraic calculation of the formula into a single dimension binary bit operation of the subdivision type spatial 3D coding at different levels , which is much faster than floating point operation, further accelerating the distance calculation speed.
[0100] According to an embodiment, the input parameters of the algorithm include two spatial grid codes and , and their corresponding grid scales and . The output of the algorithm is the diagonal distance and the Manhattan distance , and the flow of the algorithm includes: First, the algorithm will unify the length of the two grid codes. If i j, then left shift j i bits; if i j, then left shift i j bits. This step ensures that the two codes have the same length in subsequent calculations; Next, the algorithm calculates the number of bits L at each level and sets it to max(i,j). Since each level of coding consists of 3 bits, L represents the total number of levels;
[0101] Next, the algorithm splits each grid code into three single-dimensional codes, corresponding to height (H), latitude (B), and longitude (L). By looping through each level, the coding values of each dimension are extracted and stored in the corresponding variables. The purpose of this step is to decompose the three-dimensional space coding into three independent dimensions, which facilitates subsequent bit operations; After completing the coding split, the algorithm calculates the grid index difference of each dimension. Specifically, the coding difference of longitude, latitude, and height dimensions , and is calculated. These differences are obtained through binary operation, ensuring efficient calculation; Next, the algorithm selectsthe minimum of the three dimensional differences as the final distance scale ; Finally, the algorithm calculates the diagonal distance and Manhattan distance; wherein the diagonal distance takes the minimum of the three dimensional differences and multiplies it by the scale ; the Manhattan distance is to add the three dimensional differences and multiply it by the scale Scale.
[0102] The following will continue to be described Figure 3 , in step S303, based on the evaluation results, using the improved A-star algorithm and node search strategy to plan the path, to get the initial planning path. Among them, the improved A-star algorithm uses the cost function containing flight constraints and distance penalty, and the node search strategy adopts the direction heuristic pruning.
[0103] According to an embodiment, the embodiments of the application realize ten-millisecond-level path planning under ten-million-grid cell map by using the cost function containing flight constraints and distance penalty in the improved A-star algorithm, pruning the node expansion in the direction heuristic, and using the priority queue and the data structure of the open dictionary.
[0104] Among them, the node in the improved A-star algorithm of the embodiments of the application corresponds to the grid cell.
[0105] Among them, the cost function containing flight constraints and distance penalty, the way of node search strategy adopting direction heuristic pruning, and the data structure of priority queue and open dictionary will be described below.
[0106] Specifically, the step S303 further includes steps S3031 to S3034.
[0107] In step S3031, under a certain time slice, starting from the starting position of the unmanned aerial vehicle, the 3D path planning is performed according to the improved cost function and node search strategy which introduces the flight constraints and distance penalty of the unmanned aerial vehicle. Among them, a certain time slice means the same moment of 1D time coding between grid cells.
[0108] In step S3032, the node with the minimum cost is taken out from the priority queue as the current node, and it is judged whether the current node is the end point, if yes, the search is ended and the path is backtracked; otherwise, the neighborhood nodes of the current node are expanded.
[0109] In step S3033, for each neighborhood node, the cost function value thereof is calculated, and it is determined whether to add it to the priority queue and the open dictionary according to the direction heuristic search strategy and pruning rules.
[0110] In step S3034, the above steps are repeated until the end point is found or the priority queue is empty.
[0111] The traditional A* algorithm is a heuristic search method that quickly finds a path from the start to the end by combining the actual cost and the heuristic estimated cost. The overall cost function of the A* algorithm is: (12) wherein, represents any node grid encountered by the algorithm during the airspace search process, is the overall cost function of the node , representing the cost of the best path from the initial grid to the target grid. is the actual cost function, representing the actual cost from the start to the node , is the heuristic cost function, representing the heuristic minimum estimated cost from the node to the end. The A algorithm is set to continuously search from the initial grid, so the cost value of the current grid is constantly less than that of the previous grid, which means , by constantly reducing the value of the cost function, the final grid is reached with the lowest cost, i.e. the optimal path is searched.
[0112] The embodiments of the present application improve the overall cost function shown in formula (12), introducing weight coefficients and into the overall cost function to balance the actual cost and the heuristic cost. The improved evaluation function is defined as: (13) wherein, represents the weight of the actual cost function , represents the weight of the heuristic cost function . When , the algorithm will behave more "greedy", i.e. more inclined to explore towards the target direction. This "greedy" behavior helps to speed up the path planning, but may sacrifice the optimality of the path to some extent. By reasonably adjusting the values of and , the best balance between algorithm efficiency and path quality can be found.
[0113] The actual cost function and the heuristic cost function of the embodiments of the present application are described below.
[0114] 1) Actual cost function
[0115] Actual cost function The complete expression is:
[0116] in, This indicates the transition from the previous mesh element to the next mesh element. The actual cost, Indicates that the drone is in The spatiotemporal volume element in which the path is located during step planning. Indicates by the first The flight direction is determined by the path planning. It is initialized to 0, representing the actual cost at the starting point. This represents the distance penalty function.
[0117] According to one embodiment, the actual cost from the previous mesh element to the current mesh element i is... Defined as: (15) in, This indicates the cost differences associated with different drone movement patterns. Indicates two adjacent grids and The distance between them. According to the definition of spatiotemporal relationships in embodiments of this application, adjacent surfaces... When edges are adjacent When angles are adjacent Because multi-rotor drones have vertical take-off and landing characteristics, the cost of vertical up-and-down flight and straight flight is the lowest, followed by the cost of horizontal turning, while the cost of climb / dive and diagonal up-and-down flight is the highest.
[0118] Table 1 below lists the directional costs from one mode of motion to another in the embodiments of this application. The corresponding multi-rotor UAV motion direction and its explanation are provided.
[0119] Table 1
[0120] The cost values in Table 1 are based on experiments on the turning energy consumption of multi-rotor UAVs.
[0121] According to one embodiment, the A* algorithm of this application calculates the first... After the actual cost function is calculated following the path planning, the current grid cell element is then calculated. Manhattan distance from the destination The calculation formula between any two mesh elements is shown in formula (11). When , which means that the UAV is farther away from the goal after moving, a small distance penalty term is added to the actual cost function, otherwise not. The expression of the distance penalty term is:
[0122] Based on the formula (15), when the UAV is far away from the goal ( ), the distance penalty term increases .
[0123] 2) Heuristic cost function
[0124] The complete expression of the heuristic cost function of the embodiment of the present application is: (17) (18) Wherein, represents the space-time cell where the UAV is at the step of path planning, and respectively represent the single-axis moving distance and the diagonal distance of the cell from the goal. The involved in the calculation process is the distance difference between the space-time cell and the goal cell in the three dimensions of longitude, latitude and height. represents the direction penalty function.
[0125] Wherein, in the actual physical meaning, , which is generally used in grid maps or coding systems, represents the minimum number of cells that need to be crossed in each direction, here represents the number of steps that can be advanced along the diagonal direction, that is, how many steps can be taken in a way of moving in three directions at the same time. represents the Manhattan distance minus three times the diagonal distance, which can be understood as the number of steps of moving in a single axis to some extent. The combination of is an approximation of the Euclidean distance, when , or when one or two dimensions are 0 (pure plane or pure straight line case), is equal to the Euclidean distance; in other mixed cases, is slightly larger than the Euclidean distance.
[0126] In the algorithm, the Euclidean distance is not used as the distance calculation reference in the heuristic cost function, but the diagonal distance and the Manhattan distance The two calculation formulas are shown in formulas (6) and (7). The two distances are only designed for simple addition and subtraction calculation and maximum value taking in calculation, and can be efficiently realized by bit operation of three-dimensional binary grid coding (bit shift, bit splicing, binary subtraction), which is much more efficient than the operation of Euclidean distance requiring square and square root floating point number. The improved A-star algorithm based on the embodiment greatly shortens the calculation time of the heuristic cost function design.
[0127] wherein, The direction penalty term includes a height change penalty and a turning penalty, and needs to consider the cost of the change of flight direction of the multi-rotor unmanned aerial vehicle when flying to the path search. The calculation formula is:
[0128]
[0129] wherein, represents the distance difference between the space-time body element and the terminal body element in the height dimension, the actual cost function is taken as the weight.
[0130] The direction penalty term applies a smaller penalty coefficient to the height change caused by the vertical lifting of the multi-rotor unmanned aerial vehicle, and applies a slightly larger penalty coefficient to the change of flight direction caused by turning, which is consistent with the design of the vertical up and down flight cost and the straight flight cost of the precise direction cost in the actual cost function Unlike the more detailed direction weight system used by the algorithm in calculating the actual cost to finely reflect the actual cost, the heuristic function uses a simple height change penalty and a turning penalty, which is not only for calculation efficiency, to maintain the overall speed of the search, but also to ensure that the heuristic estimate can always be adopted and consistent, while avoiding making too complex or even risky branch judgments when the specific flight direction is unknown.
[0131] In the node search process, considering the flight characteristics of the multi-rotor unmanned aerial vehicle, a 26-neighbor node expansion is designed, which will expand a large number of nodes in the search process of a million grid. In addition, when multiple paths of the A-star algorithm can reach a certain node, the information of the node will be updated multiple times. If the path length of the multiple paths is equal to the current optimal path, a lot of redundant calculations will occur, and the above modification of the cost function cannot avoid the explosive node expansion.
[0132] According to one embodiment, the step S103 is based on the node search strategy, a pruning strategy based on a directional heuristic is adopted, a preferred search direction is dynamically determined by comparing the distance difference in the horizontal and vertical directions, a combined directional expansion node set is generated, and a preferred search direction set is obtained.
[0133] The preferred search direction set is used to guide the algorithm to preferentially explore directions that are more likely to approach the target in path planning, effectively reduces unnecessary node expansion, and significantly improves search efficiency.
[0134] Specifically, the horizontal direction of the preferred search is determined by comparing the distance difference between the target node and the current node in the horizontal direction. The horizontal direction includes the east-west and north-south directions. This process uses heuristic information to guide the search direction and avoids wasting computing resources in irrelevant directions.
[0135] Then, if the distance difference in the vertical direction is significantly greater than that in the horizontal direction, the expansion in the vertical direction is preferred. This judgment mechanism is based on the design of the heuristic function and can dynamically adjust the search direction to ensure that the search process is more efficient.
[0136] Then, combined with the horizontal and vertical directions, a combined directional expansion node set is generated to cover a wider search space.
[0137] Finally, these direction sets are combined to form a complete preferred search direction set, thereby guiding the algorithm to preferentially explore directions that are more likely to approach the target in path planning, effectively reducing unnecessary node expansion, and significantly improving search efficiency.
[0138] The pruning strategy described above is explained by mathematical expressions as follows.
[0139] In the path planning process, in order to improve search efficiency and reduce unnecessary node expansion, the algorithm of the present application defines a preferred search direction priority_directions, based on The preferred search direction is determined, thereby performing directional heuristic pruning on node expansion.
[0140] The algorithm defines a preferred search direction set The pruning rules include: 1) horizontal direction pruning rule; If , the east-west direction is preferred for expansion:
[0141] Wherein, E and W represent the east and west directions, EN, ES, WN, and WS represent the east-north, east-south, west-north, and west-south directions.
[0142] If , then prefer to expand in the north-south direction:
[0143] where N, S represent the north and south directions, respectively.
[0144] 2) Vertical pruning rule; If the vertical distance is significant, i.e. , then prefer to expand vertically:
[0145] where U, D represent the up and down directions, respectively.
[0146] 3) Combined direction expansion; Further combine the vertical and horizontal movements on the basis of the preferred direction to generate a combined direction expansion node set .
[0147] For example: if there is a significant vertical difference, then prefer to search {UN, US, UE, UW, UEN, USE, UWN, UWS} or {DN, DS, DE, DW, DEN, DES, DWN, DWS} and other combined directions.
[0148] Finally, the complete heuristic search preferred direction set is:
[0149] Through the above pruning rules, the algorithm can dynamically adjust the preferred search direction according to the relative position relationship between the current node and the target node during path planning, thereby reducing unnecessary node expansion and improving search efficiency.
[0150] In the node search process based on the classic A-star algorithm, at each iteration, first find the node with the smallest F value from the openList. Then, remove the node from the openList and add it to the closeList. Next, the neighbor nodes of the current node need to be checked. If the neighbor node is in the closeList, skip it; if the neighbor node is not in the openList, add it to the openList and calculate its G value, H value and F value; if the neighbor node is already in the openList, check if the new path is better, i.e. if the new path G value is smaller, if it is, update the G value, F value and parent node of the neighbor node.
[0151] Under large-scale spatio-temporal complex environment, the number of nodes in openList and closeList will increase constantly with the search. Since the time complexity of linear search is high, the linear search time of these two lists will increase significantly during the search process, resulting in gradually reduced retrieval efficiency
[0152] To solve this problem of low linear search efficiency, the algorithm optimizes the data structure, including: 1) Using priority queue (openList) and open dictionary (openDict) to replace the open list in traditional A-star algorithm.
[0153] Among them, the priority queue is used to store all nodes to be explored, and the open dictionary openDict is used to store the "key-value" pairs of the nodes to ensure fast access to the node with the minimum F value.
[0154] Specifically, the priority queue is implemented through the min-heap data structure, which converts the ordinary list into a priority queue to store all nodes to be explored. The storage form of each node in the priority queue is: Wherein, is the value of the total cost function of the node, is a continuously increasing value generated by itertools.count(), which solves the comparison problem in the priority queue, The open dictionary openDict is responsible for interacting with the open dictionary openDict and storing the "key-value" pairs of the node object. The key is the 4D grid code of the object, and the value is the node object attribute (including the previous search node, the actual value, the heuristic value, the search direction, etc.). It keeps updating with the open dictionary.
[0155] In specific operation, the priority queue openList is maintained through heappush and heappop operations. The time complexity of searching for a node in the open list through the open dictionary openDict is O(1). After using the combination of the priority queue openList and the open dictionary openDict, the time complexity of obtaining the node with the minimum F value is reduced to O(log n).
[0156] Among them, the heappush operation is used to insert a new node into the priority queue and maintain the heap property of the queue, so that the root node of the queue always has the minimum F value. The heappop operation is used to remove and return the node with the minimum F value from the priority queue while adjusting the queue to maintain the heap property. The time complexity of heappush operation and heappop operation is O(log n), where n is the number of nodes in the priority queue.
[0157] 2) using a closeSet to replace the closeList in traditional A* algorithm; wherein the closeSet is used to store the nodes that have been completely explored, and stores the Key in the node , i.e. the subdivision type 4D encoding of the space-time grid cell. The in operation of the set can be used to quickly determine whether the node has been explored. The traditional method needs O(n) time to search the node in the list. After using the set, the time complexity of checking whether the node has been explored is O(1).
[0158] According to one embodiment, the node search process based on the improved data structure includes: In the node expansion stage, firstly, the new node to be expanded is identified by using the 4D grid encoding as the unique identifier, and is added to the priority queue by using the heappush operation, and is recorded in the open dictionary at the same time; When the node to be expanded is obtained from the priority queue, the node with the minimum cost value is extracted by using the heappop operation, and the record corresponding to the node is removed from the open dictionary at the same time; After the node is completely explored, the 4D grid encoding of the node is added to the closeSet and is marked as visited.
[0159] In this embodiment, the improved A* algorithm is used for path planning. On the basis of the traditional A* algorithm, the flight constraints of the unmanned aerial vehicle and the distance penalty are introduced to improve the cost function, the direction-priority heuristic pruning strategy is adopted, and the data structure is optimized by introducing the priority queue and the open dictionary. The flight characteristics of the multi-rotor unmanned aerial vehicle are fully taken into account in the cost function, so that the path planning is more suitable for the actual flight capability of the unmanned aerial vehicle, and the ten-millisecond-level path planning under the map of ten-million-level grid cells is realized. In the node search process, the direction heuristic pruning is performed on the node expansion, and the problem of a large number of node expansions caused by multi-direction search is solved, the search space is reduced, and the search efficiency is improved.
[0160] Figure 5 A structure schematic diagram of an apparatus for indoor unmanned aerial vehicle dynamic obstacle avoidance provided by an embodiment of the present application is shown.
[0161] The apparatus includes an initial path acquisition module 101, a dynamic obstacle detection module 102, an initial path segmentation module 103, and a path update execution module 104.
[0162] Referring to Figure 5 , the initial path acquisition module 101 acquires an initial planning path, the initial planning path is obtained by using an improved A* algorithm and a node search strategy to plan a path, the improved A* algorithm uses a cost function containing flight constraints and distance penalties, and the node search strategy adopts a direction heuristic pruning.
[0163] Wherein, the improved A-star algorithm and node search strategy implemented by the present application, and the process of path planning based on the improved A-star algorithm and node search strategy have been described in the foregoing with reference to the partial views shown in the figures. Figure 3
[0164] The dynamic obstacle detection module 102 obtains an obstacle detection result by performing dynamic obstacle detection, the obstacle detection result including 4D grid codes corresponding to grid cells where one or more detected dynamic obstacles are located.
[0165] Wherein, the structure of the 4D grid code, and the way of describing the dynamic grid situation at any time by using the time slice form based on the 4D grid code of each grid cell have been described in the foregoing, and will not be described here again.
[0166] Wherein, the dynamic obstacle includes various uncertain obstacles in an indoor environment, such as the opening and closing of doors and windows bringing about dynamic changes in the scene, moving personnel, objects in flight, etc. If the dynamic obstacle appears on the original global planning path, i.e., the spatial 3D code of the grid cell corresponding to the original planning path does not change, but the time 1D code is the same as the time code corresponding to the dynamic obstacle.
[0167] Wherein, the way of dynamic obstacle detection includes but is not limited to using sensors to detect or using image processing technology to monitor object movement in the environment in real time, etc.
[0168] According to an embodiment, a dynamic obstacle set is generated based on the detected dynamic obstacles. In the dynamic obstacle set, each obstacle is represented by the 4D grid code of the spatiotemporal cell where it is located. These 4D grid codes can accurately describe the position of each dynamic obstacle in time and space.
[0169] For example, the obstacle coordinates can be obtained by UWB positioning tags, combined with the YOLOv5 model to identify the moving human body contour, and the coordinates and timestamps are mapped to 4D grid codes.
[0170] The initial path segmentation module 103 segments the initial planning path based on the 4D grid codes of the one or more dynamic obstacles, and determines one or more target segments in the initial path that need to be re-planned.
[0171] According to an embodiment, the initial path segmentation module 103 includes an obstacle distance evaluation module, a safety point index determination module, and a path segmentation determination module.
[0172] The obstacle distance evaluation module calculates the distance between the path points in the original planning path and each dynamic obstacle based on the 4D grid codes of the one or more dynamic obstacles, and evaluates whether the safety close distance condition is met.
[0173] Specifically, when determining whether the distance between the path point and any obstacle is greater than or equal to a preset safety distance threshold, if yes, it is determined that the path point meets the safety distance condition.
[0174] The safety point index determination module determines a safety start point index, a safety end point index, and a local re-planning end point index based on the safety distance evaluation result of the path point. The safety start point index is the last point before the obstacle that meets the safety distance condition, and the safety end point index is the first point after the obstacle that meets the safety distance condition.
[0175] The local re-planning end point index is the smaller of the safety end point index plus a smooth extension length (K) and the total length (N) of the path, to avoid index out-of-bounds problems. The smooth extension length K refers to taking K points after the safety point to ensure smooth connection of the path.
[0176] The path segment determination module determines one or more target road segments in the initial path that need to be re-planned based on the safety start point index and the local re-planning end point index.
[0177] Specifically, the original path is divided into multiple paragraphs according to the safety start point index and the local re-planning end point index, and the affected paragraphs (i.e., the parts that need to be re-planned) are marked as target road segments for subsequent local path re-planning.
[0178] The path update execution module 104 re-plans the target road segments using an improved A-star algorithm and node search strategy, and combines the re-planned road segments with other road segments in the initial planning path to obtain a final path planning result.
[0179] Specifically, the path update execution module 104 re-executes path planning for the one or more target road segments using an improved A-star algorithm and node search strategy to obtain an updated road segment corresponding to each target road segment; then, the one or more updated road segments are combined with other road segments outside the target road segments in the initial planning path to obtain a path planning result.
[0180] The final path planning result has real-time obstacle avoidance capability while maintaining global path optimality, and can effectively avoid all detected dynamic obstacles.
[0181] The device provided by the embodiment of the application provides an indoor unmanned aerial vehicle dynamic obstacle avoidance algorithm, which effectively deals with sudden dynamic obstacles in an indoor environment, such as a person or a door that is suddenly opened. The dynamic obstacle avoidance algorithm segments an original path according to obstacles, filters out path segments that need to be re-planned, then determines a new starting point before the obstacle and a safe target point after the obstacle according to the re-planned path segments, uses an improved A-star path planning algorithm to achieve local path re-planning, and finally splices the local re-planned path and the front and rear segments of the original path to achieve path adjustment during dynamic obstacle avoidance, thereby significantly improving the algorithm performance of unmanned aerial vehicle end distribution. The dynamic obstacle avoidance algorithm can maintain the optimality of path length and the stability of the overall path while avoiding obstacles dynamically, and has good adaptability to the appearance of dynamic obstacles or dynamic changes in the indoor environment, thereby effectively guaranteeing the efficiency and safety of indoor distribution tasks of the unmanned aerial vehicle.
[0182] Based on the same inventive concept, the electronic device provided in the embodiment of the application corresponds to the method in the foregoing embodiments, and the problem solving principle thereof is similar to that of the method. The electronic device provided in the embodiment of the application comprises at least one processor and a memory in communication connection with the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method and / or technical solution of the plurality of embodiments of the application.
[0183] The electronic device can be a user device, or a device integrated by a user device and a network device through a network, or can also be an application program running on the above device. The user device includes, but is not limited to, computers, mobile phones, tablet computers, smart watches, wristbands, and various terminal devices, and the network device includes, but is not limited to, network hosts, single network servers, multiple network server sets, or computer sets based on cloud computing, which can be used to realize part of the processing functions when setting an alarm. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing, wherein cloud computing is a kind of distributed computing, which is composed of a virtual computer formed by a group of loosely coupled computer sets.
[0184] Figure 6The structure of a device suitable for implementing the method and / or technical solution in the embodiments of the present application is shown, the device 1200 includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 1202 or programs loaded from a storage portion 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for system operation are also stored. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other through a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0185] The following components are connected to the I / O interface 1205: an input portion 1206 including a keyboard, a mouse, a touch screen, a microphone, an infrared sensor, and the like; an output portion 1207 including a cathode ray tube (CRT), a liquid crystal display (LCD), an LED display, an OLED display, and the like, and a speaker and the like; a storage portion 1208 including one or more computer readable media such as a hard disk, an optical disk, a magnetic disk, a semiconductor memory, and the like; and a communication portion 1209 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like. The communication portion 1209 performs communication processing via a network such as the Internet.
[0186] In particular, the method and / or embodiment in the embodiments of the present application can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product including a computer program carried on a computer readable medium, the computer program including program code for executing the method shown in the flowchart. When the computer program is executed by the central processing unit (CPU) 1201, the above-mentioned functions defined in the method of the present application are performed.
[0187] Among them, the program includes mobile phone program (APP program, small program, etc.), smart device program, smart device includes watch, bracelet, helmet, smart hardware device, etc.
[0188] Another embodiment of the present application also provides a computer readable storage medium having computer program instructions stored thereon, which can be executed by a processor to implement the method and / or technical solution of any one or more embodiments of the foregoing present application.
[0189] In particular embodiments, any appropriate combination of one or more computer readable media can be utilized. The computer readable media can be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium can be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
[0190] A computer readable signal medium can include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated signal can take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium can be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
[0191] Program code embodied on a computer readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0192] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider). In an embodiment of the application, the remote computer can be a server or another desktop computer.
[0193] The flow diagrams and block diagrams in the drawings are presented to illustrate the architecture, functionality, and operation of possible implementations of devices, methods and computer program products according to various embodiments disclosed. In this regard, each block in the flow diagrams and block diagrams can represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or operations, or combinations of special purpose hardware and
[0194] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0195] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are merely schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or page components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0196] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.
[0197] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software functional unit.
[0198] The integrated unit implemented in the form of software function unit can be stored in a computer readable storage medium. The software function unit is stored in a storage medium, and includes a plurality of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute part of steps of the method described in various embodiments of the present application. The storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage medium capable of storing program codes.
[0199] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
[0200] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The plurality of units or devices stated in the apparatus can also be implemented by one unit or device through software or hardware. The words "first", "second" and the like are used to indicate names, and do not mean any specific order.
Claims
1. A method for dynamic obstacle avoidance for indoor unmanned aerial vehicles (UAVs), wherein, The method includes: An initial planned path is obtained using an improved A* algorithm and a node search strategy. The improved A* algorithm uses a cost function with flight constraints and distance penalties, and the node search strategy employs directional heuristic pruning. By performing dynamic obstacle detection, obstacle detection results are obtained, including the 4D mesh code corresponding to the mesh volume element where one or more dynamic obstacles are located. Based on the 4D mesh coding of the one or more dynamic obstacles, the initial planned path is segmented to determine one or more target road segments in the initial path that need to be replanned. The target road segment is replanned using an improved A* algorithm and node search strategy, and the replanned road segment is merged with other road segments in the initial planned path to obtain the final path planning result.
2. The method according to claim 1, wherein, The 4D mesh coding based on the one or more dynamic obstacles, which segments the initial planned path, determines one or more target road segments in the initial path that need to be replanned, including: Based on the 4D mesh encoding of one or more dynamic obstacles, calculate the distance between the path points in the original planned path and each dynamic obstacle, and evaluate whether the safe proximity condition is met. Based on the safe distance assessment results of the path points, the safe start index, safe end index, and local replanning end index are determined. The safe start index is the last point in front of the obstacle that meets the safe distance condition, the safe end index is the first point in behind the obstacle that meets the safe distance condition, and the local replanning end index is the smaller value between the safe end index plus the smooth extension length and the total path length. Based on the safe starting point index and the local replanning ending point index, one or more target road segments in the initial path that need to be replanned are identified.
3. The method according to claim 2, wherein, The assessment of whether the safe close-range conditions are met includes: When determining whether the distance between a path point and any obstacle is greater than or equal to a preset safe distance threshold, if so, the path point is determined to meet the safe distance condition.
4. The method according to claim 1, wherein, The target road segment is replanned using an improved A* algorithm and node search strategy, and the updated road segment is merged with other road segments in the initial planned path to obtain the final path planning result, including: The improved A* algorithm and node search strategy are used to re-perform path planning for the one or more target road segments to obtain the updated road segments corresponding to each target road segment; The obtained one or more updated road segments are merged with other road segments other than the target road segment in the initial planned path to obtain the path planning result.
5. The method according to claim 1, wherein, The process of obtaining the initial planned path using the improved A* algorithm and node search strategy includes: In response to the path planning command of the UAV in the indoor environment, the 4D mesh code corresponding to the start position and end position of the UAV is obtained, wherein the 4D mesh code is used to uniquely identify the indoor mesh element; Based on the location of the drone and the location of obstacles, the collision risk is calculated and assessed through spatiotemporal relationships, which include spatial relationships and temporal relationships. Based on the evaluation results, an initial planned path is obtained by using an improved A* algorithm and a node search strategy. The improved A* algorithm uses a cost function with flight constraints and distance penalties, and the node search strategy adopts directional heuristic pruning.
6. The method according to claim 5, wherein, The collision risk assessment based on the drone's location and obstacle location, using spatiotemporal relationships, includes: Obtain the three-dimensional spatial coordinates and timestamp of the drone's current location; Based on the pre-built octree mesh index, the three-dimensional spatial coordinates and timestamps are converted into corresponding 4D mesh volumetric codes and time-level codes, respectively; Obtain the spatiotemporal location information of obstacles, which includes the three-dimensional spatial coordinates of one or more target obstacles in the indoor environment and the timestamps corresponding to their motion trajectories, and convert the three-dimensional spatial coordinates and timestamps into corresponding 4D mesh element codes and time-level codes, respectively. Based on a unified spatial and temporal hierarchy, spatiotemporal relationship calculations are performed on the UAV volume elements and the grid volume elements of one or more target obstacles to obtain their spatial and temporal relationships, thereby assessing the collision risk.
7. The method according to claim 5 or 6, wherein, The rules for assessing collision risk based on the drone's location and the location of obstacles, calculated through spatiotemporal relationships, include: If the spatiotemporal relationship between the two is that they intersect in space, then a collision will occur between the drone and the obstacle. If the two are spatially adjacent in terms of time and space, there is a risk of collision between the drone and the obstacle; If the two are spatially separated, the drone can travel safely without needing to avoid obstacles. If the two are at the same fixed time level and intersect in space, then it is determined to be a spatiotemporal conflict.
8. The method according to claim 5, wherein, Path planning using the improved A* algorithm and node search strategy includes: Based on the node search strategy, the preferred search direction is determined by comparing the distance difference in the horizontal and vertical directions, thereby performing directional heuristic pruning on node expansion.
9. The method according to claim 8, wherein, The step of determining the preferred search direction by comparing the distance difference in the horizontal and vertical directions, thereby performing directional heuristic pruning on node expansion, includes: By comparing the distance difference between the target node and the current node in the horizontal direction, the priority horizontal direction for searching is determined; If the difference in distance in the vertical direction is significantly greater than that in the horizontal direction, then the expansion in the vertical direction should be given priority. By combining the horizontal and vertical directions, a combined directional expansion node set is generated to cover a wider search space; These direction sets are merged to form a complete set of preferred search directions. This set of preferred search directions guides the algorithm to prioritize exploring directions that are more likely to approach the target during path planning, effectively reducing unnecessary node expansion.
10. The method according to claim 1 or 2, wherein, The 4D grid coding structure is a triple, including 3D spatial grid coding, 1D temporal grid coding and access attribute coding. The access attribute coding is used to identify the occupancy status of dynamic obstacles.
11. The method according to claim 10, wherein, The method is based on the 4D mesh encoding of each mesh element and uses time slices to describe the dynamic mesh situation at any time.
12. A device for dynamic obstacle avoidance on indoor unmanned aerial vehicles (UAVs), wherein, The device includes: An initial path acquisition module is used to acquire an initial planned path, which is obtained by planning the path using an improved A* algorithm and a node search strategy. The improved A* algorithm uses a cost function with flight constraints and distance penalties, and the node search strategy adopts directional heuristic pruning. The dynamic obstacle detection module is used to obtain obstacle detection results by performing dynamic obstacle detection. The obstacle detection results include the 4D mesh code corresponding to the mesh volume element where one or more dynamic obstacles are located. The initial path segmentation module is used to segment the initial planned path based on the 4D mesh encoding of the one or more dynamic obstacles, and to determine one or more target road segments in the initial path that need to be replanned. The path update execution module uses an improved A* algorithm and node search strategy to replan the target road segment, and merges the replanned road segment with other road segments in the initial planned path to obtain the final path planning result.
13. An electronic device, the electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 11.
14. A computer-readable medium having stored thereon computer program instructions that can be executed by a processor to implement the method as described in any one of claims 1 to 11.
15. A computer program product comprising a computer program that, when executed by a processor, implements the method of any one of claims 1 to 11.
Citation Information
Cited By
Aircraft position conflict real-time detection method, device and equipment
CN122090667A
An aircraft position conflict real-time detection method, device and equipment
CN122090667B