Collision detection method and device

By calculating the minimum scaling factor between two triangular patches, the collision detection efficiency and accuracy problems in complex scenarios are solved, and efficient three-dimensional collision detection is achieved.

CN120170723APending Publication Date: 2025-06-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311744760.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-18
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

In complex scenarios, the existing convex geometry and triangular mesh schemes have efficiency and accuracy problems, making it difficult to achieve efficient collision detection.

Method used

By obtaining two triangle patches, determining their positional relationship, and calculating the minimum scaling factor based on this relationship, we judge the collision information between the two triangle patches.

Benefits of technology

It realizes efficient collision detection between complex three-dimensional objects, reduces the calculation amount, and improves the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120170723A_ABST
    Figure CN120170723A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a collision detection method, a collision detection device, electronic equipment and a nonvolatile computer readable storage medium. The method comprises the following steps: acquiring a first triangular patch and a second triangular patch; determining the position relation of the first triangular patch relative to the second triangular patch; based on the position relation, the minimum scaling factor of the first triangular patch relative to the second triangular patch is determined, and the first triangular patch scaled according to the minimum scaling factor is just separated from the second triangular patch; and determining collision information between the first triangular patch and the second triangular patch based on the minimum scaling factor. By using the minimum scaling factor as the distance measure between the two triangular patches, the embodiments of the present disclosure achieve efficient collision detection between the triangular patches.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical fields related to robotics and computer graphics, and particularly relates to a collision detection method, a collision detection device, an electronic device, and a non-volatile computer-readable storage medium. Background Art

[0002] In the cutting-edge technologies related to robotics and computer graphics, it is usually necessary to quantitatively evaluate the collision detection or spatial position relationship between two objects. In this field, the choice of quantitative evaluation algorithm usually depends on how to represent and measure the objects in space, which greatly affects the performance and accuracy of the entire system.

[0003] Currently, two schemes have been proposed, one is to use convex geometric shapes to represent the objects in space and the other is to use a triangular mesh to represent the objects in space. However, in complex scenarios, these two schemes have obvious defects. Therefore, it is necessary to propose a more efficient collision detection scheme to meet the requirements of collision detection in complex scenarios. Summary of the Invention

[0004] In view of the above problems, the present disclosure provides a collision detection method, a collision detection device, an electronic device, and a non-volatile computer-readable storage medium.

[0005] According to one aspect of the present disclosure, a collision detection method is proposed, including: obtaining a first triangular patch and a second triangular patch; determining the position relationship between the first triangular patch and the second triangular patch; based on the position relationship, determining the minimum scaling factor of the first triangular patch relative to the second triangular patch, where the first triangular patch scaled by the minimum scaling factor is just separated from the second triangular patch; and based on the minimum scaling factor, determining the collision information between the first triangular patch and the second triangular patch.

[0006] According to another aspect of the present disclosure, a collision detection method is proposed, including: obtaining a first triangular mesh and a second triangular mesh; selecting two adjacent triangular patches from the first triangular mesh as a pair of triangular patches; selecting a triangular patch or a pair of triangular patches from the second triangular mesh that is in contact with the vertices or edges of each triangular patch in the pair of triangular patches; determining the minimum scaling factor between the first triangular mesh and the second triangular mesh to be zero, where the first triangular mesh scaled by the minimum scaling factor is just separated from the first triangular mesh; and based on the minimum scaling factor, determining the collision information between the first triangular mesh and the second triangular mesh.

[0007] According to another aspect of the present disclosure, a collision detection device is provided. The device includes: an acquisition module configured to acquire a first triangular patch and a second triangular patch; a determination module configured to acquire the first triangular patch and the second triangular patch; a calculation module configured to determine a minimum scaling factor of the first triangular patch relative to the second triangular patch based on the positional relationship, wherein the first triangular patch scaled by the minimum scaling factor just separates from the second triangular patch; and a detection module configured to determine collision information between the first triangular patch and the second triangular patch based on the minimum scaling factor.

[0008] According to another aspect of the present disclosure, an electronic device is provided, including: a processor; and a memory, wherein computer-executable code is stored in the memory, and when the computer-executable code is run by the processor, the above method is executed.

[0009] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which executable code is stored, and when the executable code is executed by a processor, the processor is caused to execute the above method.

[0010] By using the minimum scaling factor as the distance metric between two triangular patches, the embodiments of the present disclosure achieve efficient collision detection between two triangular patches. Compared with using the Euclidean distance as the metric for collision detection, the calculation amount of the minimum scaling factor is lower, and collision detection can also be performed more efficiently.

[0011] Furthermore, based on the collision detection between two triangular patches, the embodiments of the present disclosure also achieve the detection of collisions between any two triangular patch meshes. Compared with traditional collision detection schemes, the embodiments of the present disclosure can more efficiently and accurately determine the collision information between two triangular patch meshes. Description of the Drawings

[0012] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some exemplary embodiments of the present disclosure, and those of ordinary skill in the art can obtain other drawings according to these drawings without creative efforts. The following drawings are not deliberately drawn to scale in actual size, and the focus is on showing the gist of the present disclosure.

[0013] Figure 1 It is a schematic diagram showing the interaction between a robot and an example object according to an embodiment of the present disclosure.

[0014] Figure 2A is a flowchart showing a collision detection method according to an embodiment of the present disclosure.

[0015] Figure 2B is a comparison graph of calculation times for detecting collision information using the minimum scaling factor and detecting collision information using the Euclidean distance according to an embodiment of the present disclosure.

[0016] Figure 3A is a schematic diagram showing the positional relationship between two triangular patches according to an embodiment of the present disclosure.

[0017] Figure 3B is an example pseudocode showing the minimum scaling factor of two triangular patches in a coplanar relationship according to an embodiment of the present disclosure.

[0018] Figure 3C is an example pseudocode showing the minimum scaling factor of two triangular patches in an "edge-to-edge" relationship according to an embodiment of the present disclosure.

[0019] Figure 4A is an example pseudocode showing the search for the minimum scaling factor according to an embodiment of the present disclosure.

[0020] Figure 4B is a test graph showing the application Figure 4A of the example pseudocode according to an embodiment of the present disclosure.

[0021] Figure 5A is another example pseudocode showing the search for the minimum scaling factor according to an embodiment of the present disclosure.

[0022] Figure 5B is a test graph showing the application Figure 5A of the example pseudocode according to an embodiment of the present disclosure.

[0023] Figure 6 is a schematic diagram showing another collision detection method according to an embodiment of the present disclosure. Detailed Description of the Invention

[0024] In order to make the objectives, technical solutions and advantages of the present disclosure more apparent, example embodiments according to the present disclosure will be described in detail below with reference to the accompanying drawings. Apparently, the described embodiments are only a part rather than all of the embodiments of the present disclosure. It should be understood that the present disclosure is not limited by the example embodiments described herein.

[0025] As shown in this disclosure and the claims, unless the context clearly dictates otherwise, words such as "a," "an," "one," and / or "the" are not intended to refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" merely indicate the inclusion of the steps and elements that have been expressly identified, and such steps and elements do not constitute an exclusive listing. A method or apparatus may also contain other steps or elements.

[0026] Although this disclosure makes various references to certain modules in the apparatus according to embodiments of this disclosure, any number of different modules may be used and run on a user terminal and / or a server. The modules are merely illustrative, and different aspects of the apparatus and method may use different modules.

[0027] Flowcharts are used in this disclosure to illustrate the operations performed by the methods and apparatuses according to embodiments of this disclosure. It should be understood that the operations above or below do not necessarily have to be executed precisely in order. On the contrary, various steps may be processed in reverse order or simultaneously as needed. Also, other operations may be added to these processes, or one or more steps may be removed from these processes.

[0028] With the continuous development of computer graphics technology and robotics technology, real-time and efficient environmental perception and collision avoidance have become one of the main bottlenecks restricting the application and popularization of robots. Some robots need to move autonomously and interact with the outside world easily and naturally, and safely and reliably achieve navigation and obstacle avoidance in a cluttered and complex living environment or natural environment. This poses higher requirements for the environmental perception and autonomous movement capabilities of robots. Specifically, a robot needs to obtain three-dimensional information about its surrounding environment and obstacles in real time, and perform collision detection to reasonably and effectively plan its movement path. However, there are still great challenges in three-dimensional perception and rapid collision detection in complex environments. The embodiments of this disclosure can directly and efficiently handle the collision relationships between complex non-convex objects, which can significantly improve the obstacle avoidance ability of robots and contribute to the further research, development, application, and popularization of the next generation of robots.

[0029] In summary, the solutions provided by the embodiments of the present disclosure involve technologies such as intelligent robots and computer graphics. An intelligent robot refers to a robot constructed by integrating artificial intelligence (AI) technology. Among them, artificial intelligence is the theory, method, technology, and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines to enable the machines to have the functions of perception, reasoning, and decision-making.

[0030] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields, including both hardware-level technologies and software-level technologies. The basic technologies of artificial intelligence generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, and mechatronics. Among them, the pre-trained model, also known as the large model or the foundation model, can be widely applied to downstream tasks in various directions of artificial intelligence after fine-tuning. The software technologies of artificial intelligence mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0031] The embodiments of the present disclosure will be further described below with reference to the accompanying drawings.

[0032] Figure 1 It is a schematic diagram showing the interaction between a robot and a glass according to an embodiment of the present disclosure.

[0033] As Figure 1 shown, in a scenario where a robotic hand with only three fingers grasps a target object (such as a glass), the controller of the robot needs to accurately control the force of the robotic fingers to avoid excessive force exerted by the robotic fingers and thus damage the target object. To achieve this goal, the controller needs to real-time evaluate the distance, collision relationship, and collision depth between the robotic fingers and the surface of the target object to accurately calculate and apply an appropriate contact force. Specifically, the controller can establish three-dimensional models of the robotic fingers and the target object and determine the collision state between them based on such three-dimensional models.

[0034] The three-dimensional models of objects such as robotic fingers and glasses are usually complex three-dimensional structures. How to accurately and efficiently detect the collision relationship between the two has always been an urgent problem to be solved. The relevant research mainly optimizes from two aspects: one is to improve the scheme for representing spatial objects, and the other is to improve the metric for collision detection.

[0035] In improving the representation of the orientation of spatial objects, the use of convex geometric body representation and triangle mesh representation has been proposed. The convex geometric body representation can quickly detect the occurrence of collisions, but it is difficult to accurately adapt to the surface details of objects. The triangle mesh representation can accurately describe complex surfaces, but the detection efficiency is low.

[0036] In improving the metrics for collision detection, almost all current solutions are collision detection solutions based on the Euclidean distance. However, for the detection of collision relationships between complex non-convex objects, the computational cost of such solutions is still too high to meet the requirements of real-time applications.

[0037] Therefore, in view of the above problems, on the one hand, embodiments of the present disclosure provide a collision detection method, including obtaining a first triangle patch and a second triangle patch; determining the positional relationship of the first triangle patch relative to the second triangle patch; based on the positional relationship, determining the minimum scaling factor of the first triangle patch relative to the second triangle patch, wherein the first triangle patch scaled according to the minimum scaling factor is just separated from the second triangle patch; and based on the minimum scaling factor, determining the collision information between the first triangle patch and the second triangle patch.

[0038] On the other hand, embodiments of the present disclosure also provide a collision detection method, including: obtaining a first triangle mesh and a second triangle mesh; selecting two adjacent triangle patches from the first triangle mesh as a pair of triangle patches; selecting a triangle patch or a pair of triangle patches from the second triangle mesh that is in contact with the vertices or edges of each triangle patch in the pair of triangle patches; determining the minimum scaling factor between the first triangle mesh and the second triangle mesh to be zero, wherein the first triangle mesh scaled according to the minimum scaling factor is just separated from the first triangle mesh; and based on the minimum scaling factor, determining the collision information between the first triangle mesh and the second triangle mesh.

[0039] On the other hand, embodiments of the present disclosure also provide a collision detection device, the device including: an acquisition module configured to acquire a first triangular facet and a second triangular facet; a determination module configured to acquire the first triangular facet and the second triangular facet; a calculation module configured to determine a minimum scaling factor of the first triangular facet relative to the second triangular facet based on the positional relationship, wherein the first triangular facet scaled by the minimum scaling factor just separates from the second triangular facet; and a detection module configured to determine collision information between the first triangular facet and the second triangular facet based on the minimum scaling factor.

[0040] For this reason, embodiments of the present disclosure use the minimum scaling factor as a collision detection metric to implement collision detection between two triangular facets, which can greatly reduce unnecessary repeated calculations and make real-time collision detection between complex three-dimensional objects possible. The application of the embodiments of the present disclosure enables the manipulator to achieve more precise and stable grasping and manipulation, which helps to improve the intelligent level of robot grasping and interaction.

[0041] Next, first refer to Figure 2A and Figure 2B to make an overall description of various embodiments of the present disclosure.

[0042] Figure 2A is a flowchart showing a collision detection method according to an embodiment of the present disclosure. Figure 2B is a comparison graph of calculation times for detecting collision information using the minimum scaling factor and detecting collision information using the Euclidean distance according to an embodiment of the present disclosure.

[0043] The collision detection method 20 according to an embodiment of the present disclosure may include operations S201 to S204 as Figure 2A shown.

[0044] In operation S201, a first triangular facet and a second triangular facet are acquired.

[0045] Optionally, a triangular facet is a basic constituent unit for characterizing a geometric body in a virtual space or a simulation space, which is composed of three vertices and the edges connecting these three vertices. Specifically, assume that the first triangular facet can be represented as where v s1 , v s2 , v s3 are respectively the three vertices of the first triangular facet. And the second triangular facet can be represented as where v t1 , v t2 , v t3They are respectively the three vertices of the second triangular patch. In the present disclosure, the subscript "S" (or "T") respectively indicates a parameter or an object associated with the triangular patch S (or T). To describe the present disclosure more clearly and concisely, the triangular patch S and the first triangular patch refer to the same object, while the triangular patch T and the second triangular patch refer to the same object.

[0046] In operation S202, determine the positional relationship of the first triangular patch relative to the second triangular patch.

[0047] Optionally, the positional relationship here refers to the relative position and arrangement between the first triangular patch and the second triangular patch in a three-dimensional space. Specifically, the positional relationship of the first triangular patch relative to the second triangular patch includes but is not limited to: Askew, Contained, Coplanar, Vertex-face, and Edge-edge. Of course, those skilled in the art should understand that the present disclosure is not limited thereto.

[0048] Optionally, the process of determining the positional relationship of the first triangular patch relative to the second triangular patch can be briefly described as sequentially performing the following judgments. After determining that the positional relationship is one of the following five cases, no further judgment of other cases is continued. This order of judgment emphasizes sequentially judging and processing different positional relationships, enabling the embodiments of the present disclosure to more efficiently and orderly determine the relative position between two triangular patches. Of course, the present disclosure is not limited thereto.

[0049] First, judge whether the positional relationship is Askew. Specifically, in response to all three vertices of the second triangular patch being on the same side of the plane where the first triangular patch is located, determine the position as Askew.

[0050] Next, judge whether the positional relationship is Contained. In response to the centroid of the first triangular patch being inside the second triangular patch, determine the position as Contained.

[0051] Then, judge whether the positional relationship is Coplanar. In response to the first triangular patch and the second triangular patch being in the same plane, determine the position as Coplanar.

[0052] Then, judge whether the positional relationship is Vertex-face. In response to the vertex of the first triangular patch contacting the second triangular patch first during the scaling process, determine the position as Vertex-face.

[0053] Finally, judge whether the positional relationship is Edge-edge. In response to the edge of the first triangular patch contacting the edge of the second triangular patch first during the scaling process, determine the position as Edge-edge.

[0054] In operation S203, based on the position relationship, determine the minimum scaling factor of the first triangular patch relative to the second triangular patch, where the first triangular patch scaled by the minimum scaling factor is just separated from the second triangular patch.

[0055] Let represent the unit normal of the plane containing the triangular patch S. represent the signed distance of the plane containing the triangular patch S along n s from the origin of the space, where d s can be calculated as d s = n s T v s , where v s is any vertex of the triangular patch S. Based on the above definitions, the plane containing the triangular patch S can be represented by . Similarly, for the triangular patch T, its corresponding parameters m t , d t , P t can be defined similarly with reference to the triangular patch S.

[0056] Specifically, the minimum scaling factor between the first triangular patch (hereinafter denoted as S) and the second triangular patch (hereinafter denoted as T) can be defined as: scaling the first triangular patch (S) by the minimum scaling factor so that the first triangular patch (S) is just separated from (or just in contact with) the second triangular patch (T). At this time, there is probably one and only one contact point between the first triangular patch and the second triangular patch.

[0057] Specifically, assume that the vertex set of the first triangular patch S can be represented as V s , where the first triangular patch S will be scaled proportionally with the minimum scaling factor as the scaling ratio and with the centroid p s0 of the first triangular patch S as the center. During the scaling process, the first triangular patch is scaled uniformly without introducing shape distortion or stretching. In this example, although for the convenience of calculation, the centroid is used as the center for scaling, those skilled in the art should understand that any point inside the first triangular patch S can also be used as the scaling center as long as it does not introduce shape distortion or stretching.

[0058] Optionally, the centroid p s0 of the first triangular patch S can be obtained by taking the average of the vertex set V s of the first triangular patch S. In operation S203, by determining the first triangular patch S relative to its centroid ps0 The minimum non - negative scaling factor λ for scaling * such that the scaled first triangular patch S λ is just tangent to T.

[0059] Specifically, it can be represented by the first triangular patch after scaling with λ as the scaling factor. The first triangular patch S is centered at p s0 and scaled with as the scaling factor to obtain the first triangular patch S λ . The optimal value λ in λ * represents the minimum scaling factor that makes just separate from T. That is, the minimum scaling factor λ * can be used as a scaling factor for measuring whether the triangular patches S and T collide.

[0060] The example calculation process of the minimum scaling factor λ * can be briefly described as follows: In response to the positional relationship being skewed, the minimum scaling factor is determined to be positive infinity. In response to the positional relationship being inclusive, the minimum scaling factor is determined to be zero. In response to the positional relationship being coplanar, a first scaling factor is determined, where the first scaling factor makes the edge of the first triangular patch contact the vertex of the second triangular patch; a second scaling factor is determined, where the second scaling factor makes the vertex of the first triangular patch contact the edge of the second triangular patch; and the smaller value of the first scaling factor and the second scaling factor is determined as the minimum scaling factor. In response to the positional relationship being vertex - to - face, based on the centroid data, vertex data of the first triangular patch, and the unit normal vector of the second triangular patch, the minimum scaling factor is determined. In response to the positional relationship being edge - to - edge, the intersection point of the edge of the first triangular patch and the edge of the second triangular patch is determined; and based on the intersection point, the minimum scaling factor is determined.

[0061] After that, the detailed process of calculating the minimum scaling factor will be described with reference to the respective drawings described in detail later. This disclosure will not elaborate further here.

[0062] In operation S204, based on the minimum scaling factor, the collision information between the first triangular patch and the second triangular patch is determined.

[0063] Optionally, the collision information between the first triangular patch and the second triangular patch can indicate various types of interaction data between these two triangular patches. These collision information can include key information such as whether they collide, the collision depth, the collision position, etc., and this disclosure is not limited thereto.

[0064] Optionally, it is possible to determine whether the first triangular patch and the second triangular patch collide based on the minimum scaling factor λ determined in step S203 * . The value range of λ * is between 0 and positive infinity. When λ * is less than 1, it indicates that the first triangular patch S needs to be shrunk to separate from the second triangular patch T. Therefore, the first triangular patch S and the second triangular patch T must collide. And when λ * is equal to 1, it indicates that the first triangular patch S and the second triangular patch T are just separated. When λ * is greater than 1, it indicates that the first triangular patch S needs to be enlarged to collide with the second triangular patch T. Therefore, the first triangular patch S and the second triangular patch T do not collide at this time.

[0065] Optionally, it is also possible to use the minimum scaling factor λ determined in step S203 * to determine the collision depth between the first triangular patch and the target triangular patch. In the case where λ * is less than 1, the closer λ * is to 0, the deeper the collision degree between the two; the closer λ * is to 1, the shallower the collision degree between the two. Of course, the present disclosure is not limited thereto.

[0066] Optionally, it is also possible to use the minimum scaling factor λ determined in step S203 * to determine the collision position between the first triangular patch and the target triangular patch. Specifically, by using the minimum scaling factor λ * to determine the scaled first triangular patch it is possible to determine which vertex or which edge in the first triangular patch contacts the triangular patch T, thereby determining the specific collision position. Of course, the present disclosure is not limited thereto.

[0067] As Figure 2B shown, in the test of calculating the collision information between ten thousand pairs of triangular patches, compared with calculating the Euclidean distance between two triangular patches, calculating the minimum scaling factor λ * between two pairs of triangular patches significantly reduces the amount of calculation required and significantly reduces the calculation duration.

[0068] Thus, the embodiments of the present disclosure use the minimum scaling factor as a collision detection metric to implement collision detection between a first object and any (complex) object, which can significantly reduce unnecessary repeated calculations and enable real-time collision detection between complex three-dimensional objects. The application of the embodiments of the present disclosure can enable the manipulator to achieve more precise and stable grasping and manipulation, which helps to improve the intelligence level of the robot.

[0069] Next, refer to Figures 3A to 3C to further describe the minimum scaling factor in the embodiments of the present disclosure.

[0070] Figure 3A is a schematic diagram showing the positional relationship between two triangular patches according to an embodiment of the present disclosure. Figure 3B is an example pseudocode showing the minimum scaling factor of two triangular patches in a coplanar relationship according to an embodiment of the present disclosure. Figure 3C is an example pseudocode showing the minimum scaling factor of two triangular patches in an "edge-to-edge" relationship according to an embodiment of the present disclosure.

[0071] In the following detailed description, the parameters are defined as follows.

[0072] The scaling factor between the first triangular patch (S) and the second triangular patch (T) can be defined as: scaling the first triangular patch (S) according to the scaling factor so that the first triangular patch (S) is just separated from (or just in contact with) the second triangular patch (T). At this time, there is exactly one contact point between the first triangular patch and the second triangular patch.

[0073] Specifically, assume that the first triangular patch can be represented as which will be enlarged or reduced with the scaling factor as the scaling ratio, v s1 v s2 v s3 are the three vertices of the first triangular patch respectively. And the second triangular patch can be represented as which will be the target that S scaled proportionally just separates from or contacts, where v t1 v t2 v t3 are the three vertices of the second triangular patch respectively.

[0074] Let represent the unit normal of the plane containing the triangular patch S. represents the signed distance of the plane containing the triangular patch S from the origin of the space along n s where d s can be calculated as d s = n s T vs , where v s is any vertex of the triangular patch S. Based on the above definition, the plane containing the triangular patch S can be represented by . Similarly, for the triangular patch T, its corresponding parameters n t , d t , P t can be defined similarly with reference to the triangular patch S.

[0075] In addition, let p s0 be the centroid / center of the triangular patch S, where p s0 =(v s1 +v s2 +v s3 ) / 3. In the present disclosure, is used to represent the triangular patch S' obtained by scaling the triangular patch S with p s0 as the center and as the scaling factor, and λ λ represents the minimum scaling factor such that * does not separate from T.

[0076] Next, the following five examples are used to describe how to solve for the minimum scaling factor λ * .

[0077] Example 1

[0078] In Example 1, in operation S202, in response to all three vertices of the second triangular patch being on the same side of the plane where the first triangular patch is located, the position is determined to be skewed. In operation S203, in response to the position relationship being skewed, the minimum scaling factor is determined to be positive infinity.

[0079] Example 1 shows a case where the positional relationship between the triangular patch S and the triangular patch T is skewed. As shown in Example 1, all three vertices of the triangular patch T are on the same side of the plane P s where the triangular patch S is located. Therefore, the triangular patch T is separated from the plane P s where the triangular patch S is located. No matter how the triangular patch S is scaled, the triangular patch T and the triangular patch S will not intersect, so a collision will definitely not occur. In this case, λ * = +∞.

[0080] Determining whether the positional relationship between the triangular patch S and the triangular patch T satisfies the skewed condition includes:

[0081] (1) The three vertices of the triangular patch T are all on the side of the origin of the space closer to the triangular patch S. At this time, if the plane of the triangular patch S is along n s The signed distance d from the origin of the space s is greater than the maximum value of the signed distances from each vertex in the triangular patch T along n s from the origin of the space then the positional relationship between the triangular patch S and the triangular patch T is skewed;

[0082] (2) The three vertices of the triangular patch T are all on the side of the origin of the space farther from the triangular patch S. At this time, if the plane of the triangular patch S is along n s The signed distance d from the origin of the space s is less than the minimum value of the signed distances from each vertex in the triangular patch T along n s from the origin of the space then the positional relationship between the triangular patch S and the triangular patch T is skewed.

[0083] The following formula (1) illustrates the process of solving λ in Example 1 in a mathematical expression * .

[0084] If or then λ * = +∞ (1)

[0085] Example 2

[0086] In Example 2, in operation S202, in response to the centroid of the first triangular patch being inside the second triangular patch, the position is determined as contained. In operation S203, in response to the positional relationship being contained, the minimum scaling factor is determined to be zero.

[0087] Example 2 shows the case where the positional relationship between the triangular patch S and the triangular patch T is contained. In Example 2, the center p of the triangular patch S s0 is inside the triangular patch t. At this time, if and only if the scaling factor is zero, the triangular patch S is scaled into a point, that is, the center p of the triangular patch S s0 . In this case, λ * = 0.

[0088] There are multiple schemes for determining whether the center p of the triangular patch S s0 is inside the triangular patch T. One of the schemes is illustrated below. Those skilled in the art should understand that the present disclosure is not limited thereto. Let e p = p s0 - vt1 , e1 = v t2 -v t1 , e2 = v t3 -v t1 。p s0 The condition for it to be located inside the triangular patch T is: if and only if e p = c1e1 + c2e2 and e p = p s0 , where C1, C2 ≥ 0 and C1 + c2 ≤ 1. c1 = b1 / a and c2 = b2 / a. a, b1, and b2 can be solved by the following formulas (2) to (4).

[0089]

[0090] Based on formulas (2) to (4), to satisfy c1, c2 ≥ 0 and c1 + c2 ≤ 1, a, b1, and b2 need to have the same sign and satisfy the condition |b1 + b2| ≤ |a|.

[0091] That is to say, by calculating a, b1, and b2, and judging whether these three have the same sign and whether they satisfy the condition |b1 + b2| ≤ |a| and ||e p -p s0 || = 0, the centroid p of the triangular patch S can be determined s0 whether it is located inside the triangular patch T, so as to judge whether the positional relationship between the triangular patch S and the triangular patch T is an inclusion relationship.

[0092] Example 3

[0093] In Example 3, in operation S202, in response to the first triangular patch and the second triangular patch being in the same plane, the position is determined to be coplanar. In operation S203, in response to the positional relationship being coplanar, a first scaling factor is determined, the first scaling factor makes the side of the first triangular patch contact the vertex of the second triangular patch; a second scaling factor is determined, the second scaling factor makes the vertex of the first triangular patch contact the side of the second triangular patch; and the smaller value of the first scaling factor and the second scaling factor is determined as the minimum scaling factor.

[0094] Example 3 shows a situation where the positional relationship between triangular patch S and triangular patch T is coplanar. If it has been determined that the positional relationship between triangular patch S and triangular patch T does not satisfy the skew and inclusion cases, then it is necessary to determine whether the positional relationship between triangular patch S and triangular patch T satisfies the coplanar relationship. Example 3 is a relatively rare case where triangular patch S and triangular patch T are in the same plane. Specifically, it can be determined whether triangular patch S and triangular patch T are in the same plane by ||n s ×n t || = 0.

[0095] As shown in the figure, in the case of Example 3, the scaling factor is a finite non-zero real number. In the case of Example 3, there may be two sub-cases. In sub-case (a) (and as shown in the upper figure of Example 3), by scaling triangular patch S, the edge of triangular patch S first contacts the vertex of triangular patch T; in sub-case (b) (and as shown in the lower figure of Example 3), by scaling triangular patch S, the vertex of triangular patch S first contacts the edge of triangular patch T. λ * is the smaller value of the first scaling factor λ a corresponding to sub-case a) and the second scaling factor λ b corresponding to sub-case b).

[0096] To facilitate the calculation of the first and second scaling factors corresponding to sub-case a) and sub-case b), triangular patch S and triangular patch T can be projected onto their common plane first, so that all calculations can be completed in 2D space. The following variables are defined for subsequent calculations: matrix N ∈ R 3×2 , whose columns are the basis forming 's null space. Then, the vertices of the projected triangle can be calculated as v = N T (v - p s0 ), where v is any vertex of triangular patch S or triangular patch T. The projected triangular patch is represented by and . By projecting triangular patch S and triangular patch T onto their common plane, the origin of the 2-D space is also shifted to the centroid of in this way.

[0097] To calculate the first scaling factor λ a of sub-case a), first calculate the normal of the edge of the projected triangle . Let and where e s3 (1) and e s3 (2) are e s3The two components. Then, calculate the projected triangular patch Edge e of s3 , and the normal of edge e s3 is Normalize to and calculate the signed distance of edge e s3 from the origin (i.e., at the centroid of ) as Similarly, the other two edges e of s1 and e s2 can also be calculated for their normals and distances Next, it is possible to derive the minimum scaling factor that just encloses another projected triangle with a vertex is From this, the first scaling factor for sub - case a) can be derived

[0098] To calculate the second scaling factor λ for sub - case b) b , first, it is necessary to determine whether the line passing through the origin and the projected triangular patch intersects with , which holds if and only if or . Here, u is the vector orthogonal to s and . By such an operation, it is possible to identify each pair of vertices of on different sides of the line . Then, for each such pair of vertices (if any), say the candidate scaling factor can be calculated, where, similar to in sub - case a), is the normal corresponding to the edge defined by vertices and . If the candidate scaling factor λ > 0 and is a point on the line passing through and , then the candidate scaling factor λ is valid. The verification of this condition requires only a small amount of computation. By repeating the above steps for each vertex of , the second scaling factor λ for sub - case b) can be obtained b .

[0099] From this, in Example 3, λ* =min{λ a ,λ b}.

[0100] The calculation process of Example 3 can be found in Figure 3B As shown in the pseudo code - Routine 1, the process can be briefly described as follows.

[0101] Given a triangle patch S = {v s1 ,v s2 ,v s3} and T={v t1 ,v t2 ,v t3}coplanar, and use the instances corresponding to these two triangular patches as input of routine 1.

[0102] In steps 1-3, determine the unit normal n of the plane where the triangle patch S is located. s , The basis matrix N of the null space and the center p of the triangular patch S s0 .

[0103] Next, in steps 4-7, the center p of the triangle patch S is determined in turn. s0 The projection of the vectors to each vertex of the triangle patch S in the matrix N, and the center p of the triangle patch S s0 The projection of the vectors of each vertex of the triangle patch T in the matrix N. Thus, the first for loop realizes the projection of the triangle patch S and the triangle patch T onto the common plane shared by the two, and shifts the origin of the 2-D space to the projected triangle patch corresponding to the triangle patch S. In addition, in step 8, based on the result of the first for loop, the projected triangle patch corresponding to the triangle patch T is obtained.

[0104] In the second for loop corresponding to steps 9-14, the projected triangle patches are determined in turn Each edge of si , Edge si The unit normal of and edge si Signed distance calculation from the origin

[0105] In step 15, a first scaling factor corresponding to subcase a) is obtained In a subsequent step, a second scaling factor λ corresponding to subcase b) is then determined. b , and the second scaling factor λ corresponding to subcase b) bThe first scaling factor λ corresponding to sub-case a) a is compared to determine the actual minimum scaling factor in the coplanar case.

[0106] In the third for loop corresponding to steps 16 - 27, it is successively determined which side of the line passing through the origin and the projection triangle patch each vertex of the projection triangle patch is located on. Specifically, if then the vertex is located on the negative side of the line (the vertices on the negative side are stored in the set ); and if then the vertex is located on the positive side of the line (the vertices on the positive side are stored in the set ). Among them, u is a vector orthogonal to s and are the two components of and is . One vertex is extracted from the set and the set respectively to form a vertex pair located on different sides of the line As long as there are unprocessed vertex pairs the fourth for loop is executed. For each vertex pair, a candidate scaling factor is calculated. If 0 < λ (which is also λ b ) < λ * (which is also λ a ) and is a point on the line passing through and , then the second scaling factor λ b is valid. Therefore, the candidate scaling factor λ (that is, λ b ) can be used to replace λ * (that is, λ a ). " is a point on the line passing through and " can be determined by checking whether the condition is satisfied.

[0107] In step 28, after determining the completion of the first for loop, step 29 is executed. In step 29, λ * is returned.

[0108] Example 4

[0109] In Example 4, in operation S202, in response to the vertex of the first triangular patch contacting the second triangular patch first during the scaling process, the position is determined as vertex-to-face. In operation S203, in response to the position relationship being vertex-to-face, based on the centroid data of the first triangular patch (hereinafter denoted as p s0 ), vertex data (hereinafter denoted as ), and the unit normal vector of the second triangular patch (hereinafter denoted as ), the minimum scaling factor is determined.

[0110] If it has been determined that the position relationship between triangular patch S and triangular patch T does not satisfy the cases of skew, inclusion, and coplanarity, then the situation of Example 4 can be further discussed to determine the scaling factor. Example 4 shows the case where the position relationship between triangular patch S and triangular patch T is vertex-to-face. In Example 4, when scaling triangular patch S, λ * is obtained when a certain vertex of triangular patch S first contacts triangular patch T. Therefore, it is necessary to determine which vertex in triangular patch S is most likely to be the vertex that first contacts triangular patch T. Let be defined as Then, the candidate scaling factor can be calculated by the following formula (5).

[0111]

[0112] Since p s0 is the centroid of S, and after excluding the cases corresponding to Examples 1 to 3, according to the definition, it can be determined that in the case of Example 4, is necessarily satisfied. And the scaling factor λ must be a real number greater than zero, and the corresponding constraint condition for Example 4 The candidate scaling factor λ calculated by formula (5) is actually the scaling factor that makes S λ just contact the plane where triangular patch T is located, and the contact point of S λ with this plane can be calculated as If p c is included in triangular patch T, then λ * = λ. If p c is not included in triangular patch T, then λ * will be obtained in the situation of Example 5.

[0113] Example 5

[0114] In Example 5, in operation S202, in response to the edge of the first triangular patch contacting the edge of the second triangular patch first during the scaling process, the position is determined as edge-to-edge. In operation S203, in response to the position relationship being edge-to-edge, the intersection point (hereinafter denoted as p) of the edge of the first triangular patch and the edge of the second triangular patch is determined; and based on the intersection point, the minimum scaling factor is determined.

[0115] If it has been determined that the position relationship between triangular patch S and triangular patch T does not satisfy the situations in Examples 1 to 4, then it is necessary to determine the scaling factor via the situation in Example 5. Example 5 shows the situation where the position relationship between triangular patch S and triangular patch T is edge-to-edge.

[0116] In Example 5, when scaling triangular patch S, λ * is obtained when a certain edge of triangular patch S first contacts the vertex of triangular patch T. First, calculate all the intersection points of the edge of triangular patch T and the plane containing triangular patch S. For example, for the edge of triangular patch T with vertices v t1 and v t2 , the edge intersects the plane if and only if . Then, the intersection point p can be calculated as where e t3 = v t1 - v t2 . Once all the intersection points are determined, the calculation of λ * is similar to the calculation of λ a in sub-case a) in the situation of Example 3. Only need to replace the vertex of triangular patch T in the calculation of λ a with the intersection point to solve for λ * corresponding to Example 5. That is, where p is the intersection point and P is the set of intersection points.

[0117] The corresponding example calculation process of Example 5 can refer to Figure 3C the pseudo-code - Routine 2 shown, and this process can be briefly described as follows.

[0118] Given that the position relationship between triangular patches triangular patch S = {v s1 , v s2 , v s3} and T = {v t1 , v t2 , v t3} is edge-to-edge, and the instances corresponding to these two triangular patches are used as the input of Routine 2.

[0119] In steps 1 - 3, the unit normal n of the plane where triangular patch S is located is determined in sequences The plane of the triangular patch S is along n s The signed distance from the origin of the space, and initialize the candidate intersection point set P to be an empty set.

[0120] In the first for loop corresponding to steps 4 - 11, in steps 5 - 6, extract two adjacent vertices of T and store them in variables v + and v - respectively. By judging in step 7 whether the condition " is satisfied, to determine whether the edge of S with vertices v + and v - may intersect the plane where T is located. If this condition is satisfied, calculate the intersection point by the formula and incorporate the intersection point p into the candidate intersection point set P. Among them, e ti = v + - v - . Thus, at the end of the first for loop, all intersection points of the edges of the triangular patch T and the plane containing the triangular patch S can be obtained.

[0121] Next, in steps 12 - 13, successively determine the matrix N that is the basis of the null space of and the center p s0 of the triangular patch S.

[0122] In the second for loop corresponding to steps 14 - 16, successively determine the projections of the vectors from the center p s0 of the triangular patch S to each vertex of the triangular patch S in the matrix N.

[0123] In the third for loop corresponding to steps 17 - 22, successively determine the unit normal of each edge e si of the projected triangular patch si , the unit normal of the edge e si and the signed distance calculation of the edge e

[0124] from the origin. In steps 23 - 25, determine and return the minimum scaling factor

[0125] between S and T Figures 3A to 3AThe positional relationships that may exist between the first triangular patch S and the second triangular patch T are described in detail, as well as the calculation method of the corresponding minimum scaling factor under these positional relationships. Therefore, the candidate values of the minimum scaling factor of the first triangular patch mesh relative to the second triangular patch mesh can be determined based on the calculation method described above. The minimum scaling factor of the first triangular patch mesh relative to the second triangular patch mesh can also be similarly defined as: the first triangular patch mesh after being scaled by the minimum scaling factor is just separated from the first triangular patch mesh.

[0126] Next, a further description is given on how to search for the minimum scaling factor of the first triangular patch mesh relative to the second triangular patch mesh. By searching for the minimum scaling factor, it can be determined whether there is a collision between the object represented by the first triangular patch mesh and the object represented by the second triangular patch mesh, as well as the degree of the collision.

[0127] Next, with reference to Figures 4A to 5B A further description is given on how to search for the minimum scaling factor of the first triangular patch mesh S relative to the second triangular patch mesh T. By searching for the minimum scaling factor, the collision information between the object represented by the first triangular patch mesh S and the object represented by the second triangular patch mesh T can be determined.

[0128] Figure 4A is an example pseudocode showing the search for the minimum scaling factor according to an embodiment of the present disclosure. Figure 4B is an example showing the application according to an embodiment of the present disclosure Figure 4A of the test diagram of the example pseudocode. Figure 5A is another example pseudocode showing the search for the minimum scaling factor according to an embodiment of the present disclosure. Figure 5B is an example showing the application according to an embodiment of the present disclosure Figure 5A of the test diagram of the example pseudocode.

[0129] As Figure 4A shown, in some embodiments of the present disclosure, a "brute force" search scheme can be used to search for the minimum scaling factor between two triangular patch meshes.

[0130] Let the first triangular patch mesh be represented as S = {S i | i = 1, 2,..., N s}, where S i represents the triangular patch with index i in the first triangular patch mesh. And let the second triangular patch mesh be represented as T = {T i | i = 1, 2,..., N t}, where T iDenote the triangular patch with index \(i\) in the second triangular patch mesh. The minimum scaling factor between these two triangular patch meshes is still denoted as \(\lambda\). * , which can indicate the minimum distance between all pairs of triangular patches \(\{S\) i , T j \} that may be formed by the triangular patches in the first triangular patch mesh and the triangular patches in the second triangular patch mesh.

[0131] Figure 4A The algorithm shown represents a "brute - force" search for the minimum scaling factor of the triangular patches in the first triangular patch mesh relative to the second triangular patch mesh. Figure 4A The principle of the algorithm shown is as follows: Select a triangular patch from the first triangular patch mesh in index order as the first triangular patch; and select a triangular patch from the second triangular patch mesh in index order as the second triangular patch. Then, based on Figures 2A to 3C Method 20 in, determine the order of judging the positional relationship as: skew, inclusion, coplanarity, vertex - to - face, and edge - to - edge; and based on the judgment order, successively judge the positional relationship of the first triangular patch relative to the second triangular patch.

[0132] This process can be briefly described as follows.

[0133] For each triangular patch \(S\) in the first triangular patch mesh \(S\) i , refer to Figure 4A Steps 3 - 6 in, and determine the vertex set \(v\) i of the triangular patch \(S\) s , \(S\) i of the unit normal \(n\) s of the plane where it is located, the signed distance \(d\) i from the origin, and the center \(p\) s of \(S\) i . s0 .

[0134] Next, in steps 7 - 8, by traversing the second triangular patch mesh \(T\), select a triangular patch \(T\) from the second triangular patch mesh \(T\) j , and determine the vertex set \(v\) j of the triangular patch \(T\) t .

[0135] In steps 9 - 11, determine whether the positional relationship between \(S\) i and \(T\) j is skew. In response to the positional relationship between them being skew, \(S\) i relative to \(T\) jThe minimum scaling factor is determined to be positive infinity. In response to the positional relationship between the two not being skewed, steps 12 - 14 are continued. Specifically, if S i relative to T j has a minimum scaling factor of positive infinity, then S i and T j certainly are not the two closest triangular patches in the first triangular patch mesh and the second triangular patch mesh. At this time, the next triangular patch T j+1 in the second triangular patch mesh can be directly compared with i i . Therefore, the continue instruction in step 10 can be directly used to skip steps 15 - 33 and jump back to step 7 to perform the operation of selecting triangular patch T j+1 .

[0136] In steps 12 - 14, it is determined whether the positional relationship between S i and T j is inclusion. In response to the positional relationship between the two being inclusion, the minimum scaling factor of S i relative to T j is determined to be zero. In response to the positional relationship between the two not being inclusion either, steps 15 - 21 are continued. Specifically, if the minimum scaling factor of S i relative to T j is 0, then the first triangular patch mesh and the second triangular patch mesh must have collided. Once this situation is detected, the minimum scaling factor of the first triangular patch mesh relative to the second triangular patch mesh can be directly determined to be zero.

[0137] In steps 15 - 21, it is determined whether the positional relationship between S i and T j is coplanar. In response to the positional relationship between the two being coplanar, the minimum scaling factor of S i relative to T j is determined to be λ calculated by reference routine 1. In response to the positional relationship between the two not being coplanar either, steps 22 - 27 are continued. Further, referring to step 19, λ will be compared with other previously calculated candidate minimum scaling factors, and only the minimum value λ * between them will be saved.

[0138] In steps 22 - 27, assuming that the positional relationship between S i and T j is vertex - to - face, the candidate scaling factor of S i relative to T j is determined to be Based on the candidate scaling factor λ and p s0 Determine Si and T j Whether the positional relationship between them is from vertex to face. In response to the positional relationship between them being from vertex to face, set S i relative to T j 's minimum scaling factor as the candidate minimum scaling factor λ. In response to the positional relationship between them not being from vertex to face either, continue to execute steps 28 - 32. Further, referring to step 29, λ will be compared with other candidate minimum scaling factors calculated before as the candidate minimum scaling factor, and only the minimum value λ between them will be saved * .

[0139] In steps 28 - 33, set S i relative to T j 's minimum scaling factor as the minimum scaling factor λ calculated by reference routine 2. Further, referring to step 32, λ will be compared with other candidate minimum scaling factors calculated before as the candidate minimum scaling factor, and only the minimum value λ between them will be saved * .

[0140] Next, in step 34, return to step 7 to select the next triangular patch S from the second triangular patch mesh i for comparison until all triangular patches in the second triangular patch mesh have been traversed. Thus, after step 34 ends, the minimum scaling factor of triangular patch S i from the second triangular patch mesh can be obtained as a measure of the distance between this triangular patch and the second triangular patch mesh. Next, in step 35, return to step 2 to extract the next triangular patch S i+1 from the first triangular patch mesh, and determine the minimum scaling factor between this triangular patch S i+1 and the second triangular patch mesh.

[0141] It should be noted that only the minimum scaling factor between the triangular patches in the first triangular patch mesh and the triangular patches in the second triangular patch mesh needs to be obtained throughout the process. Therefore, in the first for loop, once two triangular patches satisfying the inclusion positional relationship are found, the first for loop can be terminated, and the minimum scaling factor between the two triangular patch meshes can be set to 0.

[0142] Of course, in the actual application process, it is very likely that the two triangular patch meshes do not actually collide, or there are no two triangular patches with an inclusion positional relationship. Therefore, the entire search process is also a process of searching for the minimum value. Through steps 19, 29, and 32, by comparing the candidate minimum scaling factor with the minimum value already found and discarding the larger value of the two, the memory occupancy of the entire program can also be reduced and the search efficiency can be improved.

[0143] As shown Figure 4B in the left figure of Figure 4B , during the collision detection between the robotic finger and the "rabbit doll" (see the left figure of Figure 4B ), the minimum scaling factor between each triangular patch of the robotic finger and the triangular patches of the "rabbit doll" is calculated. The horizontal axis in the right figure of Figure 4B represents the number of triangular patches of the robotic finger, while the vertical axis represents the CPU running time. The solid slanted line in the right figure of

[0144] represents the test result based on the Euclidean distance, while the dashed slanted line represents the test result based on the minimum scaling factor. It can be seen that the embodiments of the present disclosure can significantly reduce the computing cost and accelerate the computing speed. Figure 5A Further, as shown Figures 2A to 3C in some embodiments of the present disclosure, the above embodiments can be further improved. Specifically, in this improved embodiment, the minimum scaling factor of the triangular patches in the first triangular patch grid relative to the second triangular patch grid is heuristically searched. The heuristic search scheme includes: selecting a triangular patch from the first triangular patch grid in index order as the first triangular patch; selecting a triangular patch from the second triangular patch grid in index order as the candidate triangular patch; and in response to the positional relationship between the first triangular patch and the candidate triangular patch being coplanar, vertex-to-face, and edge-to-edge, taking the candidate triangular patch as the second triangular patch. Then, based on

[0145] the method 20 in

[0146] , first assume the positional relationship between the first triangular patch and the second triangular patch as vertex-to-face; then, based on the assumed positional relationship, determine the lower bound of the minimum scaling factor. After that, determine the minimum scaling factor of the first triangular patch grid relative to the second triangular patch grid based on the lower bound of the minimum scaling factor. i∈ S, after quickly excluding the scaling factors in the cases corresponding to Example 1 and Example 2, the set T′ of the remaining triangular patches in the second triangular patch mesh T can be obtained. The triangular patches in T′ are either coplanar with S i or the lower bound of their corresponding scaling factors can be calculated by formula (5). For the case where the triangular patches in T′ are coplanar with S i , their scaling factors can be calculated by routine (1). For the second case, the minimum value of all these scaling factors in T′ can be checked recursively. If this minimum scaling factor is a true minimum (i.e., the minimum scaling factor is obtained in the case of Example 4 rather than in the case of Example 5), then this minimum scaling factor is the required λ * , and the search terminates here; otherwise (i.e., the minimum scaling factor is not the final scaling factor), the true minimum value calculated in the edge-to-edge case in Example 5 is used to update this scaling factor, and the search process continues. By doing so, it is possible to avoid calculating the edge-to-edge case and some part of the vertex-to-face case for some triangles in T′, thus improving the algorithm efficiency.

[0147] Figure 5A The algorithm shown searches heuristically for the minimum scaling factor of the triangular patches in the first triangular patch mesh relative to the second triangular patch mesh one by one.

[0148] This process can be briefly described as follows.

[0149] For each triangular patch S in the first triangular patch mesh S i , referring to Figure 5A Steps 3 - 6 therein, determine the vertex set v i of the triangular patch S s , the unit normal n s of the plane where S i is located, the signed distance d s from the origin of S i , and the center p s0 of S j .

[0150] Next, in Steps 7 - 8, the candidate triangular patch set T′ and the candidate scaling factor set λ are respectively set to the empty set. In Steps 9 - 10, by traversing the second triangular patch mesh T, select the triangular patch T j from the second triangular patch mesh T, and determine the vertex set v t of the triangular patch T i .

[0151] In Steps 11 - 13, determine S j and Tj Whether the positional relationship between them is skewed. In response to the positional relationship between the two being skewed, set S i relative to T j 's minimum scaling factor to positive infinity. In response to the positional relationship between the two not being skewed, continue to execute steps 14 - 16. Specifically, if S i relative to T j 's minimum scaling factor is positive infinity, then S i and T j certainly are not the two closest triangular patches in the first triangular patch mesh and the second triangular patch mesh. At this time, the next triangular patch T in the second triangular patch mesh can be directly compared with S j+1 and S i the distance between them. Therefore, the continue instruction in step 12 can be directly used to skip steps 14 - 43 and jump back to step 9 to perform the operation of selecting the triangular patch T j+1 .

[0152] In steps 14 - 16, determine whether the positional relationship between S i and T j is inclusion. In response to the positional relationship between the two being inclusion, set S i relative to T j 's minimum scaling factor to zero. In response to the positional relationship between the two not being inclusion either, continue to execute steps 17 - 43. Specifically, if S i relative to T j 's minimum scaling factor is 0, then the first triangular patch mesh and the second triangular patch mesh must have collided. Once this situation is detected, the minimum scaling factor of the first triangular patch mesh relative to the second triangular patch mesh can be directly determined to be zero.

[0153] In steps 17 - 21, determine whether the positional relationship between S i and T j is coplanar. In response to the positional relationship between the two being coplanar (that is, it is determined that the condition of ||n s ×n t || being equal to zero is satisfied), set S i relative to T j 's minimum scaling factor to λ calculated by reference routine 1. In response to the positional relationship between the two not being coplanar either, continue to execute the subsequent steps. Further, referring to step 21, the λ obtained at this time is the true minimum scaling coefficient corresponding to Example 3, so mark λ as "true".

[0154] In steps 22 - 31, it has been determined that S i and T jThe positional relationship between them can only be vertex-to-face and edge-to-edge. First, assume S i and T j The positional relationship between them is vertex-to-face. Determine the candidate scaling factor of S i relative to T j as At this time, since it is not yet possible to determine the positional relationship between S i and T j as vertex-to-face or edge-to-edge, as described above, the candidate scaling factor λ obtained at this time is actually the lower bound of the true scaling factor. In step 29, the candidate scaling factor can be marked as false for subsequent processing. Next, in step 31, add T j to the candidate triangle patch set T′, add the candidate scaling factor λ to the candidate scaling factor set λ, and save (if any). At this time, the candidate triangle patch set T′ includes any candidate triangle patch T i that may have a face-to-face positional relationship, vertex-to-face positional relationship, or edge-to-edge positional relationship with the triangle patch S j .

[0155] In step 32, end the traversal of the triangle patches in the second triangle patch mesh T

[0156] Next, in steps 33 - 43, in the candidate triangle patch set T′, determine the triangle patch T i with the smallest distance from the triangle patch S j and the corresponding scaling factor λ * , and this scaling factor λ * will be used as a measure of the distance between the triangle patch S i and the second triangle patch mesh. For this purpose, start searching from the minimum value λ in the candidate scaling factor set λ. If the minimum value is marked as true, it means that the position between the two triangle patches corresponding to this candidate scaling factor is coplanar, so this candidate scaling factor does not need to be re-determined. Or, if based on the candidate scaling factor λ and p s0 it is determined that the positional relationship between S i and T j is vertex-to-face (for example, in step 37, it can be determined that the point is inside the triangle patch T), it means that the position between the two triangle patches corresponding to this candidate scaling factor is vertex-to-face, and the candidate scaling factor at this time should also have a "true" mark and does not need to be re-determined. Further, referring to step 38, Compare the candidate minimum scaling factor with the currently found candidate minimum scaling factor and save only the minimum value λ between the two * .

[0157] If the minimum is marked as "false" and based on the candidate scaling factor λ and p s0 Determine S i and T j The positional relationship between them is not from vertex to face, which means that the minimum The positional relationship between the two corresponding triangles should actually be edge-to-edge. Then refer to steps 41-42 and change S i Relative to T j The minimum scaling factor of is determined as the minimum scaling factor λ calculated by reference routine 2. Then the minimum scaling factor λ is used to update the previous At the same time, the flag of the scaling factor is also changed to "true".

[0158] In steps 33-43, as long as a scaling factor marked as "true" is found and the candidate scaling factor is already the minimum value in the candidate scaling factor set λ, the while loop can be jumped out, and the subsequent comparison and update of the candidate scaling factors are no longer performed, thereby reducing a large number of operations compared to the brute force search solution.

[0159] Next, in step 44, the process returns to step 2 to extract the next triangular patch S in the first triangular patch mesh. i+1 , and determine the triangle patch S i+1 Minimum scaling factor between the first and second triangle patch meshes.

[0160] It is worth noting that in the whole process, only the minimum scaling factor between the triangle patch in the first triangle patch mesh and the triangle patch in the second triangle patch mesh needs to be obtained. Therefore, in the first for loop, once two triangle patches that satisfy the positional relationship are found, the first for loop can be terminated and the minimum scaling factor between the two triangle patch meshes is set to 0.

[0161] Of course, in actual application, it is very likely that two triangular face meshes do not actually collide, or that there are no two triangular face meshes with a positional relationship. Therefore, the entire search process is also a minimum value search process. Through step 38, by comparing the candidate minimum scaling factor with the found minimum value and discarding the larger value of the two, the memory usage of the entire program can also be reduced and the search efficiency can be improved.

[0162] like Figure 5BAs shown, in the collision detection between the robotic finger and the "rabbit doll", the minimum scaling factor between the partial triangular patches of the robotic finger and the triangular patches of the "rabbit doll" is calculated. Compared with Figure 4B the left figure, the number of triangular patches to be calculated is significantly reduced. Figure 5B In the right figure of Figure 5B , the horizontal axis represents the number of triangular patches of the robotic finger, while the vertical axis represents the CPU running time. Figure 5B In the right figure of Figure 5B , the slanted line with a dashed line represents the test result of the solution based on Figure 4A while the slanted line with a solid line represents the test result of the solution based on Figure 5A It can be seen that the embodiments of the present disclosure can significantly reduce the computing cost and speed up the computing speed.

[0163] Finally, two special collision cases are briefly introduced.

[0164] Figure 6 is a schematic diagram showing another collision detection method according to an embodiment of the present disclosure.

[0165] This collision detection method includes: obtaining a first triangular patch mesh and a second triangular patch mesh; selecting two adjacent triangular patches from the first triangular patch mesh as a pair of triangular patches; selecting from the second triangular patch mesh triangular patches or pairs of triangular patches that are in contact with the vertices or edges of each triangular patch in the pair of triangular patches; determining the minimum scaling factor between the first triangular patch mesh and the second triangular patch mesh to be zero, where the first triangular patch mesh after being scaled according to the minimum scaling factor is just separated from the first triangular patch mesh; and determining the collision information between the first triangular patch mesh and the second triangular patch mesh based on the minimum scaling factor.

[0166] As Figure 6 shown, in the actual application process, it may occur that the triangular patches in the two triangular patch meshes only contact each other (that is, the triangular patches themselves do not collide), but in fact the two triangular patch meshes have penetrated each other. That is, it may occur that although the minimum scaling factor between the triangular patches in the two triangular patch meshes is 1, the actual minimum scaling factor of the two triangular patch meshes should be 0.

[0167] As Figure 6 shown in the left figure of Figure 6 , the first triangular patch mesh may include a pair of triangular patches S c ={S1, S2}, and the vertices of the triangular patches in this pair of triangular patches are all in contact with the triangular patch T in the second triangular patch mesh c={T} is in contact, and at the same time, triangular patches S1 and S2 are on different sides of T. At this time, the triangular patch T has penetrated the first triangular patch mesh. The actual minimum scaling factor of these two triangular patch meshes should be 0.

[0168] As Figure 6 shown in the right figure of, the first triangular patch mesh may include a pair of triangular patches S c ={S1, S2}, and any triangular patch in this pair of triangular patches contacts a pair of triangular patches T c ={T1, T2} in the second triangular patch mesh through an edge. At the same time, the pair of triangular patches S c ={S1, S2} is located on different sides of the pair of triangular patches T c ={T1, T2}. At this time, the pair of triangular patches T c ={T1, T2} has penetrated the first triangular patch mesh. The actual minimum scaling factor of these two triangular patch meshes should be 0.

[0169] To handle such special cases, adjacent pairs of triangular patches are collected from the first triangular patch mesh S and the second triangular patch mesh T to determine whether such pairs of triangular patches meet the above-mentioned situation. The scheme for determining whether the vertices of a triangular patch fall inside another triangular patch and the scheme for determining whether the edge of a triangular patch falls on the edge of another triangular patch have been described with reference to Figures 3A to 3C . This disclosure will not elaborate on this here.

[0170] Optionally, during the collision detection process of the first triangular patch mesh S and the second triangular patch mesh T, either the collision detection scheme shown in Figure 6 can be called first to exclude such special cases in advance, or the collision detection scheme shown in Figure 6 can be used finally to check the minimum collision factor. This disclosure is not limited thereto.

[0171] Thus, by using the minimum scaling factor as the distance metric between two triangular patches, the embodiments of this disclosure achieve efficient collision detection between two triangular patches. Compared with using the Euclidean distance as the metric for collision detection, the calculation amount of the minimum scaling factor is lower, and at the same time, it can provide a more accurate and reliable evaluation result for collision detection.

[0172] Furthermore, based on the collision detection between two triangular patches, the embodiments of this disclosure also achieve the detection of collisions between any two triangular patch meshes. Compared with traditional collision detection schemes, the embodiments of this disclosure can more efficiently and accurately evaluate and judge the collision information between two triangular patch meshes.

[0173] According to another aspect of the present disclosure, a robot is also proposed. The robot may include a body component, an upper limb component, and a leg component.

[0174] The leg component refers to the legged part of the robot for realizing movement, which includes, for example, mechanical legs and motors that connect the mechanical legs to the base and are used to realize the movement control of the mechanical legs. The embodiments of the present disclosure are not limited by the specific composition type of the lower limb part and the number of its lower limbs.

[0175] The body component refers to the main part of the robot, which can be, for example, the trunk of the robot. The embodiments of the present disclosure are not limited by the specific shape and composition of the base part.

[0176] In some embodiments, the body component includes, for example, 2 spinal joints, and the leg component can include, for example, 8 lower limb joints. The embodiments of the present disclosure are not limited by the specific number of joints included in the body component and the leg component, nor by the specific joint configuration of the robot.

[0177] The robot may further include a controller, which is arranged on the robot and can execute the motion control method as described above and has the functions as described above.

[0178] The controller includes, for example, a processing device. The processing device may include a microprocessor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array, a state machine, or other processor devices for processing electrical signals received from sensor lines. Such processor devices may include programmable electronic devices, such as PLC, programmable interrupt controller (PIC), programmable logic device (PLD), programmable read only memory (PROM), electronically programmable read only memory, etc.

[0179] In addition, the robot may further include a bus, a memory, a sensor component, a communication module, and an input / output device, etc.

[0180] The bus may be a circuit that interconnects the various components of the robot and transmits communication information (such as control messages or data) among the various components.

[0181] The sensor component can be used to perceive the physical world, including, for example, cameras, infrared sensors, ultrasonic sensors, etc. In addition, the sensor component may further include devices for measuring the current operating and motion states of the robot, such as Hall sensors, laser position sensors, or strain force sensors, etc.

[0182] The communication module can be connected to the network, for example, via wired or wireless means, so as to communicate with the physical world (e.g., a server). The communication module can be wireless and can include a wireless interface, such as IEEE 802.11, Bluetooth, a wireless local area network (WLAN) transceiver, or a radio interface for accessing a cellular phone network (e.g., a transceiver / antenna for accessing CDMA, GSM, UMTS, or other mobile communication networks). In another example, the communication module can be wired and can include interfaces such as Ethernet, USB, or IEEE 1394.

[0183] The input / output device can transfer commands or data input, for example, from a user or any other external device, to one or more other components of the robot, or can output commands or data received from one or more other components of the robot to the user or other external devices.

[0184] Multiple robots can form a robot system to collaboratively complete a task. The multiple robots are communicatively connected to a server and receive collaborative robot instructions from the server.

[0185] According to one aspect of the embodiments of the present disclosure, an electronic device is provided. The device for controlling a robot includes a processor and a memory. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory. The at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the above method.

[0186] According to one aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided. At least one instruction, at least one program, a code set, or an instruction set is stored in the storage medium. The at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the above method.

[0187] The program part in the technology can be regarded as a "product" or "article" in the form of executable code and / or related data, which is participated in or implemented through a computer-readable medium. Tangible, permanent storage media can include any memory or storage used by a computer, a processor, or similar devices or related modules. For example, various semiconductor memories, tape drives, disk drives, or any similar devices capable of providing storage functions for software.

[0188] All software, or portions thereof, may sometimes communicate over a network, such as the Internet or other communication networks. Such communication can load the software from one computer device or processor to another. Accordingly, another medium that can transfer software elements can also be used as a physical connection between local devices, such as light waves, radio waves, electromagnetic waves, etc., which are propagated through cables, optical fibers, or air. Physical media such as cables, wireless connections, or optical fibers, which are used to carry the waves, can also be considered media that bear software. As used herein, unless restricted to tangible "storage" media, other terms representing a computer or machine "readable medium" represent media that participate in the process of executing any instructions by a processor.

[0189] This application uses specific terms to describe embodiments of this application. For example, "first / second embodiment", "one embodiment", and / or "some embodiments" mean a certain feature, structure, or characteristic related to at least one embodiment of this application. Therefore, it should be emphasized and noted that the "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more at different positions in this specification does not necessarily refer to the same embodiment. In addition, certain features, structures, or characteristics in one or more embodiments of this application can be combined appropriately.

[0190] In addition, those skilled in the art can understand that various aspects of this application can be illustrated and described by several patentable types or situations, including any new and useful processes, machines, products, or combinations of substances, or any new and useful improvements to them. Accordingly, various aspects of this application can be executed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software can all be referred to as "data blocks", "modules", "engines", "units", "components", or "systems". In addition, various aspects of this application may be embodied as a computer product located in one or more computer-readable media, which includes computer-readable program code.

[0191] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by those of ordinary skill in the art to which this invention belongs. It should also be understood that terms such as those defined in a common dictionary should be interpreted as having a meaning consistent with their meaning in the context of the relevant art, and should not be interpreted in an idealized or overly formal sense, unless explicitly defined as such herein.

[0192] The foregoing is a description of the invention and should not be construed as limiting thereof. Although several exemplary embodiments of the invention have been described, those skilled in the art will readily appreciate that many modifications can be made to the exemplary embodiments without departing from the novel teachings and advantages of the invention. Accordingly, all such modifications are intended to be included within the scope of the invention as defined by the claims. It should be understood that the foregoing is a description of the invention and should not be considered limited to the specific embodiments disclosed, and modifications to the disclosed embodiments as well as other embodiments are intended to be included within the scope of the appended claims. The invention is defined by the claims and their equivalents.

Claims

1. A collision detection method, comprising: Obtain the first triangular patch and the second triangular patch; Determine the positional relationship of the first triangular patch relative to the second triangular patch; Based on the positional relationship, determine the minimum scaling factor of the first triangular patch relative to the second triangular patch, wherein the first triangular patch scaled by the minimum scaling factor is just separated from the second triangular patch; and Based on the minimum scaling factor, determine the collision information between the first triangular patch and the second triangular patch.

2. The method according to claim 1, wherein The determining the positional relationship of the first triangular patch relative to the second triangular patch includes: in response to all three vertices of the second triangular patch being on the same side of the plane where the first triangular patch is located, determining the position as skewed; The determining the minimum scaling factor of the first triangular patch relative to the second triangular patch includes: in response to the positional relationship being skewed, determining the minimum scaling factor as positive infinity.

3. The method according to claim 1, wherein The determining the positional relationship of the first triangular patch relative to the second triangular patch includes: in response to the centroid of the first triangular patch being inside the second triangular patch, determining the position as contained; The determining the minimum scaling factor of the first triangular patch relative to the second triangular patch includes: in response to the positional relationship being contained, determining the minimum scaling factor as zero.

4. The method according to claim 1, wherein The determining the positional relationship of the first triangular patch relative to the second triangular patch includes: in response to the first triangular patch and the second triangular patch being in the same plane, determining the position as coplanar; The determining the minimum scaling factor of the first triangular patch relative to the second triangular patch includes: in response to the positional relationship being coplanar, Determine a first scaling factor, where the first scaling factor makes the edge of the first triangular patch contact the vertex of the second triangular patch; Determine a second scaling factor, where the second scaling factor makes the vertex of the first triangular patch contact the edge of the second triangular patch; and Determine the smaller value of the first scaling factor and the second scaling factor as the minimum scaling factor.

5. The method according to claim 1, wherein The determining the positional relationship of the first triangular patch relative to the second triangular patch includes: in response to the vertex of the first triangular patch contacting the second triangular patch first during the scaling process, determining the position as vertex-to-face; The determining the minimum scaling factor of the first triangular patch relative to the second triangular patch includes: in response to the positional relationship being vertex-to-face, determine the minimum scaling factor based on the centroid data, vertex data of the first triangular patch, and the unit normal vector of the second triangular patch.

6. The method according to claim 1, wherein The determining the positional relationship of the first triangular patch relative to the second triangular patch includes: in response to the edge of the first triangular patch contacting the edge of the second triangular patch first during the scaling process, determining the position as edge-to-edge; The determining the minimum scaling factor of the first triangular patch relative to the second triangular patch includes: In response to the positional relationship being edge-to-edge, determine the intersection point between the edge of the first triangular patch and the edge of the second triangular patch; and Based on the intersection point, determine the minimum scaling factor.

7. The method according to claim 1, wherein The obtaining of the first triangular patch and the second triangular patch includes:[[]] Select a triangular patch as the first triangular patch from the first triangular patch mesh in index order; and Select a triangular patch as the second triangular patch from the second triangular patch mesh in index order.

8. The method according to claim 7, wherein The determining of the positional relationship of the first triangular patch relative to the second triangular patch includes:[[]] Determine the judgment order of the positional relationship as: skewed, contained, coplanar, vertex-to-face, and edge-to-edge; and Based on the judgment order, sequentially determine the positional relationship of the first triangular patch relative to the second triangular patch.

9. The method according to claim 1, wherein The obtaining of the first triangular patch and the second triangular patch includes:[[]] Select a triangular patch as the first triangular patch from the first triangular patch mesh in index order; Select a triangular patch as the candidate triangular patch from the second triangular patch mesh in index order; and In response to the positional relationship of the first triangular patch relative to the candidate triangular patch being coplanar, vertex-to-face, and edge-to-edge, use the candidate triangular patch as the second triangular patch.

10. The method according to claim 9, wherein The determining of the positional relationship of the first triangular patch relative to the second triangular patch includes: assuming the positional relationship as vertex-to-face; The determining of the minimum scaling factor of the first triangular patch relative to the second triangular patch includes: based on the assumed positional relationship, determine the lower bound of the minimum scaling factor.

11. A collision detection method, comprising: Obtain a first triangular patch mesh and a second triangular patch mesh; Select two adjacent triangular patches from the first triangular patch mesh as a pair of triangular patches; Select a triangular patch or a pair of triangular patches from the second triangular patch mesh that are in contact with the vertices or edges of each triangular patch in the pair of triangular patches; Determine the minimum scaling factor between the first triangular patch mesh and the second triangular patch mesh as zero, where the first triangular patch mesh scaled by the minimum scaling factor just separates from the second triangular patch mesh; and Based on the minimum scaling factor, determine the collision information between the first triangular patch mesh and the second triangular patch mesh.

12. A collision detection device, the device comprising: An obtaining module, configured to: obtain a first triangular patch and a second triangular patch; A determining module, configured to: obtain a first triangular patch and a second triangular patch; A calculating module, configured to: based on the positional relationship, determine the minimum scaling factor of the first triangular patch relative to the second triangular patch, where the first triangular patch scaled by the minimum scaling factor just separates from the second triangular patch; and A detecting module, configured to: based on the minimum scaling factor, determine the collision information between the first triangular patch and the second triangular patch.

13. An electronic device, comprising: A processor; and A memory, wherein computer-executable code is stored in the memory, and when the computer-executable code is run by the processor, the method according to any one of claims 1-11 is executed.

14. A non - volatile computer - readable storage medium, having stored thereon executable code, which when executed by a processor causes the processor to execute the method according to any one of claims 1 - 11.