Next Article in Journal
Median Bernoulli Numbers and Ramanujan’s Harmonic Number Expansion
Previous Article in Journal
Holistic Fault Detection and Diagnosis System in Imbalanced, Scarce, Multi-Domain (ISMD) Data Setting for Component-Level Prognostics and Health Management (PHM)
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Quadrotor Real-Time Simulation: A Temporary Computational Complexity-Based Approach

by
Gustavo Delgado-Reyes
1,
Jorge Salvador Valdez-Martínez
2,*,
Miguel Ángel Hernández-Pérez
1,*,
Karina Ruby Pérez-Daniel
3 and
Pedro Javier García-Ramírez
1
1
Instituto de Ingeniería, Universidad Veracruzana, Juan Pablo II s/n, Boca del Río 94294, Veracruz, Mexico
2
Industrial Mechanics Academic Division, Universidad Tecnológica Emiliano Zapata del Estado de Morelos, Av. Universidad Tecnológica No. 1, Emiliano Zapata 62760, Morelos, Mexico
3
Facultad de Ingeniería, Universidad Panamericana, Augusto Rodin No. 498, Insurgentes Mixcoac, Benito Juarez, Mexico City 03920, Mexico
*
Authors to whom correspondence should be addressed.
Mathematics 2022, 10(12), 2032; https://doi.org/10.3390/math10122032
Submission received: 13 May 2022 / Revised: 5 June 2022 / Accepted: 8 June 2022 / Published: 12 June 2022
(This article belongs to the Section Computational and Applied Mathematics)

Abstract

:
The interaction of digital systems with dynamic systems requires synchrony and the accomplishment of time constrains, so the simulation of physical processes needs an implementation by means of real-time systems (RTS). However, as it can be expected, every simulation and/or implementation might demand too many computational resources, surpassing the capacity of the processor used by computational systems. This is the reason for the need to perform a temporary computational complexity analysis based on the study of the behavior of the execution times of the implemented simulation. In this regard, the Real-Time Operating Systems (RTOS) feature time managing tools, which allow their precise measurement and the establishment of scheduling criteria in process execution. Therefore, this research proposes accomplishing a temporary computational complexity analysis of the real-time simulation by an embedded system (ES) of an unmanned aerial vehicle (UAV) propelled by four rotors. Derived from this analysis, formal definitions are elaborated and proposed, which establish a close relationship between the temporary computational complexity and typical real-time temporary constraints. To the best of the author’s knowledge, the definitions presented in this article have not been reported in the literature. Furthermore, to perform the temporary computational complexity analysis of the UAV, the mathematical modeling based on the Euler–Lagrange approach is presented in detail. Finally, simulations were performed using a real-time system implemented on the Embedded Computer System (ECS) Raspberry Pi 2 Model B+, in order to validate the suggested definitions.

1. Introduction

Nowadays, digital systems performing specific functions have been developed and innovated, in a way that, due to the constant technological progress, more precise sensors have been manufactured, as well as digital systems for a specific use, which are known as embedded systems (ES). There is a great influence of the ES in electronic systems, for example, in electrical household appliances, navigation systems, unmanned aerial vehicles (UAV), automobiles, communication networks, and electrical energy distribution networks, among others. Due to their system-on-chip (SoC) architecture, energy efficiency, low cost, and portability, embedded computers represent an alternative for the implementation of feedback control systems in robots, servomechanisms, and small aircrafts. In this sense, the interaction of ES with the physical world requires synchrony and the accomplishment of time constraints for its correct function; therefore, real-time study and analysis are required.
According to [1,2], a real-time system (RTS) is any system that actively interacts with an environment whose dynamics are known [3]. This interaction happens in a certain occurrence instant μ k of the physical world. The system’s output will be related to its entry through a processing time intrinsic to the real-time system. In this context, an RTS must fulfill three main characteristics: (a) Direct interaction with a real-world process through devices, such as sensors, Analogic/Digital Converters (ADC), Digital/Analogic Converters DAC), and actuators, among others; (b) emission of results according to the established times; and (c) rendering of correct responses at all times.
It is important to underline that the emission of such correct responses can vary temporarily due to the processing or calculating capacity of the system in real time, as well as to the number of elementary operations required to obtain the result in the established times. According to the preceding, the specified time intervals must be tied to a deadline designated by the system dynamics, as well as the time criteria of the sampling proposed by Nyquist [4], Kotel’nikov [5], and others.
On the other hand, the computational complexity theory is used to study the necessary hardware resources to calculate the solution to a problem. For that, the analysis of the required time for the execution of an algorithm is taken as a baseline, as well as the number of computational resources (memory, processor, priority management, etc.) used to do the calculation [6,7].
A clear illustration of the utilization of dynamic systems, whose simulation requires a numerical and computational analysis, can be found in the robotics field, with unmanned aerial vehicles (UAVs) serving as a prime example of this article. Several research articles have been held referring to UAV’s modeling and simulation, such as [8,9,10,11,12,13,14,15,16,17,18,19,20]. An example is shown in [21], where an alternative to evaluating a UAV’s performance without a physical environment is presented by means of a Gazebo open code simulator and the Robot Operating System (ROS), which allows the simultaneous simulations of different aspects, such as flight dynamics, Inertial Measurement Unit (IMU) integrated sensor, external image sensors, and complex environments. In addition, the quadrotor dynamics model was parameterized by means of wind tunnel tests and validated by comparing simulated and real flight data. The applicability for complex UAV simulation systems is shown using Visual Simultaneous Localization and Mapping (V-SLAM) approaches based on Light Detection and Ranging (LIDAR), available as open code software.
Another example is presented in [22], where a quadrotor simulator named Flightmare is proposed, which is constituted by two main tools: a configurable rendered engine built on Unity and a flexible physics engine for dynamic simulation. Both components may work independently, allowing the simulator to be high speed: the rendered one reaches rates of up to 230 Hz. In comparison, the physical simulation reaches rates of up to 200 Hz on a laptop. The simulator has been implemented using a laptop with 12-core Intel(R) Core(TM) i7-8850H CPU at up to 2.60 GHz. This also includes a multimodal sensor, an Application Programming Interface (API) for reinforcement learning that simulates hundreds of quadrotors simultaneously, and a virtual reality helmet, allowing interaction in the simulated medium. Two tasks were undertaken to prove its usefulness: the control of the quadrotor using deep reinforcement learning and the planning of routes to avoid collisions in a complex 3D environment. Furthermore, the UAV in this study is modeled as a rigid body driven by four engines. Finally, the quadrotor’s dynamic model was used to design control algorithms in the real world.
In contrast, [23] provided a generalized flight dynamic model of a quadrotor based on a novel hybrid Blade Element Momentum (BEM) theory. It allowed testing and evaluation of novel control and guidance algorithms, in simple software or hardware-in-the-loop simulations, for precise and aggressive maneuvers with an adequate performance. The controller development reduced the need for iterative gain tuning through flight tests. The systematic validation of the model was done through experiments and flight tests performed on an instrumented quadrotor.
Moreover, in [24] a low-cost, multi-rate, real-time distributed computing platform for dynamic simulation, control implementation, data visualization, and communications was presented. This platform is suitable for rapid virtual testing of aircraft system dynamics and control, including mission/path planning, flight control, propulsion, and energy management, by leveraging the off-the-shelf design and testing tools. The development was built on heterogeneous computing hardware, including real-time multi-core processors (running Linux system and PX4-based flight simulation/control/visualization) and Field-Programmable Gate Arrays (FPGA—a reconfigurable, parallel computing device). The mathematical models were solved by a set of multi-rate computational solvers and executed on multiple hardware units with different simulation time steps (or rates), depending on the model’s time scale. The controllers were implemented on either real-time multi-core processors running the Linux operating system, FPGA computing modules, or remote hardware controllers. Finally, the main contributions of this article highlight the use of this platform and show the results of a flight simulation case involving difficult dynamics in an autonomous flight mission.
According to the research mentioned above, the numerical and computational complexity of a physical process analysis, modeling, and simulation implies rising importance, mainly when intended to achieve an implementation with real-time capabilities. Therefore, a study based on temporary computational complexity would dimension the hardware benefits of an embedded system used to perform the simulation of a specific process. In addition, this approach would provide an alternative way to establish the sampling period that can be used when real-time implementations are required without relying on fundamental characteristics, such as the dynamic system time constant (which is not defined trivially in non-linear multivariable systems), among others.
Therefore, one of the most relevant contributions of this research study is the presentation of a set of formal definitions and concepts that illustrate the relationship between the analysis of temporary computational complexity and the time constraints proper of the RTS. Derived from these definitions is established some conditions that the simulation of an algorithm must meet so that its performance is in real time.
To illustrate the proposed approach, a real-time simulation of a UAV’s dynamic model has been implemented in the ECS Raspberry Pi 2 Model B+. Notice that although the UAV’s dynamic model has already been reported in several manuscripts in the literature, its mathematical development based on the Euler–Lagrange approach is presented in detail in this paper. This implementation allows one to denote how definitions and conditions describe and determine the temporary computational complexity based on an analysis of the measured execution times of the real-time tasks when using different priorities.
Finally, through the application of the developed theory, an analysis for the determination of the real-time tasks (RTT) deadline (which is a fundamental time constraint of the RTS) is offered and presented using a computational complexity analysis. This fact highlights a close relationship between temporary computational complexity and real-time systems. This analysis allows for the selection and recommendation of sampling periods by sizing the computer system’s hardware features by applying the temporary computational complexity analysis. Such a methodology is also ideal for computer systems that demand a speedy response and/or do not fail in accomplishing the deadline associated with its execution: for example, while implementing a control strategy using an RTS.
This article is organized as follows: Section 2 deals with the dynamic model of a UAV aircraft composed of four rotors (referenced in the rest of the article as quadrotor). Section 3 presents the real-time simulation of the quadrotor performed in the ECS Raspberry Pi 2 model B+, so the real-time response analysis is also shown. Section 4 presents the definitions formulated for the temporary computational complexity analysis of the quadrotor simulation algorithm implemented in the ES. This same section also addresses the relationship between the real-time systems and the temporary computational complexity. Finally, the discussion of the results is provided in Section 5, and the conclusions are presented in Section 6.

2. Mathematical Modeling

The aerial experimentation vehicle (referred to in further sections as drone, quadrotor, or UAV) has four actuators. The potential motions of the UAV are specified by manipulating the actuators; such movements are: (a) movement along with the x-axis; (b) movement along with the y-axis; and (c) movement along with the z-axis. To achieve the mentioned movements (x, y, z), the quadrotor’s orientation must be manipulated, which is accomplished by modifying or changing the pitch angle θ , roll angle ϕ , and the yaw axis ψ , defined with regards to the UAV’s orientation framework. Taking this into consideration, it is helpful to mathematically specify how the quadrotor’s orientation is represented. As it is shown in Figure 1, the quadrotor is subject to the frames of reference C and I. Accordingly, C represents the non-inertial frame of reference, that is, a coordinate axis whose center is the quadrotor’s mass center; whereas I represents the inertial frame of reference, which is subject to the land surface (ground or platform from where the drone starts its navigation).
The quadrotor’s dynamics are established by the performance of four motions: thrust, yaw, pitch, and roll, as seen in Figure 2. It is possible to modify the drone’s spatial location by generating these motions. The motions outlined above must be controlled simultaneously so the quadrotor follows certain trajectories provided by a flight plan [8].
The quadrotor’s translational positions x , y , z , in rectangular coordinates regarding the inertial framework I, are defined by vector ξ .
ξ = x , y , z T R 3 .
The quadrotor’s angular positions ψ , θ , ϕ , (quadrotor’s orientation) regarding the non-inertial framework C is denoted by vector η (also known as the Euler angles vector).
η = ψ , θ , ϕ , T R 3 .
The quadrotor’s total rotation can be found using the following rotation composition matrix, in which, for simplicity, sin = S and cos = C have been used:
R I = R ( z , ψ ) R ( y , θ ) R ( x , ϕ ) , R z , ψ = c o s ψ s i n ψ 0 s i n ψ c o s ψ 0 0 0 1 , R y , θ = c o s θ 0 s i n θ 0 1 0 s i n θ 0 c o s θ , R x , ϕ = 1 0 0 0 c o s ϕ s i n ϕ 0 s i n ϕ c o s ϕ , R I = C ψ C θ S ψ C ϕ + C ψ S θ S ϕ S ψ S ϕ + C ψ S θ C ϕ S ψ C θ C ψ C ϕ + S ψ S θ S ϕ C ψ S ϕ + S ψ S θ C ϕ S θ C θ S ϕ C θ C ϕ .
The rotation matrix referred to framework C is defined as:
R C = R I T = = C ψ C θ S ψ C θ S θ S ψ C ϕ + C ψ S θ S ϕ C ψ C ϕ + S ψ S θ S ϕ C θ S ϕ S ψ S ϕ + C ψ S θ C ϕ C ψ S ϕ + S ψ S θ C ϕ C θ C ϕ .
Therefore, taking into account the above expressions, it is possible to represent the quadrotor dynamics in terms of the generalized coordinate vector q , which is defined as:
q = x , y , z , ψ , θ , ϕ T R 6 .
The Euler–Lagrange equation, which allows the quadrotor to describe kinetic and potential energy, is defined as:
Γ i = d d t L q i ˙ L q i ,
where:
  • L is the Lagrangian function.
  • q i is the generalized coordinate vector.
  • q i ˙ is the time derivative regarding the generalized coordinate vector.
  • Γ i is the set of concurring forces acting over the aircraft.
The Lagrangian function is defined according to the following expression:
L = T V .
where:
  • T is the total kinetic energy.
  • V is the total potential energy.
To develop the quadrotor’s dynamic model, the translational and rotational dynamics are analyzed separately, as is shown in the following:
Translational dynamics is determined by the elements that constitute vector ξ given by (1), and it is defined as:
T t r a s l a c i o n a l = m 2 ξ ˙ T ξ ˙ ,
where m is the quadrotor’s mass and ξ ˙ denotes the time derivative of vector ξ .
Potential energy is defined as:
V = m g z ,
where:
  • g is the gravity’s acceleration.
  • z is the quadrotor’s height.
The Lagrangian function for translational dynamics is defined as:
L t r a s l a c i o n a l = T t r a s l a c i o n a l V .
Substituting (8) and (9) in (10), it is obtained:
L t r a s l a c i o n a l = m 2 ξ ˙ T ξ ˙ m g z .
According to the Euler–Lagrange formalism (6), it is obtained for translational dynamics:
F ξ = d d t L t r a s l a c i o n a l ξ ˙ L t r a s l a c i o n a l ξ ,
where:
  • F ξ represents the generalized force acting in the drone’s translational dynamics.
Solving (12) term by term, the following equations are obtained:
L t r a s l a c i o n a l ξ = m g E z ,
E z = 0 0 1 ,
L t r a s l a c i o n a l ξ ˙ = m ξ ˙ ,
d d t L t r a s l a c i o n a l ξ ˙ = m ξ ¨ .
Expressions (13)–(16) according to (12) can be more broadly represented as:
F ξ = m ξ ¨ + m g E z .
The generalized force F ξ is also expressed in terms of the rotation composition matrix R I as:
F ξ = R I F ^ R 3 .
From Expression (18), F ^ represents a compound vector in each element for each one of the forces delivered to the quadrotor´s engines. Such a vector is defined as follows:
F ^ = 0 0 u .
From (19), u is defined as shown below:
u = f 1 + f 2 + f 3 + f 4 = f i , i = 1 , 2 , 3 , 4 .
where:
  • f i represents the force generated by each one of the aircraft’s four engines.
The forces generated by each one of the engines incorporated into the quadrotor are defined as:
f i = k i ω i 2 , i = 1 , 2 , 3 , 4
where:
  • k i > 0 is a proportionality constant.
  • ω i is the angular velocity of each engine.
Substituting (18) and (3) into (17), it is obtained:
R I F ^ = m x ¨ y ¨ z ¨ + m g 0 0 1 .
Developing the previous expression:
C ψ C θ S ψ C ϕ + C ψ S θ S ϕ S ψ S ϕ + C ψ S θ C ϕ S ψ C θ C ψ C ϕ + S ψ S θ S ϕ C ψ S ϕ + S ψ S θ C ϕ S θ C θ S ϕ C θ C ϕ 0 0 u = m x ¨ m y ¨ m z ¨ + m g .
Translational dynamics is obtained by developing (23), resulting in:
x ¨ = S ψ S ϕ + C ψ S θ C ϕ u m , y ¨ = C ψ S ϕ + S ψ S θ C ϕ u m , z ¨ = C θ C ϕ u m g .
To develop the rotational dynamics modeling, it is first established that the generalized velocities η ˙ are related to the angular velocity vector ω c regarding the quadrotor’s coordinate axis, as shown in (25):
η ˙ = W η 1 ω c .
The calculation of W η implicit in (25) is given by (for more information see Appendix A):
W η = S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 .
The matrix J = J ( η ) , defined by (27), acts as an inertia matrix in the calculation of the rotational kinetic energy.
J = W η T I W η .
Assuming that the quadrotor’s structure is symmetrical, from (27), the matrix I is defined as:
I = I x x 0 0 0 I y y 0 0 0 I z z .
Substituting (28) and (26) in (27), it is obtained:
J = S θ S ϕ C θ C ϕ C θ 0 C ϕ S ϕ 1 0 0 I x x 0 0 0 I y y 0 0 0 I z z S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 .
According to the previous expressions, the rotational kinetic energy is defined as:
T r o t a c i o n a l = 1 2 η ˙ T J η ˙ .
The torque or moments of roll τ ϕ , pitch τ θ , and yaw τ ψ (also known as generalized moments) are defined by the following expression:
τ η = τ ψ τ θ τ ϕ = τ m 1 τ m 2 + τ m 3 τ m 4 ( f 1 f 3 ) l ( f 2 f 4 ) l ,
where:
  • l is the distance between the engines and the quadrotor’s mass center.
The moment produced by each one of the quadrotor’s engines is defined as:
τ m i , i = 1 , 2 , 3 , 4 .
The moment of yaw is also defined as:
τ ψ = f 1 + f 3 l f 2 + f 4 l .
The Lagrangian function for rotational dynamics is defined as:
L r o t a c i o n a l = 1 2 η ˙ T J η ˙ .
Substituting (34) on the Euler–Lagrange formalism (6), it is obtained for rotational dynamics:
τ η = d d t L r o t a c i o n a l η ˙ L r o t a c i o n a l η .
The equations defined by (35) can also be expressed as:
τ η = d d t J η ˙ 1 2 η ( η ˙ T J η ˙ ) .
Performing operations in (36), it is obtained:
τ η = J η ¨ + J ˙ η ˙ 1 2 η ( η ˙ T J η ˙ ) .
From (37), the Coriolis vector V ( η , η ˙ ) is defined as:
V ( η , η ˙ ) = J ˙ η ˙ 1 2 η ( η ˙ T J η ˙ ) .
The Coriolis matrix C η , η ˙ defines the centrifuge and gyroscopic effect typical of rotational dynamics. Such a matrix is obtained from (38) and it is expressed as:
V η , η ˙ = J ˙ 1 2 η η ˙ T J η ˙ = C η , η ˙ η ˙ .
Considering Expressions (38) and (39), Equation (37) is also defined as:
τ η = J η ¨ + V ( η , η ˙ ) ,
τ η = J η ¨ + C η , η ˙ η ˙ .
The Coriolis matrix calculation possesses the general form of the following:
C η , η ˙ = J ˙ 1 2 η η ˙ T J = C 11 C 12 C 13 C 21 C 22 C 23 C 31 C 32 C 33 .
Appendix A of this article contains the calculation for the inertia J and the Coriolis matrix C η , η ˙ . Finally, the quadrotor’s rotational dynamics can be represented by the following expression, which is obtained from (41):
η ¨ = J 1 τ η C η , η ˙ η ˙ .
The operation point is settled around the equilibrium point, in which the quadrotor is in a stationary state, to perform the reduced rotational dynamics modeling; that is, it is regarded that ( ψ = 0 , θ = 0 , ϕ = 0 ) . The necessity to explore these reduced dynamics stems from the fact that the dynamics defined by (43) are not simple. It is essential to underline that the approach described above only works for flight trajectories with no abrupt transitions. Thus, the Euler angles will be small.
According to the preceding considerations, given the reduced rotational dynamics, it is proved that:
s i n ψ s i n θ s i n ϕ = 0 .
c o s ψ c o s θ c o s ϕ = 1 .
Substituting the small-angle considerations described by (44) and (45) into the defined rotational dynamics defined by (41), it is obtained:
τ η = J ¯ η ¨ + C ¯ η , η ˙ η ˙ ,
where:
J ¯ = I z z 0 0 0 I y y 0 0 0 I x x ,
C ¯ η , η ˙ = 0 I y y ϕ ˙ I z z ϕ ˙ I x x θ ˙ 0 0 I x x ψ ˙ + I y y ψ ˙ I z z ψ ˙ 0 I x x ψ ˙ I y y ψ ˙ + I z z ψ ˙ 0 .
Solving the matrix operations of Expression (46), it is obtained:
τ ψ τ θ τ ϕ = I z z ψ ¨ + I y y ϕ ˙ I z z ϕ ˙ I x x ϕ ˙ θ ˙ I y y θ ¨ + ( I x x ψ ˙ + I y y ψ ˙ I z z ψ ˙ ) ϕ ˙ I x x ϕ ¨ + ( I x x ψ ˙ I y y ψ ˙ + I z z ψ ˙ ) θ ˙ .
Solving and rewriting the implicit expressions in (49), the quadrotor’s reduced rotational dynamics are defined as:
ψ ¨ = τ ψ I z z + ( I x x I y y ) ϕ ˙ θ ˙ I z z + ϕ ˙ θ ˙ , θ ¨ = τ θ I y y + ( I z z I x x ) ψ ˙ ϕ ˙ I y y ψ ˙ ϕ ˙ , ϕ ¨ = τ ϕ I x x + ( I y y I z z ) ψ ˙ θ ˙ I x x + ψ ˙ θ ˙ .
Finally, the aircraft’s non-linear dynamic model is defined by combining the translational dynamics (24) with the reduced rotational dynamics (50), resulting as follows:
x ¨ = S ψ S ϕ + C ψ S θ C ϕ u m , y ¨ = C ψ S ϕ + S ψ S θ C ϕ u m , z ¨ = C θ C ϕ u m g , ψ ¨ = τ ψ I z z + ( I x x I y y ) ϕ ˙ θ ˙ I z z + ϕ ˙ θ ˙ , θ ¨ = τ θ I y y + ( I z z I x x ) ψ ˙ ϕ ˙ I y y ψ ˙ ϕ ˙ , ϕ ¨ = τ ϕ I x x + ( I y y I z z ) ψ ˙ θ ˙ I x x + ψ ˙ θ ˙ ,
where the inputs to the model are defined by:
u = f 1 + f 2 + f 3 + f 4 , τ ψ = f 1 + f 3 l f 2 + f 4 l , τ θ = ( f 1 f 3 ) l , τ ϕ = ( f 2 f 4 ) l .

3. Real-Time Simulation

Nowadays, real-time systems (RTS) play a primordial role in human existence because they are in nearly everything we use: cellphones, microwave ovens, washing machines, TV sets, etc. For example, an RTS is used in the accurate operation of power plants and telephone stations, so the reliability of these services is guaranteed. Currently, there is a misconception about real-time systems in which it is expected that when they engage with a process, they do so immediately. However, fast systems are frequently mistaken for RTS.
Furthermore, according to [1,2], an RTS is such a digital system that is tailored to the time constraints given by the system or dynamic process according to diverse sampling criteria. It is thus established that a fast system produces its output without considering or respecting the time constraints of the environment’s process with which it interacts. Then, for this class of systems, we may state that the time it takes for data to get to the digital system is unimportant; only the time it takes for the output to be produced is important.
An RTS can be integrated by a personal computer (PC) and a RTOS that fulfills the constraints imposed by the dynamic process. For this, RTOS such as QNX®, Lynx®, RT-Linux®, Emlid RT®, and so on, can be used. These operating systems can provide proper support because of their multitasking capacities, synchronization, and message transmission, among other real-time system properties. As a result, the real-time systems implemented in a digital computer interact with the physical environment by using reconditioned variables by means of sensors, ADC, DAC, actuators [25], etc., which process their requests by means of real-time tasks ( J i ) [26,27,28]. A real-time task is an executable job entity J i , which is at least characterized by an arrival time and a time constraint [2,29]. It is formed by a set of instances j i , k , such that J i = j i , k , i , k Z + , where i represents the task index and k represents the instance index [2,30]. Accordingly, an instance j i , k is a job unit of a task J i , and it is defined with the following five-time constraints [1,2]:
l i , k , s i , k , c i , k , f i , k , d i , k | i , k Z + .
The definition of the time constraints associated with instances j i , k is the following:
Arrival time l i , k : it is the time at the beginning of the process in which a task’s instance is placed in the ready queue. It is an absolute time in which the instance is queued until it is attended.
Start time s i , k : it is the time when a task’s instance starts its execution.
Execution time c i , k : it is the time when a real-time task’s instance performs its operations without considering its displacements in the processor.
Ending time f i , k : it is the time when a task’s instance finishes its execution within interval k.
Deadline d i , k : it is the maximum time when a local response has to be obtained from a real-time task’s instance without negatively altering the process dynamics.
The time constraints of a real-time task’s instance have the graphic interpretation that can be seen in Figure 3.
Note that the execution time of an instance is not always equal to the difference between the ending time and the start time; instead, it may change according to scheduling criteria established by an RTT scheduler. A general way of describing said execution times is illustrated in Figure 4. However, it is important to note that this research work is carried out in the context of analyzing the temporary computational complexity of an algorithm whose execution times have been determined without focusing on specific RTT scheduling criteria.
In context with that mentioned above, the quadrotor’s dynamic model defined by (51) and (52) has been programmed in the ECS Raspberry Pi®. For this purpose, some functions from a self-development library have been programmed using C language and the RTOS Emlid RT®. This RTOS provides real-time support and time and priorities management tools that could allow a running algorithm to meet the time constraints imposed by a physical process, obtain correct answers, and consequently, meet the deadline associated with the RTT [31,32].
In addition, some functions of the developed software library are (a) use of matrices and vectors, (b) dynamic memory management, (c) simulation of systems expressed in state space form, and (d) numerical integration procedures based on Euler’s method. Therefore, for a real-time simulation of the drone’s mathematical model, the parameters shown in Table 1, have been used.
To perform the quadrotor’s real-time simulation, the model described by (51) and (52) is recast in terms of the generalized coordinates specified by (5), taking into account that (54) is an alternate representation of the drone’s dynamic model.
q ¨ = x ¨ , y ¨ , z ¨ , ψ ¨ , θ ¨ , ϕ ¨ T R 6 = q ¨ 1 = x ¨ = S ψ S ϕ + C ψ S θ C ϕ u m , q ¨ 2 = y ¨ = C ψ S ϕ + S ψ S θ C ϕ u m , q ¨ 3 = z ¨ = C θ C ϕ u m g , q ¨ 4 = ψ ¨ = τ ψ I z z + ( I x x I y y ) ϕ ˙ θ ˙ I z z + ϕ ˙ θ ˙ , q ¨ 5 = θ ¨ = τ θ I y y + ( I z z I x x ) ψ ˙ ϕ ˙ I y y ψ ˙ ϕ ˙ , q ¨ 6 = ϕ ¨ = τ ϕ I x x + ( I y y I z z ) ψ ˙ θ ˙ I x x + ψ ˙ θ ˙ .
The dynamic model simulation defined by (54), considering the entries defined by (52), has been performed by successively integrating q ¨ and q ˙ according to what is established in (55) and (56).
q ˙ = q ¨ d t .
q = q ˙ d t .
Euler’s numerical method was used to obtain the approximate solution for Expressions (55) and (56), and a real-time task J 1 was programmed with a simulation time of 20 s , and an iteration rate of t = 25 ms was proposed, resulting in 800 real-time instances. The simulation results are depicted in the following figures:
In Figure 5, the angular velocities ϕ , θ , ψ obtained in the quadrotor’s real-time simulation can be seen.
In Figure 6, the angular positions ϕ , θ , ψ obtained in the quadrotor’s real-time simulation are depicted.
In Figure 7, the translational velocities x, y obtained in the quadrotor’s real-time simulation are shown.
The translational velocities x, y, z acquired from the quadrotor’s real-time simulation are shown in Figure 8.
In Figure 9, the translational positions x, y obtained in the quadrotor’s real-time simulation can be seen.
The translational positions x, y, z obtained in the quadrotor’s real-time simulation are presented in Figure 10.
Once the quadrotor’s non-linear dynamic model was programmed, a simulation of this was performed in the embedded system, using distinct task execution priorities for that, which are comprehended in the interval from 19 and 19. Furthermore, the execution times of each instance were measured using the time management tools of the RTOS Emlid RT®, yielding the execution times shown in Figure 11.
It is important to emphasize that in real-time operating systems, priority management indirectly impacts the RTT execution times because a real-time task that executes and has been configured with a higher priority is less likely to have its execution postponed (evicted in the processor) due to attending an RTT configured with a lower priority [33]. Consequently, those tasks configured with a high priority tend to define lower execution times than those with a lower priority. On the other hand, it is also important to note that according to [33,34,35], the use of RTT schedulers guarantees that those RTTs that are subject to eviction by the processor receive the necessary resources until completing their ending time (see Figure 4). However, note that the latter is outside of the purpose of this research work because the experimentation using different RTT schedulers has not been carried out; this is a proposal for future work. In this sense, and as it can be seen in Figure 12, where it is shown the first probability moment E c p , k of the execution times of Figure 11 using a priority p = 19 , it can be inferred that the highest possible priority is being used. Thus, the greatest amount of resources for the execution of the real-time task is being assigned. It is worth noting that using a priority p = 19 implies that fewer resources are being given to the task’s execution.
As seen in Figure 11 and as it happens in any physical process, the behavior of execution times is random and varies over time. In this context, they also may be described as stochastic processes. The random behavior of such times is caused by various inherent characteristics in real-time operating systems such as pipeline, caching, process scheduling criteria, and priority management. It is important to note that although the behavior of the execution times is random, the deadlines determination based on a study of a temporary computational complexity of the algorithm could allow for the definition as to whether it has real-time performance or not. Therefore, this fact is part of the main motivation of the present research work, in which a study is proposed to evaluate the hardware benefits and their capability to meet specific RTT deadlines. This study is carried out through the elaboration of mathematical definitions aimed at justifying that the execution of the algorithm is performed by an RTS.
In real-time systems, the analysis and characterization of execution times c i , k and the deadline d i , k imposed for real-time task execution are critical for its good performance. Consequently, for each one of the real-time task’s instances j 1 , k , the time constraint described by the following Expression (57) is considered.
d 1 , k = t = 25 ms .
According to what has been stated above, it can be noted that every physical process in which the characterization of its time constraints is done could fulfills what is established by (58) and (59). In addition, if it is implemented in an embedded digital system, it has certain potentialities which allow it to be implemented in real-time using a real-time embedded system (RTES). In this sense, when a physical process is simulated using an algorithm programmed in an embedded digital computer, the analysis of its execution times c i , k and the fulfillment of the time constraint d 1 , k justify that the process simulation is working in real time. In this scenario, and according to the preceding reasons, the process simulation is appropriate to take place in real time. As a result, the following RTS classification is proposed.
Definition 1
(Hard Real-Time System HRTS).Any hard real-time system is the one in which the ending times f i , k are always in synchrony with the physical dynamics in all the evolution intervals. In these systems, it is mandatory that, for any instance, the following must be accomplished:
c i , k < f i , k d i , k c i , k , f i , k , d i , k R i , k Z + .
Definition 2
(Soft Real-Time System SRTS).Any soft real-time system is the one that, globally and in a sense of probability for its instances, accomplishes:
E c i , k < d i , k c i , k , d i , k R i , k Z + .
Based on the real-time analysis previously stated, it can be summarized that the quadrotor’s simulation has been done by a hard real-time system, as the fulfillment of the deadline is performed according to what is established by (57). This implies that all the execution times c i , k (and their first probability moments) are less than the deadline imposed for the execution of the real-time task.

4. Temporary Computational Complexity

The study of the number of resources required by computational algorithms from the computer system is critical in their implementation. Despite technological advancements and the development of faster computers with more functions, their processing and storing capacity remains limited. Therefore, the amount of time and the number of memory sectors used by a computer system may describe a program in execution [36]. The description of this approach can be performed using a mathematical language in terms of functions and notations that may have universal validity and could represent a field of study. Thus, an algorithm’s temporary computational complexity determines the amount of time it takes to run. Likewise, the spatial computational complexity defines the amount of memory that an algorithm demands from a computing system to be executed.
Moreover, the temporary complexity is the amount of time it takes an algorithm to run in a digital system when its input data increases. However, regardless of how precise the time management tools of RTOS are, as is illustrated in Figure 11, execution times have a random evolution like any other physical process because they are influenced by additive noises, which also can be modeled as internal or external noises in the process [37]. Then, defining the behavior of an algorithm’s execution times without concern for the growth in its entry data or the computational system on which it is implemented is a topic of interest in scientific computing. Therefore, this research article proposes the representation of an algorithm’s temporary complexity by the function T ( n ) , where n denotes its entry data. According to this, the following definition is stated:
Definition 3
(Real-Time System’s Temporary Complexity TCC-RTS).The temporary complexity T ( n ) of a real-time system is defined as a function that takes as its entry data the instances of an algorithm and maps them to the set of execution times c i , k measured, thus:
T ( n ) : ( n | n = j i , k ) c i , k .
According to the definition above, and considering that the temporary complexity is the amount of time that an algorithm requires to converge to a solution at the time that its entries increase, for any algorithm, these are essentially the evolution forms of T ( n ) illustrated in Figure 13.
It is necessary to rebound, according to Figure 13, that any algorithm whose temporary complexity is of the linear ( T ( n ) = n ) , constant ( T ( n ) = 1 ) or polynomial ( T ( n ) = n x x n x R ) , is known as an algorithm with ( P ) complexity or polynomial time.
In contrast to the previous algorithms, algorithms whose temporary complexity is of the non-polynomial ( T ( n ) = n n ) kind, also known as non-polynomial (NP) or of non-polynomial time, are hardly implemented using a real-time system, because those need too many resources from the computer system processor and are therefore deemed to potentially have an exponential complexity ( T ( n ) = 2 n ) .
Therefore, knowing an algorithm’s temporary complexity entails understanding the behavior of its execution times c i , k and how these evolve over time, which itself represents a complex problem to solve. Moreover, as shown in Figure 11, the execution times of any algorithm implemented in an embedded computer by using an RTOS have a non-deterministic behavior. Consequently, and as a mathematical tool that provides an alternate solution to this problem, asymptotic notation is used to express the behavior of T ( n ) as the number of entries n increases.
Asymptotic notation is named based on asymptotic functions, which appear to converge in one point when evaluated in specific threshold values; nonetheless, these never touch each other. As shown in Figure 14, asymptotic notation defines the function g n as an upper or lower bound in describing deterministically the global behavior of the temporary complexity T ( n ) .
Therefore, the following definition of the function g n is proposed:
Definition 4
(Function g ( n ) ). Function g n depicts the first probability moment of the random behavior of execution times c i , k . Then, g n can be represented as a function that tends to determinism and it is expressed as follows:
g n = 1 n n = 1 k c i , k = E c i , k .
The function described by (62) is proposed in this article as an alternative to (61), which defines a particular function that denotes execution times in a probabilistic approach. Then, function g D n is proposed, which is defined in terms of the constant c D , execution times, and their initial probability moments, as follows:
g D n = E c i , k + c D E c i , k c D R .
Given the definition of function g D n and the linearity properties of the first probability moment, the following mathematic manipulations can be proposed:
g D n = E c i , k + E c D E c i , k ,
g D n = E c i , k + c D E E c i , k ,
g D n = E c i , k + c D E c i , k ,
g D n = 1 + c D E c i , k ,
g D ( n ) = c × g ( n ) c R | c > 0 c = 1 + c D .
The Expressions (66) and (67) define the function g D n in terms of the function g n and the constant c. Consequently, by means of the use of the condition denoted in the previous expressions, the function can either define an upper or a lower bound for function T ( n ) . According to Figure 14, the input to the algorithm in which an intersection between the functions T ( n ) and g n has occurred is called n 0 .
Considering this analysis, the definition of function g D C S n is presented as follows:
Definition 5
(Function g DCS n ). Function g D C S n is every upper bound for every function T n (and, consequently, for execution times c i , k ) and is defined by the following expression:
g D C S n = lim n g D ( n ) = c × g n | c × g n T ( n ) n > n 0 | n 0 0 n n 0 > n 0 .
Notice that every function g D C S n for which n 0 = 0 satisfies intrinsically the condition denoted by Expression (68), and, therefore, it can be established that its nature is to define an upper bound of T n for all n.
The discrepancy e G C S , T ( n ) between any function g D C S n and T n can be analyzed according to the following expression:
e G C S , T n = lim n g D C S n T ( n ) .
It is important to underline that, according to the definitions stated above, and as long as the condition denoted by (68) is met, the magnitude of e G C S , T ( n ) can be decreased, as the magnitude of c decreases.
Similarly to Expression (68), the definition of function g D C I n is presented thus:
Definition 6
(Function g DCI n ).Function g D C I n is every lower bound for every function T n (and, consequently, for execution times c i , k ) and is defined by the following expression:
g D C I n = lim n g D ( n ) = c × g n | c × g n T ( n ) n > n 0 | n 0 0 n n 0 > n 0 .
Based on the analysis of (68) and (70), it is feasible to determine that these may be used to dimension the hardware features of the embedded system where the physical process simulation is being performed. As a result, for each function g D C S n , the smaller the magnitudes c and n 0 , the greater the processing power in the computing system used. In addition, notice that in real-time simulation, smaller sampling periods can be used, ensuring at all times and for future simulations the correct functioning in task execution. This allows for the avoidance of the overloading of the computing system by performing excessive operations that result in its blockage, which is derived from its memory overload, which is affected directly in the unfulfillment of the RTT’s deadline d i , k .
Finally, using the definitions (60)–(62), (67), and (68), the temporary complexity of a real-time algorithm may be analyzed by the following definition:
Definition 7
(Function g DD n ).Let us n = j i , k a set of instances of an algorithm implemented by a real-time system; the function g D D n is such that it maps its execution times to their deadlines, which is:
g D D n : c i , k d i , k | g D D n = g D C S n .
To validate the definitions proposed by this article, the results of the temporary computational complexity analysis of the algorithm performing the quadrotor’s real-time simulation (see Section 3) is presented. Consequently, the measured execution times of said algorithm are presented below. For that purpose, the priorities 19, 0, and 19 were taken into consideration; that is, in order to simulate the dynamic system by means of a real-time task, minimum, zero, and maximum priorities were used.
As shown in Figure 15, the use of the minimum priority in the execution of the algorithm that performs the quadrotor’s simulation has a direct influence on the measured execution times. When analyzing this response and comparing it to the responses of Figure 16, Figure 17, Figure 18 and Figure 19, it is possible to conclude that using this priority generates the maximum execution times in the embedded system; however, from these, it is possible to use the definition proposed by (68) to define the function g D S C n , whose intrinsic nature is to represent an upper bound for function T ( n ) , because n 0 = 0 .
Based on the analysis of e G C S , T ( n ) in Figure 15, and given the random behavior of T ( n ) , it can be concluded that this difference will tend to highlight the non-deterministic effect of the temporary computational complexity. Thus, for the analysis of e G C S , T ( n ) , the following expression is proposed in addition to (69):
e G C S , G ( n ) = lim n g D C S n g ( n ) .
The magnitude of the difference indicated in (72) (which can be seen in Figure 15) can be reduced when performing the quadrotor’s simulation using alternative priorities in the RTT’s execution. As a result, the experimentation shown in Figure 16, Figure 17, Figure 18 and Figure 19 denotes the possible dependency between the behavior of the execution times and the priorities. Regarding the results shown by Figure 16, which have used the priority p = 9 and which have occurred in an intersection between T ( n ) and g D ( n ) (domain value defined as n 0 ), the magnitude of e G C S , G n decreases effectively. However, function g D n does not fulfill the condition denoted by (68), as it is not accomplished for all domain n that c × g n T ( n ) . Additionally, the magnitude n n 0 is not greater than n 0 . Thus, function g D n does not acquire the character of upper bound, concluding that g D n g D C S n .
As illustrated in Figure 17, the criterion set by (68) is met for all n; hence, the function g D n presented represents a upper bound for function T ( n ) . In consequence, it is proven that, given the intrinsic nature of g D n , it is accomplished that: g D n = g D C S n . In this context, the fulfillment of the condition denoted by (68) prevails also for Figure 18 and Figure 19. Nevertheless, for the case that can be analyzed in Figure 18, function g D n , does not fulfill c × g n 0 T ( n ) ; however, taking into account that condition (68) is accomplished for all n > n 0 and also n n 0 > n 0 , it is possible to conclude (though not intrinsically) that: g D n = g D C S n .
It is worth noting, regarding Figure 19, that, similarly to what happens in Figure 15 and Figure 17, for all domain n, it is intrinsically fulfilled that c × g n T ( n ) . This, in consequence, for all three cases, we can prove that g D n = g D C S n and that n 0 = 0 . According to what was previously stated, and after analyzing the discrepancy e G C S , G n described by (72) and comparing such figures, it can be concluded that the lesser magnitude of such difference was obtained in the achieved experimentation using priorities p = 9 and p = 19 in the RTT’s execution, resulting very similar in both cases (around 1.1 ms). The significant difference between these two cases is that only for this last priority the condition expressed by (68) is intrinsically fulfilled, because n 0 = 0 , and this justifies that the optimal priority to perform the quadrotor’s real-time simulation in the used embedded system should be p = 19 . Consequently, the selection of the algorithm execution priority in embedded systems that use a RTOS could be performed in the future using an optimal criterion in terms of decreasing the magnitude of e G C S , G n , by fulfilling (preferably intrinsically) the condition (68).
Furthermore, using different priorities can influence the behavior of function T ( n ) , so that, for values close to p = 19 , the amplitude of the function g D C S ( n ) associated with it can be minimized. As a result, if this process is performed fulfilling the condition expressed by (68), it is possible to use shorter sampling periods in the real-time simulation of dynamic systems, which is especially useful when these have very small time constants. The sampling period in a system’s real-time simulation is then represented by the temporary constraint described as deadline d i , k . Then, as shown in this manuscript, one of the contributions presented is that the achievement of this temporary constraint can be studied in terms of the temporary computational complexity T ( n ) and its interaction with the functions g D n and g D C S n . In this regard, this research study provides as one of its contributions a technique for dimension the deadline d i , k in a real-time dynamic system simulation, whose application criterion is defined by (71).
One of the direct applications of the theory developed in this study might be the categorization of real-time systems based on the computational complexity analysis of algorithms implemented using an RTS. As a result of (71), and in addition to the definitions given by (58) and (59), in this article, the following categorization is proposed:
Definition 8
(Hard Real-Time System according to Temporary Computational Complexity Based Approach (HRTS-TCC)). All HRTS-TCC is HRTS whose temporary computational complexity should be intrinsically accomplished, that is to say, for all domain n, with the condition denoted by Expression (73). In these systems, it is imperative that n 0 = 0 when fulfilling such condition, this is:
lim n g D ( n ) = c × g n | c × g n T ( n ) | n 0 = 0 .
Definition 9
(Soft Real-Time System according to Temporary Computational Complexity Based Approach SRTS-TCC). All SRTS-TCC is SRTS whose temporary computational complexity fulfills that denoted by (74). In these systems, it is imperative that n 0 0 when fulfilling such condition, this is:
lim n g D ( n ) = c × g n | c × g n T ( n ) n > n 0 | n 0 0 n n 0 > n 0 .
Notice that the behavior of function T ( n ) when the number of entries of an algorithm increases can be defined in terms of function g D n . In this context, its temporary computational complexity can be classified as it is established in Table 2.
According to Table 2, each algorithm may be categorized based on an analysis of its temporary computational complexity. Then, those algorithms with a temporary complexity of the exponential kind, also known as non-polynomial time algorithms (NP) and whose function is g D n = 2 n (implicit in Table 2), show that an increase in the entries n is translated into an increase in the exponential term. This implies that the growth rate of the function T ( n ) increases, resulting in greater execution times c e i , k which lead to Table 2. The quadratic, linear, logarithmic, and constant complexity algorithms are known as polynomial-time algorithms (P). In this sense, they need substantially less processing time from the computer than NP-type algorithms when implemented. Therefore, one of the advantages of determining the temporary computational complexity of an algorithm is that it can predict how the time demand will rise when it is performed in the computer system. This is not straightforward because, as established in this article, execution times exhibit non-deterministic behavior. In addition to the aforesaid, it is necessary to know how they will behave (invariably from the computer system in which they are produced) when increasing the inputs to the algorithm; this indeed represents another aspect that complicates the computational complexity analysis.
Asymptotic notation is used to describe the temporary computational complexity; therefore, such notation is denoted by functions T ( n ) and g n . As a result, the following definitions are provided below:
Definition 10
(Asymptotic Notation Big O).Temporary complexity T ( n ) of an algorithm, has notation big O, that is to say, T ( n ) O ( g D ( n ) ) or T ( n ) is of the order of g D ( n ) , if constants c R and n 0 Z + exist, such that:
c × g n T n | c × g n = g D n = g D C S ( n ) .
Definition 11
(Asymptotic Notation Little o).Temporary complexity T ( n ) of an algorithm, has notation little o, that is to say, T ( n ) o ( g D ( n ) ) or T ( n ) is of the order of g D ( n ) , if constants c R and n 0 Z + exist, such that:
c × g n > T n | c × g n = g D n = g D C S ( n ) .
Definition 12
(Asymptotic Notation Big Ω ). Temporary complexity T ( n ) of an algorithm, has notation big Ω, that is to say T n Ω ( g D ( n ) ) or T ( n ) is of the order of g D ( n ) , if constants c R and n 0 Z + exist, such that:
c × g n T n | c × g n = g D n = g D C I ( n ) .
Definition 13
(Asymptotic Notation Little ω ).Temporary complexity T ( n ) of an algorithm, has notation little ω, that is to say, T ( n ) ω g D ( n ) or T ( n ) is of the order of g D ( n ) , if constants c R and n 0 Z + exist, such that:
c × g n < T n | c × g n = g D n = g D C I ( n ) .
Definition 14
(Asymptotic Notation Big Θ ).Temporary complexity T ( n ) of an algorithm, has notation big Θ, that is to say, T ( n ) Θ ( g D ( n ) ) or T ( n ) is of the order of g D S ( n ) and of g D I ( n ) , if constants c s , c i R and n 0 s , n 0 i Z + exist, such that:
c s × g D S n T n c i × g D I n | c s × g D S n = g D C S n c i × g D I n = g D C I ( n ) .
According to the above definitions, the quadrotor’s temporary computational complexity may be described in terms of functions g D ( n ) , as shown in Figure 15, Figure 16, Figure 17, Figure 18 and Figure 19. That is, functions g D ( n ) can be considered (taking into account Expressions (68) and (70)) as upper or lower bounds of functions T ( n ) . Then, as shown only in Figure 15 and Figure 17, Figure 18 and Figure 19 and by the accomplishment of the Expression (68), it can be concluded that functions g D ( n ) represent upper bounds for functions T ( n ) ; this fact can confirm the Expression (71). In this context, as shown in the images, when n approaches infinity, the function g D ( n ) converges to a value (about 1.7 m i l l i s e c o n d s ), and this value may be stated according to what is established by (80).
lim n g D n = 0.0017 s .
An alternative way for Expression (80) to define the convergence value of the function g D ( n ) , is as it is established by the following expression:
lim n g D n = c D 1 lim n g D 1 ( n ) = 0.0017 s .
It is important to note that, in (81), it is considered that the constant c D 1 = 0.0017 R exists, and that function g D 1 ( n ) has the definition that can be observed in (82).
g D 1 ( n ) = 1 n 0 0 n < 0
Notice that, if, given the computational complexity of an algorithm T ( n ) , it is accomplished for all n that c D 1 × g D 1 ( n ) g D n , in such a way that g D n is a upper bound for such T ( n ) . This implies that the condition denoted by (68) is fulfilled, and consequently g D n = g D C S n . In addition, by transitivity, it will be accomplish Expression (83), such that:
c D 1 × g D 1 n T n | c D 1 × g D 1 n = g D C S ( n ) .
According to the behavior of functions g D C S n , which can be seen in Figure 15 and Figure 17, Figure 18 and Figure 19, and to the definition of function g D 1 ( n ) given by (82) and Table 2, it can be summarized that the real-time simulation of the quadrotor’s dynamics presented in this article has a constant temporary computational complexity. Moreover, based on the analysis of (75) and (80)–(83), it is also established that complexity T ( n ) of the real-time simulations reported in this article can be described by the asymptotic notation: big O.

5. Discussion

As it has been analyzed previously in this article, the computational complexity is a mathematical tool that permits the determination of, a priori, what the demand of resources will be, whether in time or space, of an algorithm whose entries increase when executed on a computer system. In this context, such analysis can be applied to any algorithm, whether it is implemented by means of a real-time system or not. Then, when an algorithm is implemented in a digital computer to simulate a dynamic system or physical process, this can or cannot accomplish the time constraints imposed by the process of the system which simulates the one with which it interacts. The fulfillment of this condition is one of the characteristics of real-time systems. The correct performance of those depends not only on the logical result that the computer retrieves but also on the time in which such a result is produced. For the RTS, they must respond to external events during their evolution, and results must be sent regularly, always meeting the deadlines set to the programmed real-time tasks. To achieve this goal, execution times (internal time) in the RTS must be measured precisely and on the same scale as environmental time (external time). When an RTS is implemented using RTOS, a real-time clock is used, as well as other tools, such as timers, concurrent programming, and priority management.
In contrast with the definition of RTS, an online system, whether rapid or instantaneous, produces its output without considering nor accomplishing the time constraints of the environment with which it interacts. For this kind of system, the time in which the data arrive at the digital system is not important but only the speed with which the output is produced. In other words, the speed in giving the response within a time interval whose measurement is better when smaller is the only important factor. That is, for this system, the cost of generating such a response, the accomplishing time constraints (deadlines), or the synchrony and periodicity do not matter, which are mandatory aspects in any RTS.
Considering the facts stated above, and according to the approach proposed in this article, an algorithm that interacts with or simulates a physical process in real time has a different kind of temporary computational complexity in comparison to one which is not implemented in real time. Therefore, the simulation of the model of a quadrotor achieved by means of an online system, (or off-line in the worst-case scenario) which depends on the number of iterations, and then, considering them as its entries, it would clearly have a linear kind of temporary computational complexity. Taking into account the previous analysis, it is evident that functions T ( n ) seen in Figure 15, Figure 16, Figure 17, Figure 18 and Figure 19 have a complexity of the constant kind. This fact also justifies that the quadrotor (also known as drone) real-time simulation presented in this article has a temporary computational complexity of the constant kind and can be described using asymptotic notation big O. Regarding the functions g D C S ( n ) defined by (68), and which are observed in the previously mentioned figures, it can be assumed that the fact of using priorities close to 19 in the quadrotor’s real-time simulation modifies the discrepancy e G C S , G n . This fact denotes a certain tendency to decrease it, and consequently, it could be interpreted that there is a strongly bounded dependency between c and p, in such a way that any modification of the value of p would imply a modification of the value of c. This interpretation is mistaken, as in this manuscript a constant value of c has been used in the definition of function g D C S ( n ) . According to this, the most valid interpretation lies in the fact that, modifying the priority in a RTT’s execution, the discrepancy e G C S , G n is modified because the processor increases or decreases the number of task displacements according to the priority chosen and a scheduling criteria. Thus, when using a priority p = 19 , the processor assigns the maximum quantity of hardware resources to the execution of the task in progress, reducing then the possibility of displacement by the necessity to attend any process requiring attention. This generates smaller execution times c i , k , and consequently, the function T ( n ) which converges to smaller values is defined, these being delimited by the function g D C S ( n ) , which achieves convergence also to smaller values.
According to the definition of function g n denoted by (61), and on which the analysis presented in this article is based, it is possible to assume that it is somewhat contradictory that the computing of this, when n is increased, will have, naturally, a temporary computational complexity of the linear kind. This fact represents an incongruency with the conclusion, in which the temporary complexity of the algorithm performing the real-time simulation is of the constant kind. However, it is important to highlight that, as it is shown in Appendix B of this article, function g n can be expressed recursively and iteratively, which allows such function to be calculated in each instance of the real-time task that the quadrotor’s simulation performs. Finally, it is important to mention that the recursive expression of function g n allows its easy implementation in any embedded system.

6. Conclusions

RTS are systems that, when interacting with a physical process, must accomplish at all times with certain temporary constraints. If these temporary constraints are not met, there is the possibility of the occurrence of a failure and/or collapse when real-time implementations of these physical processes are performed in embedded systems. Therefore, this research article proposes a set of formal definitions, such as; Real-Time System’s Temporary Complexity TCC-RTS, Hard Real-Time System with a Temporary Computational Complexity based Approach HRTS-TCC, Soft Real-Time System with a Temporary Computational Complexity based Approach SRTS-TCC, Asymptotic Notations, among others. These definitions contribute to the theory that allows the analysis of the temporary computational complexity of iterative algorithms programmed in embedded systems by means of RTS. Moreover, these definitions denote and establish a close relationship that can exist between the time constraints common to all RTS and the temporary computational complexity of the simulation and/or implementation of dynamic systems in embedded systems by proposing the use of different execution priorities. Therefore, one of the proposals of this research article allows for quantifying the hardware features and determining the conditions to accomplish the deadline of the RTT’s instances. To validate the definitions formulated in this manuscript, the detailed modeling of a quadrotor (UAV) according to the Euler–Lagrange approach was presented, where the simulation, implementation, and experimentation were carried out by means of an RTS implemented in the ECS Raspberry Pi 2 Model B+. This analysis of the real-time implementation allowed us to validate the characterization of the execution times of the implemented algorithm (UAV simulation) and also allowed us to present and analyze its temporary computational complexity through the definitions elaborated in this paper. This analysis also made it possible to determine the deadline of the real-time task, without analyzing the convergence rate of the dynamic system (quadrotor model). Therefore, this fact allows for the determination of the sampling periods that can be used by making a balance between the hardware features of the embedded computer system (Raspberry Pi), where the algorithm is implemented and its temporary computational complexity is found.
On the other hand, it is possible to highlight that by applying the developed theory in this manuscript, it would be possible to improve the performance of the autonomous flight algorithms in unmanned aerial vehicles. All this since it has been detected in the literature that tests in the studied UAVs still imply the risk of damage and/or failure due to the absence of implementation of their flight algorithms by means of an RTS, in which the deadline to be used is determined by an analysis of its temporary computational complexity. That is to say, the lack of analysis of the time constraints associated with the RTS can provoke the unfulfillment of the deadline of a specific task, in this way generating delays that impact negatively the stability of closed-loop control systems. This is the particular case of the implementation of the autonomous flight systems in UAVs.

Author Contributions

Conceptualization, G.D.-R., J.S.V.-M. and M.Á.H.-P.; methodology, G.D.-R., J.S.V.-M. and M.Á.H.-P.; software, G.D.-R., J.S.V.-M. and K.R.P.-D.; validation, G.D.-R., J.S.V.-M. and K.R.P.-D.; formal analysis, G.D.-R., J.S.V.-M. and M.Á.H.-P.; investigation, G.D.-R.; resources, G.D.-R., J.S.V.-M. and K.R.P.-D.; data curation, G.D.-R., J.S.V.-M. and K.R.P.-D.; writing—original draft preparation, G.D.-R., J.S.V.-M., M.Á.H.-P. and P.J.G.-R.; writing—review and editing, G.D.-R., J.S.V.-M., M.Á.H.-P., K.R.P.-D. and P.J.G.-R.; visualization, G.D.-R., J.S.V.-M. and M.Á.H.-P.; supervision, K.R.P.-D. and P.J.G.-R.; project administration, J.S.V.-M., M.Á.H.-P., K.R.P.-D. and P.J.G.-R.; funding acquisition, G.D.-R., J.S.V.-M., M.Á.H.-P., K.R.P.-D. and P.J.G.-R. All authors have read and agreed to the published version of the manuscript.

Funding

This research received funding support from the Instituto de Ingeniería, Universidad Veracruzana.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Appendix A

The angular velocity vector ω c implicit in (25), is defined as follows:
ω c = ω c 1 ω c 2 ω c 3 = ϕ ˙ 0 0 + R v 2 c ϕ 0 θ ˙ 0 + R v 2 c ϕ R v 1 v 2 θ 0 0 ψ ˙ ,
where R v 2 c ϕ and R v 1 v 2 θ are rotation matrices defined as:
R v 2 c ϕ = 1 0 0 0 C ϕ S ϕ 0 S ϕ C ϕ ,
R v 1 v 2 θ = C θ 0 S θ 0 1 0 S θ 0 C θ .
The products R v 2 c ϕ 0 θ ˙ 0 and R v 2 c ϕ R v 1 v 2 θ 0 0 ψ ˙ are defined as it is expressed below:
R v 2 c ϕ 0 θ ˙ 0 = 1 0 0 0 C ϕ S ϕ 0 S ϕ C ϕ 0 θ ˙ 0 = 0 C ϕ θ ˙ S ϕ θ ˙ = 0 C ϕ S ϕ θ ˙ ,
R v 2 c ϕ R v 1 v 2 θ = 1 0 0 0 C ϕ S ϕ 0 S ϕ C ϕ C θ 0 S θ 0 1 0 S θ 0 C θ ,
R v 2 c ϕ R v 1 v 2 θ = C θ 0 S θ S ϕ S θ C ϕ S ϕ C θ C ϕ S θ S ϕ C ϕ C θ ,
R v 2 c ϕ R v 1 v 2 θ 0 0 ψ ˙ = C θ 0 S θ S ϕ S θ C ϕ S ϕ C θ C ϕ S θ S ϕ C ϕ C θ 0 0 ψ ˙ ,
R v 2 c ϕ R v 1 v 2 θ 0 0 ψ ˙ = S θ ψ ˙ S ϕ C θ ψ ˙ C ϕ C θ ψ ˙ = S θ S ϕ C θ C ϕ C θ ψ ˙ .
Finally, the vector ω c is defined as:
ω c 1 ω c 2 ω c 3 = 1 0 0 ϕ ˙ + 0 C ϕ S ϕ θ ˙ + S θ S ϕ C θ C ϕ C θ ψ ˙ ,
ω c 1 ω c 2 ω c 3 = 1 0 S θ 0 C ϕ S ϕ C θ 0 S ϕ C ϕ C θ ϕ ˙ θ ˙ ψ ˙ .
The expression above can also be rewritten as:
ω c 1 ω c 2 ω c 3 = S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 ψ ˙ θ ˙ ϕ ˙ .
The expression above can also be written in a generalized form as:
ω c = W η η ˙ ,
so that, Expression (26) is proved:
W η = S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 ,
solving η ˙ in the previous expression, it is obtained:
η ˙ = W η 1 ω c .
Regarding Expression (29), its calculation is defined as:
J = W η T I W η ,
J = S θ S ϕ C θ C ϕ C θ 0 C ϕ S ϕ 1 0 0 I x x 0 0 0 I y y 0 0 0 I z z S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 ,
J = I x x S 2 θ + I y y S 2 ϕ C 2 θ + I z z C 2 ϕ C 2 θ S ϕ C θ C ϕ ( I y y I z z ) I x x S θ S ϕ C θ C ϕ ( I y y I z z ) I y y C 2 ϕ + I z z S 2 ϕ 0 I x x S θ 0 I x x .
The expression denoted by (30) has the following alternative representation:
T r o t a t i o n a l = 1 2 ω c T I ω c = 1 2 η ˙ T W η T I W η η ˙ = 1 2 η ˙ T J η ˙ .
Expression (35) can be alternatively represented by:
τ η T = d d t ω c T I ω c η ˙ ω c T I ω c η ,
and, given ω c = W η η ˙ :
ω c η ˙ = W η = S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 .
Considering the previous expressions, ω c T I ω c η ˙ can be calculated as established below:
ω c T I ω c η ˙ = S θ ψ ˙ + ϕ ˙ S ϕ C θ ψ ˙ + C ϕ θ ˙ C ϕ C θ ψ ˙ S ϕ θ ˙ T I x x 0 0 0 I y y 0 0 0 I z z S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 ,
I ω c η ˙ = I W η = I x x 0 0 0 I y y 0 0 0 I z z S θ 0 1 S ϕ C θ C ϕ 0 C ϕ C θ S ϕ 0 ,
I ω c η ˙ = I W η = I x x S θ 0 I x x I y y S ϕ C θ I y y C ϕ 0 I z z C ϕ C θ I z z S ϕ 0 ,
ω c T I ω c η ˙ = ω c T I W η = g 1 g 2 g 3 ,
where:
g 1 = I x x S 2 θ ψ ˙ S θ ϕ ˙ + I y y S 2 ϕ C 2 θ ψ ˙ + C ϕ S ϕ C θ θ ˙ + I z z C 2 ϕ C 2 θ ψ ˙ S ϕ C ϕ C θ θ ˙ ,
g 2 = I y y S ϕ C θ C ϕ ψ ˙ + C 2 ϕ θ ˙ + I z z C ϕ C θ S ϕ ψ ˙ + S 2 ϕ θ ˙ ,
g 3 = I x x S θ ψ ˙ + ϕ ˙ .
The calculated values of g 1 , g 2 and g 3 can be alternatively expressed as:
g 1 g 2 g 3 T = L r o t a c i o n a l η ˙ = J η ˙ .
Calculating d d t ω c T I ω c η ˙ , it is obtained:
g 1 ˙ = I x x C θ θ ˙ ϕ ˙ S θ ϕ ¨ + 2 S θ C θ θ ˙ ψ ˙ + ψ ¨ S 2 θ + I y y ( S 2 ϕ C θ ϕ ˙ θ ˙ + C 2 ϕ C θ ϕ ˙ θ ˙ S θ C ϕ S ϕ θ ˙ 2 + θ ¨ C θ C ϕ S ϕ + 2 S ϕ C ϕ ϕ ˙ ψ ˙ C 2 θ 2 C θ S θ θ ˙ ψ ˙ S 2 ϕ + ψ ¨ S 2 ϕ C 2 θ ) + I z z ( 2 C ϕ S ϕ C 2 θ ϕ ˙ ψ ˙ 2 C θ S θ C 2 ϕ θ ˙ ψ ˙ + ψ ¨ C 2 ϕ C 2 θ C 2 ϕ C θ ϕ ˙ θ ˙ + S 2 ϕ C θ ϕ ˙ θ ˙ + S θ S ϕ C ϕ θ ˙ 2 θ ¨ C θ S ϕ C ϕ ) ,
g 2 ˙ = I y y C 2 ϕ C θ ϕ ˙ ψ ˙ S θ S ϕ C ϕ θ ˙ ψ ˙ S 2 ϕ C θ ϕ ˙ ψ ˙ + C ϕ S ϕ C θ ψ ¨ 2 C ϕ S ϕ ϕ ˙ θ ˙ + θ ¨ C 2 ϕ + I z z ( S 2 ϕ C θ ϕ ˙ ψ ˙ + S θ C ϕ S ϕ θ ˙ ψ ˙ C 2 ϕ C θ ϕ ˙ ψ ˙ S ϕ C ϕ C θ ψ ¨ + 2 S ϕ C ϕ ϕ ˙ θ ˙ + θ ¨ S 2 ϕ ) ,
g 3 ˙ = I x x ( C θ θ ˙ ψ ˙ S θ ψ ¨ + ϕ ¨ ) .
The calculated values of g 1 ˙ , g 2 ˙ and g 3 ˙ can be alternatively expressed as:
g 1 ˙ g 2 ˙ g 3 ˙ T = d d t L r o t a c i o n a l η ˙ = J η ¨ + J ˙ η ˙ .
Calculating the partial derivatives of ω c = W η η ˙ regarding η , it is obtained:
ω c η = 0 C θ ψ ˙ 0 0 S ϕ S θ ψ ˙ C ϕ C θ ψ ˙ S ϕ θ ˙ 0 C ϕ S θ ψ ˙ S ϕ C θ ψ ˙ C ϕ θ ˙ .
According to the aforesaid, calculating ω c T I ω c η it is obtained:
ω c T I ω c η = S θ ψ ˙ + ϕ ˙ S ϕ C θ ψ ˙ + C ϕ θ ˙ C ϕ C θ ψ ˙ S ϕ θ ˙ T I x x 0 0 0 I y y 0 0 0 I z z 0 C θ ψ ˙ 0 0 S ϕ S θ ψ ˙ C ϕ C θ ψ ˙ S ϕ θ ˙ 0 C ϕ S θ ψ ˙ S ϕ C θ ψ ˙ C ϕ θ ˙ ,
ω c T I ω c η = s 1 s 2 s 3 ,
where:
s 1 = 0 ,
s 2 = I x x S θ C θ ψ ˙ 2 C θ ϕ ˙ ψ ˙ + I y y S 2 ϕ C θ S θ ψ ˙ 2 C ϕ S ϕ S θ θ ˙ ψ ˙ + I z z ( C 2 ϕ C θ S θ ψ ˙ 2 + S ϕ C ϕ S θ θ ˙ ψ ˙ ) ,
s 3 = I y y S ϕ C ϕ C 2 θ ψ ˙ 2 + C 2 ϕ C θ θ ˙ ψ ˙ S 2 ϕ C θ ψ ˙ θ ˙ C ϕ S ϕ θ ˙ 2 + I z z ( C ϕ C 2 θ S ϕ ψ ˙ 2 + S 2 ϕ C θ θ ˙ ψ ˙ C 2 ϕ C θ ψ ˙ θ ˙ + S ϕ C ϕ θ ˙ 2 ) .
The calculated values of g 1 ˙ , g 2 ˙ , g 3 ˙ , s 1 , s 2 and s 3 can be expressed in the form of the Euler–Lagrange equations described by Expression (35), resulting as follows:
τ ψ τ θ τ ϕ = g 1 ˙ g 2 ˙ g 3 ˙ s 1 s 2 s 3 .
The expression above is represented alternatively as:
τ ψ τ θ τ ϕ = g 1 ˙ s 1 g 2 ˙ s 2 g 3 ˙ s 3 ,
where:
τ ψ = I x x C θ θ ˙ ϕ ˙ S θ ϕ ¨ + 2 S θ C θ θ ˙ ψ ˙ + ψ ¨ S 2 θ + I y y ( S 2 ϕ C θ ϕ ˙ θ ˙ + C 2 ϕ C θ ϕ ˙ θ ˙ S θ C ϕ S ϕ θ ˙ 2 + θ ¨ C θ C ϕ S ϕ + 2 S ϕ C ϕ ϕ ˙ ψ ˙ C 2 θ 2 C θ S θ θ ˙ ψ ˙ S 2 ϕ + ψ ¨ S 2 ϕ C 2 θ ) + I z z ( 2 C ϕ S ϕ C 2 θ ϕ ˙ ψ ˙ 2 C θ S θ C 2 ϕ θ ˙ ψ ˙ + ψ ¨ C 2 ϕ C 2 θ C 2 ϕ C θ ϕ ˙ θ ˙ + S 2 ϕ C θ ϕ ˙ θ ˙ + S θ S ϕ C ϕ θ ˙ 2 θ ¨ C θ S ϕ C ϕ ) ,
τ θ = I x x S θ C θ ψ ˙ 2 + C θ ϕ ˙ ψ ˙ + I y y ( C 2 ϕ C θ ϕ ˙ ψ ˙ S 2 ϕ C θ ϕ ˙ ψ ˙ + C ϕ S ϕ C θ ψ ¨ 2 C ϕ S ϕ ϕ ˙ θ ˙ + θ ¨ C 2 ϕ + S 2 ϕ C θ S θ ψ ˙ 2 ) + I z z ( S 2 ϕ C θ ϕ ˙ ψ ˙ C 2 ϕ C θ ϕ ˙ ψ ˙ S ϕ C ϕ C θ ψ ¨ + 2 S ϕ C ϕ ϕ ˙ θ ˙ + θ ¨ S 2 ϕ + C 2 ϕ C θ S θ ψ ˙ 2 ) ,
τ ϕ = I x x C θ θ ˙ ψ ˙ S θ ψ ¨ + ϕ ¨ + I y y ( S ϕ C ϕ C 2 θ ψ ˙ 2 C 2 ϕ C θ θ ˙ ψ ˙ + S 2 ϕ C θ ψ ˙ θ ˙ + C ϕ S ϕ θ ˙ 2 ) + I z z ( C ϕ C 2 θ S ϕ ψ ˙ 2 S 2 ϕ C θ θ ˙ ψ ˙ + C 2 ϕ C θ ψ ˙ θ ˙ S ϕ C ϕ θ ˙ 2 ) .
Gathering terms in the expressions above, these can be described in the following way:
τ ψ = ψ ¨ ( I x x S 2 θ + I y y S 2 ϕ C 2 θ + I z z C 2 ϕ C 2 θ ) + θ ¨ ( I y y C θ C ϕ S ϕ I z z C θ S ϕ C ϕ ) + ϕ ¨ I x x S θ + ψ ˙ ( I x x S θ C θ θ ˙ + I y y S ϕ C ϕ C 2 θ ϕ ˙ I y y C θ S θ S 2 ϕ θ ˙ I z z C ϕ S ϕ C 2 θ ϕ ˙ I z z C θ S θ C 2 ϕ θ ˙ ) + θ ˙ ( I x x S θ C θ ψ ˙ I y y S 2 ϕ C θ ϕ ˙ + I y y C 2 ϕ C θ ϕ ˙ I y y S θ C ϕ S ϕ θ ˙ I y y C θ S θ S 2 ϕ ψ ˙ I z z C θ S θ C 2 ϕ ψ ˙ I z z C 2 ϕ C θ ϕ ˙ + I z z S 2 ϕ C θ ϕ ˙ + I z z S θ S ϕ C ϕ θ ˙ ) + ϕ ˙ ( I x x C θ θ ˙ + I y y S ϕ C ϕ C 2 θ ψ ˙ I z z C ϕ S ϕ C 2 θ ψ ˙ ) ,
τ θ = ψ ¨ I y y C ϕ S ϕ C θ I z z S ϕ C ϕ C θ + θ ¨ I y y C 2 ϕ + I z z S 2 ϕ + ϕ ¨ 0 + ψ ˙ ( I x x S θ C θ ψ ˙ + I y y S 2 ϕ C θ S θ ψ ˙ + I z z C 2 ϕ C θ S θ ψ ˙ ) + θ ˙ ( I y y C ϕ S ϕ ϕ ˙ + I z z S ϕ C ϕ ϕ ˙ ) + ϕ ˙ ( I x x C θ ψ ˙ + I y y C 2 ϕ C θ ψ ˙ I y y S 2 ϕ C θ ψ ˙ I y y C ϕ S ϕ θ ˙ + I z z S 2 ϕ C θ ψ ˙ I z z C 2 ϕ C θ ψ ˙ + I z z S ϕ C ϕ θ ˙ ) ,
τ ϕ = ψ ¨ I x x S θ + θ ¨ 0 + θ ¨ I x x + ψ ˙ ( I y y S ϕ C ϕ C 2 θ ψ ˙ + I z z C ϕ C 2 θ S ϕ ψ ˙ ) + θ ˙ ( I x x C θ ψ ˙ I y y C 2 ϕ C θ ψ ˙ + I y y S 2 ϕ C θ ψ ˙ + I y y C ϕ S ϕ θ ˙ I z z S 2 ϕ C θ ψ ˙ + I z z C 2 ϕ C θ ψ ˙ I z z S ϕ C ϕ θ ˙ ) + ϕ ˙ ( 0 ) .
The previous expressions that define τ ψ , τ θ and τ ϕ can be written in the following form:
τ η = E ( η ) η ¨ + C η , η ˙ η ˙ ,
where:
E η = I x x S 2 θ + I y y S 2 ϕ C 2 θ + I z z C 2 ϕ C 2 θ S ϕ C θ C ϕ ( I y y I z z ) I x x S θ S ϕ C θ C ϕ ( I y y I z z ) I y y C 2 ϕ + I z z S 2 ϕ 0 I x x S θ 0 I x x ,
C η , η ˙ = J ˙ 1 2 η η ˙ T J = C 11 C 12 C 13 C 21 C 22 C 23 C 31 C 32 C 33 .
Notice that E η = J = J T and the Coriolis matrix’s elements C η , η ˙ are defined as:
C 11 = I x x S θ C θ θ ˙ + I y y S ϕ C ϕ C 2 θ ϕ ˙ C θ S θ S 2 ϕ θ ˙ + I z z ( C ϕ S ϕ C 2 θ ϕ ˙ C θ S θ C 2 ϕ θ ˙ ) ,
C 12 = I x x S θ C θ ψ ˙ + I y y S 2 ϕ C θ ϕ ˙ + C 2 ϕ C θ ϕ ˙ S θ C ϕ S ϕ θ ˙ C θ S θ S 2 ϕ ψ ˙ + I z z ( C θ S θ C 2 ϕ ψ ˙ C 2 ϕ C θ ϕ ˙ + S 2 ϕ C θ ϕ ˙ + S θ S ϕ C ϕ θ ˙ ) ,
C 13 = I x x C θ θ ˙ + I y y S ϕ C ϕ C 2 θ ψ ˙ I z z C ϕ S ϕ C 2 θ ψ ˙ ,
C 21 = I x x S θ C θ ψ ˙ + I y y S 2 ϕ C θ S θ ψ ˙ + I z z C 2 ϕ C θ S θ ψ ˙ ,
C 22 = I y y C ϕ S ϕ ϕ ˙ + I z z S ϕ C ϕ ϕ ˙ ,
C 23 = I x x C θ ψ ˙ + I y y C 2 ϕ C θ ψ ˙ S 2 ϕ C θ ψ ˙ C ϕ S ϕ θ ˙ + I z z ( S 2 ϕ C θ ψ ˙ C 2 ϕ C θ ψ ˙ + S ϕ C ϕ θ ˙ ) ,
C 31 = I y y S ϕ C ϕ C 2 θ ψ ˙ + I z z C ϕ C 2 θ S ϕ ψ ˙ ,
C 32 = I x x C θ ψ ˙ + I y y C 2 ϕ C θ ψ ˙ + S 2 ϕ C θ ψ ˙ + C ϕ S ϕ θ ˙ + I z z ( S 2 ϕ C θ ψ ˙ + C 2 ϕ C θ ψ ˙ S ϕ C ϕ θ ˙ ) ,
C 33 = 0 .

Appendix B

The function g n that can be seen in (60) can be represented alternatively by the following expression:
g n = 1 n n = 1 k c i , k = E c i , k = 1 n m = 1 k 1 c i , m + c i , k .
Evaluating function g n in n 1 , the following expression is obtained:
g n 1 = 1 n 1 m = 1 k 1 c i , m .
Solving the expression above, it is obtained:
n 1 g n 1 = m = 1 k 1 c i , m .
Substituting the previous result in the definition of g n , its recursive and iterative version is finally obtained, which is presented as follows:
g n = 1 n n 1 g n 1 + c i , k .

References

  1. Guevara, P.; Medel, J.J. Introducción a los Sistemas en Tiempo Real; Instituto Politécnico Nacional: Mexico City, Mexico, 2003. [Google Scholar]
  2. Medel, J.J.; Guevara, P.; Cruz, D. Temas Selectos de Sistemas en Tiempo Real; Instituto Politécnico Nacional: Mexico City, Mexico, 2007. [Google Scholar]
  3. Zhang, Z.; Tian, Z.; Zhou, M.; Nie, W.; Li, Z. Riddle: Real-Time Interacting with Hand Description via Millimeter-Wave Sensor. In Proceedings of the 2018 IEEE International Conference on Communications (ICC), Kansas City, MO, USA, 20–24 May 2018. [Google Scholar]
  4. Nyquist, H. Certain Topics in Telegraph Transmission Theory. Trans. Am. Inst. Electr. Eng. 1928, 47, 617–644. [Google Scholar] [CrossRef]
  5. Kotel’nikov, V.A. On the transmission capacity of “ether” and wire in electrocomunications. Phys.-Uspekhi 2006, 49, 736. [Google Scholar] [CrossRef]
  6. Cortez, A. Teoría de la complejidad computacional y teoría de la computabilidad. Investig. Sist. Inform. 2004, 10, 102–105. [Google Scholar]
  7. Bahabry, A.; Ghazzai, H.; Vesonder, G.; Massoud, Y. Space-Time Low Complexity Algorithms for Scheduling a Fleet of UAVs in Smart Cities Using Dimensionality Reduction Approaches. In Proceedings of the IEEE International Systems Conference, Orlando, FL, USA, 8–11 April 2019. [Google Scholar]
  8. Castillo, P.; García, P.; Lozano, R.; Albertos, P. Modelado y estabilización de un helicóptero con cuatro rotores. Rev. Iberoam. Autom. Inform. Ind. 2007, 4, 41–57. [Google Scholar] [CrossRef] [Green Version]
  9. Salazar, S.; Romero, H.; Lozano, R.; Castillo, P. Unmanned Aircraft Systems; Springer: Dordrecht, The Netherlands, 2008; pp. 455–470. [Google Scholar]
  10. Carrillo, L.R.G.; López, A.E.D.; Lozano, R.; Pégard, C. Quad Rotorcraft Control: Vision-Based Hovering and Navigation; Springer Science and Business Media: Heidelberg, Germany; London, UK, 2012. [Google Scholar]
  11. Avanzini, G.; Thomson, D.; Torasso, A. Model predictive control architecture for rotorcraft inverse simulation. J. Guid. Control Dyn. 2013, 36, 207–217. [Google Scholar] [CrossRef] [Green Version]
  12. Muñoz, M.P.; Fortaleza, E.F.; da Silva, J.A. Modelamiento matemático y control de un helicóptero de cuatro motores. Sci. Tech. 2013, 18, 672–681. [Google Scholar]
  13. Reinoso, M.J.; Minchala, L.I.; Ortiz, P.; Astudillo, D.F.; Verdugo, D. Trajectory tracking of a quadrotor using sliding mode control. IEEE Lat. Am. Trans. 2016, 14, 2157–2166. [Google Scholar] [CrossRef] [Green Version]
  14. Xu, B. Disturbance observer-based dynamic surface control of transport aircraft with continuous heavy cargo airdrop. IEEE Trans. Syst. Man Cybern. Syst. 2016, 47, 161–170. [Google Scholar] [CrossRef]
  15. Xu, B. Composite learning finite-time control with application to quadrotors. IEEE Trans. Syst. Man Cybern. Syst. 2017, 48, 1806–1815. [Google Scholar] [CrossRef]
  16. Gonzalez, F.A.; Afanador, M.E.; Niño, E.F. Modelamiento y simulación de un quadrotor mediante la integración de Simulink y SolidWorks. MASKAY 2019, 9, 15–24. [Google Scholar] [CrossRef]
  17. Liu, Z.; Liu, X.; Chen, J.; Fang, C. Altitude control for variable load quadrotor via learning rate based robust sliding mode controller. IEEE Access 2019, 7, 9736–9744. [Google Scholar] [CrossRef]
  18. Kusznir, T.; Smoczek, J. Sliding mode-based control of a UAV quadrotor for suppressing the cable-suspended payload vibration. J. Control Sci. Eng. 2020, 2020, 5058039. [Google Scholar] [CrossRef]
  19. López, J.C.; Cervantes, J.S.; Ordaz, P. Control adaptable para un vehículo aéreo no tripulado ante cambios de carga útil con aplicaciones en agricultura de precisión. Pädi Bol. Cient. Cienc. Básicas Ing. ICBI 2022, 9, 92–99. [Google Scholar]
  20. Guerrero, M.E.; Hernández, O.; Lozano, R.; García, C.D.; Valencia, G.; López, F.R. Energy-based control and LMI-based control for a quadrotor transporting a payload. Mathematics 2019, 7, 1090. [Google Scholar] [CrossRef] [Green Version]
  21. Meyer, J.; Sendobry, A.; Kohlbrecher, S.; Klingauf, U.; von Stryk, O. Comprehensive Simulation of Quadrotor UAVs Using ROS and Gazebo. In Simulation, Modeling, and Programming for Autonomous Robots, Proceedings of the International Conference on Simulation, Modeling, and Programming for Autonomous Robots Tsukuba, Tsukuba, Japan, 5–8 November 2012; Noda, I., Ando, N., Brugali, D., Kuffner, J.J., Eds.; Springer: Heidelberg/Berlin, Germany, 2012. [Google Scholar]
  22. Yunlong, S.; Selim, N.; Elia, K.; Antonio, L.; Davide, S. Flightmare: A Flexible Quadrotor Simulator. In Proceedings of the 4th Conference on Robot Learning, Cambridge, MA, USA, 16–18 November 2020. [Google Scholar]
  23. Abhishek, K.; Mangal, K.; Abhishek, A. Generalized Flight Dynamic Model of Quadrotor Using Hybrid Blade Element Momentum Theory. J. Aircr. 2018, 55, 2162–2168. [Google Scholar]
  24. Zhenhua, J.; Ashish, P. A Real-Time Computing Platform for UAS System Dynamics and Control Simulation. In Proceedings of the AIAA Propulsion and Energy Forum, Reston, VA, USA, 27 June–1 July 2021. [Google Scholar]
  25. Morelos, J.C.; Delgado, G.; López, A. Configuración PIC-Raspberry Pi® modelo B, con fines de monitoreo de señales analógicas. In Proceedings of the Mexican International Congress on Computer Systems, Centro Universitario UAEM Valle de México, Ciudad López Mateos, México, 10 February 2015. [Google Scholar]
  26. Liu, J. Real-Time Systems; Prentice Hall: Hoboken, NJ, USA, 2000. [Google Scholar]
  27. Burns, A.; Wellings, A. Real-Time Systems and Programming Languages; Pearson Education: London, UK, 1997. [Google Scholar]
  28. Stankovic, J.; Spuri, M.; Ramamritham, K.; Buttazzo, G. Deadline Scheduling for Real-Time Systems; Kluwer Academic Publishers: Norwell, MA, USA, 1998. [Google Scholar]
  29. Valdez, J.S.; Guevara, P.; Delgado, G. Execution Times Reconstruction in a LTI System Real-time Simulation. IEEE Lat. Am. Trans. 2014, 12, 277–284. [Google Scholar] [CrossRef]
  30. Delgado, G.; Guevara, P.; Loboda, I.; Hernandez, L.; Ramirez, J.; Valdez, J.S.; Lopez, A. State vector identification of hybrid model of a gas turbine by real-time Kalman filter. Mathematics 2020, 8, 659. [Google Scholar] [CrossRef]
  31. Zhou, J.; Yan, J.; Cao, K.; Tan, Y.; Wei, T.; Chen, M.; Zhang, G.; Chen, X.; Hu, S. Thermal-aware correlated two-level scheduling of real-time tasks with reduced processor energy on heterogeneous MPSoCs. J. Syst. Archit. 2018, 82, 1–11. [Google Scholar] [CrossRef]
  32. Reghenzani, F.; Massari, G.; Fornaciari, W. The real-time linux kernel: A survey on PREEMPT_RT. ACM Comput. Surv. 2019, 52, 18–36. [Google Scholar] [CrossRef]
  33. Gonzalez, D.; Guevara, P.; Cano, J.; Valdez, J.; Lopez, A. Response Times Reconstructor Based on Mathematical Expectation Quotient for a High Priority Task over RT-Linux. Mathematics 2022, 10, 134. [Google Scholar] [CrossRef]
  34. Alhakkak, N. Simulation Scheduling Real Time Systems using Smart Genetic Algorithms. In Proceedings of the 2021 International Conference on Emerging Smart Computing and Informatics (ESCI), Pune, India, 5–7 March 2021. [Google Scholar]
  35. Li, J.; Zheng, G.; Zhang, H.; Shi, G. Task Scheduling Algorithm for Heterogeneous Real-time Systems Based on Deadline Constraints. In Proceedings of the 2019 IEEE 9th International Conference on Electronics Information and Emergency Communication (ICEIEC), Beijing, China, 12–14 July 2019. [Google Scholar]
  36. Sun, Y.; Fei, T.; Li, X.; Warnecke, A.; Warsitz, E.; Pohl, N. Real-Time Radar-Based Gesture Detection and Recognition Built in an Edge-Computing Platform. IEEE Sens. J. 2020, 20, 10706–10716. [Google Scholar] [CrossRef]
  37. Valdez, J.; Delgado, G.; Guevara, P.; Cano, J. Transmission Times Reconstruction in a Telecontrolled Real-Time System. IEEE Lat. Am. Trans. 2019, 17, 349–357. [Google Scholar] [CrossRef]
Figure 1. Quadrotor kinematics and frames of reference.
Figure 1. Quadrotor kinematics and frames of reference.
Mathematics 10 02032 g001
Figure 2. Quadrotor’s possible movements. (a) Movement along with the x-axis. (b) Movement along with the y-axis. (c) Orientation with respect to the z-axis ( ψ angle). (d) Movement along with the z-axis (elevation).
Figure 2. Quadrotor’s possible movements. (a) Movement along with the x-axis. (b) Movement along with the y-axis. (c) Orientation with respect to the z-axis ( ψ angle). (d) Movement along with the z-axis (elevation).
Mathematics 10 02032 g002
Figure 3. Time constraints of an RTT’s instance.
Figure 3. Time constraints of an RTT’s instance.
Mathematics 10 02032 g003
Figure 4. (a) General approach to the characterization of the execution times of the RTT instances. (b) Specific approach based on the eviction of the RTT due to scheduler; where c i , k and c i , k are the execute time obtained by the eviction of the j i , k .
Figure 4. (a) General approach to the characterization of the execution times of the RTT instances. (b) Specific approach based on the eviction of the RTT due to scheduler; where c i , k and c i , k are the execute time obtained by the eviction of the j i , k .
Mathematics 10 02032 g004
Figure 5. Angular velocities ϕ , θ , ψ .
Figure 5. Angular velocities ϕ , θ , ψ .
Mathematics 10 02032 g005
Figure 6. Angular positions ϕ , θ , ψ .
Figure 6. Angular positions ϕ , θ , ψ .
Mathematics 10 02032 g006
Figure 7. Translational velocities x, y.
Figure 7. Translational velocities x, y.
Mathematics 10 02032 g007
Figure 8. Translational velocities x, y, z.
Figure 8. Translational velocities x, y, z.
Mathematics 10 02032 g008
Figure 9. Translational positions x, y.
Figure 9. Translational positions x, y.
Mathematics 10 02032 g009
Figure 10. Translational positions x, y, z.
Figure 10. Translational positions x, y, z.
Mathematics 10 02032 g010
Figure 11. Execution times of the programmed real-time task using different priorities.
Figure 11. Execution times of the programmed real-time task using different priorities.
Mathematics 10 02032 g011
Figure 12. First probability moment of the real-time task’s execution times programmed using different priorities.
Figure 12. First probability moment of the real-time task’s execution times programmed using different priorities.
Mathematics 10 02032 g012
Figure 13. Possible behaviors of the temporary complexity of polynomial and non-polynomial time algorithms.
Figure 13. Possible behaviors of the temporary complexity of polynomial and non-polynomial time algorithms.
Mathematics 10 02032 g013
Figure 14. Definition of upper or lower bound using function g ( n ) for temporary complexity analysis.
Figure 14. Definition of upper or lower bound using function g ( n ) for temporary complexity analysis.
Mathematics 10 02032 g014
Figure 15. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 19.
Figure 15. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 19.
Mathematics 10 02032 g015
Figure 16. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 9.
Figure 16. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 9.
Mathematics 10 02032 g016
Figure 17. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 0.
Figure 17. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 0.
Mathematics 10 02032 g017
Figure 18. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 9 .
Figure 18. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 9 .
Mathematics 10 02032 g018
Figure 19. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 19 .
Figure 19. Temporary computational complexity analysis of the real-time quadrotor simulation algorithm using priority 19 .
Mathematics 10 02032 g019
Table 1. Parameters used for the real-time simulation of the drone dynamic model.
Table 1. Parameters used for the real-time simulation of the drone dynamic model.
ParameterParameter ValueUnits
Quadrotor’s mass (m)1.4Kg
Engine mass0.088Kg
Arm length1.0m
Axis x inertia ( I x x )0.0116Kg m 2
Axis y inertia ( I y y )0.0116Kg m 2
Axis z inertia ( I z z )0.0232Kg m 2
Table 2. Classification of the temporary computational complexity of an algorithm based on the behavior analysis of T ( n ) .
Table 2. Classification of the temporary computational complexity of an algorithm based on the behavior analysis of T ( n ) .
TCCRelationship of T ( n ) and g D n Execution Times
Exponential Complexity g D n = 2 n c e i , k
Quadratic Complexity g D n = n 2 c c i , k | c c i , k < c e i , k
Linear Complexity g D n = n c l i , k | c l i , k < c c i , k
Logarithmic Complexity g D n = log ( n ) c l o g i , k | c l o g i , k < c l i , k
Constant Complexity g D ( n ) = 1 c c t i , k | c c t i , k < c l o g i , k
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Delgado-Reyes, G.; Valdez-Martínez, J.S.; Hernández-Pérez, M.Á.; Pérez-Daniel, K.R.; García-Ramírez, P.J. Quadrotor Real-Time Simulation: A Temporary Computational Complexity-Based Approach. Mathematics 2022, 10, 2032. https://doi.org/10.3390/math10122032

AMA Style

Delgado-Reyes G, Valdez-Martínez JS, Hernández-Pérez MÁ, Pérez-Daniel KR, García-Ramírez PJ. Quadrotor Real-Time Simulation: A Temporary Computational Complexity-Based Approach. Mathematics. 2022; 10(12):2032. https://doi.org/10.3390/math10122032

Chicago/Turabian Style

Delgado-Reyes, Gustavo, Jorge Salvador Valdez-Martínez, Miguel Ángel Hernández-Pérez, Karina Ruby Pérez-Daniel, and Pedro Javier García-Ramírez. 2022. "Quadrotor Real-Time Simulation: A Temporary Computational Complexity-Based Approach" Mathematics 10, no. 12: 2032. https://doi.org/10.3390/math10122032

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop