Abstract
In this paper, a new path planning method is proposed to resolve the problem of two-dimensional terrain following flight of flying robots in mountainous regions. The performance criteria considered for this mission design could include either the minimum vertical acceleration or the minimum flying time. To impose the terrain following/terrain avoidance constraints, various approaches such as least square method, Fourier series method, Gaussian estimation method, and Chebyshev orthogonal polynomial are explored. The resulting optimal control problem is discretized by employing a numerical technique namely direct collocation and then transformed into a nonlinear programming problem. The efficacy of the proposed method is demonstrated by extensive simulations, and particularly, it has been verified that this method is able to produce a solution that satisfies all hard constraints of the underlying problem.
Introduction
The collision with ground obstacles and terrain near airport has always been one of the most critical issues in aviation accidents. Especially, the probability of this collision could be much higher in low-altitude flights, and therefore landing conditions have always been regarded as some of the most precarious flight conditions. A safe flight in low altitude is one of the stringent requirements in defining a mission for airplanes and flying robots. Furthermore, in low-altitude flights such as in mountainous regions, it is highly desirable to find a trajectory that guaranties the safety of flight and reaches the airplane to the destination by optimizing certain factors including time, fuel, vertical acceleration, and so forth. However, each of these factors is considered based on either the design specifications or the problem conditions. For instance, the optimization of the vertical acceleration in a flight path enables the reduction of the structural damages, which itself plays a pivotal role in the construction technology and cost. Moreover, the vertical acceleration factor impacts the passenger comfort in an airplane. 1
In recent years, flying robots are widely utilized for urban missions such as relief and rescue and traffic control. To navigate and control these flying vehicles, there are flight limitations associated with terrain following (TF) and terrain avoidance (TA). For instance, given that traffic control is essential for metropolises, one of the most preponderant challenges that each designer faces is high-rise buildings in the area. Since it is so common for flying robots to fly at low altitude, prompt decisions should be made because there is no ample time for deciding and generating a suitable flyable path. Therefore, the flight paths must be generated and optimized based on the mission, which requires a sufficient identification of the mission, flight vehicle dynamics, constraints, and flight obstacles.
In low-altitude missions, TF and TA maneuvers are both considered at the same time. TA is the automatic avoidance of airplanes from nearing any obstacles and TF is the adjustment of minimum altitude from the ground and the rapid passing of the trajectory in order to optimize the terrain following. In fact, low altitude and high velocity are the two main tactics of this maneuver. Also, TF and TA could be used either simultaneously or separately, depending on the mission and problem requirements. Generally, the scope of all issues pertaining to TF maneuver for flying robots includes2,3:
Trajectory generation with TF purposes to enhance both survivability and mission effectiveness; Control law development to follow the actual or model trajectory regarding the flight vehicle maneuvering capabilities; Sensors blending for terrain data update; Evaluation of the integrated system for different scenarios as well as emergencies.
The main goal in the trajectory design is obtaining an optimal path that strives to follow terrain in a way that all of the requirements, constraints, and expectations are met. Since this path is usually a curve, the TF problem may be simplified as a two-dimensional problem solved merely in a vertical plane perpendicular to the ground where the longitudinal dynamics of the flying robot is involved. Solving this problem is generally based on modeling the terrain with a suitable curve that is generated by gathering the terrain data and deploying mathematical methods for selecting the best curve. 3
A myriad of studies with a variety of methods have been conducted on the subject of path planning for TF and TA maneuvers. Lu et al.4,5 have used inverse dynamics 4 and predictive control methods 5 for optimal trajectory generation with the scope of TF for flight vehicles. In these papers, a point mass dynamic model has been utilized for designing a curve in a two-dimensional vertical plane with the purpose of optimizing the flight time and terrain. Note that the inverse dynamics method for generating the optimal path is used for offline purposes, whereas the predictive control method generally is used for online purposes.
Asseo 6 used the steepest descent algorithm for path planning in low altitude in order to accomplish the TF/TA maneuvers. The main feature of this technique is to divide the three-dimensional problem into two subproblems associated with the horizontal and vertical planes. This simplification makes the algorithm usable for online purposes. 6
Some studies2,3,7 investigated the two- and three-dimensional optimal trajectory generation for TF/TA maneuvers of unmanned aerial vehicles. Malaek et al. utilized the equations of point mass motion for the dynamics of flying vehicle and Chebyshev orthogonal polynomial method for the terrain modeling in two dimensions. This paper also presents a three-dimensional path planning method for which the kinematics of flying vehicles is exerted in the equations of motion. One of the most outstanding features of that work is imposing comprehensive TF constraints such as external threats in motion equations of flying vehicle. It should be mentioned that since that method is categorized as an indirect method, it is effective in terms of accuracy and reliability but requires a great computational time.
Rahim and Malaek8,9 perform optimal path planning for TF/TA maneuvers using fuzzy logic method for ground robots, submarines, and unmanned flying vehicles. In that work, to simulate the TF maneuver, terrain with various gradients has been used and the flight altitude and gradient of the terrain have been modeled with the fuzzy method. In Rahim and Malaek, 9 the implementation of fuzzy method was done in two phases. The first phase includes offline navigation in which path planning is done through cost function, flight vehicle dynamics, and terrain data with the fuzzy method. The second phase includes online navigation in a way that flying vehicle follows the designed path by passing the terrain and is capable of altering the parameters of membership functions through fuzzy learning method and in conclusion, it implements three-dimensional TF/TA maneuvers simultaneously.
In Khademi et al., 10 a three-dimensional path planning problem for TF/TA purposes has been studied. In that research, the path planning problem is formulated as an optimal control problem, which is converted to a nonlinear programming problem (NLP) based on direct transcription methods from which a three-dimensional trajectory is obtained.
Many researches have been conducted in the area of optimal trajectory generation, which are categorized in ground, aerial, and marine applications.11–14 To solve the resulting optimization problem, the existing techniques could be categorized into two types15,16:
Indirect methods; Direct methods.
The indirect methods are based on the calculus of variation, which converts the optimization trajectory problem into a Hamiltonian boundary value problem. The Hamiltonian boundary value problem needs to be solved via a numerical algorithm. In contrast, the direct methods cast the optimization trajectory problem as a NLP with bounded dimensions. In indirect methods, some auxiliary variables named costate variables are incorporated into the problem, and the state and control variables are calculated through those costate variables. In direct methods, the state and control variables are derived directly without the introduction of extra variables. Since most of the costate variables in indirect methods cannot be described physically, a satisfactory initialization of those variables may be cumbersome. Moreover, the equations are sometimes very sensitive to the variation of the costate variables and a small variation may lead to large deviations in the solution. These reasons point to the complexity of finding a suitable initial value and signify that direct methods might be more favorable than indirect methods for solving an optimization trajectory problem. 17
Despite the differences in these two methods, the main idea behind them is to transform the optimization trajectory problem into a standard optimization problem (such as nonlinear programming). Unlike optimization trajectory problems, there is no explicit dynamics in standard optimization problems so the optimization variables are not time dependent. This trait allows the possibility of presentation in various solution methods for standard optimization problems. Each of these two main methods for solving the optimization trajectory problems is utilized based on its merits and demerits as well as designers’ approach. For instance, one common demerit in both methods is the long duration of the solution time and their inability for online usages. It is worth mentioning that there are many techniques for each category. For example, inverse dynamics and steepest descent approaches belong to indirect methods and direct collocation and pseudo-spectral approaches belong to direct methods.
In this paper, the direct collocation method as a particular type of the direct method is employed to solve the optimization trajectory generation problem for flying in earth boundary layer. Most of the literature on this problem focuses on indirect methods, which limit the flexibility of imposing hard constraints and lead to suboptimal solutions. For instance, a flight bound constraint is normally imposed through a soft penalty term in indirect methods, whereas this type of constraint can be easily handled by direct methods. By applying the direct collocation method to the TF problem, a NLP will be obtained. There is a broad set of algorithms for finding a local or near-optimal global solution of these problems, which may be found in numerous toolboxes including FMINCON, SNOPT, IPOPT, NPSOL, and SQPLAB. The reader could refer to Leyffer and Mahajan 18 for a comparison of the features of these solvers.
The outline of the paper is as follows. First, the path planning problem is formulated as an optimal control problem in the next section, where TF and TA maneuvers are both taken into consideration. In “TF problem” section, the TF problem is described in great detail. In “Direct collocation method” section, the problem is discretized using direct collocation method. “Terrain modeling” section is dedicated to terrain modeling. Simulation results are presented in “Simulation results” section, and the conclusions of this research are drawn in the final section.
Problem formulation
As mentioned in the previous section, the objective of this work is to design an optimal flyable trajectory in such a way that certain nonlinear dynamic constraints and linear/nonlinear nondynamic constraints are satisfied and besides a cost function is optimized. Due to the main scope of the optimal control problem which is concentrated to find a history of control variables in such a way that minimize or maximize a performance index and satisfy the constraints of the system, controllers should be found which optimize the cost function and satisfy all of the constraints.
As already noted, the safe flyable motion in vicinity of the Earth in vertical plane is named TF, whereas the motion in horizontal plane is called TA. If the dynamics of the flying vehicle is incorporated in the problem, the complexity may become extremely high. The main cause of this issue is germane to physical constraints. Due to the complexity in the three-dimensional problem of TF/TA, we study the two-dimensional motion in vertical plane (TF) in this work. However, our proposed technique could be applied to the integrated TF/TA as well.
In this problem, it is supposed that the constraints consist of first-order ordinary differential equations representing the flying robot system dynamics, initial and final boundary conditions, and certain conditions relevant to state and control variables. In this section, the above-mentioned constraints and their formulations in the TF flight problem are presented. We could describe the system motion behavior as differential equations in a general form as follows
19
Schematic of state and control variables for flying robot under the assumption of a point mass in vertical plane.

In equation (4),
The main issue with these equations is that despite the initial conditions of state variables, they cannot be solved readily. The reason is that due to the presence of some unknown parameters in these equations, variations of these parameters play preponderant role in flight trajectory and state variables. These parameters are the control variables and their adjustment plays a fundamental role in the system performance. In this work, there are two control variables that are selected based upon the problem type and flying motion equations in a vertical plane.
The first control variable is the angle of attack, which is controlled through elevator control surfaces. The second control variable is the throttle setting, which is indicated by
So far, we have introduced the flying robot dynamics constraints. Other constraints are related to the departure and terminal zones in the mission potential corridor, which could be classified as equality and inequality constraints.
In this work, the initial and terminal conditions are considered to be only equality constraints defined as follows
17
In path planning problems, there are also some environmental constraints, such as obstacles, box constraints over the state and control variables. These constraints are classified into two categories of equality and inequality constraints, as noted below 17 :
Equality constraints
Inequality constraints
Optimal trajectory with flight bound for TF maneuver.

The performance index is generally considered as follows
19
This study also may investigate designing some suitable cost functions which results in trajectories that are more convenient with physical characteristics and constraints of the flying vehicle mission.
The minimum-time cost function could be defined as follows
The shortest desired trajectory cost function is determined as
The TF cost function is defined as
Another cost function that could be important for designers is the minimum vertical acceleration. In particular, it is desirable to reset the vertical acceleration in horizontal path to zero. As mentioned in “Introduction” section, this cost function is important for a number of reasons. First, by optimizing this cost function, the flying robot can withstand structural pressures, and second the convenience of passengers is assured in commercial airplanes. The above-mentioned cost function is one of the motivations behind this work, which could be defined as follows
TF problem
The main objective of the two-dimensional pure TF is to find a suitable trajectory that is parallel to the ground to satisfy the dynamics equations and optimize a performance index. Given that the trajectory should be parallel to the terrain and this may not be always possible, the TF problem is not pure anymore. Since it is difficult to follow the mathematical model of TF, a new method should be developed.
In these cases, generally two different methodologies could be utilized to solve the aforementioned problems. In the first approach, the computed control commands are modified in such a way that is suitable for the existing flying robot dynamics. The second approach attempts to create a virtual terrain profile based on the actual one, which is mathematically well behaved and is also compatible with the limitations of the flying robot. In this approach, we may define a suitable flight bound so that the flying robot is restricted to fly in this bound within a defined minimum and maximum altitude. This admissible flying corridor could be fine-tuned in various areas by the mathematical model of terrain, the dynamics of the flying vehicle, and the given performance index. Finally, it is the obligation of the designer to generate a reliable trajectory based on the predefined mission and aforementioned criteria. A pictorial sample of the flight bound is depicted in Figure 3 where, unlike Figure 2, this bound is not parallel to the ground and could alter based on the flying robot specifications and mission requirements.
Flight corridor which could be defined based on the flying robot specifications and mission requirements.
This approach may be considered in cases that there is a trajectory with high steep and the flying vehicle dynamics is not capable of performing the pure TF mission due to possible structural damages and the designer should try a virtual terrain following strategy. In this approach, the flying vehicle may be forced to follow the virtual modified terrain instead of the actual terrain in an optimal manner. 2
In what follows, we will find an optimal control strategy for TF purposes. The optimal trajectory will be generated by employing the direct collocation method and casting the problem as a NLP. In the next section, the direct collocation methods will be explained in great detail.
Direct collocation method
The trajectory of a flying robot can be accurately modeled as a collection of some discrete points in a continuous coordinate system from the initial time to the final time. More precisely, if the number of these identified points is sufficiently high, a suitable continuous trajectory can be recovered as a passable approximation of the main path. The approximate discrete and continuous trajectories have been shown in Figure 4.
The approximate discrete and continuous trajectories.
The main idea behind direct collocation method is breaking up the state and control variables through a linear or higher order interpolation while satisfying all of the constraints. In this method, an optimal control problem is transformed into a NLP. Hence, this is an approximation technique that is employed as a numerical integration.21,22
In this method, the state and control variables are divided into Schematic of a discrete trajectory with state and control variables in each node and the cost function value in each discrete interval.

The time interval between nodes
The approximation of the continuous trajectory by a set of nodes eliminates the differential equations of the flying system and reduces the problem to a nonlinear program. Many advantages of discretization methods have been discussed in the literature. Some of these discretization methods are Euler method, trapezoidal method, Hermite–Simpson method, and classic Runge–Kutta method. 22 Two of these methods will be surveyed in this work in some detail.
Trapezoidal method
In this method, the difference between
Hermite-Simpson method
If Simpson integration rule and Hermite interpolation method are used instead of trapezoidal integration rule, the error vector for each node is calculated according to
22
In the above relations,
After the discretization of the equations through one of the aforementioned methods, the obtained NLP could be solved via a suitable numerical method. 18
Terrain modeling
There are numerous methods to estimate the mathematical model of the terrain profile based on existing terrain discrete data. The least square method, Chebyshev orthogonal polynomial method, and Fourier series method are widely utilized for two-dimensional cases due to their good accuracy in estimation. 2
The terrain modeling is performed in Figures 6 to 10 for a particular example using the aforementioned methods. The exhibited models in these figures are the results of the terrain mathematical model estimation by the least square method, Fourier series method, Gaussian estimation method, and Chebyshev orthogonal polynomial method, respectively. However, round-off error in these methods is more restrictive compared to Chebyshev orthogonal polynomial method. Increasing model accuracy while dealing with complicated terrains with irregular shapes and slopes is essential. In these estimations, we observed that the increase of the order of the approximation would be beneficial until a specific value is reached, and after that the increase would not result in improving the approximation and only causes the deflection of the curve in proportion to the true suitable model. Note that the determination of this suitable order is performed through various criteria, e.g. the error least square criterion.
Terrain modeling through least square method. Terrain modeling through Fourier series method. Terrain modeling through Gaussian estimation method. Terrain modeling through Chebyshev orthogonal polynomial method. Comparison of the terrain models obtained from the above-mentioned methods.




Simulation results
Applying the constraints in TF problem
Optimal trajectory problems for a flying robot are generally defined over a period of time where the initial time is specified but terminal time could be specified or free based on the available constraints and performance index. In this case, we compute optimal trajectories influenced by the vehicle dynamics introduced as a constraint in the mathematical process.
The flying robot mathematical model for this research is taken from Khademi et al.
10
Assume that the initial and final constraints of the state variables are specified as follows
The constraints originated from the flight path corridor are assumed to be modeled as the following inequality constraints for this case study
The physical constraints of the state variables for the flying robot.
In this case, since the final time of the flight mission is considered to be not specified but the initial and final positions of flying robot are specified, the system’s equations should be formulated in terms of
Some physical features of the flying robot in this problem are indicated below
Vertical acceleration minimization for a TF maneuver
As mentioned earlier, the main objective function considered in this work for designing a TF flight mode of the flying robot is concentrated to minimization of the vertical acceleration of the flight path with the aim of both avoiding some structural damages and supporting the main flight mission. In this problem, the initial and final conditions of the state variables are specified. The cost function for this problem is considered as follows
Given that the final time is unspecified in this example, the constraints are presented in terms of down range,
In fact, the goal is to find a suitable history of the control variables such as α, η through which the cost function is minimized.
Time minimization in vertical plane for TF
Apart from the vertical acceleration minimization problem for flying robot, the time optimization problem is another problem which is investigated in most researches. In this case, the cost function is minimized or maximized based on the problem’s requirements. Given the defined missions for flying robot, e.g. the urban traffic control, the cost function must be minimized and is defined as follows
Similar to the previous case, by changing the independent variable from
The simulation results for both the minimum-time cost function and the minimum-vertical-acceleration cost function will be presented for two different methods of trapezoidal and Hermite–Simpson methods. For this purpose, the interval will be divided into 50 equal sections in these simulations.
The simulation results for the minimum-vertical-acceleration cost function are provided in Figures 11 to 16 including the variations of controls and states with respect to Throttle controller variations for optimal terrain following problem.
In Figures 11 and 12, variations of control variables including throttle and angle of attack versus downrange distance are shown.
Angle of attack controller variations for optimal terrain following problem.
Figure 13 shows a typical case where the exact terrain could not be followed exactly due to the flying vehicle limitations. The flyable trajectory is therefore created in such a way that suits the flight dynamics and at the same time is minimized based on the cumulative vertical acceleration.
Optimal trajectory with maximum altitude constraint.
In Figure 14, variations of flight path angle versus downrange distance are shown. In Figure 15, the flying robot Mach number history is presented. In Figure 16, variations of the flying vehicle mass versus downrange distance are shown.
Optimal flight path angle. Optimal velocity in terms of Mach number. Mass variations of flying robot.


And finally, the flying vehicle actual trajectory that tracks the new path pattern instead of the exact terrain has been illustrated in the same figure.
In another case, we investigate a minimum time optimal trajectory during a TF flight. The simulation results for the minimum-time cost function using trapezoidal and Hermite–Simpson methods are given in Figures 17 to 22.
Throttle controller variations for optimal terrain following problem. Angle of attack controller variations for optimal terrain following problem. Optimal trajectory with maximum altitude constraint. Optimal flight path angle. Optimal velocity in terms of Mach number. Mass variations of flying robot.





In this example, the flying vehicle specifications might not allow following the exact pattern of the terrain because of some structurally or aerodynamically restrictions. Therefore, it is necessary that the flying vehicle dynamics and structural characteristics be considered in the mathematical trajectory design approach.
In Figure 17, throttle setting histories related to this case are presented. As it is indicated later, the bang-bang scheme for throttle setting is based on the time optimal strategy. The bang-bang throttle setting history also indicates that the velocity, in general, will not be a constant during a TF flight. Switching times in this case depend on terrain profile and also the terminal conditions.
These simulations demonstrate that the obtained trajectory is near the terrain as much as possible and meets all of the constraints.
Conclusions and final discussions
The objective of this paper is to obtain an optimal reliable trajectory design approach to control a flying robot in the vicinity of the ground similar to TF flights. This approach concentrated on a two-dimensional vertical plane flight mode to satisfy the terrain constraints as well as the physical constraints of the flying robot. In particular, certain conditions on the dynamic variables, controllers, and initial and terminal boundary values are to be met.
This problem is formulated as an optimal control problem and then the obtained optimal control problem is transformed into a NLP through direct collocation method. The objective function of the optimization is also considered as the minimum time or the minimum vertical acceleration.
For the problem of designing an optimal trajectory for TF modes, one main challenge is the terrain modeling in a two-dimensional vertical plane. There are numerous methods for terrain modeling, four of which are utilized for terrain modeling in this work, including the least square method, Fourier series method, Gaussian estimation method, and Chebyshev orthogonal polynomial method. As observed in the paper, each one of these methods yields some errors with respect to the true model. Therefore, error least square criterion is utilized to select the best model and it is verified that the Fourier series method may have the smallest error in comparison to other methods, and as a result this method is used for the modeling in this paper. It should be noted that the challenging issue pertaining to the terrain modeling is that the created curve may pass under the terrain points in some positions, leading to a lower altitude than the terrain. Hence, the altitude should be compensated for through a coefficient to guarantee that the obtained trajectory will not collide with the terrain. A suitable approach for tackling this problem is to first calculate the vertical difference between the curve model and the true points, and then shift the curve upward in proportion to the maximum height difference through which a reliable trajectory can be generated.
After carrying out the terrain, a practical cost function is to be selected for meeting the required missions. The cost function considered in this paper is the minimum vertical acceleration, where a secondary goal is to reset the vertical acceleration in horizontal trajectory to zero. In other words, by optimizing the cost function, the flying robot undergoes less structural damages and the passenger comfort is assured in aerial transport vehicles. Moreover, since the minimum-time cost function is considered in some researches, this function is also investigated in this paper in addition to the minimum-vertical-acceleration cost function.
After formulating the path planning problem as an optimal control problem, direct collocation method is deployed. One of the most outstanding features of this method is that the differential equations can be simplified as algebraic equations. In this work, it is verified in simulations that after employing this method and solving the NLP, a feasible trajectory meeting all requirements of the problem and accomplishing the mission can be found. In other words, although the dynamic equations of the robot are highly nonlinear, the simulation results are very promising.
To utilize the direct collocation technique, trapezoidal and Hermite–Simpson methods are used in this work. The Hermite–Simpson method is a three-order approximation, whereas the trapezoidal method is a linear approximation. Although a higher approximation degree results in a more accurate solution, the computation time increases. It is observed that Hermite method is more accurate than the trapezoidal method, yet the computational complexity is higher. Moreover, these aforementioned methods can be chosen based on their merits, demerits, designers’ approach, defined missions, and so forth.
It should be mentioned that there is a great number of heuristic methods for solving the optimal path planning problem and most of them are not capable of solving this complex problem under tight constraints. The efficacy of direct collocation methods is elucidated in this work and it is demonstrated that the problem can be solved with a high accuracy. Therefore, this approach could be utilized in various optimization problems and this work could lay the foundations for further research in the future.
The development of a control system for special maneuvers is a quite lengthy process that demands careful attention in both software and hardware development in addition to numerous simulations and flight testing.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
