Professional Documents
Culture Documents
Algorithm
Qixi Fu Xiaolong Liang Jiaqiang Zhang †
Air Force Engineering University 1. Air Force Engineering University 1. Air Force Engineering University 1.
National Key Laboratory of Air National Key Laboratory of Air National Key Laboratory of Air
Traffic Collision Prevention Traffic Collision Prevention Traffic Collision Prevention
2. Shaanxi Province Lab. of Meta- 2. Shaanxi Province Lab. of Meta- 2. Shaanxi Province Lab. of Meta-
synthesis for Electronic & synthesis for Electronic & synthesis for Electronic &
Information System, Xi’an 710051, Information System, Xi’an 710051, Information System, Xi’an 710051,
China China China
afeu_fqx@163.com 17629097020@163.com 17737655200@163.com
ABSTRACT the basis of avoiding the violation of the geofence, and the
proposed geofence algorithm is effective and can ensure the flight
In order to improve the safety of UAS flight, an autonomous flight safety of autonomous UAS in geo-fence.
UAS geofence algorithm is proposed. Firstly, by scaling the
original geofence and performing vertex smoothing and self- CCS CONCEPTS
intersection detection processing, a geofence pre-control-layer • Computer systems organization ~ External interfaces for
generation algorithm which is universally applicable to both robotics
concave and convex geofence is proposed. Then, the buffer is
added on the basis of traditional ray method to solve the problem
KEYWORDS
of misjudgement of intersection points. The improved ray casting
algorithm is used to detect the violation of geofence, and a re- Geofence; Unmanned Aircraft System (UAS), pre-control-layer
planning method of the violating waypoints is proposed for the generation algorithm, violation detection, boundary maintaining
UAS with violating danger. The corresponding control law of autonomous control
boundary maintaining autonomous controls is designed. Finally,
ACM Reference format:
the validation experiment is carried out by using the experimental
system built by the quad-rotor UAS. Experiment result show that Qixi Fu, Xiaolong Liang, Jiaqiang Zhang, Duo Qi and Xiujun Zhang.
2019. Design and Experiment of Autonomous Flight UAS Geofence
the UAS can modify the original flight path as little as possible on
Algorithm. In Proceedings of 2019 2nd International Conference on
†
Computer Science and Software Engineering (CSSE’19). Xi’an, China, 7
Corresponding author: 17737655200@163.com
Permission to make digital or hard copies of all or part of this work for personal or pages. https://doi.org/10.1145/3339363.3339381
classroom use is granted without fee provided that copies are not made or distributed
for profit or commercial advantage and that copies bear this notice and the full
citation on the first page. Copyrights for components of this work owned by others
than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, 1 Introduction
or republish, to post on servers or to redistribute to lists, requires prior specific
permission and/or a fee.Request permissions from Permissions@acm.org.
With the rapid development of UAS industry, the number of
CSSE '19, May 24–26, 2019, Xi'an, China Unmanned Aircraft System (UAS) has increased dramatically,
© 2019 Association for Computing Machinery. ACM ISBN 978-1-4503-7172- which poses a serious threat to the personal and property safety of
8/19/05…$15.00
https://doi.org/10.1145/3339363.3339381 ground personnel and aircraft in the air [1]. People urgently need to
CSSE’19, May, 2019, Xi’an, China Q. Fu et al.
develop UAS Traffic Management System (UTM) to ensure UAS's boundary and the control law of the boundary maintenance control
safe and orderly flight in airspace. The airborne geofence of UAS for autonomous flying UAS are designed, and the simulation
is an important part of UTM [2]. After obtaining the geofence data verification are carried out at last.
published and shared by authoritative sources, the geofence divides
the airspace into available airspace (keep-in geofence) and no-fly
zone (keep-out geofence), which are composed of vertical height 2 Pre-control-layer Generation of Geofence
restriction and horizontal boundary[3]. The horizontal boundary of Pre-control-layer generation algorithm of geofence refers to the
UAS can be regarded as a polygon composed of several vertices. generation of a new geofence on the basis of the original geofence.
In the course of flight, the flight airspace of UAS can be regarded The corresponding edges of the newly generated geofence and the
as composed of a geofence and any number of geofence. In order
original geofence are spaced at b distance. The value of b is
to avoid UAS violating the geofence, it is necessary to monitor the
position relationship between UAS and the geofence boundary in related to the mandatory parking distance, turning radius, wind
real time during UAS flight, judge whether the UAS violates the effect and state estimation error of UAS. When b 0 , the
boundary or exists the danger of violating the boundary, and geofence scales inward, that is, the geofence is keep-out to leave
trigger the boundary maintenance control according to the UAS the geofence; When b 0 , the geofence scales outward, that is,
violating state when necessary.
the geofence is keep-out to enter the geofence. Geofence pre-
In recent years, some progress has been made in the
application and research of UAS geofence at home and abroad. control-layer generation algorithm includes geofence scaling
algorithm, geofence corner smoothing algorithm and geofence self-
Geofence systems have been used in some existing commercial
products of UASs, such as Dajiang [4], Ardupilot [5], but these intersection detection and processing algorithm.
geofence systems can not completely and reliably prevent UAS
from violating the border. Literature [6] proposed that the geofence 2.1 Geofence Scaling Algorithm
system can be used as a security alternative to the perceptual The specific steps of the geofence scaling algorithm are as follows:
avoidance system. It is believed that the low altitude UAS Step1. We set scaling distance b , and get the geofence
equipped with the airborne geofence system will hardly pose any
threat to the people, finance and objects on the ground. When the
g = ( p1 ,..., pn ) = [( x1 , y1 ),( x2 , y2 ),...,( xn , yn )] , where pi is
system passively monitors the possible geofence violating the the i th vertex of the geofence. Layered geofence g ' initializes:
border, it can avoid violating the border by seizing the navigation g'= g.
control of the UAS. Unlike capturing the navigation control right
Step2. The slope of each edge of geofence is given by:
of UAS directly, literature [7] uses the optimization method to
yi +1 − yi
generate the minimum range maneuver without violating the mi = (1)
boundary of the geofence, and achieves the smooth avoidance xi +1 − xi
trajectory with the smallest change of flight headings as possible. Interception of each edge is given by:
However, this method only simplifies the geofence into a circle, bi = yi − xi * mi (2)
which is difficult to adapt to the complex flight environment of
UAS. Literature [8] presents an Algebraic Geometric geofence And i is the half-angle of interior angle, which is given by:
algorithm based on UAS performance and wind influence in UTM
1 yi +1 − yi y − yi
environment. The algorithm reduces the minimum size of geofence i = arctan − arctan i −1 (3)
from 30 m to less than 5 m in vertical and horizontal directions. In 2 xi +1 − xi xi −1 − xi
the literature [ 9 , 10 ], a safety guard technology for UAS is Step3. In Figure 1, the distance hi along the angular bisectors
proposed, and the results of validation tests for established rules
such as geographic fencing are introduced. Geofence boundaries in between the new and old edges spacing b after scaling is
security guards are divided into three layers: warning boundaries, computed by:
flight termination boundaries and hard boundaries. However, no | b |
algorithm for generating geofence boundaries is proposed. hi = (4)
sini
Through shrinking the convex and keep-out geofence of plant
protection UAS and cross-border detection, it can issue cross- Convert i to 0 ~ 2π and get:
border early warning for plant protection UAS operators in case of yi +1 − yi
cross-border danger in [11]. i = i + arctan (5)
Based on the research of UAS's geofence at home and abroad, xi +1 − xi
aiming at the problem of geofence boundary in horizontal direction, Step4. If b 0 (scaling inward), then:
this paper firstly proposes a pre-control-layer generation algorithm,
xi' = cosi * hi + xi
and then uses improved ray method to make geofence cross-border (6)
detection. For the boundary maintenance control problem of yi' = sini * hi + yi
geofence, the method of replanning the point of violating the
If b 0 (scaling outward), then:
Design and Experiment of Autonomous Flight UAS Geofence
CSSE’19, May, 2019, Xi’an, China
Algorithm
xi' = −cosi * hi + xi Step1. get the scaling distance and the vertex set of the scaled
(7) geofence g ' = ( p1' ,..., p'n ) = [( x1' , y1' ), ( x2' , y2' )..., ( x'n , y'n )] .
y = −sini * hi + yi
'
i
Finally, the layered geofence is given by: Step2. use equations (1) and (2) to compute the slope mi and
g ' = ( p ,..., p ) = [( x , y ), ( x , y )..., ( x , y )] .
'
1
'
n
'
1
'
1
'
2
'
2
'
n
'
n intercept bi of each edge of the geofence.
Step3. If pi' 180 and b 0 , or if pi' < 180 and
pi +1
+1
hi
b
p 'i +1
angle of pi' :
Converting to 0 ~ 2π yields :
pi −1
interval with the original boundary, and help to determine whether method determines whether the point r is in the geofence by a ray
the UAS can pass through the narrow area. s drawn from the point r as the end point, as shown in Figure 5.
In the original ray cast method, the ray is projected from the
end point to the positive half-axis of the y-axis. If the number of
intersections between the ray and the geofence is odd, the
determination point is in the geofence, otherwise it is outside the
geofence. But when the vertex of the ray coincides with the vertex
of the geofence, the two edges are mistakenly recorded as one, thus
the number of intersections is misjudged. In order to avoid the
detection errors caused by the above problems, this paper defines
the buffer distance b on the basis of the original ray method and
proposes an improved ray method. If the x-coordinate of a vertex
Figure 4: Scaled Geofence after Self-Intersection Processing
of a geofence is within the buffer distance of rx , a perturbation
The main steps of the self-intersection detection and −b * 2 is applied to the x-coordinate of the vertex to avoid the
processing algorithm are as follows: coincidence of the ray and the vertex of the geofence. The specific
Step1. acquires the vertex set flow of cross-border detection of geofence is shown in Figure 6.
g ' = ( p1' ,..., p'n ) = [( x1' , y1' ), ( x2' , y2' )..., ( x'n , y'n )] of scaled Begin
geofence, detects whether any two non-adjacent boundaries of Given point r = (rx,ry) and geofence
g = (p1,p2,…pi,…,pn)
scaled geofence intersect, and if they intersect, records the Generation of ray s
intersection edges and intersections of scaled geofence. from point r
Intersection point
Step2 processes the intersection edge and intersection of the For each edge
pipi+1 of g: number c = 0
combination, deletes polygons that are inconsistent with the vertex r is within the
buffer distance b of
No s is intersected
with the edge
No Is it the last
edge?
the edge? pipi+1?
order of the original scaled geofence, and the remaining part is the
Yes
scaled geofence g ' without conflict, as shown in Figure 4. Yes Yes
c=c+1
relationship between UAS position and geofence in real time to r is out of the geofence g r is in the geofence g
judge whether there is a danger of violating the border [ 12 ].
Violation detection of geofence in horizontal direction can be
End
regarded as a point-in-polygon detection problem [13]. The ray
method, widely used in point inclusion detection, can solve the
problem of horizontal geofence detection very well. The ray cast Figure 6: Flow Chart of Geofence Violation Detection
Design and Experiment of Autonomous Flight UAS Geofence
CSSE’19, May, 2019, Xi’an, China
Algorithm
4 Boundary Maintaining Autonomous Control and the corrected waypoint is obtained and replaced. Finally, the
set of corrected waypoints Wcorrrect is obtained.
After the pre-control-layer of the geofence is generated, in the
When the planned waypoint of the UAS does not pass through
UAS flight, the geofence will use the violation detection algorithm
the restricted geofence, it is similar to Figure 4. When the route
to judge its position relationship with the pre-control-layer of the
planned in advance by the UAS violates the restricted geofence,
geofence in real time. When there is no danger of violating the
there is a great difference between the replanning of violating
boundary, the UAS will fly according to the pre-planned flight path
waypoint and that without violating waypoint. At this time, the
to complete the corresponding task. Once the geofence detects the
replanning of violating waypoint is shown in Figure 8. In order to
danger of the UAS violating the boundary, the airborne geofence
avoid the possible conflict situation in the replanning of violating
system will immediately seize the navigation control of the UAS,
the restricted geofence when the UAS flies in the opposite
and react in accordance with the navigation control method set by
direction, flight rules are added in the replanning of violating the
the algorithm to avoid the UAS violating the boundary, thus
restricted geofence, that is, the correction point is inserted
ensuring the flight safety of the UAS [ 14 ]. Therefore, it is
counterclockwise along the boundary of the pre-control-layer of
particularly important to design the navigation control method of
the restricted geofence, that is, right turn.
the geofence boundary maintaining control.
b
4.1 Violating Waypoint Replanning
In the process of geofence boundary maintaining control, in order
to avoid the situation that the turning maneuver is too intense and
the track deviation is too large, the UAS uses the straight line
section of uniform speed in the boundary maintaining control, and
Legend:
the turning section USES the strategy of decelerating first and then Pre-control-layer
turning. In order to reduce the flight time, the new flight waypoint Original geofence
is inserted into the original flight point to increase the distance of True trajectory
Original waypoint
the UAS to maintain uniform flight speed in the control of the Inserted waypoint
geofence boundary as much as possible. Corrected waypoint
Deleted waypoint
After the geofence detects the danger of violating the border and (GPS), whose frequency is 10Hz. Serial communication is used for
redesigns the waypoints, the UAS can fly according to the revised data transmission. The experimental system uses Microhard P400-
points to avoid violating the border. However, the design of control 840 module based on Mesh networking technology, and the
laws for different flight controllers is not the same, and UAS still communication frequency is 840 MHz. Because the UAS needs a
have the danger of violating the boundary. So the geofence needs certain amount of calculation and high real-time performance when
to design a control law independent of the flight controller. it carries out boundary maintenance control of geofence, STM32F4
UAS is regarded as a particle, and its dynamic model adopts series microprocessors are selected for real-time operation in the
the first-order integral model. system. The hardware structure of the system is shown in Figure
x&(t ) = u(t ) (15) 10.
where x(t) and u(t) are position and velocity of UAS, respectively;
u(t) is the input of control simultaneously.
When the UAS flies in a straight line, the control law of the
UAS is designed as follows:
REFERENCES
6 Conclusion
Aiming at the geofence problem of UAS, this paper designs and
experiments the geofence algorithm, which ensures that the
geofence can be effectively avoided in the process of UAS flight.
(1) An algorithm for generating the pre-control layer of
geofence is proposed.
(2) Geofence violating detection is carried out by improved
ray cast method, and control law is maintained by replanning and
design of violating waypoints to realize the response to geofence
violating, so that autonomous flying UAS can avoid geofence
violating.
(3) The experiment results prove the effectiveness of the
proposed algorithm.
ACKNOWLEDGMENT