Content uploaded by Giuseppe Silano
Author content
All content in this area was uploaded by Giuseppe Silano on Sep 12, 2019
Content may be subject to copyright.
29.8637
“poster”
2019/9/6
page 1
i
i
i
i
i
i
i
i
Software-in-the-loop simulation for improving flight control system
design: a quadrotor case study
Giuseppe Silano, Pasquale Oppido and Luigi Iannelli
1. Motivation
Multi-rotor aircraft are a fast-growing field of robotics and nowadays are rapidly
increasing in popularity also out of the scientific community. However, designing
autopilots for UAVs (Unmanned Aerial Vehicles) is a challenging task, which
involves multiple interconnected aspects. Therefore, having tools able to show what
it happens when some new applications are going to be developed in unknown or
critical situations is more and more important.
Goal: Showing how the use of the SIL (software-in-the-loop) techniques allows to
understand the behavior of flight control systems discovering issues that model-in-
the-loop (MIL) simulation approaches do not necessarily detect, even if carried out
through a multi-physics co-simulation approach.
2. Case Study
The case study here considered is the stabilizing controller discussed in [1] that in
our case study it has been designed by considering the Parrot Bebop 2 quadrotor.
MIL
Matlab/Simulink
SIL
ROS/Gazebo
Controller Design Controller Validation
A detailed aircraft model was used in a twofold way: firstly, for tuning the con-
troller gains (obtained as the solution of an optimization problem), and then for
validating the flight control system by comparing MIL simulation results (the flight
control system implemented as a Simulink model) with those obtained through SIL
simulations (the flight control system implemented as an executable object code in
ROS/Gazebo).
3. Flight Control System
With the aim of illustrating a control design methodology exploiting the SIL simu-
lation, a common cascade control architecture was used.
Outer loop
controller
Inner loop
controller
Control
Mixer
Aircraft
+
Motors
ξr
ψr
ψr
uT
ϕr
θr
uϕ,uθ
uψ
ξd
Ωref
1,Ωref
2
Ωref
3,Ωref
4
ξd
ηd
ηd
Figure 1:The control scheme. Subscript dindicates the drone variables and r
indicates references to controllers.
The position controller (the outer loop controller) uses the measured drone position
ξdto compute the thrust (uT) and the attitude (ϕrand θr) that should have the
drone in order to reach the desired position ξrwith the desired heading (yaw angle)
orientation ψr. The attitude controller (the inner loop controller) uses the measured
drone attitude ηdto compute the model inputs uϕ,uθand uψthat should be
actuated to achieve the desired attitude (ϕr,θrand ψr). The control mixer inverts
the controller outputs obtaining the commanded motor velocities Ωref
i, later used as
inputs for the aircraft dynamical model (it considers also the rotors dynamics).
Controller equations: The drone position in the world frame is controlled through
the virtual inputs
uq=αq
µq
˙
eq−βq
µ2
q
eqm, q ∈ {x, y, z}
where µq>0,βq<0and αq= 1 −βq>0are controller parameters to be
appropriately chosen and eqare the components of the position tracking errors.
While, the inner controller determines the virtual inputs uϕ,uθand uψto regulate
the drone attitude according to the following control laws:
uϕ=Ix αϕ
µϕ
˙
eϕ−βϕ
µ2
ϕ
eϕ−eθeψ
µθµψIy−Iz
Ix!, uθ=Iyαθ
µθ
˙
eθ−βθ
µ2
θ
eθ−eϕeψ
µϕµψIz−Ix
Iy,
uψ=Iz αψ
µψ
˙
eψ−βψ
µ2
ψ
eψ−eϕeθ
µϕµθIx−Iy
Iz!,
where I=diag(Ix, Iy, Iz)is the inertia matrix of the vehicle w.r.t. its principal axis.
Finally, according to [1, eqs. (40)–(41)], the MATLAB/Simulink platform was used
to minimize in a numerical way the integral of the squared error (ISE)
ISE(µk, βk),1
tf−tiZtf
tikeη(t)k2+keξ(t)k2dt
w.r.t. the control parameters µk,βk,k∈ {x, y, z, ϕ, θ, ψ}taking into account also
motor dynamics, saturation constraints and controller discretization
4. Numerical Results
When moving from the control design based on the nominal model to the actual
implementation, several issues should be addressed:
•First, the control architecture. In our case it is based on control loops that
are nothing but PD (Proportional-Derivative). For such class of controllers,
a classical way of dealing with the time derivative of controller error is to
differentiate only the output signal;
•Then, the controller discretization. As a common rule in cascade structures
the inner loops need to be regulated at a rate faster than the outer. In our
case, the attitude controller runs at 200 Hz while the position controller runs
at 100 Hz.
•Finally, the hardware constraints and software implementation. The
controller has to clip the desired rotor velocity so that 0≤Ωref
i≤Ωmax.
Furthermore, software aspects such as synchronization, overflow, tasks com-
munication have to be managed paying attention to maintain the controller
behavior.
SIL Simulation: The SIL simulation has been carried out by the ROS (Robot Op-
erating System) middleware using Gazebo and the ROS package RotorS as robotic
simulators. The considered architecture was used to understand how the system
behaves when moving from MATLAB to Gazebo (see Fig. 2) and if the stability is
still hold.
0 5 10 15 20 25 30
4.6
5
5.4
5.8
6.2
Time [s]
Thurst [N]
(a) The total thrust uTrequested by the controller: numerical
experiment in MATLAB/Simulink.
0 0.1 0.2 0.3
−10
−8
−6
−4
−2
0
2
Time [s]
Force [N]
(b) Signal uZ: numerical experiment in Gazebo.
Figure 2:The uTand uzsignals obtained doing the same experiment in MAT-
LAB/Simulink and Gazebo, respectively.
By looking at first tenths of second of simulations it comes out that the uzcontrol
signal assumes negative values much below −mg =−4.9 N, see Fig. 2(b). That
is an important issue since uz<−mg ⇒uz+mg < 0but (see [3]), that means
uz+mg =uTcθdcϕd<0. Of course, it is not possible to apply a thrust that gives
the desired uzand such specific situation is well known in literature to bring the
system to instability [2].
Conclusions: Thus, considering the approach proposed in [2] and the naive clipping
of rotor velocities (see [3]), it is possible to make the flight control work exploiting
the advantages offered by the use of SIL methodologies in detecting instabilities
that might not arise during classical MIL simulations. We published the software as
open source available at the link https://github.com/gsilano/BebopS.
References
[1] Bouzid, Y., Siguerdidjane, H. and Bestaoui, Y., “Nonlinear internal model con-
trol applied to VTOL multi-rotors UAV,” Mechatronics, vol. 47, pp. 49–66,
2017.
[2] T. Nguyen, I. Prodan, and L. Lef`evre, “Flat trajectory design and tracking
with saturation guarantees: a nano-drone application,” International Journal of
Control, pp. 1–14, 2018.
[3] G. Silano, P. Oppido, and L. Iannelli, “Software-in-the-loop simulation for im-
proving flight control system design: a quadrotor case study”, IEEE Interna-
tional Conference on Systems, Man and Cybernetics, 2019.
Universit`a degli Studi del Sannio
Dipartimento di Ingegneria, Benevento.
Web: https://www.ding.unisannio.it
E-mail: {giuseppe.silano, pasquale.oppido, luigi.iannelli}@unisannnio.it