intelligent system for tracking and location of mobile...
TRANSCRIPT
FACULDADE DE ENGENHARIA DA UNIVERSIDADE DO PORTO
Intelligent system for tracking and
location of mobile devices – smartphones.
Bruno Daniel Mourão Azevedo
Mestrado Integrado em Engenharia Informática e Computação
Orientador: Eng. Gil Manuel Magalhães de Andrade Gonçalves
Junho de 2012
© Bruno Daniel Mourão Azevedo, 2012
Intelligent system for tracking and location of mobile devices – smartphones.
Bruno Daniel Mourão Azevedo
Mestrado Integrado em Engenharia Informática e Computação
Aprovado em provas públicas pelo Júri:
Presidente: Nome do Presidente (Título)
Vogal Externo: Nome do Arguente (Título)
Orientador: Nome do Orientador (Título)
____________________________________________________
30 de Junho de 2010
Resumo
Os sistemas de localização, posicionamento e navegação têm diversas aplicações possíveis,
de militares a comerciais, passando por segurança ou auxílio em situações de emergência. Por
estes motivos, têm sido alvo de investigação e desenvolvimento desde o início dos tempos. Com
a crescente evolução de dispositivos móveis, têm sido integrados vários tipos de sensores nos
novos equipamentos. Desde sensores dedicados a localização a outros que mesmo não tendo
esse objectivo principal, podem complementar os primeiros, representam oportunidades
investigação neste âmbito.
Com esta dissertação pretende-se criar um sistema de localização de smartphones com
sistema operativo Android, utilizando os sensores presentes no equipamento. O objectivo
principal é obter uma forma que permita complementar outros métodos de localização,
nomeadamente em locais onde o Global Positioning System (GPS) ou sistemas de localização
por rádio (Wi-Fi ou Bluetooth) tenham uma fraca cobertura, por exemplo em localizações
exteriores como zonas densamente urbanizadas ou florestadas, ou também em zonas interiores.
Obtendo e processando os dados obtidos pelo acelerómetro e pelo magnetómetro do
equipamento, é possivel estimar a distância percorrida e sua orientação, pelo que, partindo de
uma posição inicial obtida pelo GPS ou Wi-Fi, podemos estimar a localização de um
determinado equipamento, mesmo em locais onde não é possível obter informações de
localização por satélite.
Abstract
The location, positioning and navigation systems have several applications, from military
to commercial, security and emergency situations. For all these reasons, they have been the
target of much investigation and development, since the beginning of times.
With the recent evolution of mobile devices, it has been integrated several types of sensors
in the new equipment. From location dedicated sensors to others that can help complementary
the first, all of them bring new investigation opportunities.
With this thesis, the goal is to create a location-based system for Android smartphones,
using the sensor from the equipment, and that could complement the main location system, such
as GPS or radio-based Wi-Fi and Bluetooth, in locations where these signals are weak or
unavailable, like urban areas, forests or indoors.
Obtaining and processing the accelerometer and geomagnetic sensor from the equipment,
it’s possible to estimate the distance and the orientation of the movement. This means that from
an initial GPS position, one can estimate the location from a device, even in places where the
satellite information is unavailable.
Agradecimentos
Quero agradecer a todos os que estiveram comigo durante toda esta maratona que agora
termina:
Todos os colegas que conheci na FEUP;
Todos os Professores, em especial ao Prof Francisco Restivo e ao Prof.Augusto
Sousa;
A todos os meus amigos;
À minha mãe que sempre esteve comigo. Ao meu pai, que gostaria que tivesse
estado sempre comigo.
À Maria, por todo o apoio, carinho e Amor.
Contents
Introduction ....................................................................................................................... 1
1.1 Context ............................................................................................ 1
1.2 Project ............................................................................................. 2
1.3 Motivation and Goals ...................................................................... 2
1.4 Structure of this Dissertation ........................................................... 2
State of the Art .................................................................................................................. 5
2.1 Introduction ..................................................................................... 5
2.2 Technologies ................................................................................... 5
2.2.1 Global Positioning System .............................................................. 6
2.2.2 Wi-Fi positioning system ................................................................ 7
2.2.3 Inertial Navigation System .............................................................. 8
2.2.4 Android ......................................................................................... 10
2.2.5 Sensors .......................................................................................... 14 2.2.5.1 Motion Sensors 14
2.2.5.2 Position Sensors 16
2.2.5.3 Environment Sensors 18
2.3 Background Research .................................................................... 18
2.3.1 SmartNavi beta .............................................................................. 18
2.3.2 InertialNav ..................................................................................... 18
2.3.3 Wireless IMU ................................................................................ 19
2.3.4 Google Maps Floor Plan Marker ................................................... 19
2.3.5 Lighthouse Signal Systems ........................................................... 20
2.3.6 tagin! ............................................................................................. 20
2.3.7 Skyhook ......................................................................................... 20
2.3.8 Open Source Aided Inertial Navigation ToolKit .......................... 21
2.3.9 Navatar: Navigating Blind Users in Indoor Spaces using Tactile
Landmarks 21
2.3.10 Nokia High Accuracy Indoor Positioning ..................................... 22
2.4 Conclusions ................................................................................... 22
Solutions ........................................................................................................................... 24
3.1 Positioning and Movement ............................................................ 24
3.2 Conclusion ..................................................................................... 27
Implementation ............................................................................................................... 29
4.1 Architecture ................................................................................... 29
4.2 Inertial Measurement Unit ............................................................ 30
4.3 Conclusion ..................................................................................... 33
Conclusions and Future Work ....................................................................................... 35
5.1 Test Results ................................................................................... 35
5.2 Conclusions and Achieved Goals .................................................. 40
5.3 Future Work .................................................................................. 41
References ........................................................................................................................ 43
xiii
List of Figures
Figure 1 – GPS constellation example [4] 7
Figure 2 – Axis of Android device [10] 9
Figure 3 - Android architecture [12] 11
Figure 4 - World coordinate system [10] 17
Figure 5 - Equations for isolation of gravity 25
Figure 6 - Calculation of linear acceleration on each axis 26
Figure 7 - Equation of the relation between acceleration and velocity [18] 26
Figure 8 - Integral of acceleration over time [18] 27
Figure 9 - Equation of the relation between velocity and distance [18] 27
Figure 10 - Integral of velocity over time [18] 27
Figure 11 - System architecture 29
Figure 12 - Calculation of the coefficient for low pass filter 31
Figure 13 - Six degrees of freedom [21] 32
Figure 14 - Data from Device A 37
Figure 15 - Data from Device B 38
Figure 16 - Relation between distance and error - Device A 38
Figure 17 - Relation between distance and error - Device B 39
xv
List of Tables
Table 1 - Sony Ericsson X10 Mini Specifications [14] 12
Table 2 - Sony Ericsson WT19i Live With Walkman Specifications [15] 13
Table 3 – Data measures from test in Device A. 36
Table 4 - Data measures from test in Device B 36
xvii
Abreviaturas e Símbolos
GPS Global Positioning System
INS Inertial Navigation System
API Application Programming Interface
IMU Inertial Measurement Unit
RSS Received Signal Strength
Chapter 1
Introduction 2
Nowadays location and tracking systems are required in a wide variety of environments.
Outdoors location with high level of accuracy is possible using Global Positioning System 4
(GPS) receivers, that can be dedicated devices, usually for navigation purposes, or integrated in
other devices such as smartphones and Tablets. Location systems benefit from the integration 6
with internet mobile devices, allowing them to become mainstream, therefore creating many
research and marketing opportunities. The possibilities of use of an efficient indoors location 8
system are numerous, such as helping the user navigating to the boarding location at an airport,
finding a specific store in a shopping mall or even finding missing children in public spaces and 10
helping the visual impaired navigating in corridors and open spaces. Even finding missing items
such as luggage can be possible using a well built location system. 12
1.1 Context 14
This thesis was the result of a study developed as a conclusion of the Masters in Computer 16
Engineering in the Faculty of Engineering of the University of Porto, in a partnership with the
company AGT Germany, which is the Germany counterpart of the Multinational AGT 18
International. This company offers innovative solutions in the areas of critical infrastructure and
border protection, urban management, cyber security, transportation, law enforcement, and 20
natural disaster preparedness, helping unlock the world’s potential by enabling the free flow of
goods, services, people, and ideas. 22
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
2
1.2 Project
The goal of this project is to develop a location system that works indoors, where the GPS 2
signal is not available, using data from the sensors of an Android smartphone. This can be
accomplished using algorithms of sensor fusion, combining simultaneously the data from the 4
multiple sensors present in a mobile phone.
1.3 Motivation and Goals 6
Location systems can have a wide variety of uses. Some of them can be commercial, such 8
as identifying when a potential customer reaches the whereabouts of a store and sending him a
communication with a specific product or promotion. This is already made using cell 10
information and bluetooth, but if the first case lacks precision, the second one requires that the
customer has the bluetooth function on. Another potential use of location system can be for 12
security and emergency purposes, for instance for create a mobile application that sends the
authorities a distress signal with the exact location of the occurrence. If the location is in 14
outdoors, GPS signal is precise enough to achieve an acceptable level of accuracy, however in
indoors the existent technologies lack solutions that can be useful. In this thesis, the main goal is 16
to analyze the possibility of create a system that can achieve an acceptable level of accuracy
where the signal from the GPS is low or inexistent, using the sensors from the phone. 18
Considering the business area of the company AGT International, the goal is to integrate the
application created in the course of this Dissertation with the solutions the company already 20
have, improving the ones that have location awareness issues.
The main study present in this Dissertation is to discover if it is possible to develop a 22
system that uses the sensors from the phone to support the GPS signal and obtain a possible
location of the user, and if it can, for how long is the system reliable on its own, and with what 24
level of accuracy.
Because of the need to the system to be retro-compatible, this brings some additional 26
challenges, as there are some features that are already present in the most recent Android API,
that can’t be used in this system, such as the calculated sensor for Linear Accuracy and the 28
Gyroscope support.
30
1.4 Structure of this Dissertation
This Dissertation is composed by this Introduction, then in the Chapter 2 will be described 32
the state of the art, the technologies used and another solutions in the market. In the Chapter 3,
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
3
the solutions and the theory behind the implementation, that will be described in Chapter 4. In
Chapter 5 it will be described the conclusions and the fulfilment of goals. 2
Chapter 2
State of the Art 2
2.1 Introduction
4
In this chapter it will be described the technologies relevant for this work and the previous
research made in the area of knowledge of navigation and location tracking. It was also made a 6
research for applications in the market nowadays with a work related to the one in this project,
with ideas, solutions and results that could be used in this work. 8
2.2 Technologies 10
Navigation systems are present since the beginning of times, whether in nature by the
migration of birds, or in the willing of explorers from the early civilizations. Many centuries 12
ago, navigators used rudimentary devices for measuring the visible altitude of the stars and
compasses to obtain raw locations of the ships. 14
Because of its undeniable interest, for exploration, navigation or even military purposes,
navigation technologies evolved in a way that nowadays satellite navigation can provide many 16
different uses, and reached a point in which somewhere in the world anyone can know where he
is, how to reach a certain destination and even what services are in the whereabouts of the 18
location.
There are two different methods for implementing a positioning system: self and remote 20
positioning. In self-positioning, the physical location is self-determined by the user’s device
using transmitted signals from terrestrial or satellite beacons. The location is known by the user 22
and can be used by applications and services operating on the user’s mobile device. In remote
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
6
positioning, the location is determined at the server side using signals emitted from the user
device. The location is then either used by the server in a tracking software system, or 2
transmitted back to the device through a data transfer method. [1]
2.2.1 Global Positioning System 4
Global Positioning System (GPS) is a location and navigation system developed in 1973 6
by the United States Department of Defense for military purposes. It became fully operational
in 1994 and was opened to civilian use in May 2000. GPS Satellites continually transmit 8
messages that include a timestamp and its location, allowing the GPS receiver to compute its
position. To level up for any mistakes, the receiver uses always four or more satellites to 10
estimate the position using geometric trilateration, and line of sight is required at all time. This
means that for outdoors navigation GPS systems can reach high levels of accuracy, however 12
when line of sight (LOS) is not provided, for instance in indoors navigation, the system can't
be used because LOS is blocked by walls and roofs. However, in outdoors navigation, the 14
system provides precise information about latitude, longitude and altitude. At this moment, the
satellite constellation include 24 satellites, that are all available 95% of the time. There are 16
also extra satellites to performance increasing, but they are not part of the core constellation.
[2] [3] 18
In the case of poor signal conditions, many smartphones can use Assisted GPS, which is a 20
co-system that uses network resources to try to determine a raw position of the device and
obtain the correct time and the orbital data of the satellites, to optimize the first fix of the GPS 22
signal. The example of the trajectories of the constellation can be seen on Figure 1.
24
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
7
2
4
6
2.2.2 Wi-Fi positioning system 8
Wi-Fi (Wireless Fidelity) is the common name for IEEE 802.11 standard and is a 10
technology that enables wireless internet access, when the device within the radius of an access
point. Devices that use Wi-Fi include personal computers, tablets, smartphones, video game 12
consoles and portable audio players. Communications using Wi-Fi are a two-way channel in
which the device's wireless adapter converts the data to radio signals and transmit them via an 14
antenna to the wireless router, that sends the signals to the internet using a wired Ethernet
connection. 16
The process works in the same way in reverse, as the router sends the information via
radio to the device's wireless adapter. This adapter can also compute the strength of the signal, 18
measured by a number, called the received signal strength, or RSS [5].
The range of a Wi-Fi signal can reach 100 meters, or in case of the 802.11n standard, until 20
300 meters in outdoors or open-spaces, or from 25 to 50 meters in indoors environments. This
Figure 1 – GPS constellation example [4]
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
8
range, combined with the widespread deployment of networks in buildings and public services,
and the ability of the receivers to compute the RSS, provided the opportunity to implement 2
algorithms of location-based systems using Wi-Fi networks. Methods used include
triangulation, k-nearest neighbours, locally linear smoothing and fingerprinting [6] [7]. This last 4
method works by analyzing the patterns of the different signal strengths in a specific spot. As
they vary from place to place, it is possible to recognize the actual location. However, despite 6
the fact that this system works indoors, it always depends on the number and density of access
points and the quality of the signals. [8] 8
Some smartphones can combine the cell information from the network of the provider with 10
the Wi-Fi networks in range to assist the GPS to speed up and improve the location fix.
12
2.2.3 Inertial Navigation System
14
An Inertial Navigation System (INS) is a navigation system which depends entirely on 16
inertial measurements for navigation.
An INS consists of accelerometers which measure the translatory acceleration and 18
gyroscopes which measure the angular rotation of the system. [9]
It uses data from direct measurements from sensors to estimate the position and track of a 20
device, regarding its initial position. The process of estimate of the actual position based on the
previous determined position is called dead reckoning. With the data from an accelerometer and 22
a gyroscope, it can be compute the velocity, and by integration, the distance. Combining this
data with the compass, it's possible to reach an acceptable tracking of the device. Inertial 24
Navigation Systems were originally created for rockets as they were a capable self based
guidance system. 26
Basically, INSs work by combining the data from the gyroscope, with the data from the
accelerometer. Gyroscopes measure the angle speed of the device's actual position in space. INS 28
can also function without gyroscope data, but with orientation data, if the device can compute
the angle of the orientation of its axis, in relation with the earth’s axis. The axis of the device are 30
represented in Figure 2.
Accelerometers measure the current acceleration of the device in axis angles as well. The 32
first step is to compute the linear acceleration, in which the result is the acceleration of the
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
9
device, without the effects of the gravity. Then, by knowing the current acceleration and angles
of the device, by integrating the acceleration over time, the result is the current velocity of the 2
device. Integrating the velocity, the result is the current position of the device. However, this
double integral accumulate error over time, so the long-term precision is compromised, when 4
the Inertial Navigation System is used standalone. When this happens, typically systems that use
INSs try to use another system of location tracking to calibrate or reset the data from the Inertial 6
Navigation System, using this only on short terms, as it is quite reliable.
8
10
INS can also be divided in two categories which differ in the frame of reference in which
the sensors operate. The navigation system’s frame of reference is defined as the body frame, 12
and the frame of reference in which the navigating occurs as the global frame. The first category
includes Stable Platform Systems, where the inertial sensors are mounted on a platform which is 14
isolated from any external rotational motion, i.e. the platform is aligned with the global frame.
[2] 16
18
Figure 2 – Axis of Android device [10]
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
10
2.2.4 Android
2
This mobile operating system for smartphones and tablets was developed by Google and
the Open Handset Alliance. Android was unveiled in November 2007 and the first commercial 4
version was launched in 2008. In the beginning of mobile phone application development, the
coding was made in low level C/C++ for only a range of hardware compatible devices, or even 6
for a single one. With Symbian, some advances were made in access to hardware, but it was still
required the use of proprietary APIs and heavy coding of C/C++, and the implementations 8
wouldn't work properly in different devices.
With the launch of Java MIDlets, as they were executed on a Java virtual machine, 10
abstracting the lower level of software, it worked in different kinds of devices. However, the
access to the phone's hardware was very restrictive, because the operating system provides few 12
or inexistent permissions to third party application, granting only access to native ones. With the
most recent wave of operating systems, such as Windows Mobile and iOS, the development's 14
environment is simple and rich. However, this two operating systems were built in a proprietary
environment, often prioritizing the native applications over third party ones, and restricting 16
communications among applications and the phone data. [11]
The open-source basis of Android represents a huge difference for previous mobile 18
environments, as for previous operating systems were proprietary and closed, where the
developers could only manage the application layer or have restricted access to the phone's 20
hardware. Android not only doesn't prioritize the native application, as furthermore lets the user
replace the native applications with third party ones. For example, even the native dialer, or the 22
SMS client can be replaced by user created applications. This availability of options provides
the opportunity for developers to explore all the potential of the hardware of the phones. 24
For this work, with the constant need of access to the hardware of the phone, such as the 26
GPS receiver and the sensors, alongside with the free availability of the software developers kit,
made Android the choice for the development of the application. 28
Its architecture, as can be seen on Figure 3 consists of a kernel based on Linux, with a 30
layer of Libraries, an application framework and the upper Application layer.
32
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
11
Using a full featured platform such as the Linux kernel provides tremendous power and 2
capabilities for Android. Using an open source foundation unleashes the capabilities of
numerous talented individuals and companies to move the platform forward. This is particularly 4
important in the world of mobile devices where the products change so rapidly. The rate of
change in the mobile market makes the general computer market look slow and plodding. And 6
of course, the Linux kernel is also a proven core platform. Reliability is more important than
performance when it comes to a mobile phone, because voice communication is the primary use 8
of a phone. Consumers and business customers want the cool data features and will purchase a
device based on those features, but they demand voice reliability. [13] 10
To assure retro-compatibility of the application with the largest number of devices, the 12
version used to the development was the Android 2.1 Eclair, that uses the Application
Programming Interface (API) level 7, with the version code ECLAIR_MR1 launched in January 14
2010.
Figure 3 - Android architecture [12]
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
12
The use of this version assures that the application is compatible with over 90% of the 2
Android devices that nowadays access the Google Play Store. [3]
The devices used for testing the application were a Sony Ericsson X10 Mini (A) and a 4
Sony Ericsson WT19i Live with Walkman (B).
6
A - Sony Ericsson Xperia X10 Mini
General 2G Network
GSM 850 / 900 / 1800 / 1900
3G Network
HSDPA 900 / 2100
HSDPA 850 / 1900 / 2100
Body Dimensions
83 x 50 x 16 mm
Weight
88 g
Display
Type
TFT capacitive touchscreen, 16M colors (65K effective)
Size
240 x 320 pixels, 2.55 inches (~157 ppi pixel density)
Memory Card slot
microSD, up to 16GB, 2GB included
Internal
128MB
Data GPRS
Up to 85.6 kbps
EDGE
Up to 236.8 kbps
Speed
HSDPA, 7.2 Mbps; HSUPA, 2 Mbps
WLAN
Wi-Fi 802.11 b/g, Wi-Fi hotspot (v2.2 or higher)
Bluetooth
Yes, v2.0 with A2DP, EDR
USB
Yes, microUSB v2.0
Features OS
Android OS, v1.6 (Donut), upgradable to v2.1
Chipset
Qualcomm MSM7227
CPU
600 MHz ARM 11
GPU
Adreno 200
Sensors
Accelerometer, proximity, compass
Browser
HTML
GPS
Yes, with A-GPS support
Java
Yes, via Java MIDP emulator
Battery Standard battery, Li-Po 950 mAh
Stand-by
Up to 285 h (2G) / Up to 360 h (3G)
Talk time
Up to 4 h (2G) / Up to 3 h 30 min (3G)
Table 1 - Sony Ericsson X10 Mini Specifications [14]
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
13
2
B - Sony Ericsson Live with Walkman
General 2G Network
GSM 850 / 900 / 1800 / 1900
3G Network
HSDPA 900 / 2100 - WT19i
HSDPA 850 / 1900 / 2100 - WT19a
Body Dimensions
106 x 56.5 x 14.2 mm
Weight
115 g
Display Type
TFT capacitive touchscreen, 16M colors
Size
320 x 480 pixels, 3.2 inches (~180 ppi pixel density)
Memory Card slot
microSD, up to 32GB, 2GB included
Internal
320MB storage, 512 MB RAM
Data GPRS
Up to 80 kbps
EDGE
Up to 237 kbps
Speed
HSDPA, 7.2 Mbps
WLAN
Wi-Fi 802.11 b/g/n, DLNA, Wi-Fi hotspot
Bluetooth
Yes, v2.1 with A2DP, EDR
USB
Yes, microUSB v2.0, USB On-the-go support
Features OS
Android OS, v2.3 (Gingerbread), planned upgrade to v4.0
Chipset
Qualcomm MSM8255 Snapdragon
CPU
1 GHz Scorpion
GPU
Adreno 205
Sensors
Accelerometer, proximity, compass
Browser
HTML, Adobe Flash
GPS
Yes, with A-GPS support
Java
Yes, via Java MIDP emulator
Battery Standard battery, Li-Ion 1200 mAh
Stand-by
Up to 350 h (2G) / Up to 400 h (3G)
Talk time
Up to 14 h 15 min (2G) / Up to 6 h 42 min (3G)
Table 2 - Sony Ericsson WT19i Live With Walkman Specifications [15] 4
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
14
2.2.5 Sensors 2
As explained before, one of the advantages of Android system is the full access given to 4
developers of all the hardware of the phone. Android devices have several sensors which can be
used by developers to integrate in new applications. These sensors are divided in three groups: 6
Motion, Position and Environment.
In the development, the interaction is provided with the method 8
android.hardware.SensorEventListener, which receives notifications from the
Sensor Manager when a change is detected in any of the sensors initialized. 10
Some of these sensors are hardware-based and some are software-based. Hardware-based
sensors are physical components built into a handset or tablet device. They derive their data by 12
directly measuring specific environmental properties, such as acceleration, geomagnetic field
strength, or angular change. Software-based sensors are not physical devices, although they 14
mimic hardware-based sensors. Software-based sensors derive their data from one or more of
the hardware-based sensors and are sometimes called virtual sensors or synthetic sensors. [57] 16
2.2.5.1 Motion Sensors 18
Accelerometer 20
The accelerometer measures the current acceleration applied to the device regarding 3 axis 22
[x, y, z] as seen on Figure 2. This readings include the force of gravity, which means that when
the device is sitting on a table with the screen facing up, the reading is [0, 0, -9,81]. This also 24
means that if the phone is free falling, accelerating at the rate of 9,81 m/s2 the reading from the
accelerometer is [0, 0, 0]. The raw data provided from this sensor is quite inaccurate, specially 26
in device A, in which even with the device lying down in a table the Sensor Listener is
triggered. In device B, with the device static the Listener isn't triggered, which may be due to a 28
better quality accelerometer of this device. The unit from the readings of this sensor is m/s2.
30
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
15
Gyroscope
2
The gyroscope measures the rate of the rotation of a device around its axis. The coordinate
system is the same as the accelerometer. In general, the raw data from a gyroscope, when not 4
filtered or compensated, introduce drift and noise that lead to errors in the readings.
Typically, the correction can be computed from the data from the accelerometer or the 6
gravity sensor. The unit from the gyroscope's readings is rad/s. The first smartphone with a
built-in gyroscope was the IPhone 4, and the first Android device were the Google Nexus S, and 8
the gyroscope API support was introduced in Android 2.3. As it wasn't supported neither in
Android 2.1 nor in the test devices, the work of this dissertation didn't use the gyroscope data. 10
As the basis of the State of the art Inertial Navigation Systems use gyroscopes, as they tipically
represent an improvement to the precision of the system, the author reckons that one of the 12
features to be implemented in the future work that may outcome this Dissertation, is the use of a
gyroscope. 14
Gravity 16
This sensor is software based and computes the force of gravity in 3 axis from the readings 18
from the Accelerometer and the Gyroscope. In basics, this sensor isolates the gravity component
from the acceleration read in the accelerometer Sensor. When the device is at rest, the readings 20
from this sensor is equal to the reading from the accelerometer. To assure retro-compatibility
this Sensor wasn't used in this work. 22
Linear Acceleration 24
As the gravity sensor, this sensor also is software based and it computes the data read by 26
the accelerometer, and retrieves the gravity component.
28
Conceptually:
30
Linear acceleration = Acceleration - Acceleration due to gravity
32
This sensor is useful for detecting motion and changes in the position of the phone. Despite
the fact that this work doesn't use this Sensor, calculations were made for obtaining the linear 34
acceleration.
36
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
16
Rotation Vector
2
This software-based Sensor represents the orientation of the device as a combination of an
angle and an axis. This sensor is particularly useful in some motion-based tasks, such as 4
detecting gestures, and monitoring changes in orientation and angular changes. This Sensor uses
the information from the gyroscope, so it isn't used in the work described in this dissertation. 6
2.2.5.2 Position Sensors 8
Android platform provides sensors to determine the position of a device concerning the 10
world's frame of reference. These are called Position Sensors.
12
Magnetic Field 14
The Magnetic Field Sensor is a hardware based sensor that monitors changes in the earth's 16
magnetic field, in µT. It provides raw data concerning the magnetic field, however its use for
positioning concerns can be accomplished not for its raw data, but with a method that uses both 18
the data from the magnetometer and the accelerometer.
20
Orientation
22
This sensor is software based, and computes the azimuth, pitch and roll of the device,
using the data from the accelerometer and the geomagnetic field sensor. As may be seen on 24
Figure 4 the values vary on three axis. The azimuth represent the angle between the magnetic
north and the y axis of the device (rotation around the z axis), the pitch is the rotation around the 26
x axis and the roll is the rotation around the y axis.
28
This sensor, however, had two major drawbacks: the heavy processing it involved means 30
that the precision of the orientation was compromised, and the sensor was only reliable when
the roll component was 0. Due to this inconvenients, this sensor was deprecated in Android 2.2. 32
Despite this, the API provides an alternative to the raw data of the orientation sensor, the use of
the methods getRotationMatrix() and getOrientation(). These methods are 34
related and they represent a better way to avoid dealing with the raw data from the sensors.
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
17
They use the data from the accelerometer and the magnetometer to compute a matrix that
transforms a vector from the device's coordinate system to the world's coordinate system. The 2
system is then defined this way:
4
X is defined as the vector product Y.Z (It is tangential to the ground at the device's current
location and roughly points East). 6
Y is tangential to the ground at the device's current location and points towards the
magnetic North Pole. 8
Z points towards the sky and is perpendicular to the ground.
10
12
Proximity
14
This hardware-based sensor computes the distance between the front of the device (the
screen) and another physical object. In some devices, the sensor reads the distance in 16
centimeters, but in the majority of the devices, only a boolean, concerning that there's an object
close to the device, or not. The main use of this sensor is within a phone call, when the sensor 18
reads that the phone reaches the user, it automatically turn off the screen.
In the tested devices, the return type of this sensor was a boolean, however as this readings 20
are not relevant for the work, the sensor isn't used by the application.
22
Figure 4 - World coordinate system [10]
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
18
2.2.5.3 Environment Sensors
2
These sensors are provided by Android platform to monitor informations about the
environment in which the device is present. They are all hardware-bases, and apart from the 4
Light Sensor, used by many manufacturers to automatically manage the screen brightness, the
other sensors aren't always available in all the devices. Apart from the Light Sensor, there is 6
also an Ambient Temperature sensor, an Ambient air pressure sensor, also a device temperature
and an ambient relative temperature sensor. None of this sensor was used to the development of 8
this work.
10
2.3 Background Research
Due to its importance, applications designed for determine location are a preferable object 12
of research. The creation of smartphones with built-in sensors opened many possibilities of
development. For Android phones, there are many applications with location based services, but 14
only a few with inertial navigation and sensor fusion capabilities.
16
2.3.1 SmartNavi beta
18
SmartNavi beta is a step-based location system for Android phones. It captures an initial
position from the GPS sensor, and then it recognizes the steps taken by the user, and the 20
direction from the information from the sensors, so it works in outdoors and also indoors. So it
can recognize the direction and the steps taken, the device may only be held in a specific 22
vertical position in front of the user.
24
2.3.2 InertialNav
26
InertialNav presents itself as an “attitude indicator” for determining primarily the artificial
horizon, altimeter, compass, and speed meter. It uses sensor fusion for orientation, with the 28
readings from the gyroscope, compass and accelerometer it computes an Inertial Measurement
Unit. To have the best estimation of the attitude, it was implemented an Extended Kalman 30
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
19
Filter, which analyses the behaviour of the different readings, and discards the ones that are
considered noisy. For purposes of orientation of the device, it also uses quaternion formulation, 2
which improves the quality of the estimation. The application needs a gyroscope sensor to work
properly, and despite its ability to function like an Inertial Measurement Unit, the accurate 4
positioning can only be achieved using GPS, in indoors the precision is compromised.
6
2.3.3 Wireless IMU
8
Wireless IMU is an application that makes readings of the sensors of the device and sends
it to a computer in the Wi-Fi network. The information sent includes a timestamp, and the 10
current readings of the accelerometer, gyroscope and compass and can be useful if used by a
receiver application in the computer. Despite the fact that this application standalone doesn't 12
make any calculations of the location, it can be used in a distributed system in which the
calculation of the position can be made by the computer, reducing to the minimum the 14
processing effort of the phone. Allowing the calculations to be made in a computer, it will
overcome any battery draining issues or the lacking of mathematical co-processor in some 16
devices.
18
2.3.4 Google Maps Floor Plan Marker
20
This application is an add-on to Google Maps and at the time it works only in the United
States. The goal of this application is to provide indoors location for the user, mainly for 22
commercial use. Google provided the possibility of owner of public commercial places to
upload the floor plans of the space. With this information, the application uses Wi-Fi networks 24
nearby and cell information to provide the indoor location of the user.
As this is for commercial use, the goal is to provide the user with the information of the 26
stores and services present nearby his current location inside a building, like in shopping malls,
conventions or sporting events. The immediate limitation of this system is the requirement of 28
the owner of the venues to upload the floor plans, which makes Google dependable on third
party interests. However, this system has a huge possibility of future growth, mainly because of 30
the integration with other location based system from Google, as Google Maps, Google Earth,
or Google Street View. 32
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
20
2.3.5 Lighthouse Signal Systems 2
Lighthouse Signal Systems have a system with a similar scope of Google Maps Floor Plan 4
Marker, but different technology. Google's application require the uploading of the floor plans
from the space in which the location is identified, whilst Lighthouse Signal System require a 6
Wi-Fi signal map of the place. In essence, the company needs to get a fingerprint database of
the Wi-Fi signals throughout the location. Using this technology, combined with inertial 8
navigation, the company then provides the venue owners the API of the system, in case they
want to use it to integrate with potential location-based applications they own, and also provides 10
the customer with information of the services they can use nearby the current location. In the
presentation of the system, the company claims that it can achieve precision of 5-7 meters and 12
floor information, whilst Google application can only provide a precision of 55 meters.
14
2.3.6 tagin!
16
This application is an open source location tagging engine, which uses Wi-Fi
fingerprinting technology. tagin! uses a collaborative community for tagging places and points 18
of interest, which can be used in the tagin! application, or in third party applications, for
instance to apply targeted advertising in new applications. 20
2.3.7 Skyhook 22
Skyhook is a framework of location based services that can be integrated in applications or 24
embedded in the system by manufacturers. It uses a hybrid system of GPS, cell information and
Wi-Fi. The system is based on a map of predefined access points to provide location in deep 26
urban areas or indoors. The system provides the possibility of new users to upload new access
points to increase the location accuracy. Skyhook company claims the accuracy is similar to 28
GPS only, but has more availability of signal and also that the time of first fix of location is only
of 1 second, whilst in GPS only system is of 65 seconds. 30
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
21
Still from the same company, related to the framework Skyhook, there's also the SpotRank 2
service, which uses the data from the location service of the framework, to predict densities of
people in a determined place. This behavioural system provides information to other 4
applications that can be used, for instance, to direct advertising campaigns in locations that is
predicted to cover the largest number of people. 6
2.3.8 Open Source Aided Inertial Navigation ToolKit 8
Open Source Aided Inertial Navigation ToolKit (INSTk) is a repository of 10
implementations on the subject of Inertial Measurement and Inertial Navigation. This was
developed within the work for a PhD Thesis and has relevant work in functions for data 12
manipulation on location based programming.
14
2.3.9 Navatar: Navigating Blind Users in Indoor Spaces using Tactile
Landmarks 16
Navatar is a system developed by the University of Nevada, Reno for indoor navigation for 18
the visually impaired. Despite the fact that this system needs previous knowledge of the
building in which the navigation is made, it doesn't need deployment of sensors of any kind. 20
The distances and orientation is obtained by dead-reckoning using sensors from a smartphone
and the calibration is made by the compass and the walls of the known map. The main 22
difference of this solution, when compared to others, is that this uses the user as a sensor. The
navigation is incremental, using landmarks that users can identify, such as doors, hallway 24
intersections or stairs. In each step of the navigation, the system orients the user to the next
landmark he can identify. When he arrives, he confirms in the application, which assigns the 26
user to the specific landmark and reboot the INS. This way, the system reduces the time of
continuous use of the INS, using it only for short periods, when its precision is better. The step-28
by-step path is calculated using an A* algorithm over a 2D map, while the movement is
obtained by an approximation of the user's step length. [16] 30
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
22
2.3.10 Nokia High Accuracy Indoor Positioning
2
To capitalize on the commercial importance and the expansion possibilities of indoor
location systems, Nokia Research Centre and other Finnish groups developed a location system 4
which integrates the GPS in the outdoors with indoors location. The indoors navigation uses
positioning beacons installed in the premises, emitting a bluetooth signal that the smartphone 6
receives to obtain the location.
The main advantage of this system is the precision, which is of 30 centimeters. However, 8
as it needs previous installation of positioning bluetooth beacons, the cost of this system is still
unknown, and with this the willing of the venue owners to see its advantages. Technically, 10
bluetooth (or radio) positioning systems, use algorithms that process the Received Signal
Strength (RSS), the Time of Arrival and the Phase of Arrival to compute the distance, and to 12
obtain the direction use the Angle of Arrival. Using this information, this system can compute
the location and the direction of the device with a certain degree of precision, depending on the 14
quality and the availability of the signals. Because of the lack of information regarding this
system, its behaviour is unknown, in respect of possible variations brought by the number of 16
simultaneous users or the properties of the environment.
18
2.4 Conclusions 20
In this chapter we have reviewed the technologies used nowadays in location and 22
positioning of smartphones. It was identified also some of the solutions presented on the market
nowadays. Some of the solutions used external systems to allow the positioning to be made in 24
part by the device, and other by third party equipments. Other solutions require the previous
knowledge of the environment to provide the positioning information, such as pre-installed 26
maps of the location, or Wi-Fi fingerprinting of the wireless routers presented in the location.
As the goal of this dissertation is to provide a standalone dead reckoning solution, the closest 28
options are the SmartNavi beta and InertialNav. However, the first option is quite limited, as it
is step-based orientation, it only works properly if the phone is on a specific position in front of 30
the user, and it doesn't work at all if the user doesn't take steps, for instance if it is on a
wheelchair. The closest solution is the InertialNav, but as its main goal isn't quite the 32
navigation, but the attitude indicator, the positioning, specially indoors, doesn't work properly.
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
23
Furthermore, InertialNav use only the gyroscope sensor, so the retro-compatibility wasn't
assured. 2
The point of difference that this work has, when compared to the previous work done, is
mainly that this application works standalone and it doesn’t require any previous knowledge of 4
the environment. Besides, the aim of this project requires that the orientation and the direction
of movement is clearly identified, irrespective of the actual position of the phone, so it can be 6
used, for instance, with the device in a pocket or in a purse.
8
10
12
14
16
18
20
22
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
24
Chapter 3
Solutions 2
In this chapter will be described the technologies chosen to the development of the project.
Like the last chapter showed, there are many possibilities of development of location 4
applications using different technologies, and also many applications already developed.
6
The ability for identifying the location of the phone is a critical part of the system
developed. Following a basis that any kind of information is better than no information at all, 8
the initial position is obtained by any means available. In the initial phase, the system tries to
obtain the location by cell information or GPS. If GPS signal isn't available, the initial position 10
is defined by the cell information only, despite the fact the precision will always be
compromised. After the initial position fix, the estimate of the user's position is then made by 12
the Inertial Navigation System, using the accelerometer and the magnetometer. Estimating the
error provided by the double integral of the data from the accelerometer, the precision is 14
evaluated, and the application then tries to obtain calibration from the other data, such as the
GPS and cell information. 16
3.1 Positioning and Movement 18
After the initial fix from the GPS or the cell data, the application analyses the data from the 20
accelerometer and the geomagnetic sensor for estimate the movement of the device. The
problem here is to estimate correctly the orientation of the movement, because of the inaccurate 22
data from the sensors. Some authors suggest a solution based in step recognition patterns [17].
In this option, is identified the effect of a single step from the user in the accelerometer data, 24
and when this pattern is recognized, the device uses the orientation from the compass and
estimates the length of the user's step to obtain the distance. This solution solves the problem of 26
identifying the length of the movement in each step by calibrating the accelerometer data to
overcome the differences of each subject's spring, resulting in a good pedometer algorithm. 28
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
25
However, for this work, this type of movement analysis couldn't be chosen, because the goal of
the system is to obtain a software that needs to be adaptive to any kind of movement, not only 2
by foot. This step-recognizing systems are valid for walking users, but if the software was to be
used for instance in a stroller, or in a wheelchair, the system wouldn't work. Also if the system 4
is implemented in a car, the step based system wouldn't work as well.
6
To fulfill the requirements, the motion detected works in 6 ways, North, South, East, West,
Up and Down, so the altitude can be estimated. This way, if the subject is in a building, from the 8
altitude detected, there can be estimated the floor in which the device is located. To accomplish
this, the data from the accelerometer needs to be related with the orientation data. 10
Knowing the acceleration on each moment in the 3 axis of the phone, and the angles of that
axis in relation on the earth’s axis, the first step is to convert the acceleration read in the 12
accelerometer to the acceleration on the earth’s coordinate system. This can be accomplished
using trigonometry. As explained before, the accelerometer data include all the acceleration 14
read, including the gravity, so if the device is at rest, the accelerometer readings are of - 9,81
m/s2 in the z axis. The acceleration needed to identify the movement is the linear acceleration, 16
which represents the acceleration component, minus gravity.
To compute the linear acceleration, the gravity component in each axis needs to be 18
isolated. The value of gravity ( ) considered in this calculations was 9.80665 m/s2. The
calculations made are represented in Figure 5. 20
22
Figure 5 - Equations for isolation of gravity
24
26
28
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
26
With the gravity isolated, the computation of the linear acceleration is then made as seen
on Figure 6. 2
Figure 6 - Calculation of linear acceleration on each axis 4
After obtaining the linear acceleration from this method, the data available at this point 6
include the instant linear acceleration within the axis of the device, so the next step is to convert
this data to the earth’s coordinates. 8
The strategy is to divide the linear acceleration obtained previously in the 3 axis of earth
using the orientation angles – pitch and roll – and relating them to the data from the compass. 10
The azimuth value obtained in the sensor represents the angle between the positive y axis
(rotation around the z axis) from the device and the magnetic north, so it is what allows us to 12
compute the actual direction of the movement. In Chapter 4 - Implementation it will be
described the mode of calculation with further detail, as well as the challenges this calculations 14
addressed.
After the heading of the movement is obtained, now related to the earth’s coordinates, the 16
computation of the movement can be made. Having the linear acceleration it’s possible to obtain
the distance in a period of time. In theory we have: 18
Position in time 20
Velocity in time
Acceleration in time 22
If we relate acceleration and velocity: 24
Figure 7 - Equation of the relation between acceleration and velocity [18] 26
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
27
From the fundamental Theory of Calculus: 2
Figure 8 - Integral of acceleration over time [18] 4
If we then relate the velocity and the distance: 6
Figure 9 - Equation of the relation between velocity and distance [18] 8
From the fundamental Theory of Calculus: 10
Figure 10 - Integral of velocity over time [18] 12
The strategy and basis of the Inertial Navigation System implemented is to compute this 14
double integral to obtain the displacement of the device in the time measured. Relating the
distance measured by the double integral with the orientation already known, we can obtain the 16
difference from the initial position, and that way getting the actual position of the device.
3.2 Conclusion 18
In this chapter it was explained the theory behind the implementation made in this project,
so it can be applied in the next Chapter. It was described the method of isolating gravity per 20
axis, with the objective of getting the linear acceleration in each axis.
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
28
It was also described how the distance of the displacement from the initial position is
calculated, from the linear acceleration and a period of time. By analyzing this method of 2
obtaining positioning, it becomes clear that the double integral can generate errors in each
integration, so the implementation has to assure that all the data is correctly processed, and also 4
that calibration of the displacement is critical.
6
Chapter 4
Implementation 2
In this chapter it will be described the implementation details of this project, the challenges
presented and how the theory explained in the last chapter was converted into the programming. 4
The decision making processes on all the implementation took in consideration not only the
previous work by other authors, but also the behaviour of the application during the tests on 6
both of the devices tested.
8
4.1 Architecture
The high level architecture of the system is represented on Figure 11. 10
12
14
16
18
20
22
24
Figure 11 - System architecture
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
30
As is visible on the figure, after the start of the application, the application checks the
location services for an initial location fix. This location service is any one available, cell 2
information or GPS. After the initial fix, the application relies on the information from the
sensors and the inertial navigation system. At each iteration, it is checked the location in the 4
GPS, and if its precision is acceptable, the application relies on it, if not, it stays with the INS.
In this moment of the development, it was considered this solution to always provide the best 6
location possible at each moment, however it was also considered the possibility of turning off
the GPS receiver for periods of time, to avoid battery draining issues. In this possibility, it 8
needed to be calculated a prediction of the drift from the INS for the actual position, and turn on
the GPS when this drift isn’t acceptable. However, in this possibility, further tests ought to be 10
made, for evaluating the effects on the battery of the GPS sensor, versus the INS.
Eric Foxlin states that even a tiny drift rate in the gyros causes a slowly growing tilt error. 12
The horizontal acceleration error is 9.8 m/s2 times the tilt error in radians. Double integrating
this increasing acceleration error produces a position error that grows cubically in time in the 14
short term. Thus, although small inertial sensors can maintain accuracy of a few millimetres for
one second, the drift will exceed a meter in 10 seconds [8]. Based on this information and on the 16
precision wanted by the user, he can estimate the rate that the GPS tries to obtain a new fix and
calibrate the position. 18
With the start of the application after the initial location fix, if possible, the Sensor Event
Listener is activated, and after this moment, any change in any of the Sensors will be registered 20
and taken into account for the identifying of the heading of the movement and for the distance
measured. 22
4.2 Inertial Measurement Unit
The creation and implementation of the Inertial Measurement Unit was the core of this 24
development, and of course, the one that represented the most challenges.
In the start of the development, for making an initial visual analysis of the behaviour of the 26
sensors, it was created an application only for printing on the screen the readings of the raw data
from the sensors. Right at this point, there were very significant differences in the readings from 28
the tested devices. In the case of the device A, although the accelerometer readings looked
correct, even if the device was in rest at a table, the sensor readings were constantly changing, 30
even with a low refresh rate. In device B, the results were much more consistent, and it didn’t
vary with the equipment stationary. This differences could be related with the quality of the 32
sensors on each phone. Knowing this facts, the need for smoothing the raw data from the
accelerometer was imperative. 34
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
31
For the calculation of the linear acceleration, the data used in this calculations are already
treated using a low pass filter [10]. As the goal of this filter is to smooth the readings, and 2
minimize the effect of the sudden variations, and it was detected that because of the poor quality
of the sensors, even with the device stationary, the readings on the total acceleration vary. The 4
coefficient to implement and calculate the effect of the filter is calculated by the difference
between the total acceleration read, and the previous total acceleration. This way, it’s assured 6
that the filter isn’t very restrictive, and also that there’s an improvement to the smoothness of
the sensors. The example code of this coefficient calculation is represented in the Figure 12. 8
mAccelLast = mAccelCurrent; 10 mAccelCurrent = (float) Math.sqrt((double) (accelerometer_values[0] *
accelerometer_values[0] + accelerometer_values[1] * 12 accelerometer_values[1] + accelerometer_values[2] *
accelerometer_values[2])); 14
float delta = mAccelCurrent - mAccelLast;
16
Figure 12 - Calculation of the coefficient for low pass filter
18
The results of this use were quite satisfactory, as the differences between the readings of
the devices A and B were minimized. 20
Having then calculated the values for the linear acceleration, the following challenge was
to identify the heading of the movement. Despite the filter and the smoothness of the data, 22
there’s still some noise that passes as data, because of the readings from the sensors, as they
don’t read exactly 0.0. To overcome this noise, the author proposed a solution based on the data 24
from references [19] and [20], that showed that in daily life, the average walking acceleration
of a human is over 2m/s2, so in this implementation, any value under 1m/s2 is not considered as 26
movement. The choice of reducing from 2, to 1 m/s2 was based on the information from the
author that the subjects of the study were people of ages between 19 and 32, and that is 28
obviously possible that, for instance, elderly people moves in slower acceleration. To overcome
that possibility, only movements over 1m/s2 are considered. 30
With the linear acceleration obtained, the next step is to compute the heading of the 32
movement, based on the orientation data. To obtain a good estimate on the heading, the solution
proposed in this project, was to identify what’s the actual orientation of the phone, if the screen 34
is faced up or down, and if the top of the device is facing up or down. Based on the angles of the
phone, in relation to earth’s coordinates, the system then calculates the correct heading based on 36
the readings from the compass. This way, it’s possible to compute the heading and the distance
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
32
within the six degrees of freedom, as represented in Figure 13 - Six degrees of freedom,
considering the yaw is obtained by the azimuth, from 0 – 360º, being the 0 the magnetic North. 2
To identify the correct angle with the magnetic North, it was used at first the deprecated
Orientation sensor, but as stated in [10], the sensor data was only reliable when the roll was 0, in 4
any other position, the data was completely unreliable and impossible to use, as the readings
didn’t change in a linear form over the increasing angle of the roll. So, the alternative is use the 6
getRotationMatrix() method, in conjunction with getOrientation(), as the output
is the same as the Orientation sensor, but the data is more reliable, particularly the azimuth. 8
10
12
14
16
Having computed the orientation components, at this moment it has been calculated the
components of the linear acceleration in each of the 3 axis in the earth’s coordinates. The next 18
Figure 13 - Six degrees of freedom [21]
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
33
step is to calculate the distance of the movement that was present in the acceleration measured,
the double integral. The integral is used in continuous signals, but in this type of computation, 2
the data provided by the sensors is discrete, so we need to convert the integral into a sum.
4
In basis:
6
And:
8
Therefore we have:
10
12
The challenge at this time was to deal with the high rate of updates in the sensor,
particularly in device A. This issue, followed by the poor capability of the processor to maintain 14
a high duty of calculations, was the most difficult part of the implementation. The initial option
was to calculate the distance on the run, measuring the time of a new sensor reading, calculate 16
the distance and sum to total distance, however the processor couldn’t keep up with the rate of
changes in the sensor readings and stopped. The solution proposed by the author is then to 18
obtain and save the sensor readings from the phone, as well as its timestamp, so we can obtain
the dT of a specific reading, accumulate N sensor readings, and then compute its distance. The 20
idea behind this number N is to adapt it to the device in which it will be used. For instance, in
the device A, with N = 100, the total time spent reaching this number of readings was never 22
over 2 seconds, even with low sensor’s refresh rate and even with the device stationary, whereas
in device B, with a more precise sensor, to update every 2 seconds the distance, it will be 24
needed a number around N ≤ 10, and only with the device in motion.
26
This method worked in a satisfactory way in the devices tested, but of course needs further
investigation and testing in other devices. 28
4.3 Conclusion
In this chapter it was presented the challenges of the implementation of this project and the 30
choices made in it, and the basis of those choices.
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
34
Every step of the implementation was described, with every data treatment, since the
obtaining of the raw data from the sensors, to the calculation of the distance based on the initial 2
data.
4
6
8
10
12
14
16
18
20
22
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
35
Chapter 5
Conclusions and Future Work 2
In this work it was developed an application that can be used standalone to obtain location
or in the future integrated with other solutions to provide a wider use. In this chapter it will be 4
described the test results, obtain its conclusions and then analyzed the achieved goals of this
work and the orientations for future work. 6
5.1 Test Results 8
To evaluate the solution proposed, the main test was conceived with the main goal of 10
obtaining the system’s precision. To measure correctly the precision, the test was made
outdoors, so the precision could be compared with the GPS data. The main test consists in a 12
walk in a street, and in some points mark the coordinates measured by the GPS and by the INS,
that in the purpose of the test, was functioning standalone, without any type of calibration. This 14
test allows us not only to analyze the precision from the system, but also to try to measure any
difference between the two smartphones used in this work. In this test was only measured the 16
horizontal data, as it was the only one that could be efficiently measured by the GPS, but as the
calculations from the altitude are the same, we can conclude that the data evolution would be 18
the same in the vertical movement.
The initial fix from the GPS is used by the INS as a starting point, then all the distance 20
calculations from the sensors are converted to coordinates and computed from the initial data.
The Data measured in the test is presented in Table 3 and Table 4. 22
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
36
Device A GPS coordinates INS coordinates
Distance
from
previous
point (m)
Error -
Distance
between GPS
and INS (m)
1st point Latitude 41.152390
Longitude -8.599988
2nt point Latitude 41.152700 41.152660
9 4 Longitude -8.600096 -8.600096
3th point Latitude 41.152705 41.152585
15 23 Longitude -8.599906 -8.600143
4th point Latitude 41.153063 41.152652
40 54 Longitude -8.599827 -8.600178
5th point Latitude 41.154564 41.152807
170 200 Longitude -8.599528 -8.600192
6th point Latitude 41.152947 41.153580
180 80 Longitude -8.599732 -8.600235
Table 3 – Data measures from test in Device A. 2
4
6
Device B GPS coordinates INS coordinates
Distance
from
previous
point (m)
Error -
Distance
between GPS
and INS (m)
1st point Latitude 41.152847
Longitude -8.599749
2nt point Latitude 41.152782 41.152830
8 5 Longitude -8.599795 -8.599765
3th point Latitude 41.152562 41.152839
24 30 Longitude -8.599747 -8.599749
4th point Latitude 41.153205 41.153383
71 19 Longitude -8.599809 -8.599781
5th point Latitude 41.154554 41.153368
150 130 Longitude -8.599517 -8.599862
6th point Latitude 41.152909 41.154335
180 160 Longitude -8.599698 -8.599878
Table 4 - Data measures from test in Device B
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
37
The First point was the initial point of the test, in which only the first fix from the GPS is 2
measured. Immediately it’s easy to spot differences between the coordinates measured by the
two devices, despite the fact that the measurements were taken in exactly the same spot, and at 4
the same time, to prevent any external constraints. The distance walked in this test was circular,
so the last point measured is the same as the first. This way, we can also try to estimate the error 6
from the GPS in the two devices. In the device A, the distance between the first and the last
reading from the GPS if of 30 meters, while in the device B is only of 8 meters. As the test was 8
realized in a (not very dense) urban environment, this can be explained by the poorest quality of
the GPS receiver in the Device A. 10
The relation between the readings and the total distance covered in the test is presented
in Figure 14 and Figure 15. 12
14
16
18
20
22
24
26
28
30
32
34
36
0
50
100
150
200
250
300
350
400
450
2nd point 3th point 4th point 5th point 6th point
Distance from previous
point (m)
Total distance - Data from
GPS (m)
Error - Distance between
GPS and INS (m)
Figure 14 - Data from Device A
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
38
2
4
6
8
10
12
As expected by the INS concept, the evolution of the error tend to grow at the rate of the
distance covered. The sixth point of the data from Device A is the exception, as the error 14
lowered drastically from 200 meters to 80 meters, possibly because of the circular motion. The
detail of the relation between the evolution of the error with the distance covered from each 16
point is represented in Figure 16 and Figure 17.
18
20
22
24
26
28
0
50
100
150
200
250
300
350
400
450
500
2nd point 3th point 4th point 5th point 6th point
Distance from previous
point (m)
Total distance - Data from
GPS (m)
Error - Distance between
GPS and INS (m)
Figure 15 - Data from Device B
0
20
40
60
80
100
120
140
160
180
200
2nd point 3th point 4th point 5th point 6th point
Distance from previous
point (m)
Error - Distance between
GPS and INS (m)
Figure 16 - Relation between distance and error - Device A
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
39
2
4
6
8
10
12
14
As it’s possible to see in the Figure 16 and Figure 17, as expected, the error tends to grow
in a significant way, when the distance covered is bigger. As the first and the last spot were the 16
same, we can also obtain the long term difference between the distance of the INS, to the real
position. In the device A, the total distance covered, measured by the GPS, was 414 meters, and 18
the difference between the initial point, and the last coordinate measured by the INS is 130m. In
the device B, the total distance measured was 433 meters, and the distance between the last INS 20
measured coordinate and the GPS data was 170 meters.
22
This results were predictable and within the expectable, as we can conclude that as stated
before, the Inertial Navigation System, on its own, can’t be used for positioning for a long 24
period of time, as the error tends to grow up as the distance is covered.
26
0
20
40
60
80
100
120
140
160
180
200
2nd point 3th point 4th point 5th point 6th point
Distance from previous
point (m)
Error - Distance between
GPS and INS (m)
Figure 17 - Relation between distance and error - Device B
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
40
5.2 Conclusions and Achieved Goals
2
In this work the effort was to try to obtain a way to identify the actual location with the
most precision possible. With the application developed, in the devices tested, the precision was 4
acceptable as long as the device can obtain an external mean of calibration, like GPS, over short
periods of time, as the Inertial Navigation System standalone can’t keep up an acceptable 6
precision for long periods of time. But in moments of low quality, or even momentary failure
on the GPS signal, the application developed can always provide an alternative mean of location 8
identifying.
The main goal of this thesis was to evaluate the possibility of create a system that could 10
provide an efficient mean of positioning and location when the GPS system wasn’t available.
This was obtained by a series of treatments on the raw data provided by the sensors. The 12
restrictions imposed by the principle of the retro-compatibility meant that all the treatment of
the raw data had to be made by the created system, and also that the absence of the gyroscope 14
meant that the orientation of the device had to be calculated by the only means provided, the
magnetometer and the accelerometer. 16
The accelerometer data provided in the tested devices is very unstable and it’s a constant
source of errors, accumulated by the calculations to the isolation of gravity, and when combined 18
with the orientation data, calculated from the magnetometer, which is extremely sensible to the
environment’s magnetic fields, and loses precision when the device is upside down (screen 20
facing down, or top of the phone facing down). Some of this constraints are compensated by the
most recent Android API’s, mostly with sensor fusion with the gyroscope. 22
With the differences detected in the precision and behaviour of sensors from the two
devices tested, was obvious for all the time of this development that the quality of the raw data 24
from the sensors, received by the application, is largely important and can represent a major
improvement in the use of this application. 26
The system created can detect the device’s movement and identify its direction(s)
effectively, providing the measured distance from the accelerometer’s reading, however as seen 28
in the tests, the error provided is significant and grows with the distance covered, as predicted in
the Inertial Navigation Systems. Despite the fact that the application constantly filters the data, 30
to try to obtain only the useful for the movement, many data passes the filter and provide errors
to the computation of the movement. This sensor errors come from two reasons, the main one is 32
the poor quality of the sensors, which is directly related to the high cost of the most precise
ones, obviously impossible to implement in a low cost mobile device. The second reason is the 34
core of the use of the sensors, that is mainly to identify gestures of the user, to implement in
games and other applications. To identify gestures, the sensors doesn’t need to be so accurate 36
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
41
than to identify movement, in which any error provided by the sensors can represent a massive
final error in the positioning. 2
As the core of this project was to create a solution that can be deployed in almost all the
Android phones in use, or integrated in another framework to enable location based services 4
with the location provided by this application, then the main goal of this development was
indeed fulfilled. However it has become obvious in the development of this work, that with this 6
devices and conditions, it is not possible to identify movement and compute positioning in a
precise way, using only the magnetometer and the accelerometer from the smartphones. It’s 8
always needed third party calibration of the system, with the GPS, Wi-Fi data, or cell
information, but this is only useful to identify a possible area of the location, with very low 10
accuracy.
5.3 Future Work 12
With the known and discussed limitations of the devices tested, when compared to others 14
in the market right now, and also considering the wide range of opportunities that this kinds of
system provide, it’s easy to think ahead and provide some orientations of further development 16
of this system and also investigation on the area.
18
One obvious item possible for future implementation is to integrate the data from a
gyroscope, which is an excellent solution to provide more clear information over the actual 20
position of the device, as one of the main sources of error detected in this work was the
interferences on the geomagnetic sensor, which is very sensible to magnetic fields close to the 22
device.[22] As John Woodman states: “Magnetometers are not accurate enough to replace
gyroscopes in INSs. In particular they are affected by local disturbances in the earth’s magnetic 24
field caused by nearby magnetic objects. Their data can however be fused with gyroscope data
to improve the accuracy of the calculated orientation.” [23]. 26
With the possibility of integrating this solution with others, some options can be added to 28
try to increase precision when the GPS signal is weak or unavailable, like introducing an
estimation mean of calibration, like a Kalman filter, or integrating another algorithms for some 30
conditions of use, like a pedometer algorithm based on neural networks.
32
Another further possibility of future work is to create an application based on learning the
map on the run, so that in a second passage from a place, it can recognize the place and calibrate 34
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
42
the precision that way. Related to maps, a slightly less difficult way is of course the pre-loading
of a determined map of a location, which is already being made by some companies. 2
4
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
43
References
[1] Le, Manh Hunv V., Dimitris Saragas and Nathan Webb. 2009. Indoor Navigation System for
Handheld Devices. Worcester Polytechnic Institute of Massachusetts, USA.
[2] Shala, Ubejd and Angel Rodriguez. 2011. Indoor Positioning using Sensor-fusion in
Android Devices. MSc. School of Health and Society.
[3] Platform Versions | Android Developers.
http://developer.android.com/resources/dashboard/platform-versions.html (accessed on 17th of
June 2012).
[4] GPS.gov Space Segment. http://www.gps.gov/systems/gps/space/ (accessed on 17th of June
2012).
[5] Evennou, Frédéric and François Marx. 2006. Advanced Integration of WiFi and Inertial
Navigation Systems for Indoor Mobile Positioning. EURASIP Journal on Applied Signal
Processing. Volume 2006: 1–11.
[6] Chen, A., Cristina Harko, Diane Lambert and Phil Whiting. 2007. An Algorithm for Fast,
Model-Free Tracking Indoors. Mobile Computing and Communications Review, Volume 11,
Number 3. Volume 11, Number 3. 48-58.
[7] Paul, S. and E. A. Wan. 2008. Wi-Fi Based Indoor Localization and Tracking Using Sigma-
Point Kalman Filtering Methods. 2008 IEEE / Institute of Navigation – Position Location and
Navigation Symposium, May 2008.
[8] Foxlin, Eric. 2005. Pedestrian Tracking with Shoe-Mounted Inertial Sensors, IEEE
Computer Graphics and Applications November/December 2005: 38-46.
[9] Christensen, Rolf and Nijolaj Fogh. 2008. Inertial Navigation System. MSc. Faculty of
Engineering, Science and Medicine.
[10] Sensors Overview | Android
Developers. http://developer.android.com/guide/topics/sensors/sensors_overview.html (accessed
on 5th of May 2012).
[11] Meier, Reto. 2009. Professional Android Application Development. Indianapolis: Wiley
Publishing, Inc.
[12] What is Android? | Android Developers. http://developer.android.com/guide/basics/what-
is-android.html (accessed on 5th of May 2012).
[13] Ableson, W. Frank, Charlie Collins and Robi Sen. 2008. Unlocking Android - A
Developer's Guide. Manning Publications.
Erro! Utilize o separador Base para aplicar Heading 1 ao texto que pretende que apareça
aqui.
44
[14] GSM Arena - Sony Ericsson X10 mini - Full phone specifications.
http://www.gsmarena.com/sony_ericsson_xperia_x10_mini-3125.php (accessed on 6th of May
2012).
[15] GSM Arena - Sony Ericsson Live with Walkman - Full phone specifications.
http://www.gsmarena.com/sony_ericsson_live_with_walkman-4111.php (accessed on 6th of
May 2012).
[16] Apostolopoulos, Ilias, Navid Fallah, Eelke Folmer and Kostas E. Bekris. 2012. Integrated
Online Localization and Navigation for People with Visual Impairments using Smart Phones.
Paper presented on the IEEE International Conference on Robotics and Automation (ICRA),
2012, in Minnesota, USA.
[17] Scarlett, Jim. 2007. Enhancing the Performance of Pedometers Using a Single
Accelerometer. Analog Devices, Inc.
[18] Salas, Saturino, Einar Hille and Garret J. Etgen. 1999. Calculus: One and Several
Variables, 9th Edition.
[19] Ito, Teruaki. 2009. Walking Motion Analysis Using Small Acceleration Sensors.
University of Tokushima.
[20] Bussone, William. 2005. Linear and Angular Head Accelerations in Daily Life. Msc.
Faculty of the Virginia Polytechnic Institute and State University
[21] Wikipedia - Six degrees of freedom.
http://en.wikipedia.org/wiki/Six_degrees_of_freedom (accessed on 17th of May 2012).
[22] Pinto, Francisco. 2011. An Indoor Localization Solution for Mobile Devices. MSc.
Faculdade de Engenharia da Universidade do Porto.
[23] Woodman, Oliver J. 2007. An introduction to inertial navigation. University of Cambridge.