Trajectory Evaluation of Rotor-Flying Robots Using Accurate Inverse Computation Based on Algorithm Differentiation

Autonomous maneuvering flight control of rotor-flying robots (RFR) is a challenging problem due to the highly complicated structure of its model and significant uncertainties regardingmany aspects of the field. As a consequence, it is difficult inmany cases to decide whether or not a flight maneuver trajectory is feasible. It is necessary to conduct an analysis of the flight maneuvering ability of an RFR prior to test flight. Our aim in this paper is to use a numerical method called algorithm differentiation (AD) to solve this problem.The basic idea is to compute the internal state (i.e., attitude angles and angular rates) and input profiles based on predetermined maneuvering trajectory information denoted by the outputs (i.e., positions and yaw angle) and their higher-order derivatives. For this purpose, we first present a model of the RFR system and show that it is flat. We then cast the procedure for obtaining the required state/input based on the desired outputs as a static optimization problem, which is solved using AD and a derivative based optimization algorithm. Finally, we test our proposed method using a flight maneuver trajectory to verify its performance.


Introduction
The autonomous rotor-flying robot (RFR) is one of the frontier research topics in the field of robotics.Extensive research has been conducted on issues related to RFR, including flight control [1,2], path/trajectory planning [3,4], and intelligent navigation [5,6].
Flight maneuvering is a very important ability for an RFR system because it can greatly extend the system's field of applications.However, the flight maneuver control of an RFR is a challenging and absorbing problem in the field of autonomous RFR research [2].This can be explained from the following two points.On the one hand, the model of an RFR system is an extremely complicated structure [7,8], designing a suitable controller for which is very difficult.On the other hand, flight maneuvering requires that both the interval states (i.e., the attitude angles and the angular rates) and the control surfaces to have a large scope variation (or even approach the largest permitted value) [9].This may produce a great deal of uncertainty and thus presents that this flight maneuvering is dangerous and difficult to be implemented and thus requires a much more robust controller than usual [10].
Most work on flight maneuver control, such as [11,12], is based on successful flight demonstrations and grounded in learning techniques used to update the control laws.These methods have successfully pushed the envelope of what is possible with autonomous control, but they lack performance guarantees and are limited to situations where safety is not a critical concern.Thus, it is very important to assess the flight maneuvering ability of an RFR system prior to designing a controller and conducting tests.Some research has been conducted in this area.For instance, research in [2] is based on reachability analysis and explores aerobatic maneuvers and multiple vehicle collision avoidance of the RFR systems.This involves designing a sequence of modes and conducting safe transition from one to the next.However, reachability analysis is very time consuming, due to which the proposals in [2] are viable only for simplified models.Similarly, [9] involves a feasibility analysis of planned trajectories by using a greatly simplified dynamics model (without considering angular dynamics).Both the positions and attitude angles are predetermined and then used to evaluate the feasibility of the planned trajectories.Although the algorithm is simple and easily implemented, it is unfit for many planning algorithms since for which it is difficult to obtain the positions and attitude angles simultaneously.
In this paper, based on a full state dynamics model, we investigate the feasibility analysis problem of a flight maneuvering trajectory.This is actually an inverse computation problem, that is, to compute both the interval states and the inputs based on predetermined position, yaw angle, and their higher-order derivatives.In our work, we model it as a static optimization problem and then use a derivativebased optimization algorithm to obtain an accurate solution of it.We use algorithm differentiation (AD) to obtain precise higher-order derivatives of the nonlinear cost function.The advantages of our proposed algorithm are as follows: (1) only with desired positions and their derivatives, which is the case for many planning algorithm, the feasibility of the trajectories (including inner states and inputs) can be evaluated; (2) inverse computation can be very accurate because AD is a numerical algorithm that can precisely obtain the derivative of a nonlinear function.Thus, an accurate pointwise numerical feasibility analysis of planned trajectories becomes possible.
The remainder of this paper is organized as follows.We first present a model of the RFR system and show that it is flat by taking the three positions and the yaw angle as a group of flat outputs.This allows us to model the trajectory evaluation problem as an optimization problem by taking into account the dynamical model, which is solved by using the AD algorithm along with a derivative-based optimization algorithm.Finally, in order to test our proposed method, we use it to analyze a flight maneuvering trajectory.

Dynamical Model of the RFR System
Usually, the complete dynamical model of an RFR system can be divided into three parts: the actuator dynamics, the aerodynamics, and the rigid body dynamics.In this paper, only the rigid body dynamics as shown in the following equation ( 1) is considered [3]: where  = [  ]  ∈  3 and V  = [ ẋ ẏ ż ] ∈  3 are translational position and velocity vector of the RFR in the inertia frame;  is the rotation matrix between the body frame and the inertia frame;   is angular velocity vector; Θ = [  ]  is Euler angle vector;  and  are, respectively, the mass and inertia matrix of the RFR; Ψ is the transformation matrix from angular velocity vector in body frame to angular velocity vector in inertia frame; and   and   are force and moment of the RFR presented in body frame.Different kinds of RFR have very different aerodynamics, that is, the relationship between the force/moment and the control surfaces.Here we focus on the quadracopter flying robot, whose driving forces and moments can be denoted as follows: where  1 ,  2 ,  3 , and  4 are force produced by four rotors, respectively, and  is the distance between each rotor center and the RFR's center of gravity (see Figure 1).Thus, define inputs as System (1) can be rewritten as It can be easily shown that system (4) is input-to-state feedback linearizable through defining the following state vector: From ( 1) and ( 2), we have and the system can be transformed into the following linear form: 4)   (4)  (4)   ] ] with the feedback linearization controller where That means system (1) is flat and that the [  , ] are the corresponding flat outputs.

Automatic Differential Algorithm Based Inverse Computation
AD is a numerical method that is effective to accurately compute the derivatives of some complicated nonlinear function.In this section, we will briefly introduce how to conduct the inverse computation of a nonlinear flat system using AD algorithm [13].
Consider the following nonlinear system: It has been shown that the inverse computation problem of system (10), that is, to obtain a state vector   with ℎ(  ) =   (a predefined output), is solvable if  = ℎ() is a flat output of system (1) [14].
Derivatives of  with respect to  are necessary to effectively solve the preceding inverse problem.In the following contents of this section, the basic idea on how to obtain / using AD algorithm will be introduced.
Define a new matrix as From [15], we have Thus,   can be iteratively obtained as follows: Furthermore, if we denote () as then the same process can be used to compute  through the second equation of (10); that is, with a preknown  0 , compute   by forward mode and compute the following derivatives  − by reverse mode: Also, it is not difficult to show that the derivatives of output with respect to the states can be denoted as follows: Up to now, we have shown that, with a predefined state  0 , both the corresponding outputs ( 0 ) and its higher-order derivatives with respect to time, as well as the derivatives with respect to state  0 (22), can be obtained through AD algorithm.These results can be further used to conduct the inverse computation of system (1), and the detailed steps are given as follows.

AD Based Inverse Computation Algorithm
Initialization. (the highest order of the outputs' derivatives);  (step length of searching algorithm);  = 0 (iterative number).
Step 1. Compute the output vector (  ) using forward mode of AD algorithm at each time instant as a nonlinear map; that is, Step 2. Based on ( 22), AD can be used to obtain the partial derivative of  with respect to  0 ; that is,

𝐷 𝑑
) . (24) Step 3. Update the state  using the following searching iteration: where superscript "+" means the pseudoinverse of a matrix; that is, Step 4. Go to Step 1 until the terminal conditions are satisfied.
If the system is nonautonomous, that is, it can be rewritten as following form, We can first extend it into the following form: and the new system can be rewritten as where Thus, the inverse computation can be conducted using the preceding algorithm.
As for the proposed quadrocopter system introduced in Section 2, this algorithm can be directly utilized through defining the following output vector:

Evaluation of Circle Flying Maneuver
In this section, a so-called "Circle Maneuver, " that is, the RFR system flies along a circle as shown in the following equation (32) and Figure 2 [10], of the Quadrocopter is taken as an example to show the validity of the proposed algorithm.Consider where  is the period of the circle maneuver.The parameters of the RFR system are as follows: The trajectory feasibility is decided by some constrains on both inputs and states.Here the following constrains are considered.

Input Constrains. Consider
In this paper, the software toolbox LIEDRIVERS [17] based on ADOL-C is used as the basic AD algorithm, and the optimization searching is implemented using the golden sector algorithm, instead of the direct derivative-based algorithm as in Section 4.During the simulations, we test the circle maneuvers with different period , and the results are given in Figures 3, 4, and 5.
From these figures, we can obtain the following results.
(1) For input constraints (Figures 3 and 5), only the maneuvering trajectories with  = 10 s are infeasible because the required dragging force is almost 210 N, larger than the maximum permitted value of 190.8 N, while the other inputs, that is, the three moments, are all much smaller than the maximum values.
(2) For angular velocity constrains (Figure 5), again, only the maneuvering trajectories with  = 10s are infeasible, and the maneuvering trajectories with  = 12.5 s are dangerous since the maximum angular velocity approaches the maximum value of the permitted angular velocity.
(3) Based on the attitude constrains (Figure 4), the maneuvering trajectories with  = 14.3 s, 12.5 s, and 10 s are all infeasible.
Finally, from the preceding results, it can be seen that the circle maneuvers are really a highly dynamical maneuver, and the quantitative analysis prior to the flight test is useful and necessary to evaluate whether or not a maneuver trajectory is feasible or even dangerous.

Conclusions
In this paper, the flight maneuvering trajectories evaluation problem is researched, and the algorithm differentiation (AD) is used to realize the inverse computation of the rotorflying robot (RFR) system.This paper starts from constructing nonlinear dynamical model of an RFR system.Then, we show that the RFR system model is flat taking translational positions and yaw angle as flat outputs.After that, the scheme of AD based inverse computation is introduced, that is,  computing the internal states and inputs based on the desired flat outputs.Finally, with the proposed scheme, a typical flight maneuver, that is, the circle maneuver, is analyzed.
The advantages of our proposed algorithm are as follows: (1) only desired positions and their derivatives, which is the case for many planning algorithm, and the feasibility of the trajectories (including inner states and inputs) can be evaluated; (2) inverse computation can be very accurate because AD is a numerical algorithm that can precisely obtain the derivative of a nonlinear function.Thus, an accurate pointwise numerical feasibility analysis of planned trajectories becomes possible.
The method proposed in this paper can be used to not only evaluate the feasibility and validity of the maneuver flying trajectories, but also realize the tracking control algorithm, where the computed internal states and inputs are useful for attenuating the online computational burden of the tracking controller and thus improving the closed loop performance.This will be one of our future's works.