December 2013

NASA/TM–2013-218144

An Application of UAV Attitude Estimation 

Using a Low-Cost Inertial Navigation System

Kenneth W. Eure, Cuong Chi Quach, and Sixto L. Vazquez

Langley Research Center, Hampton, Virginia

Edward F. Hogge

Northrop Grumman Technical Services, Hampton, Virginia

Boyd L. Hill 

Analytical Mechanics Associates, Inc., Hampton, Virginia
NASA STI Program . . . in Profile

Since its founding, NASA has been dedicated to the 

advancement of aeronautics and space science. The 

NASA scientific and technical information (STI) 

program plays a key part in helping NASA maintain 

this important role.

The NASA STI program operates under the 

auspices of the Agency Chief Information Officer. 

It collects, organizes, provides for archiving, and 

disseminates NASA’s STI. The NASA STI 

program provides access to the NASA Aeronautics 

and Space Database and its public interface, the 

NASA Technical Report Server, thus providing one 

of the largest collections of aeronautical and space 

science STI in the world. Results are published in 

both non-NASA channels and by NASA in the 

NASA STI Report Series, which includes the 

following report types:

 TECHNICAL PUBLICATION. Reports of 

completed research or a major significant phase 

of research that present the results of NASA 

Programs and include extensive data or 

theoretical analysis. Includes compilations of 

significant scientific and technical data and 

information deemed to be of continuing 

reference value. NASA counterpart of peerreviewed formal professional papers, but 

having less stringent limitations on manuscript 

length and extent of graphic presentations.

 TECHNICAL MEMORANDUM. Scientific 

and technical findings that are preliminary or of 

specialized interest, e.g., quick release reports, 

working papers, and bibliographies that contain 

minimal annotation. Does not contain extensive 

analysis.

 CONTRACTOR REPORT. Scientific and 

technical findings by NASA-sponsored 

contractors and grantees.

 CONFERENCE PUBLICATION. 

Collected papers from scientific and 

technical conferences, symposia, seminars, 

or other meetings sponsored or cosponsored by NASA.

 SPECIAL PUBLICATION. Scientific, 

technical, or historical information from 

NASA programs, projects, and missions, 

often concerned with subjects having

substantial public interest.

 TECHNICAL TRANSLATION. 

English-language translations of foreign 

scientific and technical material pertinent to 

NASA’s mission.

Specialized services also include organizing 

and publishing research results, distributing 

specialized research announcements and feeds, 

providing information desk and personal search 

support, and enabling data exchange services.

For more information about the NASA STI 

program, see the following:

 Access the NASA STI program home page 

at http://www.sti.nasa.gov

 E-mail your question to help@sti.nasa.gov

 Fax your question to the NASA STI 

Information Desk at 443-757-5803

 Phone the NASA STI Information Desk at 

443-757-5802

 Write to:

 STI Information Desk

 NASA Center for AeroSpace Information

 7115 Standard Drive

 Hanover, MD 21076-1320
National Aeronautics and 

Space Administration

Langley Research Center 

Hampton, Virginia 23681-2199

December 2013

NASA/TM–2013-218144

An Application of UAV Attitude Estimation 

Using a Low-Cost Inertial Navigation System

Kenneth W. Eure, Cuong Chi Quach, and Sixto L. Vazquez

Langley Research Center, Hampton, Virginia

Edward F. Hogge

Northrop Grumman Technical Services, Hampton, Virginia

Boyd L. Hill 

Analytical Mechanics Associates, Inc., Hampton, Virginia
Available from:

NASA Center for AeroSpace Information

7115 Standard Drive

Hanover, MD 21076-1320

443-757-5802

The use of trademarks or names of manufacturers in this report is for accurate reporting and does not 

constitute an official endorsement, either expressed or implied, of such products or manufacturers by the 

National Aeronautics and Space Administration. 
Abstract 

Unmanned Aerial Vehicles (UAV) are playing 

an increasing role in aviation. Various methods exist 

for the computation of UAV attitude based on low 

cost microelectromechanical systems (MEMS) and 

Global Positioning System (GPS) receivers. There 

has been a recent increase in UAV autonomy as 

sensors are becoming more compact and onboard 

processing power has increased significantly. Correct 

UAV attitude estimation will play a critical role in 

navigation and separation assurance as UAVs share 

airspace with civil air traffic. This paper describes 

attitude estimation derived by post-processing data 

from a small low cost Inertial Navigation System 

(INS) recorded during the flight of a subscale 

commercial off the shelf (COTS) UAV. Two discrete 

time attitude estimation schemes are presented here 

in detail. The first is an adaptation of the Kalman 

Filter to accommodate nonlinear systems, the 

Extended Kalman Filter (EKF). The EKF returns 

quaternion estimates of the UAV attitude based on 

MEMS gyro, magnetometer, accelerometer, and pitot 

tube inputs. The second scheme is the 

complementary filter which is a simpler algorithm 

that splits the sensor frequency spectrum based on 

noise characteristics. The necessity to correct both 

filters for gravity measurement errors during turning 

maneuvers is demonstrated. It is shown that the 

proposed algorithms may be used to estimate UAV 

attitude. The effects of vibration on sensor 

measurements are discussed. Heuristic tuning 

comments pertaining to sensor filtering and gain 

selection to achieve acceptable performance during 

flight are given. Comparisons of attitude estimation 

performance are made between the EKF and the 

complementary filter. Additionally, GPS heading 

estimates are compared with EFK and 

complementary filter heading estimates. 

Introduction 

There is an extensive body of literature 

regarding attitude estimation using various sensor 

inputs [1-11]. Methods vary from computationally 

expensive particle filters to fast direct methods using 

complementary filtering. Estimator choice is based 

on available hardware and cost constraints. The 

application covered here is based on the use of 

existing attitude estimation schemes. These schemes 

are used to post-process flight data from a subscale 

Unmanned Aerial Vehicle (UAV). While particle 

filtering in principle can produce superior state 

estimates for highly nonlinear systems that are 

perturbed by unknown distributions, they suffer from 

a large computational burden. The Unscented 

Kalman Filter (UKF) reduces the computational 

burden by picking the “particles”, (that is the sigma 

points) deterministically in a manner that preserves 

the mean and variance through nonlinear 

transformation [12]. The Extended Kalman Filter 

(EKF) uses a linearized representation of the 

nonlinear system to estimate the state [13]. While the 

EKF is computationally faster than the UKF, it does 

not perform as well as the UKF in systems that are 

highly nonlinear [14]. An even faster nonlinear state 

estimation developed for attitude estimation is the 

complementary filter [15-19]. This filter may be 

tuned in the frequency domain to select areas of 

sensor spectrum containing the most state 

information while rejecting the spectral content most 

corrupted by noise. Because the application studied 

here is for UAVs, which are mildly nonlinear, the 

EKF and the complementary filter are chosen to postprocess the flight data. The resulting attitude 

estimations are compared to those of the GPS-aided 

ArduPilot, (a popular hobbyist grade autopilot 

utilizing a complementary filter for attitude 

estimation). It is shown that reasonable attitude 

estimation cannot be obtained without the use of air 

data or GPS to correct acceleration measurements 

during turns. Reasonable attitude estimations may be 

obtained by modifying the EKF and complementary 

filter to account for centrifugal accelerations resulting 

from turns. The utility of the modified EKF and 

complementary filter is demonstrated and shown to 

be ideal methods for attitude estimation using low 

cost sensors for UAV application without the need 

for GPS. 

Mathematical Development 

Reference frame transformations and algorithms 

for the EKF and complementary filter are described 

in this section. The algorithms are presented for 

discrete time implementation and references given 

describing development and additional experimental 

outcomes. 

Reference Frames 

Several reference frames may be used to 

describe the orientation of an aircraft in three1
dimensional space [6, 20]. The body frame is the 

reference frame with the origin at the aircraft’s center 

of gravity, positive z pointing out of the bottom of the 

aircraft, positive x out of the nose, and positive y in 

the direction of the right wing. For the inertial frame, 

positive x points to magnetic north, positive z points 

toward the earth’s center of gravity, and positive y is 

normal to the x-z plane, approximately east; this 

forms the North, East, Down, (NED) frame. 

Before the accelerometer readings can be used to 

estimate aircraft attitude, they must be compensated 

to reflect only the effects of gravity and not 

accelerations due to turning [17, 19]. The 

airspeed	ܸ௔௜௥ , angle of attack measurements	ߙ, and 

the 3-axis angular rate gyros ߱௫,௬,௭ may be used to 

estimate the component of the measured acceleration 

ܽሬሬሬሬ

௠ሬԦ that is due to gravity. This true gravity reading ܽሬሬሬሬ௚Ԧ

is needed to level the inertial platform. The discrete 

time algorithm below performs this task at every time 

step k and returns the normalized acceleration 

estimate due to gravity only. In the algorithm below, 

ൈ is the vector cross product, ݑሺ݇ሻ and ݓሺ݇ሻ are the 

aircraft’s linear velocity components in the x and y

direction, and หܽሬሬሬሬ

௚Ԧሺ݇ሻห is the magnitude of the true 

gravity vector. 

ݑሺ݇ሻ ൌ ܸ௔௜௥ሺ݇ሻ ∙ cos ߙ ሺ݇ሻ

ݓሺ݇ሻ ൌ ܸ௔௜௥ሺ݇ሻ ∙ sin ߙሺ݇ሻ

Ωഥሺ݇ሻ ൌ ሾ߱௫ሺ݇ሻ ߱௬ሺ݇ሻ ߱௭ሺ݇ሻሿ்

ܽ௖ ሬሬሬሬԦሺ݇ሻ ൌ Ωഥሺ݇ሻ ൈ ሾݑሺ݇ሻ 0 ݓሺ݇ሻሿ்

ܽሬሬሬሬ

௠ሬԦሺ݇ሻ ൌ ሾܽ௫ሺ݇ሻ ܽ௬ሺ݇ሻ ܽ௭ሺ݇ሻሿ்

ܽሬሬሬሬ

௚Ԧሺ݇ሻ ൌ ܽሬሬሬሬ௠ሬԦሺ݇ሻ െ ܽ௖ ሬሬሬሬԦሺ݇ሻ

ܽሬሬሬሬ

௚Ԧሺ݇ሻ ൌ ܽሬሬሬሬ௚Ԧሺ݇ሻ/หܽሬሬሬሬ௚Ԧሺ݇ሻห

 Sensor measurements in one frame may be 

represented in another through a series of matrix 

transformations [20, 21]. Consider transforming the 

measurement vector from the body frame to the 

inertial frame. This transformation may be 

accomplished through an ordered series of three 

rotation matrices. First, the compensated 

accelerometer signals ሬܽሬሬሬ

௚Ԧ are used to roll about the xaxis until the acceleration in the y-axis, ݕଵ is zero. 

The vector ሺݔଵ, ݕଵ, ݖଵሻ is an intermediate vector used 

in the next rotation. Also, ܽݐܽ݊2 is the inverse 

tangent that places the angle in the correct quadrant. 

߮ ൌ ܽݐܽ݊2 ൬

െܽ௬

ܽ௭

൰

൥

ଵݔ

ଵݕ

ଵݖ

൩ൌ൥10 0

0 cos ߮ sin ߮

0 െ sin ߮ cos ߮൩ ൥ܽ௫

ܽ௬

ܽ௭

൩

The intermediate values of ݔଵ, ݕଵ, ݖଵ are next 

used to pitch about the y-axis until ܽ௫ is zero. 

൬ ܽ݊2ݐܽ ൌ ߠ

ଵݔ

ଵݖ

൰							൥0

0

1

൩ൌ൥cos ߠ 0 െ sin ߠ

01 0

ߠ cos 0 ߠ sin

൩ ൥ݔଵ

ଵݕ

ଵݖ

൩

At this point the x-y plane is parallel to the 

surface of the earth. The next step is to rotate about 

the z-axis until the x-axis points to magnetic north. 

This is accomplished by using the transformed 

magnetometer vector. When pointing to magnetic 

north, the leveled magnetometer will read zero in the 

y-axis. A final rotation accomplishes this as shown 

below where ൫݉௫, ݉௬, ݉௭	൯ is the magnetic reference 

vector. 

൥

ଶݔ

ଶݕ

ଶݖ

൩ൌ൥cos ߠ 0 െ sin ߠ

01 0

ߠ cos 0 ߠ sin

൩ ∙

൥

10 0

0 cos ߮ sin ߮

0 െ sin ߮ cos ߮൩ ൥݉௫

݉௬

݉௭

൩

߰ ൌ ܽݐܽ݊2 ൬

ଶݕ

ଵݕ

൰										

ࡰࡱࡺ ൌ ൥ cos Ψ sin Ψ 0

െ sin Ψ cos Ψ 0

0 01

൩ ൥cos ߠ 0 െ sin ߠ

01 0

ߠ cos 0 ߠ sin

൩

൥

10 0

0 cos ߮ sin ߮

0 െ sin ߮ cos ߮൩

The matrix NED will transform the body 

reference vector to the inertial, or that is magnetic 

north, east down (NED) reference frame. Also, the 

transpose of NED will convert the inertial frame to 

the body frame. The relation is shown below where 

the accelerometer and magnetometer vectors have 

been normalized. 

൥

0

0

1

൩ ൌ ࡰࡱࡺ൥ ∙ ܽ௫

ܽ௬

ܽ௭

൩ ൥

ܽ௫

ܽ௬

ܽ௭

൩ ൌ ࡰࡱࡺ்൥ ∙ 0

0

1

൩ 

௫ܯ൥					

0

௭ܯ

൩ ൌ ࡰࡱࡺ൥ ∙ ݉௫

݉௬

݉௭

൩ ൥

݉௫

݉௬

݉௭

൩ ൌ ࡰࡱࡺ்൥ ∙ ܯ௫

0

௭ܯ

൩

2
In the above equations ܯ௫, 0, ܯ௭ are the 

measured components of the normalized magnetic 

vector when the body frame has been aligned with 

the inertial frame. These measures are relative to 

geographic location. 

The transpose of the matrix NED is the 

Directional Cosine Matrix (DCM). The DCM may be 

used to compute the Euler angles as shown below. 

߮ ൌ ܽݐܽ݊2 ൬

૜,૛ࡹ࡯ࡰ

ࡹ࡯ࡰ૜,૜൰ roll 

ߠ ൌ െܽݏ݅݊൫ࡹ࡯ࡰ૚,૜൯ pitch 

߰ ൌ ܽݐܽ݊2 ൬

૛,૚ࡹ࡯ࡰ

ࡹ࡯ࡰ૚,૚൰ yaw 

The subscripts refer to the row, column DCM

entries. The above attitude estimation is based on 

accelerometer and magnetometer readings and 

returns an approximation to the true attitude. The 

gyro measures may be used to improve the accuracy 

of the attitude estimation. This is done by both the 

EKF and the complementary filter. 

Extended Kalman Filter 

An Extended Kalman Filter is used to fuse 

together the sensor measurements for attitude 

estimation [7, 8]. Aircraft attitude may be modeled 

using a quaternion based on angular velocity 

measures from a three-axis gyroscope. The 

continuous time varying model is as follows: 

൦

ሶ଴ݍ

ଵሶݍ

ଶሶݍ

ଷሶݍ

൪ ൌ ଵ

ଶ

ۏ

ێ

ێ

ێ

ۍ

0 െ߱௫ െ߱௬ െ߱௭

߱௫ 0 ߱௭ െ߱௬

߱௬ െ߱௭ 0 ߱௫

߱௭ ߱௬ െ߱௫ 0 ے

ۑ

ۑ

ۑ

ې

൦

଴ݍ

ଵݍ

ଶݍ

ଷݍ

൪ 

The quaternion model is shown below in 

compact form where ݍ Ԧis the quaternion vector and ષ

is the matrix of angular velocity measurements given 

by the gyro. 

ݍԦሶ ൌ 1

Ԧݍ∙ષ ∙2

This continuous time equation must be 

transformed to the discrete time domain for 

computations. An approximation suitable for real 

time implementations is to use the first few terms of 

the Taylor series representation [22]. 

ሶԦݍ

ሺkሻ ൌ 1

2 ∙ۯ∙ݍԦሺ݇െ1ሻ ൅ ݓሬሬԦሺ݇ሻ

where ࡭ൌ݁ષ்ೞ ≅ܫ൅࡭∙ܶ௦ ൅

ଵ

ଶ! ∙ ሺ࡭∙ܶ௦ሻଶ ൅ ଵଷ! ∙ ሺ࡭∙ܶ௦ሻଷ ൅ ⋯ 

Here ࡭ is the discrete time representation of Ω, 

ܶ௦ is the sampling period in seconds, and ݓሬሬԦ is zero 

mean Gaussian noise. The EKF requires a system 

output equation to update the state error. A 

combination of three-axis accelerometer and threeaxis magnetometer is used to update the quaternion 

state estimations as shown below [23]. 

൦

ܽ௫

ܽ௬

ܽ௭

߰

൪ ൌ

ۏ

ێ

ێ

ێ

ێ

ଶሻݍ଴ݍ െ ଷݍଵݍሺ2 ۍ

2ሺݍଶݍଷ െ ݍ଴ݍଵሻ

଴ݍ

ଶ െ ݍଵଶ െ ݍଶଶ ൅ ݍଷଶ

ܽݐܽ݊2 ቆ 2ሺݍଵݍଶ ൅ ݍଷݍ଴ሻ

଴ݍ

ଶ ൅ ݍଵଶ െ ݍଶଶ െ ݍଷଶቇ

ے

ۑ

ۑ

ۑ

ۑ

ې

Ԧߥ ൅

This equation may be written in compact form 

as shown. 

ݕԦሺ݇ሻ ൌ ݃ሼݍԦሺ݇ሻሽ ൅	ߥԦሺ݇ሻ

Here ܽ௫ , ܽ௬ , and ܽ௭ are the compensated 

accelerations ሬܽሬሬሬ

௚Ԧ with positive ܽ௭ down and with yaw 

߰ in radians. The yaw is taken from the DCM yaw 

estimation. The term ߥ Ԧis additive zero mean 

Gaussian measurement noise. 

The equations for ݍԦሶ

ሺkሻ and ݕԦሺ݇ሻ form the 

discrete time system model used to estimate the 

aircraft attitude in terms of the quaternion. This 

representation is both time varying and nonlinear. 

The state may be estimated using an EKF as shown 

below. 

ሶԦݍ

ሺkሻ ൌ ଵ

ଶ ∙ۯ∙ݍԦሺ݇െ1ሻ 

ࡼሺ݇ሻ ൌ 	࡭ሺ݇ሻ ∙ ࡼሺ݇െ1ሻ ∙ ࡭்ሺ݇ሻ ൅ 	ࡽ

ܭሬԦሺ݇ሻ ൌ ࡼሺ݇ሻ ∙ ࡳ்ሺ݇ሻ ∙ ሺࡳሺ݇ሻ ∙ ࡼሺ݇ሻ ∙ ࡳ்ሺ݇ሻ ൅ ࡾሻିଵ 

ሶԦݍ

ሺkሻ ൌ ݍԦሶሺkሻ ൅ ܭሬԦሺ݇ሻ ∙ ሺݕԦሺ݇ሻ െ 	݃ሼݍԦሺ݇ሻሽሻ

ࡼሺ݇ሻ ൌ ሺࡵ െ ܭሬԦሺ݇ሻ ∙ ࡳሺ݇ሻሻ ∙ ࡼሺ݇ሻ

In the EKF algorithm ࡳሺ݇ሻ is the Jacobian 

matrix of ݃ሼݍԦሺ݇ሻሽ and may be found by taking the 

partial derivative of each row of ݃ሼݍԦሺ݇ሻሽ with respect 

to each element of ݍԦሺ݇ሻ. 

The EKF returns estimates of the aircraft attitude 

in terms of quaternions. The Euler angles may be 

determined from the quaternions as shown below 

[23]. 

3
߶ ൌ ܽݐܽ݊2 ቆ 2ሺݍ଴ݍଵ ൅ ݍଷݍଶሻ

଴ݍ

ଶ െ ݍଵଶ െ ݍଶଶ ൅ ݍଷଶቇ

ߠ ൌ asin	ሺ2ሺݍ଴ݍଶ െ ݍଵݍଷሻሻ

߰ ൌ ܽݐܽ݊2 ቆ 2ሺݍଵݍଶ ൅ ݍଷݍ଴ሻ

଴ݍ

ଶ ൅ ݍଵଶ െ ݍଶଶ െ ݍଷଶቇ

Complementary Filter 

The complementary filter may be used to 

compute attitude based on sensor measurements [15, 

16, 18]. This technique requires fewer computations, 

which makes it more suitable for less powerful 

processors with slower clock speeds. The algorithm 

is presented below. 

ࡾ෩ሺ݇ሻ ൌ ࡾ෡்ሺ݇ሻ ∙ ࡹ࡯ࡰሺ݇ሻ

ࢇ࣊ሺ݇ሻ ൌ 1

2 ∙ ቀࡾ෩ሺ݇ሻ െ ࡾ෩்ሺ݇ሻቁ

ષሺ݇ሻ ൌ ቎ 0 െ߱௭ሺ݇ሻ ߱௬ሺ݇ሻ

߱௭ሺ݇ሻ 0 െ߱௫ሺ݇ሻ

െ߱௬ሺ݇ሻ ߱௫ሺ݇ሻ 0

቏

ષሺ݇ሻ ൌ ષሺ݇ሻ െ ࢙ࢇ࢏࢈ሺ݇ሻ

࡭ሺ݇ሻ ൌܫെ

ષሺ݇ሻ ∙ sinሺ|ષሺ݇ሻ| ∙ ܶ௦ሻ

|ષሺ݇ሻ|

൅

ષሺ݇ሻଶ ∙ ሺ1 െ cosሺ|ષሺ݇ሻ| ∙ ܶ௦ሻሻ

|ષሺ݇ሻ|ଶ

ࡾ෡ሺ݇൅1ሻ ൌ ࡾ෡ሺ݇ሻ ∙ ൫࡭ሺ݇ሻ ൅ ܭ௘௦௧ ∙ ࣊௔ሺ݇ሻ൯

࢙ࢇ࢏࢈ሺ݇൅1ሻ ൌ ࢙ࢇ࢏࢈ሺ݇ሻ ൅ ܶ௦ ∙ ݇௕ ∙ ࣊௔ሺ݇ሻ

In the above algorithm DCM is the directional 

cosine matrix derived from the sensor measurements. 

The matrix ࡾ ෡may be initialized to identity; k is the 

time step and ܶ௦ is the sample rate in seconds. The 

matrix elements ߱௫ሺ݇ሻ, ߱௬ሺ݇ሻ, and	߱௭ሺ݇ሻ are the 

gyro readings in radians/second and bias(k) is the 

gyro bias at time step k. The gains ܭ௘௦௧ and ݇௕ may 

be tuned for the desired application. The attitude 

estimate may be obtained from the matrix ࡾ෡, which is 

an improved estimate of the DCM since it includes 

gyro measurements. 

The Complementary filter may also be 

implemented directly without need to compute the 

DCM [17, 19]. The quaternion based algorithm is 

shown below for discrete time implementation. 

ݑሺ݇ሻ ൌ ܸ௔௜௥ ∙ cos ߙ

ݓሺ݇ሻ ൌ ܸ௔௜௥ ∙ sin ߙ

Ωഥሺ݇ሻ ൌ ሾ߱௫ሺ݇ሻ ߱௬ሺ݇ሻ ߱௭ሺ݇ሻሿ்

ܽ௖ ሬሬሬሬԦሺ݇ሻ ൌ ൫Ωഥሺ݇ሻ െ ܾሬԦሺ݇ሻ൯ ൈ ሾݑሺ݇ሻ 0 ݓሺ݇ሻሿ்

ܽሬሬሬሬ

௠ሬԦሺ݇ሻ ൌ ሾܽ௫ሺ݇ሻ ܽ௬ሺ݇ሻ ܽ௭ሺ݇ሻሿ்

ܽሬሬሬሬ

௚Ԧሺ݇ሻ ൌ ܽሬሬሬሬ௠ሬԦሺ݇ሻ െ ܽ௖ ሬሬሬሬԦሺ݇ሻ

ܽሬሬሬሬ

௚Ԧሺ݇ሻ ൌ ܽሬሬሬሬ௚Ԧሺ݇ሻ/หܽሬሬሬሬ௚Ԧሺ݇ሻห

Ω෡ሺ݇ሻ ൌ Ωഥሺ݇ሻ ൅ ݇௣ ∙ ݁Ԧሺ݇െ1ሻ ൅ ݇ூ ∙ ܾሬԦሺ݇െ1ሻ

࡭ሺ݇ሻ ൌ ࢋభ

మ∙்ೞ∙ષ෡ೣ

ݍԦሺ݇ሻ ൌ ࡭ሺ݇ሻ ∙ ݍԦሺ݇െ1ሻ

ݍԦሺ݇ሻ ൌ ݍԦሺ݇ሻ | ⁄ ݍԦሺ݇ሻ|

ܽොሺ݇ሻ ൌ ቎ 2ሺݍଵݍଷ െ ݍ଴ݍଶሻ

ଵሻݍ଴ݍ ൅ ଷݍଶݍሺ2

଴ݍ

ଶ െ ݍଵଶ െ ݍଶଶ ൅ ݍଷଶ

቏

݁Ԧሺ݇ሻ ൌ ܽሬሬሬሬ

௚Ԧሺ݇ሻ ൈ ܽොሺ݇ሻ

ܾሬԦሺ݇ሻ ൌ ܾሬԦሺ݇െ1ሻ ൅ ݇ூ ∙ ܶ௦ ∙ ݁Ԧሺ݇ሻ

In the above algorithm ݇௣ and ݇ூ are gains to be 

set by the user and the Euler angles may be obtained 

from the quaternion estimation. Also, the acceleration 

has been corrected for turning maneuvers. The vector 

ܽሬሬሬሬ

௠ሬԦሺ݇ሻ is the measured acceleration at time step k, 

ܽ௖ ሬሬሬሬԦሺ݇ሻ is the acceleration due to centrifugal force, and 

the vector ܽሬሬሬሬ

௚Ԧሺ݇ሻ is due to gravity. It is interesting to 

note that this algorithm does not use the 

magnetometer measurements. The quaternion 

solution returned is valid for pitch and roll, but yaw 

must be computed by integrating the gyro signal or 

using the magnetometer. The equation shown below 

uses the magnetometer measurements to compute the 

yaw and is the method used here. 

߰ ൌ

െܽݐܽ݊2 ቆ ݉௬ cos ߶ െ ݉௭ sin ߶

݉௫ cos ߠ ൅ ݉௬ sin ߶ sin ߠ ൅ ݉௭ cos ߶ sin ߠቇ

Experimental Setup 

Two test platforms were used to obtain data for 

attitude estimation. The first is the VECTORNAV 

VN100 development board, manufactured by 

VectorNav Technologies LLC., shown in Figure 1 

[24, 25]. 

4
Figure 1. VN100 Development Board 

The VN100 data was gathered using a serial 

interface to a computer using MATLAB to record 

sensor data (3-axis accelerometer, gyroscope, and 

magnetometer) and attitude estimations returned by 

the VN100. The data was generated by randomly 

moving the VN100 by hand for two minutes. This 

data was post-processed by the EKF and 

complementary filter algorithms to estimate the 

attitude and compare the estimated attitude with that 

returned by the VN100. The purpose of this 

experiment was to test for correct algorithm 

implementation in a controlled environment and 

make observations in regards to any deviations in 

comparing the resulting attitude estimations. 

The second experimental platform was the UAV 

shown in Figure 2 mounted nose down in a trifilar. 

Figure 2. Edge 540T UAV 

This UAV is a 33% scaled Edge 540T, 

manufactured by SIG Manufacturing Company, Inc., 

with electric propulsion powered by lithium polymer 

batteries. The Edge is 98 inches long with a 100 inch 

wing span, weighs 47.4 lbs., and has 1881 in2 of wing 

area with an average wing load of 0.025 psi. The 

power system consists of two brushless DC electric 

motors mounted in tandem to drive a 26 inch 

propeller. The motor assembly turns the propeller up 

to 6000 RPM to develop about 37 pounds of thrust. 

Its airspeed ranges from a stall of 12 m/s to a dash of 

about 40 m/s (23-77 knots). 

There are two INS systems onboard the Edge. 

The first is the VN100 and the second the ArduPilot, 

manufactured by 3DRobotics Inc., shown in Figure 3. 

Figure 3. ArduPilot Mounted in Edge 

The ArduPilot is located within the center silver 

box. In the rear of Figure 3 is the PC104 used for data 

recording. Data from the ArduPilot sensors and the 

ArduPilot’s attitude estimation were recorded during 

flight along with the VN100 sensor data and attitude 

estimation. This data was then post-processed to 

determine attitude estimations using both the EKF 

and the complementary filter. Post-processed attitude 

estimations were compared to estimations from the 

VN100, ArduPilot, and heading estimates from GPS. 

Laboratory Results 

To demonstrate the attitude estimation 

capabilities of both the EKF and the complementary 

filter, data was gathered using the VN100 

development board. Comparisons were made with the 

unfiltered DCM solution, EKF and complementary 

filter solutions, and the attitude solution returned by 

the VN100. 

5
Extended Kalman filter results 

Shown in Figure 4 is the ability of the EKF to 

estimate the Euler angles of the VN100 development 

board during random motion by hand. 

Figure 4. EKF Euler Angles and Differences 

As seen in the attitude plots of Figure 4, the EKF 

returned the same estimates, (blue), as the VN100, 

(red). Also shown are the DCM attitude estimations, 

(green), which were derived from the accelerometer 

and magnetometer without use of the gyrometers. 

The DCM solution is not as immune to noise since no 

filtering is taking place. Overall, these experimental 

results demonstrate the ability of the EKF 

implementation to very closely match that of the 

VN100. 

Complementary filter results 

Figure 5 demonstrates the ability of the 

complementary filter to estimate the attitude returned 

by the VN100 during random motion by hand. As 

can be seen from the attitude plots, the 

complementary filter performed similar to the VN100 

solution. 

0 0.5 1 1.5 2 -80

-60

-40

-20

0

20

40

60

80

Time in Minutes

Degrees

Roll

VN100

DCM

EKF

0 0.5 1 1.5 2 -60

-40

-20

0

20

40

60

Time in Minutes

Degrees

Pitch

VN100

DCM

EKF

0 0.5 1 1.5 2 -100

-50

0

50

100

150

200

Yaw

Time in Minutes

Degrees

VN100

DCM

EKF

0 0.5 1 1.5 2 -10

0

10

Degrees

Pitch Difference

VN100 - DCM

VN100 - EKF

0 0.5 1 1.5 2 -10

0

10

Roll Difference

Degrees

0 0.5 1 1.5 2 -10

0

10

Yaw Difference

Time in Minutes

Degrees

0 0.5 1 1.5 2 -80

-60

-40

-20

0

20

40

60

80

Time in Minutes

Degrees

Roll

VN100

DCM

Complement

6
Figure 5. Complementary Filter Estimates and 

Differences 

The attitude plots show reasonable agreement 

between the filtering techniques. However, a small 

difference can be seen when comparing the VN100 

and complementary filter solutions. This small 

difference may be attributed to the fact that they are 

different estimation schemes and does not necessarily 

reflect a more accurate solution of one technique in 

comparison with the other. Overall the solutions are 

very similar and indicate the characteristic of the 

complementary filter to return a reasonable solution 

while requiring fewer computations. 

Flight Results 

Both the EKF and complementary filter may be 

used to estimate the attitude of the Edge aircraft by 

post-processing the sensor data recorded during 

flight. It was found that both filters returned 

reasonable results for attitude estimates when the 

acceleration measurements were corrected during 

turn maneuvers. 

EKF application to flight data 

In this section the application of the EKF to 

flight data is presented. The sensor data from the 

accelerometer, gyrometer, and magnetometer is postprocessed using the EKF algorithm to compute 

estimates of the quaternion attitude representation. 

Figure 6 shows the flight path and the resulting 

attitude estimates given by the VN100, ArduPilot, 

and EKF. The flight path is relative to an arbitrary 

zero point and northing, easting are the relative 

distances north and east. The yaw estimate plot also 

shows the GPS heading [26]. 

0 0.5 1 1.5 2 -60

-40

-20

0

20

40

60

Time in Minutes

Degrees

Pitch

VN100

DCM

Complement

0 0.5 1 1.5 2 -100

-50

0

50

100

150

200

Time in Minutes

Degrees

Yaw

VN100

DCM

Complement

0 0.5 1 1.5 2 -10

0

10

Degrees

Pitch Difference VN100 - DCM

VN100 - Comp

0 0.5 1 1.5 2 -10

0

10

Roll Difference

Degrees

0 0.5 1 1.5 2 -10

0

10

Yaw Difference

Time in Minutes

Degrees

0 100 200 300 400 500 600 700 0

100

200

300

400

500

600

700

Easting (meters)

Northing (meters)

Flight Path in Meters

Total Flight Path

Takeoff

Landing

7
Figure 6. EKF Euler Angles and Differences 

The ArduPilot attitude solution and that returned 

by the EKF are approximately the same given the 

high noise level and low cost instrumentation used in 

the flight. However, the attitude estimation given by 

the VN100, (red), is unacceptable as can be clearly 

seen by examining the yaw solution and difference 

plots of Figure 6. This is due to centrifugal force 

effects on the VN100 accelerometer during turns. In 

the first experiment when the VN100 development 

board was randomly moved by hand, there were no 

appreciable centrifugal forces. However, during 

aircraft turn maneuvers the accelerometers are 

measuring the acceleration due to turning as well as 

gravity. Since the aircraft attitude calculations are 

dependent on the gravity vector pointing straight 

down for accurate attitude estimations, the body 

frame of the aircraft cannot be properly aligned with 

the inertial frame for meaningful estimates. This 

requires that the acceleration measurements be 

compensated using velocity and/or GPS 

measurements to correct the attitude estimates during 

turning. The VN100 does not have this capability. 

However, the EKF implementation presented here 

uses the pitot tube to determine the aircraft velocity 

combined with the gyros to produce correct attitude 

estimates. GPS is used here only to show heading 

agreement. 

Complementary filter application to flight data 

The complementary filter may also be applied to 

the flight data to compute the correct attitude. Figure 

7 shows the resulting attitude for the same flight used 

by the EKF. As can be seen, the ArduPilot and the 

complementary filter return similar attitude 

05 10 15 20 25 -200

-150

-100

-500

50

100

150

200

Yaw

Time in Minutes

Degrees

VN100

ArduPilot

EKF

GPS

05 10 15 20 25 -120

-100

-80

-60

-40

-200

20

40

60

80

Time in Minutes

Degrees

Roll

VN100

ArduPilot

EKF

05 10 15 20 25 -500

50

100

Time in Minutes

Degrees

Pitch

VN100

ArduPilot

EKF

05 10 15 20 25

-200

20

Degrees

Pitch Difference

ArduPilot - VN100

ArduPilot - EKF

05 10 15 20 25

-500

50

Roll Difference

Degrees

05 10 15 20 25

-2000

200

Yaw Difference

Time in Minutes

Degrees

8
estimations. The observed differences may be 

attributed to different tuning gains, noise levels, and 

instrumentation differences. The MEMs used for the 

ArduPilot solution are slightly less accurate than 

those of the VN100. The VN100 sensor suite and the 

pitot tube were used as the data sources for the 

complementary filter. The GPS heading is shown 

only for comparison and was not used in the 

complementary filter calculations. It is interesting 

that the complementary filter returns an attitude 

estimate that appears to be just as accurate as that of 

the EKF but with far fewer computations. 

Figure 7. Complementary Filter Estimates and 

Differences 

0 5 10 15 20 25 -200

-150

-100

-50

0

50

100

150

200

Time in Minutes

Degrees

Yaw

ArduPilot

Complement

GPS

0 5 10 15 20 25 -150

-100

-50

0

50

100

150

Time in Minutes

Degrees

Roll

ArduPilot

Complement

0 5 10 15 20 25 -50

0

50

100

Time in Minutes

Degrees

Pitch

ArduPilot

Complement

0 5 10 15 20 25

-20

0

20

Degrees

Pitch Difference ArduPilot - Comp

0 5 10 15 20 25

-40

-20

0

20

40

Roll Difference

Degrees

0 5 10 15 20 25

-200

0

200

Yaw Difference

Time in Minutes

Degrees

9
Conclusions 

Low cost Inertial Navigation Systems provide 

reasonable attitude estimation performance when 

centrifugal forces can be accounted for during turns. 

The applications presented here demonstrate the use 

of the Extended Kalman Filter and complementary 

filter for both a low noise lab experiment and an 

unmanned aerial vehicle flight. Results demonstrate 

reasonable attitude tracking performance of both 

filters when the filters are provided with velocity 

measurements derived from a pitot tube to correct 

gravity measurements during turns. The direct 

implementation of the complementary filter is of 

special interest due to low computational burden. 

From visual inspection of the attitude plots it was 

found that the complementary filter is an ideal 

candidate for low cost attitude estimation where 

processor memory and speed are restricted. This 

work also highlights the need to provide the low cost 

microelectromechanical systems with additional 

information, such as velocity measurements, to 

correct attitude estimates during turns. 

References 

[1] Zamani, Mohammad, Jochen Trumpf, Robert Mahony, 

2010, Near-Optimal Deterministic Attitude Filtering, 

49th IEEE Conference on Decision and Control, 

Atlanta, GA, Institute of Electrical and Electronics 

Engineers, pp. 6511-6516. 

[2] Crassidis, John L., F. Landis Markley, Yang Cheng, 

2006, Survey of Nonlinear Attitude Estimation 

Methods, Journal of Guidance, Control, and 

Dynamics, Vol. 30, No. 1, American Institute of 

Aeronautics and Astronautics, pp. 12-28. 

[3] Kingston, Derek B., Randal W. Beard, 2004, RealTime Attitude and Position Estimation for Small 

UAVs Using Low-Cost Sensors, AIAA 3rd

“Unmanned Unlimited” Technical Conferences, 

Workshop, and Exhibit, Chicago, Illinois, American 

Institute of Aeronautics and Astronautics, pp. 1-9. 

[4] Du, Dacheng, Li Liu, Xiaojing Du, 2010, A Low-Cost 

Attitude Estimation System for UAV Application, 

2010 Chinese Control and Decision Conference, 

Xuzhou, Institute of Electrical and Electronics 

Engineers, pp. 4489-4492. 

[5] Bauer, Peter, Jozsef Bokor, 2010, Development and 

Hardware-in-the-Loop Testing of an Extended 

Kalman Filter for Attitude Estimation, 11th IEEE 

International Symposium on Computational 

Intelligence and Informatics, Budapest, Hungary, 

Institute of Electrical and Electronics Engineers, pp. 

57-62. 

[6] Marmion, Mathieu, 2006, Airborne Attitude Estimation 

using a Kalman Filter, Longyearbyen, Norway, The 

University Centre of Svalbard, pp. 1-85. 

[7] Sabatelli, Simone, Francesco Sechi, Luca Fanucci, 

Alessandro Rocchi, 2011, A Sensor Fusion Algorithm 

for an Integrated Angular Position Estimation with 

Inertial Measurement Units, Design, Automation & 

Test in Europe (DATE) Conference & Exhibition, 

Grenoble, European Design and Automation 

Association, pp. 1-4. 

[8] Chao, Haiyang, Calvin Coopmans, Long Di, 

YangQuan Chen, 2010, A Comparative Evaluation of 

Low-Cost IMUs for Unmanned Autonomous Systems, 

IEEE International Conference on Multisensor Fusion 

and Integration for Intelligent Systems, Salt Lake City, 

Utah, Institute of Electrical and Electronics

Engineers, pp. 211-216. 

[9] Lee, Jung Keun, Edward J. Park, Stephen N. 

Robinovitch, 2012, Estimation of Attitude and 

External Acceleration Using Inertial Sensor 

Measurement During Various Dynamic Conditions, 

IEEE Transactions on Instrumentation and 

Measurement, Vol. 61, No. 8, Institute of Electrical 

and Electronics Engineers, pp. 2262-2273. 

[10] Jang, Jung Soon, Darren Liccardo, 2007, Small UAV 

Automation Using MEMS, IEEE A&E Systems 

Magazine, Institute of Electrical and Electronics 

Engineers, pp. 30-34. 

[11] Ma, Der-Ming, Jaw-Kuen Shiau, I.-Chiang Wang, 

Yu-Heng Lin, 2011, Attitude Determination Using a 

MEMS-Based Flight Information Measurement Unit, 

Sensors 12, no. 1, pp. 1-23. 

[12] Almeida, Joao, 2010, State Estimation of Nonlinear 

Systems Using the Unscented Kalman Filter, Lisbon, 

Portugal, Institute for Systems and Robotics – Lisbon. 

[13] Huang, Shoudong, 2010, Understanding Extended 

Kalman Filter – Part III: Extended Kalman Filter, 

Sydney, University of Technology Sydney, pp. 1-5. 

[14] Sadeghi, Behrooz, Behzad Moshiri, 2007, SecondOrder EKF and Unscented Kalman Filter Fusion for 

Tracking Maneuvering Targets, IEEE International 

Conference on Information Reuse and Integration, Las 

Vegas, Nevada, Institute of Electrical and Electronics 

Engineers, pp. 514-519. 

[15] Mahony, Robert, Terek Hamel, Jean-Michel Pflimlin, 

2008, Nonlinear Complentary Filters on the Special 

10
Orthogonal Group, IEEE Transactions on Automatic 

Control, Vol. 53, No. 5, Institute of Electrical and 

Electronics Engineers, pp. 1203-1218. 

[16] Mahony, Robert, Tarek Hamel, Jean-Michel Pflimlin, 

2005, Complementary Filter Design on the Special 

Orthogonal Group SO(3), 44th IEEE Conference on 

Decision and Control, European Control Conference, 

Seville, Spain, Institute of Electrical and Electronics 

Engineers, pp. 1477-1484. 

[17] Euston, Mark, Paul Coote, Robert Mahony, Jonghyuk 

Kim, Tarek Hamel, 2008, A Complementary Filter for 

Attitude Estimation of a Fixed-Wing UAV, IEEE/RSJ 

International Conference on Intelligent Robots and 

Systems, Nice, IROS, pp. 340-345. 

[18] Hamel, Tarek, Robert Mahony, 2006, Attitude 

Estimation on SO(3) Based on Direct Inertial 

Measurements, Proceedings 2006 IEEE International 

Conference on Robotics and Automation, Orlando, 

Florida, Institute of Electrical and Electronics 

Engineers, pp. 2170-2175. 

[19] Mahony, R., M. Euston, Jonghyuk Kim, P. Coote, T. 

Hamel, 2010, A Non-Linear Observer for Attitude 

Estimation of a Fixed-Wing Unmanned aerial Vehicle 

Without GPS Measurements, Transactions of the 

Institute of Measurement and Control, Sage, pp. 699-

717. 

[20] Leng, G., Lecture 6: Aircraft Orientation in 3 

Dimensions, Singapore, National University of 

Singapore, pp. 1-26, 

http://dynlab.mpe.nus.edu.sg/mpelsb/me4241/L6n.pdf. 

[21] Axelrad, P., D. Lawrence, 2006, Attitude 

Determination Problem, University of Colorado 

Boulder, pp. 1-18, 

http://www.colorado.edu/ASEN/asen3200/handouts/A

SEN3200%20Attitude%20Representations.ppt. 

[22] Woodman, Oliver J., 2007, An Introduction to Inertial 

Navigation, Cambridge, England, University of 

Cambridge, pp. 21-23. 

[23] VectorNav Technology, Quaternion Math, Rev 1.1, 

VectorNav Technology, 

http://www.vectornav.com/Downloads/Support/AN00

2.pdf. 

[24] VectorNav Technologies, 2009, VN-100 

Development Board User Manual, VectorNav 

Technologies, pp. 1-10. 

[25] VectorNav Technologies, 2009, VN-100(T) User 

Manual, VectorNav Technologies, pp. 1-65. 

[26] SiRF Technology, Inc., 2005, NMEA Reference 

Manual, Revision 1.3, SiRF Technology, Inc., pp. 1-7. 

11
REPORT DOCUMENTATION PAGE Form Approved

OMB No. 0704-0188

2. REPORT TYPE 

Technical Memorandum

 4. TITLE AND SUBTITLE

An Application of UAV Attitude Estimation Using a Low-Cost Inertial 

Navigation System 

5a. CONTRACT NUMBER

 6. AUTHOR(S)

Eure, Kenneth W.; Quach, Cuong C.; Vazquez, Sixto L.; Hill, Boyd L.

 7. PERFORMING ORGANIZATION NAME(S) AND ADDRESS(ES)

NASA Langley Research Center

Hampton, VA 23681-2199

 9. SPONSORING/MONITORING AGENCY NAME(S) AND ADDRESS(ES)

National Aeronautics and Space Administration

Washington, DC 20546-0001

 8. PERFORMING ORGANIZATION

 REPORT NUMBER

L-20330

10. SPONSOR/MONITOR'S ACRONYM(S)

NASA

13. SUPPLEMENTARY NOTES

12. DISTRIBUTION/AVAILABILITY STATEMENT

Unclassified - Unlimited

Subject Category 03

Availability: NASA CASI (443) 757-5802

19a. NAME OF RESPONSIBLE PERSON

STI Help Desk (email: help@sti.nasa.gov)

14. ABSTRACT

Unmanned Aerial Vehicles (UAV) are playing an increasing role in aviation. Various methods exist for the computation of UAV attitude based on low cost 

microelectromechanical systems (MEMS) and Global Positioning System (GPS) receivers. There has been a recent increase in UAV autonomy as sensors are 

becoming more compact and onboard processing power has increased significantly. Correct UAV attitude estimation will play a critical role in navigation and 

separation assurance as UAVs share airspace with civil air traffic. This paper describes attitude estimation derived by post-processing data from a small low 

cost Inertial Navigation System (INS) recorded during the flight of a subscale commercial off the shelf (COTS) UAV. Two discrete time attitude estimation 

schemes are presented here in detail. The first is an adaptation of the Kalman Filter to accommodate nonlinear systems, the Extended Kalman Filter (EKF). The 

EKF returns quaternion estimates of the UAV attitude based on MEMS gyro, magnetometer, accelerometer, and pitot tube inputs. The second scheme is the 

complementary filter which is a simpler algorithm that splits the sensor frequency spectrum based on noise characteristics. The necessity to correct both filters 

for gravity measurement errors during turning maneuvers is demonstrated. It is shown that the proposed algorithms may be used to estimate UAV attitude. The 

effects of vibration on sensor measurements are discussed. Heuristic tuning comments pertaining to sensor filtering and gain selection to achieve acceptable 

performance during flight are given. Comparisons of attitude estimation performance are made between the EKF and the complementary filter. 

15. SUBJECT TERMS

Attitude; Euler Angles; Inertial navigation system; Low cost; Navigation; Unmanned aerial vehicles

18. NUMBER

 OF 

 PAGES

16

19b. TELEPHONE NUMBER (Include area code)

(443) 757-5802

a. REPORT

U

c. THIS PAGE

U

b. ABSTRACT

U

17. LIMITATION OF 

 ABSTRACT

UU

Prescribed by ANSI Std. Z39.18

Standard Form 298 (Rev. 8-98)

3. DATES COVERED (From - To)

5b. GRANT NUMBER

5c. PROGRAM ELEMENT NUMBER

5d. PROJECT NUMBER

5e. TASK NUMBER

5f. WORK UNIT NUMBER

 534723.02.05.07 

11. SPONSOR/MONITOR'S REPORT

 NUMBER(S)

NASA/TM-2013-218144

16. SECURITY CLASSIFICATION OF:

The public reporting burden for this collection of information is estimated to average 1 hour per response, including the time for reviewing instructions, searching existing data sources, 

gathering and maintaining the data needed, and completing and reviewing the collection of information. Send comments regarding this burden estimate or any other aspect of this 

collection of information, including suggestions for reducing this burden, to Department of Defense, Washington Headquarters Services, Directorate for Information Operations and 

Reports (0704-0188), 1215 Jefferson Davis Highway, Suite 1204, Arlington, VA 22202-4302. Respondents should be aware that notwithstanding any other provision of law, no person 

shall be subject to any penalty for failing to comply with a collection of information if it does not display a currently valid OMB control number.

PLEASE DO NOT RETURN YOUR FORM TO THE ABOVE ADDRESS.

1. REPORT DATE (DD-MM-YYYY)

01- 12 - 2013