Experimental and Simulation-Based Performance Analysis of a Computed Torque Control (CTC) Method Running on a Double Rotor Aeromechanical Testbed

: Concept of closed loop control appears in many ﬁelds of engineering sciences, where the output quantity of some physical system must be forced to follow some prescribed function over time, e.g., when a robotic arm endpoint must track a desired trajectory or path given as timed series of spatial coordinates. The classic approach for solving this kind of problem involves a PID compensation block, and the necessary input signal for keeping the controlled process in the vicinity of the desired trajectory is calculated as the weighted sum of momentary deviation, deviation integral, and deviation derivative relative to the reference path. However, despite the obvious advantages, practical usability, and simplicity of the PID controllers, their performance is limited when they are utilized for controlling nonlinear systems. Even with linear systems, their proper operation requires an accurate system model and precise tuning process for ﬁnding the best weight values for the proportional, integral, and derivative effects, and the planned closed loop behavior might change signiﬁcantly as the parameters of the controlled plant change over time. In this article, a computed torque-based controller is presented, which has only one adjustable parameter ensuring precise trajectory tracking even with signiﬁcantly alternated model constants. The practical usability of the offered algorithm is evaluated and veriﬁed by simulations and experiments performed on a simple mechanical bi-rotor testbed playing the role of controlled plant.


Introduction
The traditional formulation of the Computed Torque Control (CTC) assumes the possession of a precise system model and the lack of unknown or unobserved external disturbances, known nominal trajectory to be tracked q N (t), the actual trajectory q(t) according to (1) in which Q(t) denotes the generalized forces exerted by the robot drives, H(q) being a positive definite (sometimes not very well conditioned but at least in principle invertible) inertia matrix of the robot arm, and h(q,q) containing Coriolis and gravitational forces: H(q) q N (t) + K I e int (t) + K P e(t) + K Dė (t) + h(q,q) = Q .
It is assumed that q(t) andq(t) can be measured by industrial sensors. By subtracting (1b) from (1c) and utilizing the existence of H(q) −1 , it is obtained thaẗ e(t) + K I e int (t) + K P e(t) + K Dė (t) ≡ 0 .
(2) Accordingly, the integral (K I ), the proportional (K P ), and the derivative (K D ) feedback gains must be appropriately set to guarantee the e int (t) → 0, e(t) → 0, andė(t) → 0 as t → ∞. The traditional way is based on the introduction of a "artificial state variable" x(t) = [e int (t), e(t),ė(t)] T that evidently satisfies the LTI systems' equation of motion in (3).
By investigating the Jordan canonical form of matrix A (e.g., [1]), it can be stated that the system is stable if and only if the real part of each eigenvalue of matrix A in (3) is negative.
A more traditional approach is considering the symmetric positive definite matrix Q and the matrix function Φ ∈ R n×n (ξ) defined as Evidently, Φ(ξ) is symmetric, positive definite since the inverse of e ξ A T is e −ξ A T and the inverse of e ξ A is e −ξ A , i.e., these matrix exponential functions are invertible, therefore, they cannot map a nonzero array to zero. The time-derivative of Φ(ξ) can be computed as in which In connection with the Canonical Form of Quadratic Matrices by Jordan [1,2], Ψ(∞) exists only if each eigenvalue of the matrix A has a negative real part. In this case e ξ A → 0 as ξ → ∞, Φ(∞) = 0, and Ψ(t 0 , ∞) is finite. For the special case of t 0 = 0, (5) yields that in which evidently P ≡ Ψ(0, ∞) de f = ∞ 0 e ξ A T Qe ξ A dξ > 0 (i.e., positive definite). For solving the so-called Lyapunov equation defined by (7), modern program languages, such as e.g., Julia language [3], simple functions are available by the use of which it can be checked whether a given setting of the parameters K I , K P , and K D and given matrix Q results in a solvable Lyapunov equation. This approach has a close relationship with the idea of PID controller.
The CTC controller can be introduced in a little bit different manner outlined in Figure 1.

Approximate Model
Actual System Q Generalized Forcë q Desq Assume that, for a second order system, on the basis of purely kinematic considerations, a "desired"q Des (t) 2nd time-derivative is constructed that guarantees the e int (t) → 0, e(t) → 0, andė(t) → 0 as t → ∞ conditions if it is realized. If the available system model is not exactly precise (i.e., it contains theĤ(q),ĥ(q,q) approximate model) while the exact model contains the functions H(q), h(q,q), in Figure 1, the control force is computed from the approximate model, and the realizedq(t) value will bë that in the special case of the "exact" approximate model leads toq(t) =q Des (t). In this approach for designingq Des (t), we can follow a simpler choice than the more general PID-based approach. Let 0 < Λ = const. and try to realize the motion according to Since for differentiable which evidently corresponds to particular possible PID feedback terms depending only on a single parameter Λ. To show that this setting results in vanishing tracking error as t → ∞, consider the functions g k (t) : it follows that Λ + d dt i g i−1 (t) = 0. Consequently, the general solution of equations in (9) for e int (t) is in which the free coefficients {c 0 , c 1 , c 2 } can be chosen according to the initial conditions. In other words, the linear set of the solutions is spanned by the basis vectors {g 0 (t), g 1 (t), g 2 (t)} so that each basis vector converges to 0 as t → ∞. It can be noted that, for tackling the problem of modeling errors, the traditional approach, such as the "Adaptive Inverse Dynamics Controller" or the "Adaptive Slotine-Li Controller" [4], evolves by the use of Lyapunov's stability theorem and his 2nd or "direct" method [5,6]. The "Robust Variable Structure / Sliding Mode Controller" invented in the Soviet Union in the past century (e.g., [7][8][9]), instead of trying to realize (9) (that according to the computations is very sensitive to the modeling errors), introduced the concept of "error metrics" S(t) and the control goal with K > 0, w > 0 parameters. The simple idea behind (13) is that, for big S components, the "tanh" function is saturated at ±1; therefore, S can be driven to the vicinity of zero during finite time and subsequently can be kept around zero. The subtle dynamic details of how S(t) is driven to zero or how is it kept near zero in this approach are not important; for this reason, a very approximate model can work well to maintain the e int (t) ≈ 0 that has quite similar consequences as (9) for the error integral and the error. This solution evidently can suffer from the phenomenon of chattering if parameter K is very big and the "smoothing parameter" w is too small.
Recently, control algorithms based on or incorporating CTC have been used in a wide variety of applied engineering research areas, such as motion control of miscellaneous robot manipulators with open and closed (or parallel) kinematic chains [10,11] and cabledriven robots [12]; overhead crane payload sway control [13]; attitude control of drone-like multi-rotor aircraft [14]; operation of a musculoskeletal therapy device with artificial muscles [15]; gait planning for bipedal robots [16]. However, in almost all cases, separate integral, proportional, and derivative gains or parameters are used to "tune" the controlled system for the optimal trajectory tracking, which makes finding the ideal parameter set a complicated task.
The methodology followed in the article is as follows: first, a simple real-world testbed for control algorithms is introduced and its mathematical model is constructed based on various parameter estimation measurements ( Figure 2). Then, the performance of the one-parameter CTC algorithm is studied by comparing the simulated and measured (when the algorithm was running on a microcontroller, controlling the real-world testbed) trajectory tracking results. Further experiments were carried out on the real-world testbed showing trajectory tracking with alternative trajectory profiles (sine signal with increasing frequency). The resistance against outer disturbances tested with simulation and measurement as well and the results were compared qualitatively. Besides that, an alternative, more traditional control method (PID compensator with nonlinear feedforward term, referred to as "Nonlin. PID" in Figure 2) is also tested for trajectory tracking by simulation and measurement. Finally, the robustness of CTC and "Nonlin. PID" methods against model parameter variations (when the controller, tuned for the original plant model, interacts with a plant with altered parameters) were compared using the simulational results of the two methods.

Structure and Mechanical Model of the Bi-Rotor Testbed
To justify the practical usability of the proposed one parameter CTC scheme, a simple twin-rotor experimental test stand was built, consisting of a beam rotating in the vertical plane around a horizontal axis in the vicinity of its middle point. The angular position of the arm-which is the controlled variable-can be varied by a control torque exerted by two propellers at both ends of the rod. Propellers were driven by electric motors with variable rotational speed, which can be regulated by a Pulse-Width Modulated (PWM) electric signal. The test platform is also equipped with a programmable microcontroller board on which the control algorithm can be implemented and executed in real-time. A photograph of the device and free body diagram of the arm belonging to the testbed is shown in Figure 3. Basic information about the main components of the device is summarized in Table 1.  The position of the lever arm is characterized by the inclination angle α given in degrees, which is defined as the angle between the horizontal direction (perpendicular to the gravitational gradient vector g) and the center-line of the arm. The instantaneous value of thrust force vectors generated by the left and right propellers are denoted by F 1 (t) and F 2 (t). The distance between the center lines of the two rotors is L. The gravitational force mg (where m is the mass of the arm) is acting at the S center of gravity. The location of point S relative to the rotational center point is given by distances h x , h y , where h x is measured parallel with the arm center-line and h y is measured perpendicular to the arm center-line. The horizontal and vertical components of the reaction force from the bearing are denoted by K x and K y . α(t),α(t) andα(t) are the instantaneous angular position, angular velocity, and angular acceleration of the lever arm, respectively. The damping torque M d is considered to be proportional to the actual angular velocity: where d is a damping constant. By considering the aforementioned forces and torques, the lever arm equation of motion can be written in the following form: where Θ is the lever arm moment of inertia calculated to the rotational center. M c (t) is the actual control torque, the second term in the equation is the torque of the gravitational force, and the third is the damping torque. Since the reaction forces K x and K y are rising at the center of rotation, they do not produce torque contribution. The connection between the u 1 (t), u 2 (t) input PWM signals (to the left and right motors) and the exerted F 1 (t), F 2 (t) thrust forces can be modeled as first order linear functions: This consideration can be only held when u 1 (t) or u 2 (t) varies very slowly or when they are stationary constant values. Parameter A is already known from experiments with the single-arm testbed. The actuator (BLDC motor with the propeller) dynamics is modeled with a dead-time, first-order block with parameters τ force delay time and t rise force rising time, which was also measured previously when the single-arm version of the testbed was built (for more details about the force exertion dynamics, see [17]): The left and right motor PWM control signals are calculated from the single incoming control signal u(t) according to the following logical rules: The control signal distribution logic is also illustrated in Figure 4. Current control torque M c (t) generated by the two propellers is: Therefore, momentary control torque acting on the arm written with the input signal u is: The equation of motion, including the actuation dynamics, becomes: where f (α(t)) is a nonlinear function −mg[h x cosα(t) + h y sinα(t)]. However, because of the tension and slight stuttering effects on the imperfect bearing, f (α(t)) might contain other unmodeled terms. In a stationary state, whenα(t) = 0,α(t) = 0 andu(t) = 0, equation of motion (20) reduces to a time-invariant expression: Stationary α − u states can be closely resembled, when input signal u is increased linearly over time with a very small rate of change while the measured α values are also captured during the experiment, as depicted in Figure 5. The connection between cohesive α − u value pairs can be well approximated by a fourth-order polynomial function F(α), which is considered as the static characteristic of the bi-rotor testbed: After the experimental determination of the static behavior, dynamic parameter values for Θ and d are fine-tuned to match with the experimental step response results ( Figure 6). The values of identified model parameters can be found in Table 2.  (20) and (22), is calculated as: Equation (23) serves as an inverse dynamic model for the controlled system. Here, it is worth mentioning that the inverse dynamic model described by the (23) neglects the actuation dynamics (time delay and rise time) since it is already compensated by the derivative effect of the kinematic block (see in the next section).

Results
The details of the realized CTC control scheme as it was first tested in Matlab Simulink is illustrated by Figure 7. For generating the rough nominal trajectory, the desired angular position was changed according to a predefined time schedule (0 degrees for 15 s, than +40, −40, +20, −20, +30, −30 and 0 degrees for 10-10 s). From these rough values, a smooth time-dependent path is generated by the smoothed trajectory generator, which consisted of four first-order serially connected low-pass filters with time constants of 0.2 s. This step is essential, since the second-order temporal derivative of the nominal position (α N (t)) has to be finite and two times continuously differentiable function which can be fed to the kinematic block (described by Equation (10)) to calculate the desired angular acceleration valueα Des (t).
In the first 5 s of the operation, control signal u is set to zero resulting in u 1 = u 2 = u lowest = 1.3 × 10 −4 s signal levels for the left and right motors. This phase is used for spinning up the rotors to reach their lowermost effective actuation levels (see Figure 4). During this short "spinning up" phase, the arm executes small-amplitude free oscillation and the position is not controlled. Meanwhile, the measured angle is fed into the smooth trajectory planner, which thereby will be ready to generate a smooth transition path to the desired commanded position, when its output is already connected to the rough trajectory generator after 5 s. The measured transition between the uncontrolled first 5 s and the controlled state on the real physical system is also outlined later in the upper left graph in Figure 10.
During normal operation, the control signal u(t) is calculated in two steps. First, the desired angular accelerationα Des (t) is determined by the kinematic block in the function of nominal angular acceleration (α N (t), originated from the smoothed trajectory generator), tracking error e(t) = α N (t) − α meas (t), tracking error derivativeė(t), and tracking error integral e int according to Equation (10). Then, the desired accelerationα Des (t), the measured current angular position α meas (t), and its derivativeα meas (t) are forwarded to the inverse dynamic model (Equation (23)) to obtain the current control signal u(t), which here also plays the role of generalized control force Q as also shown in Figure 1. To keep the controller output in a feasible range (between u min = 6 × 10 −4 s and u max = 6 × 10 −4 s, see again Figure 4), a saturation block is also added.
Besides the Simulink model, simulations were also carried out in the form of a Matlab script, where the simulation time step was ∆t = 0.016 s and a simple first-order Euler integration scheme was used to get the angular velocity and position values. For imitating the sensor noise, a random number with normal distribution was added to the realized α(t) positions, and the standard deviation parameter σ was 0.5053 degrees. The simulation was executed using six different Λ trajectory tracking parameter values (Λ = 1.75, 2.00, 2.25, 2.50, 2.75, 3.00, the unit of Λ is s −1 ).
For performance evaluation of the proposed CTC scheme in the real world, a Circuit-Python code was generated and compiled on the microcontroller board belonging to the test-bed. The execution cycle time of the real-time CTC algorithm was ∆t = 0.016 s (same value as the simulation time step). To attenuate tilt sensor noise without causing any additional time delay, fifty angle values were read from the tilt sensor in every computational cycle, and their mean value was utilized as the current α(t) value. Besides the mentioned straightforward "oversampling-averaging" technique, no other more advanced method was applied to improve the position signal quality. Instantaneous measured angular velocity was approximated by a simple numerical derivation (α ≈ ∆α/∆t). Experimental measurements with a real-world test stand were also executed with six different Λ values, lasting for 85 s.
Time series of the captured simulated and experimental data are compared in Figure 8. Good quality trajectory tracking was achieved in general both for simulated and experimental cases. The only appreciable difference between simulations and experiments is the behavior during the uncontrolled phase in the first five seconds, which can be explained by the fact that one of the rotors starts to spin slightly earlier (about 0.3-0.5 s) than the other, resulting in a short living non-zero torque acting on the beam. In the plots depicting control signal variations, upper and lower limits (u min = −6 × 10 −4 s, u max = 6 × 10 −4 s) are outlined by a dashed line. The CTC algorithm results in highly fluctuating control signals for all scenarios. However, the wobbling in u(t) seems to be more intense in simulations, since the sensor noise level was slightly over-estimated. As the Λ parameter increases, fluctuations become more and more significant, as well as u(t) more likely tending to saturate at the limits of the usable signal range.  Small scale variations in the quality of trajectory tracking caused by changing parameter Λ can be highlighted by evaluating the absolute integral error between the realized and nominal trajectory, while the control algorithm is active: Simulations and experimental measurements based on the aforementioned absolute integral error quantity are ranked in Figure 9. It can be observed that there is an optimal trajectory tracking parameter value that provides the smallest absolute integral error. The most advantageous value for Λ is 2.75 s −1 in the case of experiments and 2.25 s −1 for simulations. This observation can be explained as follows: for smaller Λ values, the trajectory tracking is less "aggressive", therefore some details of the nominal trajectory are not followed perfectly, while, for larger Λ values, the controller is "overreacting", causing frequent saturation on the output, and, for this reason, some features of the desired path are again missed. Some detailed views of the best experimental trajectory followings with Λ = 2.75 s −1 are shown in Figure 10.
To show that the proposed CTC scheme is not optimized just for a certain specific nominal trajectory, Λ = 2.75 s −1 experimental setting is also tested in the frequency domain by applying a sinusoidal wave as the desired path with a decreasing time period known as "chirp signal" (see Figure 11). Frequency is increased linearly over time from 0.001 Hz to 0.57 Hz, the peak-to-peak amplitude was 60 degrees with −30 minimal and +30 maximal values. The smooth transition between the controlled and uncontrolled phase is achieved by phase-shifting of the initial sine wave to match the last measured angle value at the end of the five seconds long "free oscillation" period. The trajectory tracking is almost perfect up to 0.3 Hz and a still acceptable quality path following can be observed up to 0.45 Hz (as a comparison: the natural frequency of the abandoned system, when oscillating freely is around 0.5 Hz). Low-grade path fidelity can be observed from 0.45 Hz to 0.65-0.7 Hz; stability loss is occurring around 0.75-0.8 Hz.
The change in the quality of trajectory tracking under the influence of external disturbance was first investigated by simulation ( Figure 12). The duration of the applied external disturbance torque was 10 or 1 s, and the absolute value was one-third of the maximal achievable control torque (which is exerted when the lowest u min or the highest u max control signal values are sent permanently to the input signal distribution function depicted in Figure 4). When both short and long-duration disturbances occur or are removed, a transition period of about 10 s is needed for the algorithm to bring the controlled variable back to the vicinity of the prescribed nominal path. To show that the effect of external torque perturbations is also neutralized in real life, "qualitative" measurement series were elaborated, where the external disturbance was induced manually by pushing one of the arms belonging to the test stand arm (the measured results are shown in Figure 13, a similar magnitude of torque to the simulated disturbance could have been achieved by suspending weights to the arm, but the coordination of the weights' loading and unloading with the simulation load timing would have been too complicated). Each manual push lasted about 1 to 3 s. It is worth mentioning here that, in this experiment, the nominal trajectory was not predefined, but was generated in real-time by the microcontroller based on rough trajectory data provided by an incremental encoder knob. Each time, the experimenter turned the encoder knob by one position, the rough trajectory increased or decreased by 2 degrees, and this was fed to the smoothed trajectory generator .  To illustrate the magnitude of the disturbance torque, the minimum and maximum control torque levels that can be applied by the rotors are shown as dashed lines on the middle graph.

Performance Comparison of CTC and PID Compensator with a Nonlinear Feedforward Term
Since the desired nominal trajectory encompasses a wide range of motion (from -40 to +40 degrees), most conventional PID controller design methods, such as fitting a linear PID block to the linear approximated version of the original nonlinear system in a certain operating point, are out of the question. However, when the nonlinear part of the system model is supposed to be known or can be determined by carefully designed experimental measurements (e.g., approximation by polynomial functions, as was done previously in Section 2), PID compensation can be an option together with a nonlinear feedforward [4] term. In our particular case, the control signal for the bi-rotor testbed can be formulated as where is a built-in by default PID controller block in Matlab Simulink (referred to as the "ideal form" of PID blocks), which can be "tuned" automatically to get a desired step response function. With controller in (25) (not considering the actuation time delay and rise time), the equation of motion (20) becomes: Since A L 2 [F(α(t))] = f (α(t)) (see Equation (22)), the troublesome nonlinear part is canceled out and the resultant model can be further treated as an LTI system. Deficiencies of the actuator dynamics (dead-time, rise time) can also be compensated up to a certain limit by appropriate K P , K I , K D choice. The Simulink model of the realized "PID with nonlinear feedforward" control scheme is depicted in Figure 14, where the feedforward linearizator block contains formula A L 2 [F(α(t))] and the smoothed trajectory was generated in the same way as was done previously in the case of the CTC method. The obtained K P , K I , K D parameters from PID tuning are shown in Table 3. Since the lower computational demand is relative to the CTC algorithm, simulation time step and execution cycle time for the real-time controller board were halved from their original value. On the "D" channel, a first-order low-pass filter was inserted to attenuate the noise on the angular velocity signal (in addition, the aforementioned oversampling and averaging method for conditioning the measured angular position signal has also remained in use). Table 3. Values of the tuned PID parameters used in "PID with nonlinear feedforward" control scheme. Experimental and simulation results for trajectory tracking with "PID with nonlinear feedforward" control scheme are shown in Figure 15. Trajectory tracking is much less accurate relative to the CTC results, even with carefully tuned PID parameters. The constant sections in the desired path are reached with a considerable amount of over-or undershoots. These temporal peaks can be totally eliminated by choosing a less "aggressive" PID parameter set option, but, in this case, the settling time (the amount of time necessary to reach a constant value) expanded to 7-8 s, which generally resulted in even worse quality trajectory tracking. Experimental results for path following are again slightly better than the simulation ones, which can be explained by the "pessimistic" noise level approximation, and also by the sensitivity of the PID-based algorithm to the variations of the static and inertial parameters (see Figure 16 and the next two paragraphs about the model robustness). To test the robustness and model parameter sensitivity of the two different proposed control schemes, a set of simulation studies were performed, where the original control scheme interacts with altered virtual plant versions ( Figure 16, for CTC, Λ = 2.25 s −1 case was chosen as the "original" controller since it had the smallest absolute integral error value). In the first set of simulations, only inertial parameter Θ was varied by ±25% relative to its identified value in Table 2; in the second set, only the viscous parameter d was varied by ±25%; in the third set, only time-delay τ was varied by ±25%, and, finally, in the fourth set of simulations, all "static parameters" including A, c 0 , c 1 , c 2 , c 3 , c 4 were altered by ±25% at the same time in the plant model, while other system parameters were kept at a constant value.

PID Parameter Name Notation Value
While the CTC scheme was unaffected by all types of investigated model alternations, the "PID with nonlinear feedforward" algorithm shows a significantly different trajectory tracking behavior when the inertial or the static parameters were changed in the given range. The only disadvantage that can be mentioned in this comparison against the CTC is that it loses its stability when dead-time τ is increased drastically by factor 2.5 (0.2 s instead of the "true" 0.08 s), while the same time "PID with feedforward" still remains stable with very low quality trajectory tracking. for "PID with nonlinear feedforward" cases, the PID parameter set is from Table 3, A, c 0 , c 1 , c 2 , c 3 , c 4 values used in every case inside the CTC controller are from Table 2.

Conclusions
In highly nonlinear systems-e.g., in robotics, autonomous driving, navigation or attitude control of aerial vehicles-precise trajectory tracking is a crucial issue, especially if the system is loaded by time-delay as well. In this study, we have provided a generally applicable framework which aims to deal with this issue. We have developed and implemented an effective single parameter CTC control algorithm which was tested by various simulations and experiments that are ideal for applications where a specific nominal trajectory has to be followed precisely. The presented controller scheme preserves its stability and precision for a wide range of trajectory tracking parameter Λ values even if the actuation dynamics are corrupted by severe time delays, saturation, significant external disturbances, and feedback sensor measurement noise. While designing the CTC controller, no high precision exact model is required, since it shows appreciable robustness against model parameter variations.
The robustness of the presented control scheme and its insensitivity to model parameter variations can be further improved by adding a fixed point iteration-based adaptive deformation block between the kinematic and inverse dynamic blocks in Figure 7, which modifies or "deforms" the desired acceleration based on the last measured realized acceler-ation and the last calculated "deformed" acceleration value. Theoretical background and various simulation studies connecting to the CTC scheme supplemented by a fixed point transformation block can be found in [18][19][20][21]. It is worth noting that, while the theoretical background of this adaptive approach was elaborated in 1922 by Banach in his Fixed Point Theorem [22], the first proposal for its application in adaptive control was only published in 2009 in [21]. This method means a kind of "general framework" that can be filled in with various particular contents by specifying various functions, the use of which the task of finding the appropriate control signal can be transformed to iteratively finding the fixed point of a function. The function called "Robust Fixed Point Transformation" was the first example that was published in [21]. Later different functions were suggested and investigated via simulations in [23][24][25] that mean potential solutions. In the near future, experimental performance investigation of fixed point iteration based methods will hopefully be carried out by the help of the presented twin rotor test platform. Data Availability Statement: The Matlab and Python codes, Simulink models, measurement data, video links are available at: https://drive.google.com/drive/folders/1hNdgYBwFCSzv84MubIOa rzTUEdwEKY2g?usp=sharing.