A Novel Design and Implementation of an Autopilot Terrain-Following Airship

Unmanned Aerial vehicles (UAV) have been utilized in many application domains. UAVs (or Airships, e.g., Drones) have been adopted to explore resources (e.g., minerals). One of the main limitations of using such airships is that flying at a fixed altitude is based on GPS altitude information. In many applications, it is important to support the ‘terrain-following flying’ function for airships when deployed and utilized in areas where the terrain is not flat but bumpy and steep (for example, in mountains areas in South Korea). This paper proposed a novel architecture of an airship autopilot system with three main contributions: First, the proposed architecture is designed to support a terrain-following function using a laser range finder (which continuously identifies the distance between an airship and terrain). Second, the proposed system provides two new algorithms for path and terrain-following functions for the proposed architecture. Third, this work designed and implemented a prototype airship and autopilot system to validate the proposed method. As a result, the proposed airship design and algorithm can guarantee a high-quality data collection (e.g., magnetic data) and demonstrate the benefits of the proposed approach with the experimental results based on real-flight operation in a test area.


I. INTRODUCTION
Unmanned aerial vehicles (UAV) and their applications have been rapidly expanding along with the development of a miniature Inertial measurement unit (IMU) due to the micro-electromechanical system (MEMS) technology and the spread of GPS chips in various fields. The use of UAVs offers multiple benefits, and one of them is that UAV achieves missions such as obtaining high-resolution aerial photos through low-altitude flight. Such an advantage is also highly useful in various resources (e.g., minerals) exploration, and it can replace resources exploration using manned aircraft or helicopters with unmanned aerial vehicles. In particular, there are a lot of mountainous areas in certain countries (e.g., South Korea), and resource exploration on the ground by a human or human team is extremely hard in some cases. So obtaining resource data by operating unmanned aircraft at low altitudes is one of the key areas to investigate. However, The associate editor coordinating the review of this manuscript and approving it for publication was Xujie Li . in mountainous terrain, it is very challenging to obtain uniform resource data due to the difference in distance from the ground when an UAV is flying at a fixed altitude. The distance from the terrain becomes short, the quality of data is close to ground exploration by a human that has the best quality. Therefore, it is significant to support terrain-following flying for UAVs. Also, this can improve data quality in other remote sensing areas.
In previous work, to support terrain-following flying, several methods, including geographic information [7], Light Detection and Ranging (LiDAR) [8], laser rangefinder [9], [10], and optical flow [11], [12] have been proposed. However, the previous work only showed simulation results or simple test results (e.g., indoor experiments), and they did not show any test results with wide-area outdoor environments.
In addition, the previous work on a terrain-following flight has been done with other aircraft types such as drones and fixed-wing aircraft. The proposed work uses an airship because the airship provides several benefits over the other aircraft types. First, this aircraft requires less energy to remain in flight for a long time owing to the fact that they do not need forward speed to maintain lift. Second, the proposed airship supports low-speed flying, and it enables one to acquire high-quality exploration data. Third, the proposed airship consists of the equipment that has the least iron content, which can exert influence on the magnetic sensors used for the exploration. In addition, to reduce the iron content, a small and low-powered control computer was adopted for the proposed airship.
The main contributions of this work are summarized as follows: • Proposed a novel architecture of an airship that supports terrain-following flying.
• Designed the airship that utilizes a minimum number of components and minimizes computational overhead.
• Implemented a prototype and tested it in the 2km 2 terrain map of the actual test area.
• Demonstrated proposed airship system after flying the prototype in a 7.5km actual distance and collected the experimental flight results and analyzed them.
The rest of this paper is as follows: Section II introduces backgrounds and related work. Section III presents our proposed system architecture. Section IV presents the evaluation and analysis of our proposed system. Section V summarizes the limitations and future work. Finally, Section VI concludes this paper.

A. AIRSHIP AUTOPILOT
There are previous works related to the autopilot of an airship. Elfes et al. [1] proposed the autopilot concept for an airship and the configuration of the control and navigation system. In [2], [3], and [4], proposed algorithms that are validated only through simulation, whereas the work including [5] and [6] used flight experiments.
Yang et al. [2] proposed a backstepping sliding-mode control technique instead of the conventional sliding-mode control. Furthermore, Vieira et al. [3] proposed a unified backstepping sliding mode control design, which airship positioning method, and showed that the proposed method was validated using simulations. Nie et al. [4] showed threedimensional path-following control for an airship using reinforcement learning, also validated with simulation.
Pshikhopove et al. [5] analyzed the aerodynamics of airship through a mathematical model and presents a nonlinear control algorithm, tests the proposed algorithm through simulator and experiment. However, it was not easy to understand the actual performance because it does not show detailed experimental procedures and results.
Zheng et al. [6] created a dynamic model of an airship and designed a path-following control technique, and validated it through flight experiments. However, they showed only fragmentary test results in a tiny area, although an airship has a very long flight time compared to other aircraft types.
Compared to the prior work, our proposed work validated our proposed algorithms by performing a 7.5km long-range flight experiments in a wide test area of 2km 2 .

B. TERRAIN-FOLLOWING
Terrain-following flight research can be implemented in various methods, using geographic information [7], LiDAR [8], laser rangefinder [9], [10], an optical flow using a camera [11], [12], and so on. Regarding the method using geographic information [7], the flying route is created based on data collected in advance with Geographic Information System (GIS). GIS information generation should consider the error of the information and during flight because it is impossible to manage the changes in terrain and new obstacles.
Regarding the method using LiDAR [8], it has the advantage of detecting the terrain in 3D. However, it requires a powerful computing device (e.g., a PC). It takes up a significant portion of the payload, considering the weight of the LiDAR device and the battery for the power supply. The primary application of the proposed work is mineral resource exploration using a magnetic sensor. The Prototype airship has a total 10kg payload. And sensor quality is generally proportional to weight. In this research, a high-quality sensor was employed rather than LiDAR. Regarding the method using a laser rangefinder [9], [10], it measures the distance with only one point. Therefore, it does not require any data processing device that weights a light payload. However, one critical disadvantage of this method is that small or thin obstacles may not be detectable. Because this method processes the terrain as one line, significant obstacles are recognized as terrain. On the contrary, obstacles out of the line are not detectable.
Regarding the method using optical flow [11], [12], it requires a lightweight camera and an additional image processing device. They have been tested only at the laboratory level.
This paper adopted a laser rangefinder for the terrainfollowing algorithm and verified it through long-range experiments.
The research using the same device [9] presented specific mathematical models such as terrain, vehicle, path, and tracking errors according to measurement errors. And they are compared with Monte Carlo simulation results to determine the optimal sensor installation angle according to the vehicle response speed. However, experiments using an actual aircraft have not been researched.
Also, in [10], a rangefinder is mounted on the gimbal to adjust the measurement angle so the optimum angle is calculated according to the aircraft's attitude, the horizontal speed, and the desired altitude. Still, there is no experimental result in the previous work.
This paper proposes a simple algorithm with a fixed laser sensor in the direction of 45 degrees below the front of the aircraft without a gimbal to minimize equipment that affects to magnetometer for exploration, different from the work [10] VOLUME 10, 2022 that uses the gimbal to adjust the laser's downward angle according to the speed. The proposed work uses only a laser rangefinder and a small 8-bit microcontroller with algorithms taking into account calculation overhead. Also, verified proposed algorithms through flight experiments in mountainous terrain.

C. UAV EXPLORATION
Jon et al. [13] showed ongoing work that an airship equipped with a laser scanner, digital camera, and thermometric camera for ground mapping. Ren et al. [14] proposed a thermal infrared sensing system mounted to an airship and experimented on a large area. They analyzed the thermal image in detail but did not address the flight data. Qian et al. [15] showed ground hazards investigation interpreting low-altitude photographic images using the airship on their test area, in which altitude varies. This result could be better when they adopt terrain-following, even it is safer for low-altitude flight.
Malehmir et al. [16] compared the geophysical magnetic survey result using a drone with the result of crewed aircraft. In work [17], they showed a lower altitude flight and compared it with ground exploration results. Jackish et al. [18] introduced a methodology for integrating magnetic and multi-spectral exploration results using a drone and fixedwing UAV.
However, it is necessary to minimize the impact of the aircraft on magnetic sensors, as shown in work [19], [20]. In addition, as mentioned in [21], the drone has the disadvantage that it should lift the entire weight of the aircraft only with battery power, so the flight time cannot exceed 30 minutes. Furthermore, existing studies demonstrated exploration results on flat land. In contrast, in some areas (e.g., South Korea), about 70 percent of the land is mountainous, and most of the exploration area is mountainous, so terrain-following flight is essential to obtain more accurate exploration data.
An airship is employed to resolve these requirements, which is possible to fly for a long time with little power since the buoyancy of helium gas lifts the aircraft. And the primary materials (urethane cloth, fiber-reinforced plastic, Styrofoam) that make up the aircraft do not influence the magnetometer. No study used an airship for terrain-following flight due to the dull motion characteristics. However, this work showed that the proposed airship could successfully support terrain-following flight. Fig. 1 shows the overall flight system architecture and components. There are mainly two systems: airship and ground control system. An airship has the following components: microcontroller unit (MCU), GPS and Attitude and Heading Reference System (AHRS), RF modem, Rudder, Elevator, Throttle motor, and magnetometer. One MCU process all the flight control algorithms that Atmel's ATmega2560 is the MCU, the chip vendor that provides ''Atmel Studio'' as a development tool, using C language. As shown in Fig 1, the  MCU has four Universal Asynchronous Receiver/Transmitter (UART) ports and supports multiple Pulse Width Modulation (PWM) outputs. For the GPS and AHRS devices, Xsens' MTi-G-700 is adopted because it integrates two functions (GPS and AHRS) into it. The laser rangefinder can measure distances up to 100m using Lightware's SF30/C. The RF modem uses Digi's XT09, which communicates at 900MHz frequency, power up to 1Watt, and has a maximum data rate is 115,200bps. Since servomotors drive the rudder and elevator, a 50Hz PWM signal can control them. In addition, the Electronic Speed Controller (ESC), which adjusts the power of motors, receives a 50Hz PWM signal. Therefore, the flight control loop operates at 50Hz. Consequently, the GPS/AHRS and the laser rangefinder transmit data at 50Hz. In the case of communication, the RF modem sends the flight information to the ground at 25Hz synchronously. On the other hand, ground commands are asynchronously sent to the airship only when necessary. Ground Control System (GCS) consists of a manual controller, GCS-PC, and RF modem. GCS uses a typical laptop, an RF modem, and a manual controller connected to GCS through a USB-UART converter.

III. PROPOSED SYSTEM ARCHITECTURE
Our proposed prototype airship is shown in Fig. 2. It was used for our flight algorithms development and flight experiments. The gasbag made of urethane cloth is about 11m in length. However, it is a non-rigid type with no internal structure, so when it is folded out of gas, the volume becomes very small, making it convenient for carriage. The gondola is made of Fiber-Reinforced Plastic (FRP) and can load the battery, flight control computer, and payloads inside. The tail wing was composed of Styrofoam and installed a servo motor to change the wind direction. The prototype airship has about a 10kg total payload. The battery weighs 4kg for a 1-hour flight. So other equipment should not weigh over 6kg. There is a trade-off between equipment and battery. When equipment is less than 6kg, more batteries can be equipped and fly longer. Fig. 3 shows the entire flowchart of the autopilot algorithm. The elevator, rudder, and throttle, which control altitude, direction, and speed, consist of independent algorithms but operate at the same 50Hz frequency.
The elevator control algorithm has two modes: the terrain-following mode and the GPS altitude mode, which can be selected by the user's command. In terrain-following mode, it operates only with the distance of the laser rangefinder, and in the opposite case, it works using only the GPS altitude.
The rudder control algorithm branches the path-following navigation or point navigation algorithm according to the way-points (WP) arrangement. When the current WP is horizontally or vertically (which has the same latitude or longitude) located to the previous WP, the path-following algorithm operates. Otherwise, the point navigation algorithm is used. Since the flight for exploration purposes is generally horizontal or vertical aligned, a simple path-following algorithm is proposed to reduce calculation overhead.
The throttle control algorithm was designed to maintain the speed specified by the user. Although the wind force or user changes the speed dramatically, this algorithm also considers acceleration for the airship's smooth movement by limiting instant acceleration and deceleration. All parameters in the proposed algorithms are optimized based on the flight experiments. By running these three algorithms simultaneously, the airship can fly fully autonomously without human interruption.

A. TERRAIN-FOLLOWING ALGORITHM
In the real world, actual terrain changes continuously. However, the proposed algorithm digitalized terrain into two steps for the explanation, as shown in Fig. 4. When the laser rangefinder detects the new step, the laser distance changes, so the airship needs to change its altitude to the new step as the following calculation method. First, it measures the distance l using a laser rangefinder. It considers the current pitch angle of the airship C and the laser rangefinder attached 45 • downward and calculated the vertical distance d V and horizontal distance d H as shown in Eq. 1 and 2.
In Fig. 4, a T represents a target altitude specified by the user, so that it needs to sustain the target altitude despite the terrain changes by processing the terrain-following algorithm continuously. T represents the target pitch degree of the airship due to terrain changes. It calculates using the difference between the current vertical distance d V and the target altitude a T divided by the horizontal distance d H , as shown in Eq. 3.
represents the difference between the target angle T and the current pitch angle of airship C so that it can be used to move the airship at this angle to maintain the target altitude.
Since the airship follows the target angle, the elevator needs to turn the appropriate angle as Eq. 5 to derive the target angle of the airship. Here, C E is an elevator constant tuned to an optimal value of 5.25 through multiple flight experiments.
VOLUME 10, 2022  At first, this algorithm follows terrain very accurately, especially the terrain exhibits smooth changes. However, testing the initial algorithm (Eq. 5) during several flight experiments, a few crashes happened when our airship flew in terrain with rapid altitude changes within a short distance (such as valleys and logging areas). It requires a modification of the initial algorithm, reducing the elevator to a half-angle of the upward angle when the elevator moves downward as in Eq. 6.
After reducing the downward angle of the elevator, the performance of the algorithm degraded, which did not perfectly follows the terrain, but no further crash accident occurred during the additional flight experiments.

B. PATH-FOLLOWING ALGORITHM
Since this work aims to develop an autopilot algorithm for exploration, it is possible to obtain data that are more accurate by flying according to a straight path. Therefore, the horizontal line path-following algorithm is proposed, as shown in Fig. 5 and 6.
The basic concept of the proposed algorithm is that as the airship flies away from the straight line, it turns its heading more to the straight line. The primary purpose of this algorithm is flying to P 1 in Fig. 5, and keeping close to the straight line is the second purpose, so it is designed to turn 45 degrees maximum for satisfying both purposes.
If the airship is flying from position P 0 to P 1 , as shown in Fig. 6, the distance from the straight line would be d 0 . To obtain this, (Latitude A 0 , Longitude A 0 ) and (Latitude 0 , Longitude A 0 ) are converted to meter distances using the method of work in [22]. After that, as the airship A 0 is positioned above or below the straight line, the heading degree of the airship is calculated by Eq. 7 and Eq. 8. if In Eq. 7 and 8, the angle 90 • is the base heading angle of the airship for moving from P 0 to P 1 and the adjusting angle is added according to distance d 0 . The adjusting angle is multiplied by the constant C d . When the distance is short, the adjusting angle is small, and this can be extended up to 45 • while the distance becomes longer. The adjusting angle is limited to 45 • . Otherwise, it would violate the basic flight purpose of flying from P 0 to P 1 . The constant C d value was determined as 0.02 after multiple flight experiments.
For the remaining cases, A 1 , A 2 , A 3 can calculate in the same way as H • T as mentioned above.

C. THROTTLE CONTROL ALGORITHM
Throttle control is an essential algorithm for an autopilot that holds the speed specified by the user during flight. This paper proposed a simple throttle control algorithm to maintain the speed with minimal overhead. The primary design concept of this algorithm is to avoid rapid acceleration for saving energy so that it can fly longer with identical battery capacity. Therefore this algorithm firstly concerns the acceleration. In Eq. 9, the target acceleration Acc T is obtained through the difference between the target velocity Spd T and the current velocity Spd Cur , respectively. Using the constant C A , the target acceleration according to the speed difference is scaled. After several flight experiments, C A was optimized to 0.25.
In addition, Eq. 10 prevents instantaneous acceleration and deceleration. The proposed algorithm is limited not to exceed ±0.5m/s 2 .
To obtain the required power according to the target acceleration, it calculates the difference between the target acceleration and the current acceleration, as shown in Eq. 11, and multiplies the constant C P to scale the required power. After the flight tests, the constant C P was optimized to 35. However, in actual implementation, the control loop operates at 50Hz, so the constant C P works as 0.7 to fit the control loop.
Finally, as in Eq. 12, it adds power to the throttle value.
Since the throttle value must be between 0% and 100%, like the acceleration range in Eq. 10, it is also limited in Eq. 13. Thr = min {max(Thr, 100%), 0%} (13) Because the throttle control algorithm results in the rotational speed of a 50cm (20inch) propeller, safety must be the top priority. There should not be a human accident due to malfunction during landing, and the propeller should not run in the event of a collision with an obstacle to minimize the impact damage. To this end, the safety code is added as in Eq. 14 is based on the vertical distance d V obtained from Eq. 1.
This safety code operates only in autopilot mode, and when switching to manual mode during landing, the propeller can run even at a vertical distance of less than 3m. However, it can be very safe in the case that it is switched to autopilot mode by a mistake or malfunction.

D. IMPLEMENTATION
For evaluating the results of the terrain-following experiments, a terrain altitude would be necessary to compare them with flight altitude. Therefore, to verify the proposed algorithm, implementation and experiment were performed according to the following procedure.
1) Implement an airship prototype and program the proposed algorithms. 2) Optimize the parameters through several flight experiments. 3) Select the test area for overall system verification. 4) Fly at high altitudes in the test area and take large quantities of photographs. 5) Create the 3D terrain of the test area with photographs using commercial software. 6) Fly in the test area with the proposed terrain-following algorithm. 7) Verify comparing the flight altitude with the created terrain. To obtain accurate topographic information, it flew at an altitude of 450m above sea level and took about 1,000 pictures with GPS tags. Subsequently, 3D topographic information was acquired using Agisoft's Photoscan program, as shown in Fig. 7

IV. EVALUATION AND ANALYSIS A. EXPERIMENTAL RESULTS AND ANALYSIS
The results of terrain-following flight experiments performed on the terrain in Fig. 7 are shown in Fig. 9.
The results showed that despite setting the target altitude at 60m from the terrain, the aircraft flew above 60m overall. This phenomenon appears to reduce the descent angle of the elevator by half. In the part where the altitude rises rapidly or continuously rises, there is also a part that almost coincides  with 60m from the ground by flying only with the ascending elevator angle. If the ascent and descent angles become the same, a more accurate flight will be possible. However, it might have a crash in the terrain where the altitude rises rapidly, such as some terrain (estimated as a quarry or logging area) in Fig 9(c). It was an inevitable choice. Fig. 10 shows how accurately the airship flew on the exploration line. In general, it showed an error of about 10m in a straight line. Considering the length of the airship is 11m, it is an outstanding result. The big difference in the first part of Fig. 10(b) is that the previous WP1 is orthogonal to WP2. Since the airship needs to turn 90 degrees, the difference in the first part is extensive, but it shows that the difference is getting closer to a straight line during flight. Fig. 10(a), 10(c) shows a slight difference in value, but overall, the flight path skewed eastward. On the contrary, in Fig. 10(b), it skewed westward. So it can be estimated that the west wind was blowing during the flight. Table 1 compares performances with other work that addresses flight experiment results. For the path-following error, Pshikhopov et al. [5] mentioned they have a 27m error but did not mention whether it is the maximum or average value. Considering their airship size is 40m, this error is not that enormous. Other work [6] that uses a similar length of the airship addressed the error is within 10m most of the time, which is not an accurate error value, and even during crosswind, they showed it has a 20m error. The proposed work showed a 4.38m error average value and 10.55m maximum, except during 90 degrees turn in Fig. 10(b).
A terrain-following flight experiment using an airship was the first in this paper. In table 1, the proposed work showed a 35.15m average and 73.04m maximum. These are not slight errors because the algorithm changed after the crash accident during experiments. There are planning to enhance the algorithm for more accurate terrain-following flight for future work.

B. EVALUATION OF PROPOSED WORK
The requirements necessary for the evaluation of the proposed study are as follows. First, when using UAVs for resource exploration, the following flight requirements are needed.
• R.1 To increase the precision of exploration data, fly closer to the ground.
• R.2 Better to fly closer to the survey line (straight line) specified by the user as much as possible.  As an example of a specific exploration, the following requirements are needed when mounting a magnetometer to an aircraft for magnetic exploration, which is the goal of the proposed study.
• R.3 When making the aircraft, avoid materials containing iron as much as possible.
• R.4 Minimizes the installation of electronic devices other than thrust motors and ESCs, essential for flight.
• R.5 Inevitable electronic devices minimize their size. • R.6 To minimize the flight control computer, all flight algorithms are designed in the direction of reducing computational overhead. Table 2 briefly summarizes whether the existing and proposed studies meet each requirement. R.1 is the first proposed study to fly as close to the ground as possible via airship-based terrain-following flight and show the experimental results. For R.2, the existing studies performed path-following experiments, but only fragmentary results were presented in a small area, making it impossible to identify the exact results. The proposed study shows 7.5 km of flight results over a large test area of 2km 2 . Studies such as [19] and [20] have led to R.3. As an alternative way, previous studies have shown that magnetic sensors have been hung on a string to keep them as far away from the aircraft as possible. The proposed study has used an airship to meet this. The envelope is made of urethane fabric, and the gondola is made of FRP, so it uses minimal iron material compared to other aircraft. R.4 and R.5 are additional requirements followed by R.3. The proposed study has eliminated even the gimbal used in [10], and the flight control computer was also minimized by using only one 8-bit microcontroller. R.6 is a requirement for implementing software suitable for such minimized hardware, and all algorithms in the proposed study are designed in a direction with minimal computational overhead.

V. LIMITATION AND FUTURE WORK
In the proposed study, the airship, which is suitable for magnetic exploration and has the advantage of extended flight time, has the disadvantage of not following the terrain perfectly because it moves slowly without responding immediately to tail wings or thrust control. It also means that flying too close to the terrain increases the risk of a crash. Other limitations include using only one laser rangefinder to satisfy R.4, which limits the design of high-accuracy terrainfollowing algorithms. Similarly, a minimum specification MCU is adopted to satisfy R.5 to implement the algorithm as simple as possible in the proposed study. Additionally, due to the characteristic of the airship, it can not fly during high wind speed, and our self-regulation is flying under 3m/s wind speed. Finally, the airship uses helium gas, which costs between $1,500 (wholesale, bulk purchase) to $3,000 (retail price) per injection. Therefore, the flight experiment was performed in one place because the cost problem arises to perform each experiment on various terrain. To apply to magnetic exploration, due to the helium gas cost, once it is injected into the airship, it should cover a larger area than the drone to make it feasible. Also mentioned in [21], ''the unmanned airship, which can stay in the air for a long time, is suitable for carrying out medium-area magnetic surveys.'' Recently, low-power and high-performance MCUs have been emerging due to the development of SoC (System on Chip) technology. In the future, GIS data will be uploaded to MCU to create a terrain-following path in advance, and a laser rangefinder will be used as a safety device. The algorithm's complexity will increase, simulation development is necessary for future work.

VI. CONCLUSION
Unlike drones that are popular these days, using an airship that can fly for a long time with a small number of motors, it is approved the possibility of terrain-following for the first time through a long-range flight experiment. To match the characteristics of the airship, minimize other electronic devices which have little effect on the magnetic sensor. Therefore, it draws a disadvantage for higher performance. Furthermore, many experiments were not carried out due to the cost of helium gas, especially in a crash, which resulted in significant delays in development, as gas costs were gone and had to wait for the next budget. In addition, this crash forced the algorithm to be modified, which resulted in poor terrainfollowing accuracy. Although flying at altitudes above the target altitude in general, it was excellent given that it flew using only one laser rangefinder and an airship with dull motion characteristics.
This study began with the development of an unmanned aircraft for the magnetic survey. Therefore, for the exploration, the airship was selected, which had the least iron content compared to other aircraft. When the airship maintains lift, it needs less energy than the other aircraft. So it can fly with small motors, most of which are composed of iron. Also, all of the algorithms were designed most simply for losing the weight of the low-powered flight control computer. Most of all, the terrain-following algorithm was developed suitable for making the airship fly as close to the ground as possible because it can guarantee high-quality exploration data even the Korean territory is mountainous. And also, the path-following algorithm was developed to make a flight as close as possible to the survey line.