CUDA-based collision detection method and device, electronic equipment and storage medium
By employing the CUDA parallel computing platform in the autonomous driving system, trajectory and obstacle information are abstracted into a specific set for parallel processing, solving the problem of high CPU computational overhead in existing technologies and achieving efficient and accurate collision detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI WESTWELL INFORMATION & TECH CO LTD
- Filing Date
- 2022-12-06
- Publication Date
- 2026-04-17
AI Technical Summary
In existing autonomous driving systems, collision detection based on sampling trajectory generation algorithms consumes a large amount of CPU computing power, becoming a significant bottleneck for the efficiency and results of trajectory planning.
Employing a parallel computing platform based on CUDA, this approach abstracts candidate trajectories into sequences of bounding boxes and obstacle information into sets of obstacle points. By processing these sequences and sets of obstacle points in parallel, it identifies matching pairs of potential collision risks, detects collision risks in parallel, and combines coarse and fine detection to achieve efficient and accurate collision detection.
This greatly improves the efficiency of collision detection, saves CPU computing overhead, and increases detection speed and accuracy, enabling efficient and accurate collision detection of candidate trajectories.
Smart Images

Figure CN115933658B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of autonomous driving technology, and more specifically, to a CUDA-based collision detection method, apparatus, electronic device, and storage medium. Background Technology
[0002] In autonomous driving systems, the planning module needs to generate a smooth, collision-free trajectory based on the environmental model constructed through perception fusion and localization to complete the driving task, and provide it to the control module to complete the required driving task between the origin and destination. In engineering applications, under a given reference line, sampling-based trajectory generation algorithms are commonly used for local path planning / trajectory generation, and due to their lower computational cost and relatively good planning results, they have gradually become one of the mainstream trajectory planning algorithms.
[0003] The sampling-based trajectory generation algorithm samples the final state of the vehicle's pose in different scenarios to generate multiple possible driving trajectories, which are called candidate trajectories. After generating candidate trajectories, collision detection is performed on all candidate trajectories in combination with obstacles in the environment to filter out collision-free candidate trajectories, calculate the cost, and select the candidate trajectory with the lowest cost to guide the vehicle.
[0004] In the trajectory planning process of the above planning module, collision detection requires a large amount of CPU (Central Processing Unit) computing overhead, and CPU computing overhead is a major bottleneck that restricts the efficiency and results of trajectory planning.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] In view of this, the present invention provides a collision detection method, apparatus, electronic device and storage medium based on CUDA. It adopts CUDA (Compute Unified Device Architecture, a parallel computing platform based on GPU (Graphics Processing Unit)) to realize parallel collision detection, which can greatly improve detection efficiency, save CPU computing overhead and realize efficient and accurate collision detection of candidate trajectories.
[0007] According to one aspect of the present invention, a CUDA-based collision detection method is provided, comprising: in response to a planned candidate trajectory and collected obstacle information, abstracting the candidate trajectory into a sequence of bounding boxes and the obstacle information into a set of obstacle points; processing the sequence of bounding boxes and the set of obstacle points in parallel based on CUDA to determine matching pairs with potential collision risks, wherein a matching pair consists of a bounding box and an obstacle point; and in response to the obtained matching pairs, detecting the collision risk of each matching pair in parallel based on CUDA to obtain a collision detection result of the candidate trajectory.
[0008] In some embodiments, the step of processing the trajectory box sequence and the obstacle point set in parallel based on CUDA to determine matching pairs with potential collision risk includes: caching each trajectory box of the trajectory box sequence in parallel based on CUDA, and calculating the hash value of each trajectory box in parallel; caching each obstacle point of the obstacle point set in parallel based on CUDA, and calculating the hash value of each obstacle point in parallel; and matching the hash values of the cached trajectory boxes with the hash values of the obstacle points, and determining the trajectory boxes and obstacle points with matching hash values as matching pairs with potential collision risk.
[0009] In some embodiments, the step of caching each trajectory frame of the trajectory frame sequence in parallel based on CUDA and calculating the hash value of each trajectory frame in parallel includes: creating a first GPU space corresponding to the data volume of the trajectory frame sequence based on CUDA, and a first thread set and a second thread set corresponding to the number of each trajectory frame; using the first thread set to update the first GPU space in parallel, caching each trajectory frame to the corresponding memory space of the first GPU space; and using the second thread set to calculate the hash value of each trajectory frame in parallel, updating the corresponding memory space of the first GPU space.
[0010] In some embodiments, the step of using the second set of threads to compute the hash value of each of the trajectory boxes in parallel includes computing the hash value of a current trajectory box using a current second thread, which includes: obtaining an axis-aligned bounding box that covers the current trajectory box; computing the hash values of the maximum and minimum corner points of the axis-aligned bounding box, and using the range of hash values between the maximum and minimum corner points as the hash value of the current trajectory box.
[0011] In some embodiments, the step of caching each obstacle point of the obstacle point set in parallel based on CUDA and calculating the hash value of each obstacle point in parallel includes: creating a second GPU space corresponding to the data volume of the obstacle point set, and a third thread set and a fourth thread set corresponding to the number of each obstacle point, respectively; using the third thread set to update the second GPU space in parallel, caching each obstacle point to the corresponding memory space of the second GPU space; and using the fourth thread set to calculate the hash value of each obstacle point in parallel and update the corresponding memory space of the second GPU space.
[0012] In some embodiments, the hash value of each bounding box is represented as a range of hash values, and the hash value of each obstacle point is represented as a single hash value; the step of determining the bounding boxes and obstacle points with matching hash values as a pair with potential collision risk includes: determining the obstacle points and bounding boxes with single hash values falling within the hash value range as a pair with potential collision risk.
[0013] In some embodiments, after the hash values of each obstacle point are calculated in parallel, the hash values of each obstacle point are also sorted; when matching the hash values of the cached trajectory frames with the hash values of the obstacle points, a set of threads corresponding to the number of cached trajectory frames is used to determine, in parallel, a single hash value falling into each hash value range based on the sorted hash values of the obstacle points.
[0014] In some embodiments, the CUDA-based parallel detection of collision risk for each matching pair includes: a fifth thread set corresponding to the number of matching pairs created and obtained by CUDA; and using the fifth thread set to detect the collision risk of each matching pair in parallel based on the area comparison method.
[0015] In some embodiments, the parallel detection of collision risk of each of the matching pairs using the fifth thread set includes using a current fifth thread to detect the collision risk of a current matching pair, including: determining whether the sum of the areas of the triangles formed by connecting the obstacle points of the current matching pair to the corner points of the trajectory frame of the current matching pair is greater than the area of the trajectory frame of the current matching pair; if not, then determining that the current matching pair has a collision risk.
[0016] In some embodiments, the obstacle information is point cloud data, and the step of abstracting the obstacle information into a set of obstacle points includes: abstracting each obstacle point cloud in the point cloud data into a coordinate point without area; or, the obstacle information is a grid map, and the step of abstracting the obstacle information into a set of obstacle points includes: abstracting each obstacle grid in the grid map into a grid point without area.
[0017] According to another aspect of the present invention, a CUDA-based collision detection device is provided, comprising: a geometry abstraction module, configured to abstract the candidate trajectory into a sequence of bounding boxes and the obstacle information into a set of obstacle points in response to a planned candidate trajectory and collected obstacle information; a potential risk screening module, configured to process the sequence of bounding boxes and the set of obstacle points in parallel based on CUDA to determine matching pairs with potential collision risks, wherein a matching pair consists of a bounding box and an obstacle point; and a collision risk detection module, configured to detect the collision risk of each matching pair in parallel based on CUDA in response to the obtained matching pairs, and obtain the collision detection result of the candidate trajectory.
[0018] According to another aspect of the present invention, an electronic device is provided, comprising: a processor; a memory storing executable instructions; wherein, when the executable instructions are executed by the processor, they implement the CUDA-based collision detection method as described in any of the above embodiments.
[0019] According to another aspect of the present invention, a computer-readable storage medium is provided for storing a program that, when executed by a processor, implements the CUDA-based collision detection method as described in any of the above embodiments.
[0020] The beneficial effects of this invention compared to the prior art include at least the following:
[0021] The CUDA-based collision detection scheme of this invention abstracts candidate trajectories into a sequence of bounding boxes and obstacle information into a set of obstacle points, facilitating subsequent collision detection between the bounding boxes and obstacle points using CUDA, thereby improving detection accuracy. By processing the bounding box sequence and obstacle point set in parallel using CUDA, it helps identify matching pairs with potential collision risks, achieving a coarse detection of collision risks for candidate trajectories and effectively reducing the order of magnitude of subsequent fine detection. Furthermore, for matching pairs with potential collision risks, the collision risks of each matching pair are detected in parallel using CUDA, achieving fine detection of collision risks between geometries with potential collisions, accurately determining whether there is a collision risk between the corresponding bounding box and obstacle point.
[0022] The collision detection scheme based on CUDA of this invention can greatly improve detection efficiency and save CPU computing overhead by utilizing the parallel computing capabilities of CUDA. By combining coarse detection and fine detection, the speed and accuracy of collision detection are further improved by first coarsely screening matching pairs with potential collision risks and then finely detecting the collision risks of each matching pair, thus achieving efficient and accurate collision detection of candidate trajectories.
[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0025] Figure 1 A schematic diagram illustrating the steps of the CUDA-based collision detection method in an embodiment of the present invention is shown.
[0026] Figure 2 This illustration shows a step in an embodiment of the present invention to process a sequence of trajectory frames and a set of obstacle points in parallel to determine matching pairs with potential collision risks.
[0027] Figure 3 This diagram illustrates the steps of parallel processing of trajectory box sequences in an embodiment of the present invention.
[0028] Figure 4 This diagram illustrates the steps of parallel processing of obstacle point sets in an embodiment of the present invention.
[0029] Figure 5 An example diagram of collision risk detection based on area comparison method in an embodiment of the present invention is shown;
[0030] Figure 6 This diagram illustrates an example of the CUDA thread management model in an embodiment of the present invention.
[0031] Figure 7 This diagram illustrates an example of collision detection based on candidate trajectories and a grid map in an embodiment of the present invention.
[0032] Figure 8 This diagram illustrates an example of collision detection based on candidate trajectories and point cloud data in an embodiment of the present invention.
[0033] Figure 9 A schematic diagram of the CUDA-based collision detection device in an embodiment of the present invention is shown.
[0034] Figure 10 A schematic diagram of the structure of an electronic device in an embodiment of the present invention is shown. Detailed Implementation
[0035] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to fully and completely convey the concept of the exemplary embodiments to those skilled in the art.
[0036] The accompanying drawings are merely illustrative of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0037] Furthermore, the processes shown in the accompanying drawings are merely illustrative and do not necessarily include all steps. For example, some steps can be broken down, some steps can be combined or partially combined, and the actual execution order may change depending on the actual situation. The terms "first," "second," and similar terms used in the specific description do not indicate any order, quantity, or importance, but are only used to distinguish different components. It should be noted that, unless otherwise specified, embodiments of the present invention and features in different embodiments can be combined with each other.
[0038] Autonomous driving systems consist of basic modules such as perception, localization, fusion, planning, and control. The CUDA-based collision detection scheme of this invention is mainly used in the planning module of autonomous driving systems. It can be integrated into the planning module or communicate and interact with the planning module to perform collision detection on candidate trajectories generated by the planning module, thus solving the problems of high computational overhead, slow response speed, and insufficient collision detection precision of existing collision detection schemes.
[0039] Figure 1 The main steps of the CUDA-based collision detection method in the embodiments are shown; refer to Figure 1 As shown, in one embodiment, the CUDA-based collision detection method includes:
[0040] In step S110, in response to the planned candidate trajectory and the collected obstacle information, the candidate trajectory is abstracted into a sequence of trajectory frames, and the obstacle information is abstracted into a set of obstacle points.
[0041] Candidate trajectories are generated by the planning module of the autonomous driving system based on the environmental model constructed by the perception, fusion, and localization modules; obstacle information is collected by the perception, fusion, and localization modules. Most current collision detection schemes perform collision detection based on candidate trajectories and obstacles abstracted as polygons, which cannot achieve refined collision detection. In this step, candidate trajectories are abstracted into a sequence of bounding boxes, and obstacle information is abstracted into a set of obstacle points. This facilitates subsequent collision detection between the geometry of the bounding boxes and obstacle points based on CUDA, improving detection accuracy.
[0042] Step S120: Based on CUDA parallel processing of the trajectory box sequence and obstacle point set, determine the matching pairs with potential collision risk. A matching pair consists of a trajectory box and an obstacle point.
[0043] By using CUDA to process trajectory box sequences and obstacle point sets in parallel, it helps to identify matching pairs with potential collision risks, enabling a coarse detection of collision risks for candidate trajectories and effectively reducing the order of magnitude of subsequent fine detection.
[0044] CUDA (Compute Unified Device Architecture) is a parallel computing platform based on GPU (Graphics Processing Unit), which can significantly improve computing performance by leveraging the processing power of GPUs.
[0045] Step S130: In response to the obtained matching pairs, the collision risk of each matching pair is detected in parallel based on CUDA to obtain the collision detection results of the candidate trajectory.
[0046] For matching pairs with potential collision risks, CUDA is used to detect the collision risks of each matching pair in parallel, so as to achieve fine detection of collision risks between geometries that may collide, and accurately determine whether there is a collision risk between the corresponding trajectory box and obstacle point.
[0047] Therefore, by adopting the above-mentioned CUDA-based collision detection method, the parallel computing capabilities of CUDA can be utilized to greatly improve detection efficiency and save CPU computing overhead. Furthermore, by combining coarse detection and fine detection, the speed and accuracy of collision detection can be further improved by first coarsely screening matching pairs with potential collision risks and then finely detecting the collision risks of each matching pair, thus achieving efficient and accurate collision detection of candidate trajectories.
[0048] Figure 2 The illustrated embodiment shows the steps of parallel processing of the trajectory box sequence and obstacle point set to determine matching pairs with potential collision risk; see reference. Figure 2As shown, in one embodiment, the determination of matching pairs with potential collision risk is based on CUDA parallel processing of trajectory box sequences and obstacle point sets, including:
[0049] Step S210: Based on CUDA, cache each trajectory frame of the trajectory frame sequence in parallel and calculate the hash value of each trajectory frame in parallel.
[0050] Step S220: Based on CUDA, cache each obstacle point in the obstacle point set in parallel and calculate the hash value of each obstacle point in parallel.
[0051] By first caching the trajectory box sequence and obstacle point set, and then performing collision detection (including coarse detection and fine detection) on the trajectory box sequence and obstacle point set, the caching and execution of geometry are separated, so that the collision detection of candidate trajectories has asynchronous characteristics.
[0052] While caching the geometry, the hash value of the geometry is also calculated so that in the subsequent rough detection stage, the geometry can be matched according to the hash value to identify matching pairs with potential collision risks.
[0053] Step S230: Match the hash values of the cached trajectory boxes with the hash values of the obstacle points, and identify the trajectory boxes and obstacle points with matching hash values as matching pairs with potential collision risk.
[0054] The identified matching pairs with potential collision risks indicate a possible collision between the corresponding trajectory box and the obstacle point, which is used for subsequent fine-grained collision risk detection.
[0055] Figure 3 The steps for parallel processing of trajectory box sequences are shown in the embodiment; refer to Figure 3 As shown, in one embodiment, the trajectory frames of the trajectory frame sequence are cached in parallel based on CUDA, and the hash value of each trajectory frame is calculated in parallel, including:
[0056] Step S310: Based on CUDA, create a first GPU space corresponding to the amount of data in the trajectory box sequence, and a first thread set and a second thread set corresponding to the number of each trajectory box.
[0057] The capacity of the first GPU space corresponds to the amount of data in the trajectory box sequence, in order to store the trajectory box sequence and the hash value of each trajectory box. The number of threads in the first thread set and the second thread set corresponds to the number of trajectory boxes in the trajectory box sequence, in order to perform caching operations and hash value calculation operations for each trajectory box respectively.
[0058] Step S320: Use the first thread set to update the first GPU space in parallel, and cache each trajectory box to the corresponding memory space of the first GPU space.
[0059] When caching the trajectory box sequence, multiple first threads update the first GPU space simultaneously. Each first thread updates the memory space corresponding to the data volume of a trajectory box, thereby realizing the parallel caching of the trajectory box sequence into the first GPU space.
[0060] Step S330: Use the second thread set to calculate the hash value of each trajectory box in parallel and update it to the corresponding memory space in the first GPU space.
[0061] When calculating the hash value, multiple second threads simultaneously calculate the hash value of each trajectory frame. Each second thread calculates the hash value of one trajectory frame and updates the memory space that caches the trajectory frame with the calculated hash value.
[0062] The hash value of the trajectory box is used to express its coverage area. Since the trajectory box has an area, the hash value is calculated for the two corner points of the AABB (Axis-Aligned Bounding Box) that covers it, and the range of hash values is used as the hash value of the trajectory box.
[0063] Specifically, in one embodiment, the hash values of each trajectory box are computed in parallel using a second set of threads, including computed a hash value of a current trajectory box using a current second thread, including: obtaining an axis-aligned bounding box that covers the current trajectory box; computed the hash values of the maximum and minimum corner points of the axis-aligned bounding box, and using the range of hash values between the maximum and minimum corner points as the hash value of the current trajectory box.
[0064] The maximum and minimum corner points of the axis-aligned bounding box are determined based on the coordinates of each corner point and are located on the diagonal of the axis-aligned bounding box. When calculating the hash value of a corner point, a suitable hash algorithm can be used based on the coordinates of the corner point.
[0065] Figure 4 The steps for parallel processing of obstacle point sets are shown in the embodiment; refer to Figure 4 As shown, in one embodiment, the obstacle points of the obstacle point set are cached in parallel based on CUDA, and the hash value of each obstacle point is calculated in parallel, including:
[0066] Step S410: Based on CUDA, create a second GPU space corresponding to the amount of data in the obstacle point set, and a third thread set and a fourth thread set corresponding to the number of each obstacle point.
[0067] The capacity of the second GPU space corresponds to the amount of data in the obstacle point set, in order to store the obstacle point set and the hash value of each obstacle point. The number of threads in the third and fourth thread sets corresponds to the number of obstacle points in the obstacle point set, in order to perform caching operations and hash value calculation operations for each obstacle point respectively.
[0068] Step S420: Use the third thread set to update the second GPU space in parallel, and cache each obstacle point to the corresponding memory space of the second GPU space.
[0069] When caching obstacle point sets, multiple third threads simultaneously update the second GPU space. Each third thread updates the memory space corresponding to the data amount of one obstacle point, thereby achieving parallel caching of obstacle point sets to the second GPU space.
[0070] Step S430: Use the fourth thread set to calculate the hash value of each obstacle point in parallel and update it to the corresponding memory space in the second GPU space.
[0071] When calculating the hash value, multiple fourth threads simultaneously calculate the hash value of each obstacle point. Each fourth thread calculates the hash value of one obstacle point and updates the corresponding memory space that caches the obstacle point with the calculated hash value.
[0072] When calculating the hash value of obstacle points, the same hash algorithm used to calculate the hash value of the trajectory box can be used based on the coordinates of the obstacle points.
[0073] Through the above-described process of parallel processing of trajectory box sequences and obstacle point sets based on CUDA, the trajectory box sequences, obstacle point sets, and corresponding hash values are efficiently cached in the GPU's memory space for subsequent screening of matching pairs with potential collision risks and fine-grained detection of collision risks for matching pairs.
[0074] In one embodiment, the hash value of each bounding box is represented as a range of hash values, and the hash value of each obstacle point is represented as a single hash value; identifying bounding boxes and obstacle points with matching hash values as a pair with potential collision risk includes: identifying obstacle points and bounding boxes with a single hash value falling within the hash value range as a pair with potential collision risk.
[0075] By matching hash values, matching pairs with potential collision risks can be quickly filtered out.
[0076] In one embodiment, after the hash values of each obstacle point are calculated in parallel, the hash values of each obstacle point are also sorted. When matching the hash values of the cached trajectory frames with the hash values of the obstacle points, a set of threads corresponding to the number of cached trajectory frames can be used to determine, in parallel, a single hash value falling into each hash value range based on the sorted hash values of the obstacle points.
[0077] The hash values of each obstacle point are sorted, specifically using the RadixSort algorithm. In a specific example, the hash values of each obstacle point can be sorted in ascending order. When matching the hash values of the cached trajectory boxes with the hash values of the obstacle points, each thread, for a trajectory box, quickly determines the single hash value falling within the hash value range of the obstacle points in ascending order, thereby determining the matching pair corresponding to that trajectory box.
[0078] Thus, by performing a rough detection based on hash values on the cached trajectory box sequence and obstacle point set, geometric pairs that may collide in space can be identified.
[0079] Furthermore, in one embodiment, the collision risk of each matching pair is detected in parallel based on CUDA, including: a fifth thread set corresponding to the number of matching pairs created and obtained by CUDA; and using the fifth thread set to detect the collision risk of each matching pair in parallel based on the area comparison method.
[0080] When detecting the collision risk of a matching pair, each fifth thread is used to detect the collision risk of a matching pair based on the area comparison method. Specifically, using a current fifth thread to detect the collision risk of a current matching pair includes: determining whether the sum of the areas of the triangles formed by connecting the obstacle points of the current matching pair to the corner points of the current matching pair's bounding box is greater than the area of the current matching pair's bounding box; if not, then the current matching pair is determined to have a collision risk.
[0081] Figure 5 An example of collision risk detection based on area comparison method is shown in the embodiment; see reference Figure 5 As shown, for a current matching pair, the obstacle point 510 of the current matching pair is connected to each corner point 520' of the trajectory frame 520 of the current matching pair, so that the obstacle point 510 and each pair of adjacent corner points 520' form a triangle, thus the obstacle point 510 and each corner point 520' of the trajectory frame 520 form a total of four triangles; it is determined whether the sum of the areas of the four triangles is greater than the area of the trajectory frame 520. If it is, it means that the obstacle point 510 is outside the trajectory frame 520 and there is no risk of collision between them. Otherwise, it means that the obstacle point 510 is inside the trajectory frame 520. In a real scenario, when the vehicle travels to the trajectory point corresponding to the trajectory frame 520, it will collide with the obstacle corresponding to the obstacle point 510. Therefore, it is determined that the current matching pair has a collision risk, that is, there is a collision risk between the trajectory frame 520 and the obstacle point 510.
[0082] After detecting the collision risk of each matching pair in parallel using CUDA, if none of the matching pairs corresponding to the candidate trajectory have a collision risk, then the candidate trajectory can be determined to have no collision risk; if any matching pair corresponding to the candidate trajectory has a collision risk, then the candidate trajectory can be determined to have a collision risk, and the matching pairs with collision risks can be recorded for subsequent optimization of the candidate trajectory.
[0083] Thus, by first roughly screening matching pairs with potential collision risks and then finely detecting the collision risks of each matching pair, the speed and accuracy of collision detection are greatly improved, achieving efficient and accurate collision detection of candidate trajectories.
[0084] In the above embodiments, if the obstacle information is point cloud data, then abstracting the obstacle information into a set of obstacle points includes: abstracting each obstacle point cloud in the point cloud data into a coordinate point without area; or, if the obstacle information is a raster map, then abstracting the obstacle information into a set of obstacle points includes: abstracting each obstacle raster in the raster map into a grid point without area.
[0085] Based on point cloud data / raster maps, collision detection between candidate trajectories and point cloud / raster level obstacle information can be achieved, improving detection accuracy.
[0086] Furthermore, in the above embodiments, CUDA is based on a thread management model and uses the concepts of Grid and Block to organize threads. A single Kernel starts all threads to form a Grid, a Grid can be composed of multiple Blocks, and a Block can be composed of multiple threads; both Grid and Block can be one-dimensional, two-dimensional, or three-dimensional.
[0087] Taking the fine-tuning phase, collision detection of each matching pair is performed as an example. Figure 6 An example of the CUDA thread management model in the embodiment is shown; see reference Figure 6As shown in the example, this example illustrates a 2D Grid610 and a 2D Block620. In this example, candidate trajectories are abstracted as a sequence of bounding boxes, which can specifically be polygons; point cloud data is abstracted as a set of coordinate points without area, or a raster map is abstracted as a set of grid points without area. After the coarse detection stage, the selected matching pairs include, for example, n pairs, which can be denoted as {(Polygon_1, Point_1 / grid_1), (Polygon_2, Point_2 / grid_2), ..., (Polygon_n, Point_n / grid_n}; then, in the CUDA thread management model of this example, each thread 630 performs collision detection between a bounding box (Polygon_k) and an obstacle point (Point_k / grid_k).
[0088] Figure 7 This embodiment illustrates an example of collision detection based on candidate trajectories and a grid map; see reference. Figure 7 As shown, based on the descriptions of the above embodiments, when the obstacle information is a grid map, the process of collision detection between the candidate trajectory and the grid map may include:
[0089] The candidate trajectory 710 is abstracted into a sequence of trajectory frames 720, and the grid map is abstracted into a set of obstacle points 730.
[0090] Based on CUDA, the trajectory box sequence and obstacle point set are processed in parallel, and each trajectory box 720 and its hash value, as well as each grid point 730 and its hash value, are cached.
[0091] Based on hash value matching, matching pairs with potential collision risks are identified. In this example, four matching pairs are identified: the matching pair of trajectory frame 720a and grid point 730a, the matching pair of trajectory frame 720a and grid point 730b, the matching pair of trajectory frame 720b and grid point 730a, and the matching pair of trajectory frame 720b and grid point 730b.
[0092] For the obtained matching pairs, the collision risk of each matching pair is detected in parallel using CUDA. For example, the matching pairs of trajectory box 720a and grid point 730a, trajectory box 720a and grid point 730b, and trajectory box 720b and grid point 730b are detected to have collision risk, thereby obtaining the collision detection result of candidate trajectory 710.
[0093] Figure 8 This embodiment illustrates an example of collision detection based on candidate trajectories and point cloud data; see reference. Figure 8As shown, based on the descriptions of the above embodiments, when the obstacle information is point cloud data, the process of collision detection of candidate trajectories and point cloud data may include:
[0094] The candidate trajectory 810 is abstracted into a sequence of trajectory boxes 820, and the point cloud data is abstracted into a set of obstacle points 830.
[0095] Based on CUDA, the trajectory box sequence and obstacle point set are processed in parallel, and each trajectory box 820 and its hash value, as well as each coordinate point 830 and its hash value are cached.
[0096] Based on hash value matching, matching pairs with potential collision risks are identified. In this example, three matching pairs are identified: the matching pair of trajectory frame 820a and coordinate point 830a, the matching pair of trajectory frame 820a and coordinate point 830b, and the matching pair of trajectory frame 820b and coordinate point 830b.
[0097] For the obtained matching pairs, the collision risk of each matching pair is detected in parallel using CUDA. For example, the matching pair of trajectory box 820a and coordinate point 830a is detected to have a collision risk, thereby obtaining the collision detection result of candidate trajectory 810.
[0098] In summary, the CUDA-based collision detection method of the present invention has the following advantages for collision detection between candidate trajectories and point cloud data / raster maps representing obstacle information:
[0099] Abstracting candidate trajectories into a sequence of bounding boxes and obstacle information into a set of obstacle points facilitates collision detection between the geometry of bounding boxes and obstacle points based on CUDA, thereby improving detection accuracy.
[0100] By using CUDA to process the trajectory box sequence and obstacle point set in parallel, each trajectory box and its hash value, as well as each obstacle point and its hash value, are cached to facilitate subsequent coarse detection based on hash values and fine detection of collision risk between geometry.
[0101] By combining coarse and fine detection, the method first coarsely screens matching pairs with potential collision risks and then finely detects the collision risks of each matching pair. This effectively reduces the order of magnitude of collision risk calculation between the trajectory box and obstacle points, improves the speed and accuracy of collision detection, and achieves efficient and accurate collision detection for candidate trajectories.
[0102] By separating the geometry used for collision detection from the collision detection between the geometry, the collision detection in trajectory planning becomes asynchronous.
[0103] Employing a GPU-based parallel computing framework effectively reduces CPU computational overhead; furthermore, leveraging CUDA's parallel computing capabilities significantly improves detection efficiency while saving CPU computational costs. Testing showed that, in collision detection involving 10,000 point cloud datasets and 1,000 bounding boxes, the average computation time in benchmark tests was within 1 e... -2 Within milliseconds; collision detection is performed on a 600x600 grid map and a 1000-fold bounding box, with an average computation time of 1 e in benchmark tests. - 2 Within ms.
[0104] This invention also provides a CUDA-based collision detection device, which can be used to implement the CUDA-based collision detection method described in any of the above embodiments. The features and principles of the collision detection methods described in any of the above embodiments can be applied to the following collision detection device embodiments. In the following collision detection device embodiments, the features and principles of CUDA-based collision detection already explained will not be repeated.
[0105] Figure 9 The main modules of the CUDA-based collision detection device in the embodiment are shown; see reference. Figure 9 As shown, in one embodiment, the CUDA-based collision detection device 920 includes:
[0106] The geometry abstraction module 920a is used to abstract candidate trajectories into a sequence of trajectory frames and obstacle information into a set of obstacle points in response to planned candidate trajectories and collected obstacle information.
[0107] The potential risk screening module 920b is used to determine matching pairs with potential collision risks by processing trajectory box sequences and obstacle point sets in parallel using CUDA. A matching pair consists of a trajectory box and an obstacle point.
[0108] The collision risk detection module 920c is used to detect the collision risk of each matching pair in parallel based on CUDA in response to the obtained matching pairs, and obtain the collision detection results of the candidate trajectories.
[0109] Furthermore, the CUDA-based collision detection device 920 may also include modules that implement other process steps of the above-described CUDA-based collision detection method embodiments. The specific principles of each module can be referred to the descriptions of the above-described CUDA-based collision detection method embodiments, and will not be repeated here.
[0110] The CUDA-based collision detection device of the present invention can be integrated into the planning module of an autonomous driving system or communicate and interact with the planning module. It can utilize the parallel computing capabilities of CUDA to greatly improve detection efficiency and save CPU computing overhead. By combining coarse detection and fine detection, it further improves the speed and accuracy of collision detection by first coarsely screening matching pairs with potential collision risks and then finely detecting the collision risks of each matching pair, thus achieving efficient and accurate collision detection of candidate trajectories.
[0111] This invention also provides an electronic device, including a processor and a memory, wherein the memory stores executable instructions, and when the executable instructions are executed by the processor, they implement the CUDA-based collision detection method described in any of the above embodiments.
[0112] The electronic device of the present invention can be deployed in the planning module of an autonomous driving system or communicate and interact with the planning module. It can utilize the parallel computing capabilities of CUDA to greatly improve detection efficiency and save CPU computing overhead. By combining coarse detection and fine detection, it further improves the speed and accuracy of collision detection by first coarsely screening matching pairs with potential collision risks and then finely detecting the collision risks of each matching pair, thus achieving efficient and accurate collision detection of candidate trajectories.
[0113] Figure 10 The main structure of the electronic device in the embodiment is shown; see reference Figure 10 As shown, the electronic device 960 is presented in the form of a general-purpose computing device. Components of the electronic device 960 include, but are not limited to: at least one processing unit 960a, at least one storage unit 960b, and a bus 960c connecting different platform components (including storage unit 960b and processing unit 960a).
[0114] Storage unit 960b stores program code, which can be executed by processing unit 960a, causing processing unit 960a to perform the steps of the CUDA-based collision detection method described in any of the above embodiments. For example, processing unit 960a can perform, as follows: Figure 1 The steps are shown.
[0115] The storage unit 960b may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) and / or a cache memory unit, and may further include a read-only memory unit (ROM).
[0116] Storage unit 960b may also include a program / utility having one or more program modules, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0117] The 960c bus can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0118] Electronic device 960 can also communicate with one or more external devices, such as keyboards, pointing devices, Bluetooth devices, etc. These external devices enable users to interact with electronic device 960. Electronic device 960 can also communicate with one or more other computing devices, including routers and modems. This communication can be achieved through the input / output (I / O) interface of electronic device 960 or an autonomous driving system. Furthermore, electronic device 960 can communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter. The network adapter can communicate with other modules of electronic device 960 via bus 960c. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 960, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms.
[0119] This invention also provides a computer-readable storage medium for storing a program that, when executed, implements the CUDA-based collision detection method described in any of the above embodiments. In some possible implementations, various aspects of this invention can also be implemented as a program product comprising program code, which, when run on a terminal device, causes the terminal device to execute the CUDA-based collision detection method described in any of the above embodiments.
[0120] The storage medium of this invention can be executed by the planning module of an autonomous driving system, realizing the parallel computing capabilities of CUDA, greatly improving detection efficiency, saving CPU computing overhead, and combining coarse detection and fine detection. By first coarsely screening matching pairs with potential collision risks and then finely detecting the collision risks of each matching pair, the speed and accuracy of collision detection are further improved, achieving efficient and accurate collision detection of candidate trajectories.
[0121] The storage medium may be a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the storage medium of the present invention is not limited thereto, and may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0122] The storage medium may be any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media include, but are not limited to: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0123] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. This propagated data signal may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable signal medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0124] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device, for example, via the Internet using an Internet service provider.
[0125] The above description, in conjunction with specific preferred embodiments, provides a further detailed explanation of the present invention. It should not be construed that the specific implementation of the present invention is limited to these descriptions. For those skilled in the art, various simple deductions or substitutions can be made without departing from the concept of the present invention, and all such modifications and substitutions should be considered within the scope of protection of the present invention.
Claims
1. A collision detection method based on CUDA, characterized in that, include: In response to the planned candidate trajectory and the collected obstacle information, the candidate trajectory is abstracted into a sequence of trajectory frames, and the obstacle information is abstracted into a set of obstacle points; The trajectory box sequence and the obstacle point set are processed in parallel using CUDA to determine matching pairs with potential collision risk. A matching pair consists of a trajectory box and an obstacle point. The step of using CUDA to process the trajectory box sequence and the obstacle point set in parallel to determine matching pairs with potential collision risk includes: caching each trajectory box of the trajectory box sequence in parallel using CUDA, and calculating the hash value of each trajectory box in parallel; caching each obstacle point of the obstacle point set in parallel using CUDA, and calculating the hash value of each obstacle point in parallel; matching the hash values of the cached trajectory boxes with the hash values of the obstacle points, and determining the trajectory boxes and obstacle points with matching hash values as matching pairs with potential collision risk. In response to the obtained matching pairs, the collision risk of each matching pair is detected in parallel based on CUDA to obtain the collision detection result of the candidate trajectory.
2. The collision detection method as described in claim 1, characterized in that, The method of caching each trajectory frame of the trajectory frame sequence in parallel based on CUDA and calculating the hash value of each trajectory frame in parallel includes: Based on CUDA, a first GPU space corresponding to the amount of data in the trajectory box sequence is created, and a first thread set and a second thread set corresponding to the number of each trajectory box are created respectively. The first GPU space is updated in parallel using the first thread set, and each trajectory box is cached in the corresponding memory space of the first GPU space; and The hash values of each trajectory frame are calculated in parallel using the second set of threads and updated to the corresponding memory space in the first GPU space.
3. The collision detection method as described in claim 2, characterized in that, The step of using the second set of threads to compute the hash value of each of the trajectory boxes in parallel includes computing the hash value of a current trajectory box using a current second thread, including: Obtain the axis-aligned bounding box that covers the current trajectory frame; Calculate the hash values of the maximum and minimum corner points of the axis-aligned bounding box, and use the range of hash values between the maximum and minimum corner points as the hash value of the current trajectory box.
4. The collision detection method as described in claim 1, characterized in that, The method of caching each obstacle point in the obstacle point set in parallel based on CUDA and calculating the hash value of each obstacle point in parallel includes: Based on CUDA, a second GPU space corresponding to the amount of data in the obstacle point set is created, and a third thread set and a fourth thread set corresponding to the number of each obstacle point are created respectively; The third thread set is used to update the second GPU space in parallel, caching each obstacle point to its corresponding memory space in the second GPU space; and The hash value of each obstacle point is calculated in parallel using the fourth thread set and updated to the corresponding memory space in the second GPU space.
5. The collision detection method as described in claim 1, characterized in that, The hash value of each track box is represented as a range of hash values, and the hash value of each obstacle point is represented as a single hash value; The step of identifying the trajectory bounding boxes and obstacle points that match the hash values as matching pairs with potential collision risk includes: Obstacle points and trajectory boxes whose single hash values fall within the hash value range are identified as matching pairs with potential collision risk.
6. The collision detection method as described in claim 5, characterized in that, After the hash values of each obstacle point are calculated in parallel, the hash values of each obstacle point are also sorted. When matching the hash values of cached trajectory frames with the hash values of obstacle points, a set of threads corresponding to the number of cached trajectory frames is used to determine, in parallel, a single hash value falling into each hash value range based on the sorted hash values of obstacle points.
7. The collision detection method as described in claim 1, characterized in that, The CUDA-based parallel detection of collision risks for each matching pair includes: The fifth thread set is based on the number of matching pairs created and obtained by CUDA; Based on the area comparison method, the fifth thread set is used to detect the collision risk of each matching pair in parallel.
8. The collision detection method as described in claim 7, characterized in that, The step of using the fifth thread set to detect the collision risk of each matching pair in parallel includes using a current fifth thread to detect the collision risk of a current matching pair, including: Determine whether the sum of the areas of the triangles formed by connecting the obstacle points of the current matching pair to the corner points of the trajectory frame of the current matching pair is greater than the area of the trajectory frame of the current matching pair. If not, then the current matching pair is determined to have a collision risk.
9. The collision detection method according to any one of claims 1-8, characterized in that, The obstacle information is point cloud data, and the abstraction of the obstacle information into a set of obstacle points includes: Each obstacle point cloud in the point cloud data is abstracted as a coordinate point without area; Alternatively, the obstacle information is a grid map, and the abstraction of the obstacle information into a set of obstacle points includes: Each obstacle grid in the grid map is abstracted as a grid point with no area.
10. A CUDA-based collision detection device, characterized in that, include: The geometry abstraction module is used to abstract the candidate trajectory into a sequence of trajectory frames and the obstacle information into a set of obstacle points in response to the planned candidate trajectory and the collected obstacle information. The potential risk screening module is used to process the trajectory box sequence and the obstacle point set in parallel based on CUDA to determine the matching pairs with potential collision risks. A matching pair consists of a trajectory box and an obstacle point. The potential risk screening module uses CUDA to process the trajectory box sequence and the obstacle point set in parallel to determine matching pairs with potential collision risks. This includes: caching each trajectory box in the trajectory box sequence in parallel using CUDA, and calculating the hash value of each trajectory box in parallel; caching each obstacle point in the obstacle point set in parallel using CUDA, and calculating the hash value of each obstacle point in parallel; matching the hash values of the cached trajectory boxes with the hash values of the obstacle points, and identifying trajectory boxes and obstacle points with matching hash values as matching pairs with potential collision risks. The collision risk detection module is used to detect the collision risk of each matching pair in parallel based on CUDA in response to the obtained matching pairs, and obtain the collision detection result of the candidate trajectory.
11. An electronic device, characterized in that, include: processor; A memory, wherein executable instructions are stored; When the executable instructions are executed by the processor, they implement the CUDA-based collision detection method as described in any one of claims 1-9.
12. A computer-readable storage medium for storing a program, characterized in that, When the program is executed by the processor, it implements the CUDA-based collision detection method as described in any one of claims 1-9.
Citation Information
Patent Citations
Motion planning for autonomous vehicles and reconfigurable motion planning processors
US11429105B2