{'fraction_non_alphanumeric': 0.031870715965377494, 'fraction_numerical': 0.009506179016360635, 'mean_word_length': 4.486686796596212, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Defending a Perimeter from a Ground Intruder Using an Aerial Defender: Theory and Practice

The perimeter defense game has received interest in recent years as a variant of the pursuit-evasion game. A number of previous works have solved this game to obtain the optimal strategies for defender and intruder, but the derived theory considers the players as point particles with first-order assumptions. In this work, we aim to apply the theory derived from the perimeter defense problem to robots with realistic models of actuation and sensing and observe performance discrepancy in relaxing the first-order assumptions. In particular, we focus on the hemisphere perimeter defense problem where a ground intruder tries to reach the base of a hemisphere while an aerial defender constrained to move on the hemisphere aims to capture the intruder. The transition from theory to practice is detailed, and the designed system is simulated in Gazebo. Two metrics for parametric analysis and comparative study are proposed to evaluate the performance discrepancy.


I. INTRODUCTION
The pursuit-evasion games (PEGs) have been widely investigated over the past years and are used in many applications including mobile robotics [1]. There are many variants of PEGs under different assumptions on the players and the environments. One route is to consider the players as point particles [2], [3]. Liang et al. [2] address a PEG with three point particles: target, attacker, and defender. The attacker aims to capture the target while avoiding the defender, and the defender aims to defend the target while trying to capture the attacker. Other work [3] allows the point particle players move in three dimensions and solves the differential games with three defenders and one intruder with equal speeds.
Researchers also have focused on solving the PEGs with real robots [4], [5], [6]. Vidal et al. [4] propose a hierarchical hybrid system to implement the pursuitevasion game scenario on real UAVs and UGVs. The PEG between two pursuing and one evading unmanned aerial vehicles is solved in [5]. Deep learning based approach for vision-based UAV pursuit-evasion is implemented in [6].
This work formulates a variant of pursuit-evasion game known as the target-guarding problem [7]. In this problem, intruders aim to reach the target without being captured by defenders, while defenders try to capture intruders [2], We gratefully acknowledge the support from ARL Grant DCIST CRA W911NF-17-2-0181, NSF Grant CNS-1521617, ARO Grant W911NF-13-1-0350, ONR Grants N00014-20-1-2822 and ONR grant N00014-20-S-B001, and Qualcomm Research. 1   Hemisphere perimeter defense game in theory and practice shows the discrepancy in executing optimal strategies.
[8], [9]. When defenders are constrained to move along the perimeter of the target region, we call this problem as perimeter defense game, which we refer to [10] for detailed survey. Previous works consider the players as point particles with first-order assumptions [2], [7], [8], [9], [10]. The optimal strategies are theoretically proved for multiplayer game on two-dimensional convex shapes [8] and for three-dimensional game on hemisphere [9].
There are many challenges in realizing the perimeter defense system with real robots, and the major challenges lie in coping with discrepancy between first-order assumptions of point particles and dynamics of real robots, as shown in Fig. 1. This work simulates the perimeter defense based on Unmanned Aerial Vehicles (UAVs). UAVs are deployed in various space such as power plant [11], penstock [12], forest [13], or disaster sites [14], which are good perimeter defense applications. This paper extends the previous work [9] on hemisphere defense to apply the derived theory from point particles to real robots. We observe any performance discrepancy in relaxing first-order assumptions and discuss how to reduce such discrepancy. The contributions of the paper are (i) realizing perimeter defense between aerial defender and ground intruder from theory to practice; and (ii) performing parametric analysis of system scales and comparative study of strategies to evaluate the performance discrepancy in relaxing first-order assumptions.
Section II formulates the problem. Section III addresses the transition from point particle to real robot. To evaluate the discrepancy, two metrics are proposed in Section IV. Section V provides experimental results, and Section VI concludes the paper.

II. PROBLEM FORMULATION AND PRELIMINARIES
Consider a hemisphere perimeter O with radius of R as shown in Fig. 2. The defender D is constrained to move on the hemisphere while the intruder A is constrained to move on the ground plane. The positions of the players in spherical coordinates are: z D = [ψ D , φ D , R] and z A = [ψ A , 0, r ], where ψ and φ are the azimuth and elevation angles, which gives the relative position as: z [ψ, φ, r ], where ψ ψ A − ψ D and φ φ D (see Fig. 2). Without loss of generality, we assume the defender's maximum speed is 1. The intruder is assumed to have a maximum speed ν ≤ 1 (otherwise, intruder always has a strategy to win the game). We denote that the velocities of defender and intruder are v D and v A , respectively. The game ends at time We call t f as the terminal time.
A. Optimal breaching point for point particle Given z D , z A , we call breaching point as a point on the perimeter at which the intruder tries to reach the target, as shown B in Fig. 2. We call the azimuth angle that forms the breaching point as breaching angle, denoted by θ, and call the angle between (z A − z B ) and the tangent line at B as approach angle, denoted by β.
It is proved in [9] that given the current positions of defender z D and intruder z A as point particles, there exists a unique breaching point such that the optimal strategy for both defender and intruder is to move towards it, known as optimal breaching point. The breaching angle and approach angle corresponding to the optimal breaching point are known as optimal breaching angle, denoted by θ * , and optimal approach angle, denoted by β * .
As stated in [9], although there exists no closed form solution for θ * and β * , they can be computed at any time by solving two governing equations: and

B. Target time and payoff function
We call the target time as the time to reach B and define τ D (z D , z B ) as the defender target time, τ A (z A , z B ) as the intruder target time, and the following as payoff function: The defender reaches B faster if p < 0 and the intruder reaches B faster if p > 0. Thus, the defender aims to minimize p while the intruder aims to maximize it.

C. Optimal strategies and Nash equilibrium
It is proven in [9] that the optimal strategies for both defender and intruder are to move towards the optimal breaching point at their maximum speed at any time.
Let Ω and Γ be the and let Ω * and Γ * be the optimal strategies that minimize τ D (z D , Ω) and τ A (z A , Γ), respectively, then the optimality in the game is given as a Nash equilibrium:

III. FROM THEORY TO PRACTICE
This section discusses the transition from theory to practice in executing the optimal strategies for hemisphere perimeter defense game.

A. From point particle to three-dimensional robot
The major challenge in bringing the theory closer to practice lies in representing the agents as threedimensional robot. Previous works in perimeter defense focused on the point particle [2], [7], [8], [9], [10] to represent the defender and intruder, and the following are the assumptions made for the point particle, which may not hold true in working with the three-dimensional robot: • It has no volume and thus it is scale invariant • It moves with desired velocity instantly and precisely • If it moves at its maximum speed, the speed is consistent along the trajectory • It can accurately detect other agent's positions and react to it simultaneously • Optimal trajectory obeys first-order assumptions This work aims to simulate robots using the optimal strategies derived from theory, observe any discrepancy between the performances from theory and practice, and discuss how relaxing aforementioned assumptions would lead to the discrepancy. The employed robot is an UAV in Fig. 3. It has a dimension of 735mm × 735mm × 200mm and the mass of 1.8kg. This UAV well represents a threedimensional robot relaxing the point particle assumptions. In practice, we relax the assumption of scale invariance. The radius of hemisphere becomes a relevant variable R, as denoted in Fig. 2. Accordingly, (2) in practice becomes although (1) stays the same in practice since all the parameters are scale invariant. We can solve for β * and θ * by solving two governing equations (1) and (5), and obtain the corresponding optimal breaching point in practice.

C. Controller
As mentioned in the previous assumptions [9], the controller used for theoretical approach was simply perfect. Both defender and intruder reacted to each other without any delay, and desired dynamics were enforced precisely and instantly to result in continuous optimal trajectories as shown in Fig. 1. The agents also identify each other's states without any error at any time (e.g. perfect state estimation).
The overall controller for practical approach is illustrated in Fig. 4. All modules represent the nodes in ROS and are connected by rostopics for real-time implementation. For each agent, the strategy module subscribes to the ground truth odometry that are published by both UAVs to calculate position command. In this way, state estimation is based on ground truth and becomes highly accurate. Then, the position command is fed into the SO3based controller based on [15]   Overall controller for cross feedback system control the robot in low level. Finally, the simulated robot publishes the ground truth odometry to be fed into the SO3-based controller for closed loop control. Note that the defender and intruder strategy modules take in both agents' odometry. For this cross feedback system, the two odometry data are stored into queues and used for synchronized computation of the optimal strategy.

D. Executing optimal strategies
As stated in Sec.II-C, both defender and intruder move at their maximum speeds in executing optimal strategies in theory. It is also worth noting that the optimal trajectories are continuously changing based on the configuration of agents at given time because the optimal breaching point is newly calculated at any time to reflect the change in positions of the defender and intruder.
For this reactive and adversarial environment, we enforce the players to follow an infinitesimal segment of computed optimal trajectory at any time to maintain consistent maximum speeds. In Fig. 2, given the optimal breaching point B and current configurations of defender and intruder z D = [ψ D , φ D , R] and z A [ψ A , 0, r ], their current optimal trajectories are DB and AB , respectively. Based on the movements of defender and intruder, the optimal trajectories as well as the optimal breaching point may change over time, so we set the goal trajectory DD and A A as segments of original trajectories by taking the length of d l and d l for defender and intruder, respectively. We give position command towards the end point of the infinitesimal segment, which can be viewed as controlling an instantaneous velocity of agents.
First, we aim to compute the position of D [x D , y D , z D ] after infinitesimal defender movement d l . For simplicity, assume D is on the zx-plane (i.e. ψ D = 0) by rotating the hemisphere by −ψ D about the z-axis, and we will rotate the coordinates by ψ D back to the original orientation at the end. Given the radius R, azimuth angle φ D , and d l , we know the following: (i) D is on the hemisphere O with a center on the origin and a radius of R; (ii) The arc distance between D and D is d l ; (iii) D is on the plane OB D. The conditions (i) and (ii) give We know the equation of a plane is given by Therefore, the plane OB D is uniquely determined by three points O(0, 0, 0), B (R cos θ, R sin θ, 0), and D(R cos φ D , 0, R sin φ D ). With the condition (iii), (8) becomes Together with (6), (7) and (9), we get where The final computation of the position x D , y D , z D is summarized in Algorithm 1. Notice that line 4 and 5 rotate the system back to the original configuration. Similarly, the position of A [x A , y A , z A ] after infinitesimal intruder movement d l is computed in Algorithm 2, and overall agents' strategies are summarized in Algorithm 3.

IV. DISCREPANCY ANALYSIS
In this section, we propose two metrics to evaluate the discrepancy between the performances from theory and practice. One metric measures the discrepancy from relaxing the scale invariant assumption made for point particle. This metric is crucial since the discrepancy between small and large scales would not allow scalability, which is essential for real-world applications. The other metric investigates if the traversed trajectory is the same as the optimal trajectory derived from theory by comparing its performances with the performance of other  end if 9: end if baseline strategy. We chose these metrics to evaluate the discrepancy because other point particle assumptions (e.g. instant velocity change, simultaneous detection and reaction, and no fluctuation in maximum speed) highly depend on the hardware. A robot with better computing power will be closer to meet these assumptions, so we focus on the discrepancy in system scales and strategies. Fig. 5 shows different scales of environment (e.g. hemisphere) for perimeter defense game. Since the robot size is fixed, this variance may impact the dynamics of the UAV. For instance, if the robot traverses along the surface of small hemisphere, it may enforce the controller to execute abrupt turns and the resulting trajectory may not exactly follow the hemisphere surface.

A. Discrepancy in system scales
To account for such performance discrepancy, we propose a metric l d as shown in Fig. 6. This metric computes the geodesic between D and A , which represent the positions of defender and intruder at terminal time t f , respectively. We purposely set the game for the intruder to win (e.g. intruder reaches to perimeter before defender does) because more interesting dynamics are happening for defender so we fix the behavior of intruder and evaluate l d that is normalized by radius for different set of system scales. We also compare l d with the outcome derived from first-order assumptions and observe how the relaxed point particle assumptions impact l d , which would be closer to the theoretical outcome in ideal conditions.

B. Discrepancy in strategies
We define a metric l s , shown as l s in Fig. 7, to understand the discrepancy in different defender strategies. This metric measures the distance between D and A at terminal time t f , which represents the distance between the agents at the end of the game. To obtain this metric, we intentionally set the game for the defender to win so that D lies on the base of the hemisphere. In this manner, any plausible defender strategy can be evaluated because the game ends only if the defender finishes executing its strategy. If l d is to be used as the metric, the game would end before defender fully executes the strategy, which makes it challenging to compare the performance.
In comparing strategies, we run two defender strategies: (1) optimal strategy that moves defender towards the breaching point B at its maximum speed at any time; and (2) baseline strategy that moves defender at its maximum speed at any time towards the azimuth angle of intruder, which is towards B that is an intersection of O A and the base of hemisphere as shown in Fig. 2. A strategy with larger l s outperforms the other since it secures more time to defend the intruder.

V. EXPERIMENTS
This section evaluates the performance discrepancy between theory and practice based on system scales and strategies. We run all experiments using Gazebo with ROS.

A. Parametric analysis of system scales
In the parametric analysis, we vary the system scales by changing the radius of the hemisphere. A total of 22 different radii from 3 to 300 are used, and multiple experiments are run for each radius to compute l d . Given radius R, the experiments are run with an initial configuration z = [ψ, φ, r ] = [0.9, 0.3π, 2R], infinitesimal movement d l = d l = 0.72 (lead to v D = v A = 0.8), and ν = 1. Fig. 8 shows the change in l d as a function of radius. l d is normalized by radius so it should be consistent in theory regardless of system scales. It can be seen that l d stays relatively small in the regime of small radius (e.g. 3 ≤ R ≤ 50) and converges to the value derived from firstorder assumptions as R increases. The error bar indicates that the standard deviation decreases as R increases. Fig.   9 confirms that small radius regime may result in nonsmooth trajectories and the UAV trajectories converge to first-order assumptions as R increases. We infer that in the small radius regime, UAV dynamics is sensitive to control inputs since the scale of robot is comparable to the scale of environment. The UAV may accelerate well to get up to the maximum speed so l d is lower and inconsistent with the outcome from the first-order assumptions.
In this way, the point particle assumption that agents move with desired velocity instantly is much relaxed. Accordingly, to reduce the discrepancy between theory and practice, a larger scale of environment relative to that of robot is preferred, and sensitivity analysis for the system would help the robot better obey the scale invariant assumptions.

B. Comparative study of strategies
For this study, we compute l s for optimal and baseline strategies. Seven trials with different configuration are conducted to observe the performance discrepancy. An infinitesimal defender movement d l = 1.36 (lead to v D = 1.0), an infinitesimal intruder movement d l = 0.36 (lead to v A = 0.6), and ν = 1 are used to guarantee that the defender reaches to the base of hemisphere earlier than the intruder does. Fig. 10 shows the variations of l s normalized by radius for the two strategies in different trials. Although the discrepancy is very small, it is worth noting that the baseline strategy sometimes outperforms the optimal strategy. This tendency supports the claim that there exists discrepancy between theory and practice and that the optimal strategy derived from first-order assumptions could perform worse than other strategies in high-order dynamics. This discrepancy is due to the delay in executing the optimal strategy because computing the optimal breaching point takes some time. As a reference, one cycle of the cross feedback system in Fig. 4 takes about 70 msec, and the optimal breaching point calculation takes the major portion of it, which is about 10 msec. To compensate for the delay, robots with higher computing power can be employed.

VI. CONCLUSION
This paper aims to apply the theory with first-order assumptions derived from the hemisphere perimeter defense game to robots with realistic models, and observe performance discrepancy in relaxing point particle assumptions. We study the transition from theoretical point particles to practical three-dimensional robots using UAV models in Gazebo. To evaluate the performance discrepancy, two analyses are conducted. In the parametric analysis, it is found that UAV trajectories converge to first-order assumptions as the radius of the hemisphere increases. The comparative study shows that the optimal strategy derived from first-order assumptions can perform worse than other strategies in high-order dynamics due to the delay in executing the strategy. To cope with this discrepancy, the future work will focus on changing the first-order model to better capture the high dynamics of the UAVs and design pursuit strategies for the new model.