LiDAR-based Perception and Control for Rotary-wing UAVs in GPS-denied Environments Duarte José Baptista Pereira Alves Thesis to obtain the Master of Science Degree in Aerospace Engineering Supervisor(s): Prof. Rita Maria Mendes de Almeida Correia da Cunha Prof. Bruno João Nogueira Guerreiro Examination Committee Chairperson:Prof. João Manuel Lage de Miranda Lemos Supervisor:Prof. Rita Maria Mendes de Almeida Correia da Cunha Member of the Committee:Prof. Pedro Manuel Urbano de Almeida Lima October 2016
74
Embed
LiDAR-based Perception and Control for Rotary-wing · PDF fileLiDAR-based Perception and Control for Rotary-wing UAVs ... 5.9 Desired Angular velocity response sent to the Mikrokopter
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
LiDAR-based Perception and Control for Rotary-wing UAVsin GPS-denied Environments
Duarte José Baptista Pereira Alves
Thesis to obtain the Master of Science Degree in
Aerospace Engineering
Supervisor(s): Prof. Rita Maria Mendes de Almeida Correia da CunhaProf. Bruno João Nogueira Guerreiro
Examination Committee
Chairperson:Prof. João Manuel Lage de Miranda LemosSupervisor:Prof. Rita Maria Mendes de Almeida Correia da Cunha
Member of the Committee:Prof. Pedro Manuel Urbano de Almeida Lima
October 2016
ii
Acknowledgments
I need to thank DSOR laboratory Team, in particular Prof. Rita Cunha for all her help in the research
part of the thesis, in that regard I should also thank Prof. Bruno Guerreiro for is help with the control
problem, in addition, he was always there during the testing phase along with Eng. Bruno Gomes, who
helped with setting up the connection between the quadcopter and simulink as well keeping the quad-
copter from crashing sometimes, along with Mr. Tojeira, the backup pilot, who would help to stabilize the
quadcopter manually in case of any problem with the algorithms.
I also need to thank my family and friends for all their support during this last stage of my academic life.
iii
iv
Resumo
Esta tese explora o problema da estimacao da atitude e controlo dum quadrotor em ambientes no qual
nao existe cobertura GPS, o que e particularmente importante, por exemplo, para inspecionar pontes.
O sensor usado para este efeito foi o LiDAR que permite estimar a posicao do corpo relativamente a
um poste de referencia. Em primeiro lugar foi estudada a determinacao da atitude usando vectores no
referencial do corpo e no inercial e fundindo essa informacao com a que e obtida pelo giroscopio. Estes
podem tambem estimar um bias constante na velocidade angular com algumas alteracoes, ambas as
versoes foram desenvolvidas, tendo depois sido analisados os casos nos quais podem ser usados. Ex-
perimentalmente, os observadores foram usados com vectores obtidos atraves do LiDAR, onde as suas
medidas correspondem a interseccoes com um poste que e usado como referencia. Foram tambem
desenvolvidos controladores de posicao e atitude de modo a manter o qudricoptero em frente ao poste.
Estes foram testados experimentalmente usando a matriz de Rotacao do IMU, o Estimador e derivando
a posicao atraves do LiDAR. Os resultados obtidos com este sistema foram promissores, podendo ser
usados quando nao existe informacao de GPS.
Palavras-chave: Estimacao de Atitude, Estimadores Nao-Lineares, Controlo Nao-Linear,
LiDAR
v
vi
Abstract
This thesis explores the problem of Attitude Estimation and Control of a quadcopter in a GPS denied
environment. This is particularly important in cases such as bridge inspections. The sensor used for
this purpose was a LiDAR which allows the estimation of the relative position and attitude of the vehicle
relative to a pier. Firstly, the problem of attitude estimation was addressed, using vector measurements
expressed in the body frame and in the inertial frame, fusing this information with the one obtained from
the gyroscopes. The presented observers can estimate a constant bias in the angular velocity with
a few changes. Both versions were developed and the cases were they can be used were analysed.
Experimentally the observers were tested using vector measurements in the body and inertial frames
obtained from the LiDAR, where those measurements correspond to edges of a reference pier. Position
and attitude controllers were also developed in order to keep the Quadcopter facing the pier. These
were then experimentally tested using the Rotation Matrix from the IMU, the estimator and the estimated
position from the LiDAR. The results obtained for this system were promissing and can be used when
Substituting the previous result in the bound for − ddt (tr(RS(b))), plus considering θ ∈]0, π2 [
− d
dt(tr(RS(b))) ≤ | sin(θ)|||ω||||b||+sin(θ)2(
1
2||S(λ)b||2−2kI
∑||S(λ)vi||2)+4 sin(θ)||M ||||b||−2kc cos(θ)‖b‖2.
(2.66)
Regarding the term˙bT b2kI
from the bias term, it can be written as
˙bT b
2kI= S−1(2Pa(RM))T b. (2.67)
This term can then be bounded by
˙bT b
2kI≤ ||S−1(2Pa(RM))||||b||
= ||S−1(2Pa((R− I)M))||||b||
≤√
2||(I − R)M ||||b||
≤ 2||M || sin(θ)||b||. (2.68)
In the previous steps, the properties of table A.2 were used for the inequalities. The term tr( ˙R) can be
written as
tr( ˙R) = 2kP sin(θ)2n∑i=1
vTi S(λ)2vi − tr(RS(b))
= 2kP sin(θ)2n∑i=1
vTi ||S(λ)vi||2 − tr(RS(b))
≤ 2kP sin(θ)2n∑i=1
vTi ||S(λ)vi||2 + 2 sin(θ)||b||. (2.69)
Collecting all the terms from 2.70, 2.69 and 2.65, one can define the system
V ≤ −[| sin(θ)| ||b||
]a11 a12
a12 a22
| sin(θ)|
||b||
(2.70)
1||I − R|| = 2√2 sin(θ)
15
where Bω is a bound for ||ω|| and a11,a12,a22 are given by
a11 = 2(kP − kckI)
∑||S(λ)vi||2 + kc
1+cos(θ) ||S(λ)b||2
a12 = −(2kc||M ||+ ||M ||+ 1 + kcBω
2 )
a22 = 2kc cos(θ)
. (2.71)
To make the matrix negative definite
a11 > 0
a11a22 − a212 > 0
. (2.72)
This translates in setting up the gains kP , kI and the constant kc. By obeying this conditions, uniform
asymptotic stability of the observer errors can be guaranteed, using Theorem 1. Since for this stability
proof θ needed to be less than π2 , the domain is smaller than for the previous section case, nonetheless,
the simulation results suggest that the observer can perform very well in the presence of angular velocity
bias, even over a larger interval. This may as well be just a problem of finding a better Lyapunov function.
Important note: Although one is restricting only to θ < π2 , this also imposes a restriction on b.
2.6 Simulation Results
In this section the cases from the previous sections are simulated for situations where they are applica-
ble. In all examples, θ is the angle of the rotation matrix error in the angle axis representation.
Example 1 Simple case
A Simulink Model is created and tested, in which a system of differential equations to simulate R is
used in order to have the vectors in both reference frames, which are needed to feed the observer
system.
The vectors are time varying on the inertial frame and the angular velocity input is driven by
ω = 3 sin(150t)[1 1 1
]T. (2.73)
The vectors on the Inertial Frame were created as an arbitrary matrix driven by sinusoidal functions
and its column vectors were normalized.
For initial conditions one assumed the Estimate to be
R0 =
0.7071 0.6124 0.3536
0 0.5000 −0.8660
−0.7071 0.6124 0.3536
(2.74)
16
the initial rotation as
R0 =
0.4698 −0.3420 0.8138
0.1710 0.9397 0.2962
−0.8660 0 0.5000
. (2.75)
This choice was made in order to have θ < π2 . The constant kP was defined as kP = 1. Figure
2.1 shows the Simulink representation of the system , where the inputs are in yellow, the observer
system is light blue, the system is dark blue and the Lyapunov function is white. Figure 2.4 shows
the response obtained for the Lyapunov function. It can be seen that the error goes to zero just
after 2 seconds, crosschecking its derivative it can be seen that its value is always less than 0, thus
in agreement with the conditions for the stability proof.
Figure 2.1: The Simulink model of the System.
Figure 2.2: Lyapunov function for initial θ <π2
Figure 2.3: Lyapunov function derivative for
initial θ < π2
Keeping the rest of the conditions and constants the same and changing the initial rotation
matrix to
R0 =
−0.7071 0.2418 −0.6645
0 −0.9397 −0.3420
−0.7071 −0.2418 0.6645
. (2.76)
17
Figure 2.4: Lyapunov function for initial π2 <
θ < π
Figure 2.5: Lyapunov function derivative for
initial π2 < θ < π
From figure 2.5, it can be seen that the system is still stable, so it is in agreement with the
previous mathematical formulation. The Lyapunov function takes more time to converge to 0, but
that is to be expected from the higher initial error.
Example 2 Filter using a single vector measurement
As with the previous case, Simulink was used for the simulation.
In this case there is a single vector, which is time varying on the inertial frame and the angular
velocity input is driven by sinusoidal functions, the same input as the previous case was used
(2.74).
The vector on the Inertial Frame were created as an arbitrary vector given by a combination of
sinusoidal functions and then normalized.
The initial conditions for the system were chosen the same as before, allowing an initial error angle
below π2 , with estimated and actual rotation matrices respectively as
R0 =
0.7071 0.6124 0.3536
0 0.5000 −0.8660
−0.7071 0.6124 0.3536
(2.77)
R0 =
0.4698 −0.3420 0.8138
0.1710 0.9397 0.2962
−0.8660 0 0.5000
. (2.78)
The constant kP was defined as kP = 1. The system’s structure is the same as Figure 2.10 from
the previous filter and thus its representation will be omitted. The vector measurement (before
normalization) is
QI =[a+ b ca+ 0.5b cb+ 0.4a
]T(2.79)
where a = π2 cos(t), b = π
2 sin(t+ π3 ) and c = 1.
18
Figure 2.6: Lyapunov function for initial θ <π2
Figure 2.7: Lyapunov function derivative for
initial θ < π2
From Figure 2.6 it can be seen that the Lyapunov function converges to 0, furthermore from
Figure 2.7 it can be seen that it is always decreasing, therefore the system is stable for those initial
conditions.
Example 3 Bias Correction
A Simulink Model was created and tested, in which a system of differential equations to simulate
R was used in order to have the vectors in both reference frames, which were needed to feed the
observer system.
The vectors are constant on the inertial frame and given in matrix form by
vI =
0.7071 0 0.4364
0.7071 1.0000 0.2182
0 0 0.8729
(2.80)
where each column vector is a reference vector in the inertial frame. The angular velocity input is
driven by
ω =
π2 sin(50t+ π
2 )
π2 sin(50t+ π
3 )
π2 sin(50t+ π
8 )
(2.81)
this choice was arbitrary as no restrictions were made on the angular velocity. For initial conditions,
they are the same as with the previous example, the rotation matrix estimate is defined as (2.78)
and far off from the actual initial rotation matrix (2.79). The constants kP and kI were defined as
kP = 1 and kI = 0.5. The vector kn values were chosen arbitrarily and are given by
kTn =[3 2 1
]. (2.82)
19
The initial bias estimate was assumed as
bT0 =[2 2 2
]. (2.83)
The actual bias is given by
bT0 =[1 1 1
](2.84)
this choice again is purely arbitrary, furthermore these values would be quite high for a real situa-
tion. The Simulink representation of the system is shown in figure 2.10, where the inputs to system,
are in yellow, the constants used for the system are in magenta, the Observer System is light blue,
the System is dark blue. The red block is for the calculation of the errors and the orange blocks
are for the Lyapunov function and its derivative. From Figure 2.8 it can be seen that the Lyapunov
function converges to 0, furthermore from Figure 2.9 it can be seen that it is always decreasing,
therefore the system is stable for those initial conditions.
Figure 2.8: Lyapunov function for initial θ <π2
Figure 2.9: Lyapunov function derivative for
initial θ < π2
Figure 2.11 shows the Rotation Error, it corroborates with the Lyapunov function as it tends
asymptotically to 0 after 5 seconds. Figure 2.12 shows the error in the angular velocity bias on the
three directions, one can see the error converges to 0 and thus after approximately 9 seconds the
bias is well estimated.
20
Figure 2.10: The Simulink model of the System.
Figure 2.11: Error in the Rotation Matrix es-
timation for initial θ < π2
Figure 2.12: Error in Bias estimation for ini-
tial θ < π2
Afterwards, a simulation was conducted for the case where the rotation matrix error angle is
close to π (0.9π) by setting the initial rotation matrix estimate as
R0 =
−0.7071 0.2418 −0.6645
0 −0.9397 −0.3420
−0.7071 −0.2418 0.6645
. (2.85)
From figures 2.13 and 2.14, it can be concluded that the Lyapunov function converges to 0 and is
continuously decreasing which corroborates with the mathematical deduction.
21
Figure 2.13: Lyapunov function for initial π2 <
θ < π
Figure 2.14: Lyapunov function derivative for
initial π2 < θ < π
It can be seen from figure 2.15 that the rotation error takes more time to go to 0, this happens
at approximately 7 seconds. The bias error in all directions goes to 0 at approximately 9 seconds,
slightly more than in the smaller initial angle error case.
Figure 2.15: Error in the Rotation Matrix es-
timation for initial π2 < θ < π
Figure 2.16: Error in Bias estimation for ini-
tial π2 < θ < π
Example 4 Bias Correction (with time varying vectors in Inertial Frame)
The Model here is the same as 2.4, with the same inputs and constants, the difference here being
the simulated input vectors are not constant. Instead a time varying input matrix is used, where
each column vector represents a measurement, notice these are before normalization. In addition,
each vector measurement is given by a combination of scalar, time varying entries a, b, c. They are
defined as a = 2 sin(40t + pi2 ), b = sin(30t + pi
3 ), c = 3 sin(20t + pi8 ). The vector measurements
22
matrix before normalization is given by
QI =
−abc b+ a b+ c
b c a
a b c
. (2.86)
The initial rotation error is chosen as lower than π2 , since this was the restriction on the stability
proof. The angular velocity input is driven by
ω =
π2 sin(50t+ π
2 )
π2 sin(50t+ π
3 )
π2 sin(50t+ π
8 )
(2.87)
here the angular velocity was kept as a bounded value in order to satisfy the assumption in the
proof. For the rest of the initial conditions, they are the same ones as the ones from the previous
example for the θ < π2 case.
The Lyapunov function used is the second one, whose stability was proven for θ < π2 . From figures
2.17 and 2.18 it can be seen that the Lyapunov function converges to 0 and is always decreasing,
agreeing with the proof.
Figure 2.17: Lyapunov function for initial θ <
π2
Figure 2.18: Lyapunov function derivative for
initial θ < π2
By changing the rotation matrix estimation to
R0 =
−0.7071 0.2418 −0.6645
0 −0.9397 −0.3420
−0.7071 −0.2418 0.6645
, (2.88)
from Figure 2.19 one can see that the Rotation Matrix error converges to 0 as well, the differ-
ence with the previous case is some shakiness between 0.2 and 3 seconds. The error bias also
converges to 0 on the three directions as one can see from figure 2.20, this happens as with the
previous case approximately 9 seconds later.
These results suggest that for θ < π2 the behaviour is quite similar to the constant measurement
23
case.
Figure 2.19: Error in the Rotation Matrix es-
timation for initial θ < π2
Figure 2.20: Error in Bias estimation for ini-
tial θ < π2
Changing the initial rotation matrix estimate to
R0 =
−0.7071 0.2418 −0.6645
0 −0.9397 −0.3420
−0.7071 −0.2418 0.6645
(2.89)
translates into a θ close to π, specificially 0.9π, this value is outside of the domain of applicability of
the Lyapunov function chosen. Figure 2.21 shows that this function, although decreases to almost
0, is not always decreasing (confirmed by figure 2.22) and thus cannot be a Lyapunov function.
Figure 2.21: Lyapunov function for initial π2 <
θ < π
Figure 2.22: Lyapunov function derivative for
initial π2 < θ < π
It is believed that this is just a problem of the Lyapunov function chosen since the error and
the bias converge to 0 as can be seen in figures 2.23 and 2.24. This means that there is still the
possibility of finding a better Lyapunov function for this case.
24
Figure 2.23: Error in the Rotation Matrix es-
timation for initial π2 < θ < π
Figure 2.24: Error in Bias estimation for ini-
tial π2 < θ < π
25
Chapter 3
Attitude Estimation Results
3.1 Experimental setup
In order to test the observers using vector measurements, the existing platforms and sensors available
in DSOR/ISR were used, specifically a quadcopter equipped with a Hokuyo LiDAR, building on the work
of [20].
This LiDAR measures 1081 distances corresponding to the angles between −135◦ and 135◦ . The vehi-
cle’s LiDAR will hit one or two faces of the cuboid shaped object, depending on its orientation, and the
intersection between them will result in one or two straight lines, which from here on will be called edges
to follow the terminology of [20]. The edges are represented by a matrix QB , expressed in {B}, where
each column of this matrix represents an edge and expressed in {I} by the matrix QI , noticing that the
projection in the XY plane of this reference frame corresponds to the section of the pier. Throughout this
simulation the column vectors are normalized (vi = Qi
‖Qi‖ ) in order to have a problem in the form [21].
Notice however, that due to the geometry of the problem, it is possible that in some cases the vehicle’s
facing only one side of the pier and thus has only one vector measurement, in this case, while the sys-
tem would still converge, this convergence would take more time as previously discussed.
Two blocks are used for the conversion of between the LiDAR distances measured and the vectors
needed for the observer, which were already developed at DSOR prior to this work. One block is re-
sponsible for clustering the data points and selects the one whose centroid is the closest from the origin
in {B} . For the second block, after receiving the clustered data points, it estimates the dimensions of
the pier, removes the outliers and calculates the edges. Estimating the dimensions of the pier is the main
difference with respect with [20], which relied heavily on knowing beforehand the edge dimensions. The
second block requires as input, besides the cluster information (number of points, distances,angles), the
absolute height at which the Quadcopter is. To obtain this information, it can be used, for example, the
barometer data. However, sometimes the barometer information is unreliable, so an approximate height
is obtained by equipping the Quadcopter with mirrors which reflect the LiDAR rays into the ground. Fig-
ure 3.1 shows the correspondence between the data points and their usage, due to using some laser
points for the height estimation, some points inbetween the height estimation and the edges calculation
26
need to be ignored.
Figure 3.1: Data point usage
The points that are used for the height estimation are in the intervals [−134.375,−131.875]◦ and
[131.875, 134.375]◦. The height calculation involves 2 steps. In the first step an estimated height is
calculated as described in Algorithm 1, where ψ and φ are the roll and pitch angles. The reason why
the maximum measured height is being used, is due to the quadcopter legs sometimes intersecting the
laser, yielding a distance which is quite smaller than it normally is. For the second step, (the) height is
smoothed by using a 5 point Median Filter, as described in Algorithm 2. It should be mentioned that, not
to rely on the measure pier edges, the pitch and roll angles from the IMU are being used.
Data: Distances, Pitch and Roll anglesResult: Estimated Heighth1 = max(dicos(ψ)cos(φ)), height measured on one side of the Quadcopter;h2 = max(dicos(ψ)cos(φ)), height measured on other side of Quadcopter;h = h1+h2
2 , the Quadcopter height should be in between the two;Algorithm 1: Height Estimator-step 1
Data: Estimated HeightResult: Median Estimated Heightif sampled heights < 5 then
new height=median of current sampled heights;save current measurement in a buffer for the last height measurements;
elsenew height=median of the height measurements in the buffer;update buffer and prepare for next measurement;
endAlgorithm 2: Height Estimator-step 2
27
3.2 Discretized Filters
In the above stability analysis of the attitude observers their discretized versions were not not taken
into account. In any case, the discretization described with the equations presented in Table 3.1 have
provided good experimental results, where h is the sampling time. CF is used to designate the observer
without bias estimation, while CFwBC to designate the observer with bias correction. It should also be
mentioned that this is different from the typical observers used in the literature which are quaternion
based. The reason authors do it is because they are faster to calculate, however their representation is
not unique unlike the rotation matrices and thus one could have problems such as unwinding as stated
in [22].
Figure 3.2 shows the Simulink representation of CF, the one with bias correction will not be shown since
it is similar to this one. The yellow block contains the input data variables, the blue block processes the
LiDAR data, and converts it to vector measurements that are used by the green block that contains the
actual observer.
Table 3.1: Discretized versions of the observers with and without bias correction
Filter Rotation Matrix Estimator with ω as Bias Estimator
CF RTk+1 = e−S(ωk)hRTk ωk = ωk + kpωerrork –––
CFwBC RTk+1 = e−S(ωk)hRTk ωk = ωrk + kpωerrork − bk bk+1 = −kIωerrorkh+ bk
Figure 3.2: Simulink representation of the observer system
28
Data: Vector Measurements, Angular velocity
Result: Estimated Rotation Matrix
if Simulation Starts then
Initialize next estimates;
else
current estimate is the previous next estimate;
Normalize measurements;
Calculate ωerror ;
Calculate next estimates;
endAlgorithm 3: Pose Observer pseudo code
3.3 LiDAR sensor Simulation
Before testing the observers with real data, a simulink block was created to simulate the sensor data
which is obtained from the LiDAR.
Data: Rotation Matrix, Pier Position in I, Quadcopter Position in I, dimensions of Pier
Result: distance vectora, new, altitude
Initialize Pier vertices in I;
Rotate the Pier vertices to B;
Determine the vertices that define the cross section of the Pier in B;
Define the edges made of the vertices; for range of angles of the LiDAR do
for range of edges of the pier do
if nth edge of pier and the ith laser angle intersect thenCalculate intersection between the edge of the pier and the ith laser angle;
Calculate distance from the intersection to the origin (aux);
ith distance is equal to the mininum between aux and ith distanceb;
end
end
end
if distance vector is equal to the previous distance vector thennew=0;
elsenew=1;
endAlgorithm 4: LiDAR Sensor Block
avector with 1081 distancesbFor distances bigger than 0
The Simulink block created needs as input the rotation matrix from {I} to {B}, the position of the
29
quadcopter in {I}, the position and dimensions of the pier.
The block then outputs the 1081 distances, as well as a boolean stating whether there are new vector
measurements or not, plus the altitude of the quadcopter in the Inertial frame. Figure 3.3 shows an
example of the interception points between the laser and the pier section.
Figure 3.3: Example of the Intersection between the Laser and the Pier
3.3.1 Sensitivity of the Conversion block
Since the Simulink block that converts the LiDAR sensor data had already been built, it was decided to
test the sensitivity of the obtained data, at a fixed position (p =[−0.5 −0.5 −2
]T) with a time varying
angular velocity input in the x direction, given by ωx = π6 sin(t).
Table 3.2: Sensitivity analysis of the LiDAR conversion block for different distribuitions of gaussian whitenoise
Table 3.2 shows the results obtained for the simulation, where µlaser and σlaser are the average and
standard deviation of applied gaussian white noise, respectively. These results show there is always a
error in the estimated angles. For the pitch, this value increases with the increase in standard deviation
of the laser data, however no relation can be established for the Pitch and Roll. Ultimately the importance
30
of this test lies in knowing there will be an error in the estimation that can go up to 5◦, this means that a
future controller using the observer cannot be too fast in order to decrease the impact of such errors.
3.4 Experiment
In this section, the cases from the previous chapter are tested, in all of them the sampling frequency for
the experiment was 40Hz.
3.4.1 Observer without bias
3.4.1.1 Using multiple vector measurements
For this simulation, real data was used, which was then adapted in order to be used with the CF. Here,
a value of kP = 0.8 for the proportional gain and the initial rotation matrix estimate was assumed as the
identity matrix. There are multiple measurements for a significant amount of time most of the time, there
is an oscillation between one and two measurements being available as seen in figure 3.4.
Figure 3.4: Number of Laser Measurements available with time
It can be seen from Figure 3.5 that the roll, pitch and yaw responses for the filter are similar to those
obtained from the IMU. The differences between them are within what was expected from subsection
3.3.1. It should be noticed that the response from the IMU itself cannot be considered as the True values
and it is merely a reference for checking the observer responses. The yaw response from the IMU, for
the time period between 20 and 25 seconds, exhibits a strange behaviour. This might be due to the
magnetometer data which is used, through sensor fusion, by the IMU.
31
Finally Figure 3.6 shows the 3D representation of the Vectors obtained in the Inertial Frame against
the Estimated Vectors in the inertial Frame (that is RvB), some differences can be seen between them,
specially on the Z axis, this might explain the pitch response behaviour between 35 and 50 seconds
being similar to the IMU but with the values being shifted to the negative axis.
Figure 3.5: Estimated Roll vs IMU Roll, using multiple vector measurements, kP = 0.8
32
Figure 3.6: Estimated vector measurements of the Laser in the Inertial Frame vs Real Measurementswith multiple vector measurements and no angular velocity bias, kP = 0.8
3.4.1.2 Using a single vector Measurement
As it was stated before, in some situations there is only one measurement available. To test this, real
data is used as with the previous experiment, however, here only one is used, even if two are available,
in order to mimic this case. Again, a value of kp = 0.8 is used for the proportional gain and the identity
matrix for the initial rotation matrix estimate.
From Figure 3.7 it can be seen that the responses for the angles of the observer, the first 20 seconds,
have smaller oscillations than those for the case with multiple vector measurements. In addition, it
can be seen that the peak values for the Roll and Pitch angles are smaller than for the previous case
counterparts.
33
Figure 3.7: Estimated euler angles vs IMU euler angles, single vector measurement, kP = 0.8
3.4.2 Observer with Bias Correction
In this case the same data as in the previous cases is used, since there was no bias in the angular
velocity (at least no appreciable one). Additionally, a bias of bT =[1 1 1
]rad/s was artificially set, by
adding this vector to the angular velocity. The integral gain kI for the bias estimate was chosen to be 0.3
so that the setting time for the bias was 20 seconds, the reason for this being to not filter the dynamics,
at the same time, the proportional gain kP value was kept the same from the previous observer with
a value of 0.8. The initial rotation matrix estimate was kept as the identity matrix and no bias for the
estimate was initial assumed.
As it can be seen on Figure 3.8, after 20 seconds the responses for the observer are similar to those for
the previous one, as desired. Furthermore it can be seen in Figure 3.9 that the responses for bias in the
x and y directions converge to the true value around 20 seconds, while experiencing a slight overshoot.
The bias response in the z direction, figure converges to the true value faster, at approximately 12
seconds. The experimental results show that this observer works for cases in which the vectors are time
varying in the Inertial Frame.
As with the CF, the vectors are plotted in the Inertial Frame as well as the estimated vectors on the
34
inertial frame, Figure 3.10, here the estimated ones are separated between the times before and after
20 seconds since it was when the response converged to the CF case, as expected the response before
20 seconds is extremely erratic.
Figure 3.8: Estimated euler angles vs IMU euler angles, estimating bias, kP = 0.8, kI = 0.3
35
Figure 3.9: Estimated bias vs True value, kP = 0.8, kI = 0.3
Figure 3.10: Estimated vector measurements of the Laser in the Inertial Frame vs Real Measurements,with angular velocity bias and (kP = 0.8, kI = 0.3)
36
Chapter 4
Position and Attitude Control
When one wants to follow a desired trajectory, position control is also necessary. Building on the work in
[23], the developed controller belongs to the class of Hierarchical Controllers, where the Attitude Control
loop (Inner Loop) is faster then the Position Control Loop (Outer Loop). It is important to notice, that
this analysis does not consider the fact the attitude fed to the controller is estimated, as stated in the
following assumption.
Assumption 1.
The dynamics between the angular velocity error are negligible, as one assumes the angular velocity is
driven to the desired one instantaneously.
4.1 Outer Loop - Position Control
The system dynamics of a quadcopter are considered to be given by the system of equations
x = v
v = ge3 − Tmr3
(4.1)
where T is the scalar thrust applied to the vehicle and r3 as the third column vector of the rotation matrix
from {B} to {I}, g is the acceleration due to gravity, and e3 is third versor that defines the coordinate
system. The error dynamics of the system to be controlled are then given by
˙x = v
˙v = ge3 − Tmr3 − vd
. (4.2)
The error in the angular velocity is not needed, as the system is going to be actuated in thrust and angular
velocity. The errors for position and velocity are defined as x = x − xd and v = v − vd, respectively, in
37
which the subscript d denotes the desired value. The desired rotation matrix vector r3d is given by
r3d =ge3 − u||ge3 − u||
(4.3)
where u = −kpx− kv v + vd. Furthermore the desired thrust Td satisfies
m(kpx+ kv v + ge3 − vd) = Tdr3d (4.4)
where r3d represents the direction and Td the magnitude. Defining T = TdrT3dr3, replacing this into (4.2)
and adding and subtracting Tdr3dm , the error dynamics can be rewritten as ˙v = −(kpx + kv v) + u where
u = −TdS(r3)2r3d
m . Therefore the error dynamics can be written as
˙X = AX + U (4.5)
with
A =
03×3 I3×3
−kpI3×3 −kvI3×3
, (4.6)
X = [x, v], U = Bu and B = [03×3 I3×3]T . Define real symmetric positive definite matrices P,Q ∈ R6×6,
such that the Lyapunov equation is given by
1
2(ATP + PA) +Q = 0. (4.7)
Consider the Lyapunov function candidate to be used in the sequel given by
Vp =1
2XTPX. (4.8)
with derivative given by
Vp =1
2( ˙XTPX + XTP˙X). (4.9)
Replacing (4.5) in the previous equation yields
Vp =1
2(XTATPX + XTPAX) +
1
2(UTPX + XTPU) (4.10)
which, using Eq. (4.7) results in
Vp = −XTQX + UTPX. (4.11)
Therefore, the derivative of the candidate Lyapunov function can be bounded according to
Vp ≤ −λmin(Q)||X||2 + λmax(P )||u||||X||. (4.12)
Assuming for the time being that the desired attitude can be achieved instantaneously, then r3 = r3d and
as a result u = 0. This ensures that Vp ≤ −WQ(X) = −λmin(Q)‖X‖2 < 0, thus satisfying the conditions
38
of Theorem 2, yielding asymptotic stability of the origin X = 0. Further on, the constants will be defined
in order to achieve the stability of the complete system even without considering this simplification. The
norm of u can be written as ||u|| = Td
m ||S(r3)r3d||, where the fact of ||S(r3)2r3d|| = ||S(r3)r3d|| was used.
Substituting this result plus using the triangular inequality, equation (4.12) can be rewritten as