Tech Report: Efficient and Exact Collision Detection for Circular Agents

08/26/2019 ∙ by Thayne Walker, et al. ∙ 0

A common problem in multi-robot algorithms is collision detection. Many solutions exist, but often suffer from problems such as high computational cost or causing false negative or false positive detections. In practice, these problems can result in results that range from inefficiency and annoyance to catastrophic. The main contribution of this paper is to provide a high-level overview of major categories of collision detection, provide insight into the need for accurate and computationally efficient collision detection, and provide methods of collision detection and anticipatory collision avoidance that are both computationally efficient and exact – that is, they will never yield false negative or false positive detections. Supplementary reference for mathematics behind collision detection.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

page 4

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

Introduction

In routing algorithms for robotics, navigation, games, etc. the problem of determining if one or more agents (robots, objects, players, etc.) collide is of central importance. Many approaches exist. The key attributes of collision detection algorithms are accuracy and computational efficiency. While some approaches are computationally efficient, they often exhibit inherent inaccuracies. This paper provides a broad overview and categorization of existing methods and summarizes the advantages and disadvantages of each. Then the major contribution of this paper: exact and computationally efficient solutions to both collision detection and anticipatory collision avoidance for circular and spherical agents for the cases of both constant velocity and initial velocity with constant acceleration. Although the examples herein are for 2-dimensional spaces, the case of 3-dimensional spaces is directly applicable with no changes to the algorithms other than changing from 2-dimensional vectors to 3-dimensional ones.

Background

Conflict detection is important for many problems with multiple moving objects and agents. In the case of navigation and routing problems for multiple agents, feasible joint solutions cannot be found or verified without proper conflict detection. A conflict represents a simultaneous attempt to access a joint resource. Depending on the target domain a conflict may have different meanings, for example when states have dimensions other than temporospatial components or when abstract states are used. Typically, when considering only temporospatial aspects, conflict detection is referred to as collision detection. Collision detection (also known as intersection detection) has been extensively studied in the fields of computational geometry, robotics, and computer graphics. In this section we provide a brief taxonomy of collision detection techniques for multiple moving obstacles.

Static

(a)

(b)

(c)
Figure 1: Static Collision Detection. A collision is correctly detected between agents (a) and (b), but erroneously detected between (a) and (c).

There are various approaches to static collision detection for stationary objects Jiménez, Thomas, and Torras (2001),Kockara et al. (2007). A simple approach that extends static collision methods into the temporal domain involves reserving space that encapsulates an entire edge (in both space and time) for each agent move and then detecting intersection with other agent’s reserved space. In Figure 1 an example of this approach is shown. Agent (a), (b) and (c) take 2 actions (represented as directed edges) to arrive at their goal. Axis-aligned bounding boxes are reserved for each of these edges. Then an intersection check is carried out. Because more area is reserved than necessary, an erroneous collision is detected between (b) and (c). Although this approach is computationally fast, when long edges are present in the graph, this approach will reserve more temporospatial area than necessary, over-restricting other agents.

Incremental/Sampling-Based

(a)

(b)

(c)
Figure 2: Sampling-Based Collision Detection. A collision is correctly detected between agents (a) and (b).

This approach (also called multiple interference testing) involves translating objects along their trajectories incrementally and using static collision detection methods to detect overlaps at each increment. Figure 2 shows an example of this approach. Axis aligned bounding boxes are created for each agent at regular intervals along their trajectories. In contrast to the example in Figure Kockara et al. (2007), there is no erroneous collision detected between agent (a) and agent (c). The sampling approach is very important, samples too far apart may miss a collision, but samples too close together is computationally costly. Adaptive sampling approaches can help improve the computational cost Gilbert and Hong (1989).

In grid worlds, a coarse form of collision detection, Brezenham’s line algorithm Bresenham (1987) can be used for selecting a specific set of grid-squares covered by a trajectory and then checking whether multiple agents are in the same grid square at intersecting times. A tighter approach based on Wu’s antialiased line algorithm Wu (1991) is used in the AA-SIPP(m) Yakovlev and Andreychuk (2017) algorithm.

Algebraic

Figure 3: Collision times for agent trajectories with constant velocity (a) and initial velocity with constant acceleration (b) can be solved algebraically

By parameterizing the trajectory, a closed-form solution to continuous-time conflict detection for circular, spherical, Ericson (2004) and trianglular Moore and Wilhelms (1988) shaped agents have been formulated. An example for circular agents is shown in Figure 3. These methods will calculate the exact time of collision between two moving obstacles assuming constant velocity and direction. When dealing with arbitrary-length graph edges, we can calculate the time an agent will reach the end of an edge based on speed and Euclidean distance. The main contribution of this paper is to extend these methods.

Geometric

Figure 4: Constructive Solid Geometry Collision Detection. Time is extruded into the model as an extra dimension, after which polygonal intersection detection is performed.
Figure 5: Velocity Obstacle (VO) collision detection. The trajectories and shapes of agents are interpreted to create the velocity obstacle

Geometric solutions are the most computationally expensive collision detection approaches, however they are formulated for many different obstacle shapes - typically primitive shapes, polygons or meshes. Two of the most popular approaches are constructive solid geometry (CSG) Requicha and Voelcker (1977), and velocity obstacles (VO) Fiorini and Shiller (1998).

CSG approaches treat the time domain as an additional polygonal dimension, extruding polygons into the time dimension, after which a static polygonal intersection check is applied. Computation of the extruded volumes can be very expensive and formulating ways to enhance CSG has been a subject of research.

Velocity obstacles are been formulated for infinite length vector collision detection for arbitrary-shaped agents. A velocity obstacle is created using the center points of two agents and , a description of the agent shapes, and their velocity vectors and . The shape of agent is inflated by computing the minkowski sum of two agent’s shapes, then computing two tangent lines from the center of agent to the widest visible vertices of from agent ’s perspective; these tangent lines represent the velocity obstacle. Agent will collide with agent some time in the infinite future given constant velocities if translated by is inside the velocity obstacle translated by .

Summary

Depending on the application, any of the above methods may be desirable. Static detection is the approach of choice for domains with discretized-time movement models as it is the cheapest and (depending on the movement model) may yield no loss in accuracy. In continuous-time domains, one of the latter choices is usually preferable, with sampling often being the cheapest approach, followed by algebraic and geometric approaches. There is a trade-off with respect to accuracy and computational cost. The latter approaches provide the most flexibility when high accuracy and complex agent shapes are necessary.

Closed-Form Solutions for Circular Agents

Figure 3 shows an example of two-agent motion for fixed velocity (a) and initial velocity with fixed acceleration (b). Computing the time and duration of conflict for two circular agents can be done by solving equations for the squared distance between agents Ericson (2004).

Constant Velocity

Given , the start position of agent , and , the start position of agent , velocity vectors , , and radii , respectively, the location in time of an agent is defined as:

(1)

The squared distance between the agents is modeled as:

(2)

where

Or simply

(3)

where

which gives the equation for the squared distance between circular edges:

(4)

where

Initial Velocity with Constant Acceleration

Equation can be extended for constant acceleration. Given , the start position of agent , and , the start position of agent , velocity vectors , , acceleration vectors , and radii , respectively, the location in time of an agent is defined as:

(5)

The squared distance between the agents is modeled as:

(6)

where

for

Or simply

(7)

where

Computing the Exact Conflict Interval

We can determine the exact conflict interval by solving for the roots of or using the quadratic and quartic formulas respectively. These solutions assume that both agents are at and at the same time. However, if there is an offset in time, e.g. agent 1 starts moving at time and agent 2 starts moving at time , then must be adjusted to reflect this offset by projecting the position of the earlier agent to be at the position when the later agent starts. If the earlier agent were agent 1, the adjustment would be as follows:

(8)

Otherwise, the adjustment will be analogously done for agent 2. In the case of acceleration, the position and velocity must be adjusted (again, assuming agent 1 starts early) as:

(9)
(10)

Constant Velocity

Figure 6: Agent Trajectories and Corresponding Squared Distance Plot

For the quadratic form, if the discriminant () is less than zero, and are parallel and no collision will ever occur. Assuming the discriminant is positive, the collision interval is defined as the roots of the quadratic formula . In the case of a double root, the edges of the agents just touch, but no overlap actually occurs (assuming open intervals).

(11)

See Figure 6 for an example of two-agent motion and the resulting squared-distance plot. When the distance is less than zero, there is overlap of the agents. Given this interval, it is possible to to determine whether a collision will occur in the future and at what time, or if the agents are currently colliding.

Initial Velocity with Constant Acceleration

This case uses the quartic formula to find roots to . The quartic formula will yield 4 roots, some of which may be imaginary resulting in 0, 1 or 2 conflict intervals. Imaginary roots will tell us the time(s) at which agents are locally closest together, but do not actually overlap (local minima). Imaginary roots are always double roots, and can be discarded. If all 4 roots are imaginary, the agents never overlap. If there is a double real root, then the two agents touch edges at exactly one point in time, creating an instantaneous interval. Because our equation is based on distance, the quartic function will always be concave up. Hence, the overlapping intervals can only be between roots 1,2 and 3,4. If roots 1,2 and/or 3,4 are real, then the agents continuously overlap between 1,2 and/or 3,4 respectively. Four real roots means that the objects overlap twice, continuously between root pairs 1,2 and 3,4. This is possible because agents may have curved trajectories. See Figure 3 (b) for an example.

Determining Exact Minimum Delay for Conflict Avoidance

It is often useful, not just to determine if and when agents are going to collide, but to determine a delay time to avoid collision.

Constant Velocity

In order to determine the minimum delay required for an agent to avoid conflict, we adjust (3) to incorporate , a delay variable, by plugging into equation to get:

(12)

where

is the standard form of a conic section. Note that the sign of both and are positive, therefore, this conic section will always be an ellipse. The conversion of (8) to canonical form for an ellipse will not be covered here, nor is it necessary. Figure 7 shows an example of agent trajectories, the squared distance plot (equation (4)) when , and the resulting conic section (equation (12)). Note that the horizontal line at passes through the ellipse at the exact same time points that the squared distance plot does. If agent 1 were to delay by , the horizontal line would move up, resulting in a different collision interval (see Figure 8). If agent 2 were to delay by , the horizontal line would move down, again resulting in a different collision interval. The question we want to solve is: what value of will result in no collision? In other words, we want to find the positive value of , such that the radii of the agents just touch, i.e. (12) yields a double root. The targeted delay interval is derived by determining the top and bottom extrema of the ellipse (https://math.stackexchange.com/users/149569/osmund-francis) (n.d.),Hendricks (2012).

(13)

where is the y-coordinate of the ellipse center:

The collision times of the endpoints of the delayRange are computed via:

(14)

Note that (13) is undefined when the discriminant is negative, which can only happen for a=0 or c=0. This can only happen when agents’ motion vectors are parallel (moving the same or opposite directions) or either agent is waiting in place. These cases are easy to detect.

Figure 7: Agent Trajectories, Squared Distance Plot and Ellipse Showing Collision Intervals for Varying
Figure 8: Agent 1 delayed by 0.2 seconds

When the motion is not of infinite length, for example when agents travel between two points, or piecewise between waypoints, we must also take into account the beginning and end of the duration of motion. Effectively, we treat agents as if they appear at their start time and disappear at their end time. When the movement of agents 1 and 2 start at and and end at and respectively, we measure time relative to and . In the case that is outside of the range as calculated via (LABEL:eq:delayRange), no collision will occur. If either of the collision times (as calculated in (14) for each point in occur before , or after , the delay times need to be re-computed for or as necessary using (15). An example where occurs too early is shown by the vertical dashed line in Figure 9.

This yields the following algorithm for computing the unsafe interval for truncated and piecewise motion. The algorithm utilizes the following formulas:

The value of , given a time which is derived from (12), solved for :

(15)

The leftmost coordinate on the ellipse:

(16)

where is

Thus, when a trajectory segment ends relatively sooner than the first collision time as computed by (LABEL:extrema), the required delay time is shorter and can be computed by plugging $t_{max} into (15).

1:INPUT: P1,P2,V1,V2,t1,t2,t1’,t2’,r1,r2
2:// Get latest conflict time
3:if t1<t2 then
4:     P1 = P1 + V1*(t2-t1)
5:else
6:     P2 = P2 + V2*(t1-t2)
7:end if
8:t0=MAX(t1,t2)
9:// Execute equation (4)
10:interval=getConflictInterval(P1,P2,V1,V2,r1,r2)
11:if interval= or interval[2]>t0 then
12:     return NO COLLISION
13:end if
14:// Execute equation (13) to get unsafe delay range
15:delayRange=getDelayRange(P1,P2,V1,V2,r1,r2)
16:// Execute equation (14) to get unsafe delay range times
17:collisionTimes=getDelayCollisionTimes(P1,P2,V1,V2,r1,r2)
18:minCollisionTime=MIN(collisionTimes)
19:maxCollisionTime=MAX(collisionTimes)
20:// Truncate delay for motion time segments
21:if minCollisionTime<t0 then
22:     // Get delay for t0 via (15)
23:     delayRange[1]=getDelayAtTime(P1,P2,V1,V2,r1,r2,t0)
24:end if
25:tmax=MIN(t1’,t2’)
26:if maxCollisionTime<t0 then
27:     // Get delay for tmax via (15)
28:     delayRange[2]=getDelayAtTime(P1,P2,V1,V2,r1,r2,t0)
29:end if
30:// Return the unsafe interval by adding the delay to the start time
31:return [t0+delayRange[1],t0+delayRange[2]]
Algorithm 1 Unsafe Interval Computation for Segmented Motion
Figure 9: An example where the maximum delay time happens after the first agent arrives at its destination.

Initial Velocity with Constant Acceleration

The equivalent conic equation for 4th order bivariates is called a quartic plane curve. An exact solution for unsafe intervals is still an open question. However, an interative solution has been formulated for the constant velocity case which is generalizable to this case Andreychuk et al. (2019).

The algorithm starts by evaluating (7) at , retrieving an initial upper bound from the interval which is closest to and greater than . Then performs a binary search, for both ends of the interval until an accuracy threshold is reached. Binary search is a well known algorithm and will not be repeated here.

Conclusion

In this paper, we have provided an overview of collision detection for polygonal and circular agents. We have also provided derivations for computing the exact interval of collision between two agents with constant velocity or intial velocity with constant acceleration. We have additionally derived an exact formulation for computing unsafe intervals (the range of start times in which agents come into collision) for two circular agents with constant velocity and differing start times. An algorithm was then shown for computing the unsafe intervals in the case of segmented motion.

Future work may involve derivations of the exact formulation of unsafe intervals for agents with acceleration and computing exact speeds which will result in collision avoidance based on the unsafe interval.

References

Andreychuk, Anton, Konstantin Yakovlev, Dor Atzmon, and Roni Stern. 2019. “Multi-Agent Pathfinding with Continuous Time.” In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI-19

. International Joint Conferences on Artificial Intelligence Organization.

Bresenham, Jack E. 1987. “Ambiguities in Incremental Line Rastering.” IEEE Computer Graphics and Applications 7 (5). IEEE: 31–43.

Ericson, Christer. 2004. Real-Time Collision Detection. CRC Press.

Fiorini, Paolo, and Zvi Shiller. 1998. “Motion Planning in Dynamic Environments Using Velocity Obstacles.” The International Journal of Robotics Research 17 (7). Sage Publications Sage CA: Thousand Oaks, CA: 760–72.

Gilbert, Elmer G, and SM Hong. 1989. “A New Algorithm for Detecting the Collision of Moving Objects.” In Robotics and Automation, 1989. Proceedings., 1989 Ieee International Conference on, 8–14. IEEE.

Hendricks, Mark C. 2012. “Rotated Ellipses and Their Intersections with Lines.”

(https://math.stackexchange.com/users/149569/osmund-francis), Osmund Francis. n.d. “Determining the Major/Minor Axes of an Ellipse from General Form.” Mathematics Stack Exchange. https://math.stackexchange.com/q/820896.

Jiménez, Pablo, Federico Thomas, and Carme Torras. 2001. “3D Collision Detection: A Survey.” Computers & Graphics 25 (2). Elsevier: 269–85.

Kockara, Sinan, Tansel Halic, K Iqbal, Coskun Bayrak, and Richard Rowe. 2007. “Collision Detection: A Survey.” In Systems, Man and Cybernetics, 2007. Isic. Ieee International Conference on, 4046–51. IEEE.

Moore, Matthew, and Jane Wilhelms. 1988. “Collision Detection and Response for Computer Animation.” In ACM Siggraph Computer Graphics. ACM.

Requicha, Aristides AG, and Herbert B Voelcker. 1977. “Constructive Solid Geometry.”

Wu, Xiaolin. 1991. “An Efficient Antialiasing Technique.” In Proceedings of the 18th Annual Conference on Computer Graphics and Interactive Techniques, 143–52. SIGGRAPH ’91. New York, NY, USA: ACM. doi:10.1145/122718.122734.

Yakovlev, Konstantin, and Anton Andreychuk. 2017. “Any-Angle Pathfinding for Multiple Agents Based on Sipp Algorithm.” arXiv Preprint arXiv:1703.04159.