**6.1 Elliptical helix trajectory**

The first trajectory waypoints (**Table 3**) describe an elliptical helix in a forward trajectory along with the *x* axis of inertial frame **i***x*.


**Table 3.** *Waypoints test 1.*

With this set it was calculated the desired optimal trajectory. Using this trajectory the PSO algorithm calculates the optimal gains for each of the three evaluated control algorithms.

With this gains the simulation was performed and validation errors in each of the four coordinates were registered. **Tables 4**–**6** present the gains used in each case, and corresponding validation errors.

When calculating the gains using PSO it was observed that the processing time increases substantially with the initial orientation angle (*ϕ*ð Þ 0 ). It was also observed in cases 2 and 3 that once a set of optimal gains is calculated, later results do not reduce substantially the validation error.

Small angle control is more sensible to variations in rotational positions as observed in the results. Optimal small angle control gains are bigger than rotational (**Tables 4**–**6**). The opposite occurs for DTV and geometric tracking.

Case 3 is the most challenging since the quadrotor starts almost upside down. Geometric tracking controller is more sensitive to noise error, PSO did not succeed in finding a set of gains in Case 3.

A visual validation is possible using the tool. Graphics in **Figure 3** show the performance of small angle control in Case 3. The quadrotor drops and recoverers the vertical position, and continues along with the desired trajectory. Graphics on the right supports a visual validation of position and orientation variables.

In the graphics of propellers'speeds of **Figure 4**, dashed red lines indicate the speed extremes. In extreme situations, the controller attains the propellers' limits.

**Figure 5** presents the performance of DTV Control on Case 3. It is observed a faster reaction and a more accurate trajectory following.

Near the third point the trajectory leads the quadrotor to its limits. Propellers' speeds in **Figure 6** show a more stable performance than the previous strategy.


#### **Table 4.**

*Elliptical helix trajectory case 1, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>0</sup><sup>∘</sup> *.*


#### **Table 5.**

*Elliptical helix trajectory case 2, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>88</sup><sup>∘</sup> *.*


Compared with small angle, this strategy seems to be more robust and accurate. **Figure 7** presents the performance of geometric tracking control in Case 2. This strategy reacts faster to challenging situations, since it recovers in a shorter

*.*

*.*

**Figure 3.**

**Figure 4.**

**Figure 5.**

**113**

*Elliptical helix trajectory case 3 small angle control, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>178</sup><sup>∘</sup>

*DOI: http://dx.doi.org/10.5772/intechopen.97435*

*Quadrotor Unmanned Aerial Vehicles: Visual Interface for Simulation and Control…*

*Propellers' speeds in rpm with small angle control.*

*Elliptical Helix Trajectory Case 3 DTV Control, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>178</sup><sup>∘</sup>

#### **Table 6.**

*Elliptical helix trajectory case 3, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>178</sup><sup>∘</sup> *.* *Quadrotor Unmanned Aerial Vehicles: Visual Interface for Simulation and Control… DOI: http://dx.doi.org/10.5772/intechopen.97435*

**Figure 3.** *Elliptical helix trajectory case 3 small angle control, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>178</sup><sup>∘</sup> *.*

**Figure 4.** *Propellers' speeds in rpm with small angle control.*

#### **Figure 5.**

*Elliptical Helix Trajectory Case 3 DTV Control, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>178</sup><sup>∘</sup> *.*

Compared with small angle, this strategy seems to be more robust and accurate. **Figure 7** presents the performance of geometric tracking control in Case 2. This strategy reacts faster to challenging situations, since it recovers in a shorter

With this set it was calculated the desired optimal trajectory. Using this trajectory the PSO algorithm calculates the optimal gains for each of the three evaluated

With this gains the simulation was performed and validation errors in each of the four coordinates were registered. **Tables 4**–**6** present the gains used in each

When calculating the gains using PSO it was observed that the processing time increases substantially with the initial orientation angle (*ϕ*ð Þ 0 ). It was also observed in cases 2 and 3 that once a set of optimal gains is calculated, later results do not

Small angle control is more sensible to variations in rotational positions as observed in the results. Optimal small angle control gains are bigger than rotational

Case 3 is the most challenging since the quadrotor starts almost upside down. Geometric tracking controller is more sensitive to noise error, PSO did not succeed

A visual validation is possible using the tool. Graphics in **Figure 3** show the performance of small angle control in Case 3. The quadrotor drops and recoverers the vertical position, and continues along with the desired trajectory. Graphics on

In the graphics of propellers'speeds of **Figure 4**, dashed red lines indicate the speed extremes. In extreme situations, the controller attains the propellers' limits. **Figure 5** presents the performance of DTV Control on Case 3. It is observed a

Near the third point the trajectory leads the quadrotor to its limits. Propellers' speeds in **Figure 6** show a more stable performance than the previous strategy.

**Control Strategy** *Kp Kd KR K<sup>ν</sup> xv* **%** *yv* **%** *zv* **%** *ψ<sup>v</sup>* **%** Small Angle 17.96 7.11 0.231 0.16 1.373 7.763 6.301 1.0300 DTV 18.91 10.77 44.920 23.43 2.112 4.907 5.300 0.6455 Geometric Tracking 7.34 7.35 90.590 20.75 3.172 8.807 26.680 0.3973

**Control Strategy** *Kp Kd KR K<sup>ν</sup> xv* **%** *yv* **%** *zv* **%** *ψ<sup>v</sup>* **%** Small Angle 22.76 2.00 0.765 0.197 2.01 32.69 26.22 0.6344 DTV 19.70 4.85 155.400 26.710 1.58 22.03 27.65 0.4949 Geometric Tracking 8.24 5.62 220.200 27.670 3.17 35.94 51.57 0.4027

**Control Strategy** *Kp Kd KR K<sup>ν</sup> xv* **%** *yv* **%** *zv* **%** *ψ<sup>v</sup>* **%** Small Angle 8.180 2.349 2.45 0.4371 5.988 64.98 146.1 1.223 DTV 7.268 3.434 236.40 31.4300 4.709 33.71 105.4 1.351 Geometric Tracking —— — — ————

*.*

*.*

*.*

the right supports a visual validation of position and orientation variables.

faster reaction and a more accurate trajectory following.

(**Tables 4**–**6**). The opposite occurs for DTV and geometric tracking.

control algorithms.

**Table 4.**

**Table 5.**

**Table 6.**

**112**

case, and corresponding validation errors.

*Robotics Software Design and Engineering*

reduce substantially the validation error.

in finding a set of gains in Case 3.

*Elliptical helix trajectory case 1, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>0</sup><sup>∘</sup>

*Elliptical helix trajectory case 2, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>88</sup><sup>∘</sup>

*Elliptical helix trajectory case 3, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>178</sup><sup>∘</sup>

**Figure 6.** *Propellers' speeds in rpm with DTV control.*

**6.2 Lemniscate Shape Trajectory**

*DOI: http://dx.doi.org/10.5772/intechopen.97435*

*Validation comparison for cases 1 and 2.*

<sup>1</sup> *Calculated with Gains of Case 3.* <sup>2</sup> *Calculated with Gains of Case 2.*

**Table 7.**

**Table 8.** *Waypoints test 2.*

**115**

in the direction of displacement.

**Figure 9** depicts the second trajectory.

A second set of waypoints presented in **Table 8**, depicts a lemniscate shape trajectory varying the position in *Z*, orienting the front of quadrotor (*yaw* angle *ϕ*)

*t s*ð Þ *x*desð Þ *m y*desð Þ *m z*desð Þ *m ψ*desð Þ rad 0.00 0.00 0.00 2.00 �1.57 0.40 0.12 �0.28 1.58 �0.79 0.80 0.40 �0.40 1.40 0.00 1.20 0.68 �0.28 1.58 0.79 1.60 0.97 0.00 2.00 0.79 2.00 1.25 0.28 2.42 0.79 2.40 1.53 0.40 2.60 0.00 2.80 1.81 0.28 2.42 �0.79 3.20 1.93 0.00 2.00 �1.57 3.60 1.81 �0.28 1.58 �2.36 4.00 1.53 �0.40 1.40 �3.14 4.40 1.25 �0.28 1.58 �3.93 4.80 0.97 0.00 2.00 �3.93 5.20 0.68 0.28 2.42 �3.93 6.60 0.40 0.40 2.60 �3.14 6.00 0.12 0.28 2.42 �2.36 6.40 0.00 0.00 2.00 �1.57

**Control Strategy** *<sup>ϕ</sup>*ð Þ **<sup>0</sup> <sup>∘</sup>** *xv* **%** *yv* **%** *zv* **%** *<sup>ψ</sup><sup>v</sup>* **%** Small Angle 0° 1.373 7.763 6.301 1.0300 Small Angle1 0° 3.111 21.960 28.390 0.2430 Small Angle 88° 2.010 32.690 26.220 0.6344 Small Angle1 88° 3.242 51.760 49.580 0.3378 DTV 0° 2.112 4.907 5.300 0.6455 DTV1 0° 4.625 15.650 13.310 0.2350 DTV 88° 1.584 22.030 27.650 0.4949 DTV1 88° 4.886 41.580 44.530 0.3509 Geometric Tracking 0° 3.172 8.807 26.680 0.3973 Geometric Tracking<sup>2</sup> 0° 3.338 5.917 28.660 0.2615

*Quadrotor Unmanned Aerial Vehicles: Visual Interface for Simulation and Control…*

**Figure 7.** *Elliptical helix trajectory case 2 geometric tracking, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>88</sup><sup>∘</sup> *.*

**Figure 8.** *Propellers' speeds in rpm with geometric tracking.*

time its hovering orientation. This fast reaction makes it more sensitive to measuring noise.

Propellers'speeds in **Figure 8** confirm the faster command reaction of the controller compared with **Figures 4** and **6**. This strategy is also sensitive to nonlinear behaviour. When it reaches the propeller limits, it is highly prone to instability.

The gains calculated for the more challenging Cases were later tested on Cases 1 and 2. Despite being less optimal they displayed a stable behaviour. The performance is presented in **Table 7**.

Graphical results of small angle control performance on Case 1, when using the optimal gains compared with the performance with the gains calculated for Case 3. The system holds the attitude performance. The same comparison was performed for DTV control. The decrease in performance is lower than with the small angle controller [15].

*Quadrotor Unmanned Aerial Vehicles: Visual Interface for Simulation and Control… DOI: http://dx.doi.org/10.5772/intechopen.97435*


<sup>2</sup> *Calculated with Gains of Case 2.*

#### **Table 7.**

*Validation comparison for cases 1 and 2.*

#### **6.2 Lemniscate Shape Trajectory**

A second set of waypoints presented in **Table 8**, depicts a lemniscate shape trajectory varying the position in *Z*, orienting the front of quadrotor (*yaw* angle *ϕ*) in the direction of displacement.

**Figure 9** depicts the second trajectory.


**Table 8.** *Waypoints test 2.*

time its hovering orientation. This fast reaction makes it more sensitive to

Propellers'speeds in **Figure 8** confirm the faster command reaction of the controller compared with **Figures 4** and **6**. This strategy is also sensitive to nonlinear behaviour. When it reaches the propeller limits, it is highly prone to instability.

*.*

The gains calculated for the more challenging Cases were later tested on Cases 1 and 2. Despite being less optimal they displayed a stable behaviour. The perfor-

Graphical results of small angle control performance on Case 1, when using the optimal gains compared with the performance with the gains calculated for Case 3. The system holds the attitude performance. The same comparison was performed for DTV control. The decrease in performance is lower than with the small angle

measuring noise.

**Figure 6.**

**Figure 7.**

**Figure 8.**

*Propellers' speeds in rpm with DTV control.*

*Robotics Software Design and Engineering*

*Elliptical helix trajectory case 2 geometric tracking, <sup>ϕ</sup>*ð Þ¼ <sup>0</sup> <sup>88</sup><sup>∘</sup>

controller [15].

**114**

mance is presented in **Table 7**.

*Propellers' speeds in rpm with geometric tracking.*

Baseline controllers are offered so students may compare performance, and is open to easily introduce other strategies for comparison. A trajectory planning based on minimum *snap* give support to trajectory following control, and GUI

*Quadrotor Unmanned Aerial Vehicles: Visual Interface for Simulation and Control…*

The tool makes easier and faster to realize critical quadrotor requirements and limitations for challenging applications. These requirements may be related with the complexity of a defined trajectory, the weakness of a control strategy, or the improvements that may be carried out in the quadrotor (size, weight, propeller

Other controllers can be studied and compared using this tool, such as *Backstepping* and intelligent strategies. In the trajectory planning stage, applications with obstacles may be simulated. Support for multiple quadrotors, communication with the controller via Robotics Operating System (ROS) and implementation of

obstacles are some of the future improvements planned for this tool.

allows the evaluation in dimensions of position and time.

power, etc.) to accomplish the desired results.

*DOI: http://dx.doi.org/10.5772/intechopen.97435*

PD *Proportional plus Derivative Control* PID *Proportional Integral Derivative Control*

*Mi* Moment produced by the rotor *i*

*ϕ*\_ Rate of change of *Roll*

*θ* Rate of change of *Pitch ψ*\_ Rate of change of *Yaw sϕ*,*sθ*,*sψ* Sine of angles *ϕ*, *θ* and *ψ cϕ*,*cθ*,*cψ* Cosine of angles *ϕ*, *θ* and *ψ*

arbitrary Y *frame*

*p* Angular speed related to the x axis in the *Frame* **B** *q* Angular speed related to the y axis in the *Frame* **B** *r* Angular speed related to the z axis in the *Frame* **B**

*Fi* Propulsion force produced by the rotor *i*

<sup>X</sup> Rotation matrix of a vector represented in an arbitrary *frame* X for an

FF-PD *Feed-forward Proportional Derivative Control*

LQR *Linear Quadratic Regulator* LQG *Linear Quadratic Gaussian*

**Abbreviations**

**Nomenclature**

*ϕ Roll θ Pitch ψ Yaw*

\_

**R**Y

**117**

**I** Inertial frame **V** Vehicle frame **B** Rigid Body frame *ω<sup>i</sup>* Speed of the rotor *i*

ROS *Robot Operating System* PSO *Particle Swarm Optimization*

DTV *Desired Thrust Vector* RMS *Root Mean Square* GUI *Graphical User Interface* UAV *Unmanned Aerial Vehicles*

**Figure 9.** *Lemniscate shape trajectory.*

As with the to previous trajectory, the small angle control compensates its limitations with lower gains to guarantee stability, gains are bigger for position control than for attitude.

DTV Control is again the best validated strategy. Geometric tracking presents a lower performance due to its sensitivity to noise and nonlinear operation conditions. The DTV control had presented the best validation even in the most challenging conditions.

Detailed results and analysis of this trajectory are available in [15].

Using the tool the graphical and numerical analysis was easier. Not much programming knowledge was necessary for using and configuration, just basic MatLab programming. Access to quadrotor parameters of the analyzed device, analyzing the influence of measurements noise, and comparing and simulating different control strategies is easier than with other visual platforms. Graphical and numerical simulation results are easily available with the interface buttons.

#### **7. Summary**

Quadrotor control is a fascinating research area, but the equations involved and programming skills requirements can be arduous for initiating students. It is a worth to develop motivational appliances for beginners. This was the motivation to present a beginner-friendly visual interface tool for the development of quadrotor control strategies. It is easy to understand, device characteristics are simple to configure, and control algorithms can be implemented and analyzed with not much effort. It is not necessary to have a deep knowledge in programming languages, and may be an introduction to this field of research.

This tool uses RMS and basin of attraction for numerical validation, and the GUI may help to evaluate stability, robustness, and accuracy. It integrates these criteria in a unique interface and helps to measure and visualize details and requirements that may not be so clear using other visual tools.

*Quadrotor Unmanned Aerial Vehicles: Visual Interface for Simulation and Control… DOI: http://dx.doi.org/10.5772/intechopen.97435*

Baseline controllers are offered so students may compare performance, and is open to easily introduce other strategies for comparison. A trajectory planning based on minimum *snap* give support to trajectory following control, and GUI allows the evaluation in dimensions of position and time.

The tool makes easier and faster to realize critical quadrotor requirements and limitations for challenging applications. These requirements may be related with the complexity of a defined trajectory, the weakness of a control strategy, or the improvements that may be carried out in the quadrotor (size, weight, propeller power, etc.) to accomplish the desired results.

Other controllers can be studied and compared using this tool, such as *Backstepping* and intelligent strategies. In the trajectory planning stage, applications with obstacles may be simulated. Support for multiple quadrotors, communication with the controller via Robotics Operating System (ROS) and implementation of obstacles are some of the future improvements planned for this tool.
