1. Trang chủ
  2. » Luận Văn - Báo Cáo

Implement step and heading estimation using sensors on smartphones

73 7 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Implement Step and Heading Estimation Using Sensors on Smartphones
Tác giả Tran Quang Dai, Nguyen Tien Loc
Người hướng dẫn Pham Hoang Anh, Ph.D, Le Thanh Van, Ph.D, Pham Quoc Cuong, Assoc. Prof. Ph.D
Trường học Vietnam National University Ho Chi Minh City
Chuyên ngành Computer Engineering
Thể loại Graduate Thesis
Năm xuất bản 2021
Thành phố Ho Chi Minh City
Định dạng
Số trang 73
Dung lượng 1,77 MB

Cấu trúc

  • 1.1 Topic Introduction (14)
  • 1.2 Thesis Objective and Scope (16)
  • 1.3 Thesis Structure (17)
  • 3.1 Inertial Measurement Units (IMUs) (23)
    • 3.1.1 Accelerometer (24)
    • 3.1.2 Gyroscope (24)
    • 3.1.3 Magnetometer (25)
  • 3.2 Pedestrian Dead Reckoning (25)
  • 3.3 Coordinates systems (27)
    • 3.3.1 Smartphone/Device Coordinates System (27)
    • 3.3.2 Ground/Earth Coordinates System (28)
    • 3.3.3 Coordinates Transformation (29)
  • 3.4 Step Detection (30)
    • 3.4.1 Peak Detection (31)
    • 3.4.2 Zero-crossing Based Step Detection (31)
    • 3.4.3 Peak-trough based step detection (32)
  • 3.5 Step Length Estimation (32)
  • 3.6 Heading Estimation (35)
    • 3.6.1 Gyroscope based heading estimation (35)
    • 3.6.2 Principal Component Analysis for heading estimation (35)
  • 3.7 Position Estimation (36)
  • 4.1 Introduction (37)
    • 4.1.1 Advantages (38)
    • 4.1.2 Limitations (38)
    • 4.1.3 Expo framework (38)
    • 4.1.4 Device Motion from Expo (39)
  • 4.2 Planning and Analysis (39)
    • 4.2.1 Step detection (40)
    • 4.2.2 Step length estimation (43)
    • 4.2.3 Heading estmation (43)
  • 4.3 Design (44)
  • 4.4 Implementation (46)
    • 4.4.1 Installation (46)
    • 4.4.2 DeviceMotion Implementation (47)
    • 4.4.3 Coordinates transformation (48)
    • 4.4.4 Data filtering (51)
    • 4.4.5 Step and Heading Detection (54)
    • 4.4.6 Step Detection (54)
    • 4.4.7 Step Length Estimation (55)
    • 4.4.8 Heading determination (56)
    • 4.4.9 Position Estimation (56)
  • 5.1 Results (59)
  • 5.2 Test Scenarios (63)
    • 5.2.1 Test Scenario 1 (63)
    • 5.2.2 Test Scenario 2 (64)
    • 5.2.3 Test Scenario 3 (65)
    • 5.2.4 Test Scenario 4 (66)
    • 5.2.5 Test Scenario 5 (67)
    • 5.2.6 Evaluation (68)
  • 6.1 The contribution of the thesis (70)
  • 6.2 Result (71)
  • 6.3 Future work (71)
  • 3.1 General Architecture of Pedestrian Dead Reckoning System (0)
  • 3.2 Smartphone coordinate system (0)
  • 3.3 The positive directions of 3 axes of the smartphone (0)
  • 3.4 Ground/Earth Coordinate System (0)
  • 3.5 Basic Peak Detection Method (0)
  • 3.6 Basic Zero-crossing Detection Method (0)
  • 4.1 Accelerations of 5 steps when holding smartphone parallel to the (0)
  • 4.2 Accelerations of 5 steps when holding smartphone perpendicular to (0)
  • 4.3 Accelerations of 5 steps when holding smartphone arbitrary (0)
  • 4.4 Walking acceleration magnitude in hand and pocket (0)
  • 4.5 The general view of our system architecture (0)
  • 4.6 Installation Expo CLI (0)
  • 4.7 Testing Expo CLI (0)
  • 4.8 Expo Go app in iOS App Store (0)
  • 4.9 Subscribe Device Motion Function (0)
  • 4.10 Device’s coordinates (red) and the Ground’s coordinates (blue) (0)
  • 4.11 Acceleration data when holding the phone perpendicular to the (0)
  • 4.12 Rotated acceleration data when holding the phone perpendicular (0)
  • 4.13 Acceleration data when holding the phone in arbitrary orientation 38 (0)
  • 4.14 Rotated acceleration data when holding the phone in arbitrary (0)
  • 4.15 Moving Average Filter Function (0)
  • 4.16 acceleration data in z-axis before (green) and after (red) filtering . 40 (0)
  • 4.17 Transfer Data Function (0)
  • 4.18 Testing Detect Movement Algorithm (0)
  • 5.1 Calibrate Step Length Screen (0)
  • 5.2 Main Screen (0)
  • 5.3 Export data to other applications or excel file (0)
  • 5.4 Exported Data (0)
  • 5.5 Result Scenario 1 (0)
  • 5.6 Result Scenario 2 (0)
  • 5.7 Result Scenario 3 (0)
  • 5.8 Result Scenario 4 (0)
  • 5.9 Result Scenario 5 (0)

Nội dung

Topic Introduction

In today's world, various positioning techniques play a crucial role in our daily lives, particularly with the rise of portable devices that enhance Location-based Services (LBS) While GPS remains the most accurate outdoor navigation tool for smartphones, it faces significant challenges in indoor environments due to weak signals, multi-path effects, and high signal attenuation Typically, the accuracy of GPS and cellular network-based methods exceeds 10 meters, making it impractical for tracking individuals or objects within buildings and distinguishing between rooms.

Indoor positioning has gained significant attention in recent years, as statistics indicate that people spend over 70% of their time engaged in indoor activities With the rise of various terminal devices, this field has emerged as a promising area for development Consequently, applications utilizing indoor positioning technology are increasingly being integrated into smartphones, tablets, and wearable devices, enhancing various aspects of daily life.

A modern museum or exhibition hall should not only provide information based on visitors' real-time locations but also guide them to essential facilities like ATMs, restrooms, elevators, or exits Upon entering specific rooms or areas, the activation of projectors, lighting, and other supporting technologies can enhance the visitor experience Looking ahead, advanced indoor positioning techniques are poised to revolutionize physical distribution management, becoming a crucial element of the Internet of Things (IoT).

The rapid advancement of smartphone technology and the increasing number of users have made smartphone-based indoor position tracking a popular choice, primarily through the use of inertial and magnetic sensors in a method called pedestrian dead reckoning (PDR) These smartphone navigation systems are essential in various applications, effectively addressing the challenges posed by satellite signal limitations.

Smartphone-based position estimation systems offer the advantage of requiring no additional peripheral devices, relying solely on the smartphone itself These systems are particularly useful for indoor localization in environments like shopping malls and airports, as well as in GPS-denied outdoor areas By utilizing only embedded sensors, they avoid the added costs and complexities associated with integrating Wi-Fi signals, radio frequencies, GPS, or vision cameras, which also necessitate infrastructure installation and maintenance However, a significant drawback is the accumulation of location errors over time due to random noise and device inaccuracies, highlighting the need for effective correction methods to maintain performance in pedestrian dead reckoning applications.

Pedestrian dead reckoning (PDR) utilizing Inertial Measurement Units (IMUs) is a technique for estimating an individual's movement by tracking movements, estimating stride lengths, and determining motion directions through smartphone sensors In location-based applications, accurately estimating motion direction presents significant challenges A key difficulty in implementing PDR arises from the fact that IMUs are integrated into smartphones, making the determination of a pedestrian's direction of motion heavily reliant on the smartphone's orientation relative to their walking direction.

Thesis Objective and Scope

Integrating step and movement direction identification with existing indoor navigation systems can enhance mobile indoor navigation applications Currently, Wi-Fi-based positioning systems require extensive signal scanning from Wi-Fi hotspots, resulting in delays and inadequate real-time responsiveness To improve time and error response in indoor positioning, mobile device sensors will be utilized for step and movement direction estimation while scanning Wi-Fi signals for error correction Employing hybrid algorithms can further improve navigation reliability by combining localization techniques to minimize IMU drift and using IMU data to refine absolute location estimates.

Figure 1.1: Results of localization with two classes of location sensing (a) Localization base on Wi-Fi access points (b) Localization using IMU devices.

The objective of this thesis is to investigate and implement one solution

Thesis Structure

To accurately estimate steps and directions using mobile device sensors, it is essential to evaluate the performance of algorithms analyzing this sensor data The approach should leverage commonly available sensors on modern smartphones while minimizing disruption to user habits However, a key challenge arises as the device’s heading often does not align with the user's actual heading; the orientation of the Inertial Measurement Units (IMUs) within the phone can shift due to the pedestrian's hand movements Consequently, the direction indicated by the IMU may differ from the user's walking direction.

The PDR method, while not highly accurate on its own, serves as a valuable tool for extending navigation in areas lacking other systems and can enhance accuracy when combined with additional methods Its effectiveness is constrained by the precision of step detection, step length estimation, and heading angle measurement Additionally, a significant challenge lies in differentiating between walking, running, and other activities such as biking, climbing stairs, or using elevators.

Our system utilizes common embedded sensors to detect position changes in the horizontal plane, specifically designed for handheld mobile devices that must remain stable while walking or stored in a pocket Section 4.2 will provide a detailed explanation of the limitations and rationale behind this approach Additionally, the performance analysis will highlight the advantages and disadvantages of this position measurement method within the SHS framework, along with important considerations for future developments.

Fundamentally, this thesis consists of 6 chapters These chapters are orga- nized as follows:

In chapter 2, the related research of indoor positioning system will be briefly introduced.

Chapter 3 presents essential theoretical concepts of PDR, focusing on key elements such as step detection, step length, and heading angle estimation It also details the development of an algorithm for the SHS system utilizing inertial sensors, along with other relevant information pertaining to this system.

In chapter 4, the methodology of the chosen positioning estimation algorithm is discussed in detail.

In chapter 5, the analysis of both the experiments and results is provided.

In chapter 6, all of the thesis is summarized and a few future works are therefore discussed.

In response to the challenges posed by GPS in indoor environments, various positioning technologies have emerged over the past two decades Vision-based systems, known for their accuracy and real-time capabilities, face limitations due to obstructions and dependence on lighting and camera distribution Similarly, ultrasound and infrared methods encounter comparable drawbacks, while Radio Frequency Identification (RFID) has struggled to consistently achieve meter-level accuracy Recently, researchers have turned to Wireless Local Area Network (WLAN) technologies, which can provide positioning accuracy of less than 2 meters, contingent upon complete Wi-Fi coverage and real-time interactions with access points However, the effectiveness of WLAN solutions diminishes without reliable access points Bluetooth and Zigbee-based solutions have shown promise in specific scenarios, particularly in high-density environments like shopping malls, although they also require a significant number of beacons and are affected by environmental conditions In extreme situations, such as rescue operations or scientific expeditions in areas lacking satellite or cellular signals, alternative self-contained strategies must be developed to ensure continuous position tracking.

The PDR method enhances outdoor pedestrian tracking with smartphones, outperforming built-in GPS modules in accuracy Research emphasizes step recognition through the smartphone's accelerometer, utilizing techniques such as threshold setting, peak detection, correlation analysis, and spectral analysis The peak detection method identifies steps by analyzing peak values in accelerometer data, rather than relying on preset thresholds This approach involves extracting local peaks in acceleration and applying constraints to minimize overcounting, with each remaining peak counted as a step However, the accuracy of peak detection may decline during transitions between step modes or changes in smartphone posture.

The authors of the article [6] developed an accurate step counting method for different gaits using an affordable Three Degrees of Freedom (3DoF) accelerometer They introduced four key characteristics—minimum peak distance, minimum peak protrusion, dynamic threshold, and vibration elimination—along with periodic features and similarity measures, effectively addressing issues of overcounting, undercounting, and operational inaccuracies.

The model presented in [11] offers a significant advantage by enhancing the stability of the positioning system Misidentification of peaks or valleys can disrupt the entire peak-valley pairing, resulting in erroneous outcomes in peak-valley-based models However, this model allows for precise measurement of variance, effectively minimizing the impact of potential frequency errors.

A recent study investigated the connection between motion recognition and step detection, examining the distinct characteristics of direction derived from the amplitudes and both vertical and horizontal components of acceleration This research focused on six common physical activities: sitting, standing, walking, running, and driving.

Estimation of heading direction has always remained an important piece of information since the beginning of the history of navigation and positioning

[14] In order to estimate the heading, several methods using magnetometer and gyroscope data have previously been proposed.

Research indicates that for optimal use of the heading estimation app, users should position their smartphones parallel to the ground, ensuring that the z-axis points upward The device should only rotate around this z-axis, with the initial orientation determined by the user's gesture when launching the application.

Estimating walking direction by projecting accelerometer signals onto the horizontal plane may seem theoretically sound, but the reality is far more complex Many heading estimation methods that utilize smartphones often rely on oversimplified scenarios with fixed holding styles, which complicates the ability to meet real-time requirements, even with advancements in Pedestrian Dead Reckoning (PDR) components.

Research [2] found that the location of the mobile phone has a great impact on the accuracy of each heading estimation algorithm For example, in the document

The article presents an innovative indoor navigation solution that integrates physical motion recognition with WLAN positioning on smartphones It extracts direction-independent features from both vertical and horizontal acceleration components, including average horizontal acceleration, acceleration amplitude variance, and horizontal acceleration variance The study emphasizes six distinct motion modes: Static (ST), Standing Waving (SS), Normal Walking with a Mobile Phone (WH), Walking with Hand Swing (WS), Fast Walking (WF), and U-turning (UT).

Using a smartphone's built-in digital compass for estimating heading direction can lead to inaccuracies due to orientation changes, which introduce an offset in the calculations Additionally, environments with significant electromagnetic interference can render magnetometer measurements unreliable To address these issues, some researchers have turned to gyroscopes for more accurate heading estimation However, relying on raw gyroscope data necessitates that the sensor, and consequently the smartphone, remain fixed in the direction of travel to accurately calculate turning angles when the user changes direction.

To enhance user experience, it is essential for smartphones to be held in any preferred orientation before being secured Research indicates that when a smartphone is not positioned in its optimal vertical or horizontal alignment, gyroscope readings may underestimate true angular velocity, particularly during turns or on curved roads Therefore, accurately estimating distance requires distinguishing between various phone placements, a task that can be quite complex.

Inertial Measurement Units (IMUs)

Accelerometer

An accelerometer sensor measures acceleration, defined as the differential rate of velocity variations, in meters per square second (m/s²) within the device's coordinate system It detects forces acting on the sensor from various directions and, using Newton's second law, calculates acceleration by dividing the force by the sensor's mass When an Inertial Measurement Unit (IMU) device is stationary on a table parallel to the Earth's surface, the accelerometer registers a value of g = 9.81 m/s², which represents Earth's gravitational pull Conversely, during free-fall, when the IMU accelerates towards the ground at 9.81 m/s², the accelerometer will indicate a reading of 0 m/s².

Gyroscope

A gyroscope sensor measures the differential rotational momentum around the device's local x, y, and z axes in radians per second (rad/s), utilizing the same coordinate system as the acceleration sensor By integrating the gyroscope's output over time, it calculates the rotation, effectively describing the change in angles as time progresses.

Rotation is positive in the counterclockwise direction That is, an observer looking from some positive location on the x, y, orz axis at a device positioned

3.2 Pedestrian Dead Reckoning on the origin would report positive rotation if the device appeared to be rotating counterclockwise.

Gyroscope noise and offset can lead to errors that require compensation for accurate long-term monitoring To maintain precision, regular recalibration of the gyroscope is essential, often utilizing data from additional sensors.

Magnetometer

A magnetometer is a sensor that measures the ambient magnetic field along three axes (x, y, and z) in micro-Tesla (µT) It is valuable for localization and tracking due to its ability to determine the strength and direction of magnetic fields However, magnetometers can be unreliable in indoor environments because they are highly sensitive to nearby metals, leading to variable errors from external magnetic influences.

Pedestrian Dead Reckoning

on the origin would report positive rotation if the device appeared to be rotating counterclockwise.

Gyroscope noise and offset can lead to errors that require compensation for accurate long-term monitoring To ensure reliability, regular recalibration of the gyroscope is essential, typically utilizing data from additional sensors.

A magnetometer is a sensor that measures the ambient magnetic field along the local x, y, and z axes in micro-Tesla (µT) It is valuable for localization and tracking by determining the strength and direction of magnetic fields However, its reliability is compromised due to its sensitivity to magnetic fields and surrounding metals, which can introduce variable errors, limiting its effectiveness in indoor environments.

The user's location is estimated using IMU-based Pedestrian Dead Reckoning (PDR), which integrates step lengths and heading angles at each detected step While the theoretical displacement can be calculated through the double integral of acceleration over time, practical applications often yield inaccurate results due to significant deviations Nevertheless, valuable information can be extracted from acceleration signals generated during walking, as each step produces a distinct impulse in the acceleration data This allows for step counting and estimation of step lengths, while continuous updates of the current position can be made based on heading direction Inspired by PDR, researchers are exploring innovative indoor positioning approaches.

Pedestrian Dead Reckoning utilizes various combinations of inertial sensors to accurately determine speed and perform dead reckoning This approach resembles a Step and Heading System (SHS), which monitors the real-time position of each step by utilizing an Inertial Measurement Unit (IMU).

PDR (Pedestrian Dead Reckoning) is an effective method for integrating inertial sensor data for personal navigation By utilizing data from the Inertial Measurement Unit (IMU), including accelerometers for step detection and distance estimation, as well as magnetometers for heading determination, PDR provides real-time updates on a pedestrian's position The gyroscope further enhances this capability by detecting changes in heading, ensuring accurate navigation based on the physical impulses triggered during walking.

Figure 3.1: General Architecture of Pedestrian Dead Reckoning System

The SHS-PDR workflow, which mainly consists of three functional modules, is shown in the figure 3.1: step detection; step length estimation; and heading esti-

Coordinates systems

Smartphone/Device Coordinates System

Smartphone sensors typically utilize a standard 3-axis coordinate system to represent data values, which is defined based on the device's screen orientation when held in its default position.

The smartphone coordinate system is established based on the device's screen orientation when held perpendicular to the ground In this position, the x-axis runs horizontally to the right, while the y-axis is aligned vertically.

In smartphones, the coordinate system is defined with the positive directions of the three axes: the vertical axis pointing upwards, and the z-axis extending out from the screen surface, with negative z values indicating locations behind the screen This system is utilized by embedded sensors such as the accelerometer, magnetometer, and gyroscope A key feature of this coordinate system is that it remains consistent, even when the device's screen orientation changes, ensuring that the sensor’s coordinate system does not alter as the device moves.

Ground/Earth Coordinates System

Figure 3.4 illustrates the ground coordinate system, where the x and y axes represent vectors that are tangential to the ground and perpendicular to each other The z-axis vector extends vertically towards the sky, maintaining a perpendicular orientation to the ground Our algorithm will accurately display the user's position on this coordinate system using the x and y coordinates.

The Earth coordinate system is basically a ground coordinate system but with

Figure 3.4: Ground/Earth Coordinate System x-axis points to the East and y-axis points to the North.

Coordinates Transformation

Working with IMUs required a clear understanding of coordinate transfor- mations In brief, coordinates transformation is a method of converting a vector in one coordinate system to another without affecting the vector.

Smartphones collect sensor data represented as a three-component vector, which can be transformed between coordinate systems through vector rotation This process requires the application of rotation matrices to the original vector to achieve the desired orientation The rotation angles around the x, y, and z axes are denoted as Pitch, Roll, and Yaw, respectively, with their corresponding rotation matrices represented as R_Pitch, R_Roll, and R_Yaw.

Step Detection

Peak Detection

This method detects all peaks above a threshold and then selects the highest in a window of time associated with one step Fig.3.5 illustrates the basic peak detection method.

Figure 3.5: Basic Peak Detection Method

Zero-crossing Based Step Detection

The zero-crossing method is a straightforward technique for step detection using acceleration signals, which identifies step occurrences by counting the points where the signal crosses zero This algorithm determines the intersection between the average acceleration line and the signal's rising or falling segments While it effectively counts zero-level crossings to identify steps, its simplicity can lead to the miscounting of non-step events, ultimately compromising the accuracy of step recognition Figure 3.6 illustrates the fundamental zero-crossing detection method.

Figure 3.6: Basic Zero-crossing Detection Method

Peak-trough based step detection

Peaks and troughs detection identifies valid peak-trough pairs in acceleration signals, enabling the extraction of essential features for step classification and length estimation However, this approach can be complex, as incorrectly identifying a peak or trough significantly diminishes the accuracy of step detection.

Step Length Estimation

Figure 3.6: Basic Zero-crossing Detection Method

3.4.3 Peak-trough based step detection

Peaks and troughs detection identifies valid peak-trough pairs in acceleration signals, enabling the extraction of essential features for accurate step classification and length estimation However, this method can be complex, as incorrectly counting a peak or trough significantly diminishes the accuracy of step detection.

Step length is a crucial factor that influences the distance a user travels, defined as the distance between two heel strikes To accurately estimate the duration of a step, various individual parameters must be considered, including walking speed, frequency, route inclination, acceleration magnitude, and physiological characteristics such as body height, leg length, and weight The variability in human gait further complicates the determination of precise step length.

3.5 Step Length Estimation estimation difficult Estimating the length of each step is one of the most vital requirements for pedestrian navigation, as it estimates the distance traveled.

Improving the estimation of step length can be achieved by accurately detecting the user's motion state, which includes activities like walking, running, and stair climbing Since human mechanics vary with different motion states, this variation can lead to errors in stride length estimation By incorporating information about a person's motion state, we can enhance the accuracy of stride length calculations.

According to the literature [11], the step length estimation models can be categorized as the following:

1 Constant step length: Users must either measure their step length manually (walk a particular number of steps and measure the distance) or depend on the default value.

2 Determined by height: The male step length is 0.415 times his height, while the female step length is 0.413 times her height [11].

1 Weinberg Model: steplength=k×√ 4 a max −a min (3.4) where a max and a min are the maximum and minimum vertical accelera- tions in a step, respectively, and k is the user-specified parameter.

There areN sampling points in the step anda i is the vertical acceleration of the i th sampling point; k indicates also the user parameter.

The explanations for the parameters are the same as the equations above. The peak and trough values, their difference as well as the magnitude are utilized.

4 Xu Model: steplength=k×[(a max −a min ) +√ 4 a max −a min ] (3.7)

The Xu Model shares similarities with the Weinberg Model, with the key distinction being its focus on the difference between peak and trough values However, the formulation of the Xu Model is notably more complex.

Frequency-related models suggest a linear correlation between step size and step frequency, indicating that pedestrians who walk at a higher frequency tend to take longer steps This relationship is based on the understanding that as walking speed increases, both the length and frequency of steps typically rise together The mathematical representation of this concept is expressed as steplength = a × f + b, where 'f' represents step frequency and 'a' and 'b' are non-negative coefficients This model highlights the proportional relationship between step length and frequency.

This model incorporates both step frequency (f) and variance (v) during each step, resulting in a more nuanced approach compared to the previously mentioned frequency model It acknowledges that only higher frequencies can significantly impact outcomes, leading to a more refined analysis.

Heading Estimation

Gyroscope based heading estimation

Gyroscope-based heading estimation remains a crucial aspect of pedestrian dead reckoning systems, despite challenges related to integration drift This technique is effective only when the device's heading aligns with the walking direction and maintains a consistent attitude throughout the movement.

Principal Component Analysis for heading estimation

Principal Component Analysis (PCA) is utilized to extract pedestrian heading direction by analyzing the maximum variation of acceleration signals in the horizontal plane, based on accelerometer magnitude readings Experimental data reveals that while angle deviations can estimate headings, this approach requires a motion mode recognition system to ensure accurate heading determination.

Position Estimation

To effectively visualize a location on a map, a coordinate system is essential Ground navigation systems for both outdoor and indoor environments utilize 2D maps, such as building floor layouts or urban street maps, particularly in areas with minimal altitude variation Even in multi-floor 3D applications, users often rely on 2D maps that indicate the floor number as a representation of altitude For most popular indoor and urban applications, Earth coordinates serve as a superior tool for visual tracking The position of a pedestrian at time step k+1 can be calculated accordingly.

Where x andy are the coordinates in North and East directions,SL is the step length and θ is the heading compared to the North at momentk.

This thesis focuses on the investigation and implementation of a Smart Health System (SHS) on smartphones utilizing embedded sensors The two dominant mobile platforms, Android and iOS, require extensive development time due to their separate programming languages, Objective-C and Java However, the use of React Native, an open-source framework, streamlines the process by enabling the creation of native apps for both platforms efficiently Given its convenience and robust support libraries, React Native was selected for this system's implementation.

Introduction

Advantages

React Native is built on JavaScript, one of today's most widely used programming languages This foundation allows React Native developers to utilize a vast array of external libraries compatible with their applications Additionally, many libraries designed for ReactJS can also be seamlessly integrated into React Native projects.

• The possibility of integrating React Native with an already existing mobile application With this, we can continue developing an existing application using React Native.

The Expo framework enhances React Native development by offering a variety of essential components that streamline the creation of standard mobile applications Key features include seamless access to text messages, contacts, camera functionality, and social media login options, making it easier for developers to build robust and user-friendly apps.

Limitations

• Some features of iOS and Android are still not supported, and the community is always inventing the best practices.

• We will need to write some platform specific code if we want to create native functionality which has not been designed yet.

Expo framework

Expo is a powerful framework and platform designed for universal React applications, offering a comprehensive suite of tools and services centered around React Native and native platforms It enables developers to efficiently create, build, deploy, and rapidly iterate on applications for iOS, Android, and the web, all from a single JavaScript or TypeScript codebase.

The Expo SDK offers extensive access to essential device and system features, including audio, camera, GPS location, and sensors Additionally, it incorporates powerful libraries for over-the-air updates, maps, authentication tools, and more, enhancing the development experience.

Device Motion from Expo

DeviceMotion from expo-sensors offers access to the motion and orientation sensors of a device The data is represented across three axes based on the device's coordinate system, with the x-axis extending from left to right, the y-axis from bottom to top, and the z-axis running perpendicularly through the screen from back to front in portrait orientation.

Using DeviceMotion, we can get:

• acceleration (object): Device acceleration on the three axis as an object with x,y, z keys.

• accelerationIncludingGravity (object): Device acceleration with the effect of gravity on the three axis as an object with x, y, z keys.

The rotation of an object refers to its orientation in space, defined by three key angles: alpha, beta, and gamma Alpha represents the rotation around the Z axis, beta corresponds to the rotation around the X axis, and gamma indicates the rotation around the Y axis Understanding these rotational parameters is essential for accurately describing an object's position in three-dimensional space.

• rotationRate (object): Device’s rate of rotation in space expressed in degrees per second.

It is worth noting that the rotation object returns rotation angle in the ground coordinate system and the acceleration data is used will be expressed in G

Planning and Analysis

Step detection

Pedestrian walking exhibits a periodic acceleration pattern, as evidenced by the tri-axial accelerometer's output waveform, which changes consistently during movement As the foot transitions from lifting to landing, the center of gravity shifts from rising to falling, causing the vertical acceleration data to follow a distinct curve that moves from peak to trough.

Figure 4.1: Accelerations of 5 steps when holding smartphone parallel to the ground

Figure 4.2: Accelerations of 5 steps when holding smartphone perpendicular to the ground

Figures 4.1 and 4.2 illustrate the accelerations of a user taking five steps while holding the phone both horizontally and vertically In these scenarios, the most significant data for determining user steps is observed in the z and y-axis, specifically the vertical acceleration.

4.2 Planning and Analysis data that many researchers often use for their step recognition methods However, most of these algorithms require the user to hold the phone in a fixed orientation, which could be inconvenient, because the amount of data obtained from one axis is not enough to determine the number of steps when holding the phone in arbitrary orientation (Fig.4.3).

Figure 4.3: Accelerations of 5 steps when holding smartphone arbitrary

Other authors have created algorithms focused on the magnitude of accelerations, which reduces their dependence on the phone's orientation However, this approach can compromise accuracy by incorporating more irrelevant data.

Our step detection algorithm relies exclusively on vertical acceleration data derived from the z-axis By utilizing DeviceMotion, we can perform coordinate transformations to convert acceleration data into the ground coordinate system, as detailed in Chapter 3 This process allows us to accurately capture the necessary vertical accelerations for effective step detection.

Peak detection-based step recognition algorithms are widely utilized due to their simplicity and consistent accuracy However, they face challenges, particularly in distinguishing actual walking steps from similar movements, such as raising or lowering the device and changing its orientation To enhance accuracy, researchers have incorporated additional characteristics like static and dynamic thresholds and minimal peak distance.

4.2 Planning and Analysis they take more time to calculate as well as require additional data analysis.

Another problem worth mentioning is that, according to research [2], the placement of the phone has a significant impact on the accuracy of each step counter.

Figure 4.4: Walking acceleration magnitude in hand and pocket

The output waveform of a tri-axial accelerometer reveals distinct differences when a user holds one phone in front and carries another in their pocket, as illustrated in Fig 4.4 Over a 6-step duration, the phone held in hand generates six recurring acceleration patterns, while the pocketed phone produces only three This three-pattern occurrence is also observed when the phone is swung in hand, attributable to the nature of walking, where one foot is always in contact with the ground Each pattern corresponds to two steps, influenced by which foot is touching down Although some researchers integrate this data with motion mode recognition for location tracking, this thesis does not pursue that avenue due to the extensive data analysis required, which complicates the system.

To enhance accuracy in step detection, our team developed a peak detection algorithm that incorporates practical features The algorithm is specifically designed for scenarios where the user holds the phone in hand, allowing for any orientation However, it is crucial that the user maintains this orientation while walking, as changing it could potentially deceive the algorithm by simulating movement through stationary acceleration of the accelerometer.

Step length estimation

Pedestrian movements produce distinct impulses in acceleration signals, allowing for the statistical estimation of the horizontal distance traveled by the body's center of mass This estimation model aims to derive step length from various physical measurements obtained through inertial sensors However, the complexity of individual physical structures makes it challenging to create a universal analytical model for all gait types Many step length estimation algorithms require extensive training datasets to determine customized coefficients, but due to limitations in time and methodology, our team opted for the algorithm referenced in [3] Over six months, we trained on a substantial dataset, revealing that step length is a non-linear function of frequency and variance, and we utilized the resulting coefficients to estimate step length effectively.

Heading estmation

The heading of sensors typically lacks correlation with the user's movement, making it challenging to implement Most heading algorithms rely on data from the magnetometer or one axis of the gyroscope (either the y or z-axis) to determine the direction of movement, assuming the phone is aligned parallel or perpendicular to the travel direction However, the accuracy of the magnetometer significantly decreases when utilized in this context.

Design

an indoor environment, and the initial orientation of the mobile phone is restricted, greatly reducing the feasibility and applicability of the system.

Our step detection algorithm allows for flexible phone orientation during movement, enabling accurate heading estimation without requiring the user to align the phone with their walking direction Utilizing Expo’s Device Motion library, we implemented a sensor fusion algorithm that tracks the phone's rotation in the ground coordinate system Specifically, we extracted the alpha angle from the Rotation object provided by Device Motion, as it represents the fixed angle of the phone relative to the walking direction, with alpha indicating the rotation around the z-axis.

This method utilizes angle returns from the magnetometer to determine the absolute heading in the Earth's coordinate system, where the y-axis points North However, the initial orientation of the smartphone affects the angle reading, leading to discrepancies even when walking in the same direction For instance, if the device is held with the y-axis facing North while walking North, the magnetometer might show a heading of 0° Conversely, if the phone is in landscape mode, the reading could be 90° To accurately calculate the initial heading offset, users must hold the smartphone in a specific direction, which complicates usability by restricting the device's orientation This challenge can be addressed by integrating the system with other indoor positioning technologies.

The proposed system, illustrated in Figure 4.5, effectively gathers data from accelerometers, gyroscopes, and magnetometers via DeviceMotion This collection of data enables the analysis of device accelerations resulting from movements, as well as the determination of device orientations, including pitch, roll, and yaw The processed information is then transformed into actionable insights.

In the ground coordinate system, design utilizes rotation matrices derived from pitch and roll angles, followed by processing the data through a moving average filter to minimize noise This refined data, combined with yaw information from Device Motion, enables the calculation of step count, step length, and heading for each step Ultimately, the user's coordinates in the ground coordinate system are determined as (x,y), where the x-axis aligns with the walking direction relative to the original position.

Figure 4.5: The general view of our system architecture

Implementation

Installation

To implement our system, we selected the Expo framework as the primary technique This process involves two essential tools: the Expo CLI, a command line application for initializing and serving the project, and Expo Go, a mobile client app for accessing the project on iOS and Android devices Additionally, the project can be opened in any web browser After installing Node.js, we installed the Expo CLI by executing the command shown in Fig 4.6, with the results verifiable in Fig 4.7.

The second tool expo requires, Expo Go, can be installed through Android Play Store or iOS App Store.

There are still some Expo SDK and community standard native libraries that need to be installed in order to implement this system:

• DeviceMotion from expo-sensors: provides access to the device’s motion and orientation sensors.

• react-native-chart-kit: a library that helps us display data in charts.

Math.js is a comprehensive mathematics library designed for JavaScript and Node.js, featuring a versatile expression parser that supports symbolic computation It includes a wide array of built-in functions and constants, providing an integrated solution for handling various data types such as numbers, big numbers, complex numbers, fractions, units, and matrices With its powerful capabilities and user-friendly design, Math.js simplifies complex mathematical operations.

• xlsx, expo-files-ystem and expo-sharing: used to display trajectory and share data with other applications.

Figure 4.8: Expo Go app in iOS App Store

DeviceMotion Implementation

In order to work with DeviceMotion, first we subscribe to updates from using the function as Fig.4.9.

This function retrieves values outlined in chapter 4.1.4 and stores them in multiple arrays for subsequent processing It establishes a 20-millisecond interval between DeviceMotion updates, resulting in 50 data points per second for each axis Consequently, the inertial sensors operate at a sampling frequency of 50Hz While increasing the refresh rate can enhance precision, it also leads to higher power consumption.

Figure 4.9: Subscribe Device Motion Function

Coordinates transformation

Smartphones are typically used with an uncertain orientation, as illustrated in Fig 4.10 The accelerometer measures real-time tri-axial accelerations based on the smartphone's internal coordinate system (red in Fig 4.10) To accurately map the walking trajectory onto a standard ground coordinate system (blue in Fig 4.10) and facilitate further recognition processes, it is essential to convert the accelerations from the smartphone's axes into ground coordinates.

To do that, we implement rotation matrices as mentioned in chapter 3. These rotation matrices are:

With the help of Math.js, we can easily implement function 4.3 to transform

The acceleration data from the device's coordinates (red) and the ground's coordinates (blue) is represented by the equation: acceleration G = R Pitch * R Roll * acceleration D Here, acceleration G signifies the acceleration in the ground coordinate system, while R Pitch and R Roll are the rotation matrices that transform the device's acceleration data into the ground's reference frame.

R Roll are rotation matrices with P itchand Roll getting fromDeviceMotion and acceleration D is acceleration in the device’s coordinates system, which is collected also from DeviceMotion.

To test the algorithm above, we plot acceleration including data in two

4.4 Implementation cases: before and after using equation 4.3.

Figure 4.11: Acceleration data when holding the phone perpendicular to the ground

Figure 4.12: Rotated acceleration data when holding the phone perpendicular to the ground

In Figure 4.11, the acceleration measured in the device's coordinate system, with 1G equating to 9.8 m/s², is displayed when the device is held perpendicular to the ground Conversely, Figure 4.12 illustrates these acceleration values in the ground coordinate system The data clearly indicates that the gravitational force, originally aligned with the y-axis, has been effectively transferred to the z-axis, as anticipated.

Figures 4.13 and 4.14 illustrate an experiment where the phone is held in various orientations The gravitational force is measured along three axes and is effectively converted to align with the z-axis The results shown in Fig 4.14 confirm that the acceleration data has been successfully transformed into ground coordinates.

Figure 4.13: Acceleration data when holding the phone in arbitrary orientation

Figure 4.14: Rotated acceleration data when holding the phone in arbitrary orientation

Data filtering

Acceleration signals in the ground coordinate system are often plagued by significant noise from inertial units and the measurement process, resulting in jitters that can be misinterpreted as steps To address this issue, it is essential to reject these noise-induced jitters, which can be viewed as high-frequency components of the original signal Implementing a low-pass filter is necessary to effectively remove these high-frequency jitters and enhance the clarity of the acceleration signals.

The Moving Average Filter serves as an effective low-pass filter to mitigate random jitters in data By applying this filter, each data point in the acceleration sequence is substituted with the average of its neighboring values, enhancing the overall signal quality.

4.4 Implementation sampling points within a moving window with certain size Because of the checks and balances among the neighbors, the accidental jitters can be, in a certain probability, smoothed away. a movAvg [i] = 1

The equation Xj = -M^2 - 1 a_raw[i+j] (4.4) represents the relationship between the input signal, a_raw[], following coordinate transformation, and the output signal, a_movAvg[], after applying a Moving Average Filter The fixed size of the moving window, denoted as M, is typically set to 5, based on empirical analysis of the signal.

To effectively process data within the current moving window, it is essential to focus on the central data points while considering the limited data at both ends Consequently, various calculation methods must be employed The formulas for the different data segments are represented as Eq 4.5, specifically for the moving average, movAvg[i].

(4.5) where i denotes the index of the data sequence; n indicates the data size of the whole segment to be processed; andj is the index within in each window.

Figure 4.15: Moving Average Filter Function

Figure 4.15 illustrates a function that executes Equation 4.5, taking acceleration data from one axis (arr) and a range variable (M) as inputs The output of this function is filteredArr, which contains the accelerations after the filtering process.

We plot the acceleration, including gravity, in thez axis prior and posterior to applying the Moving Average Filter in order to demonstrate the effectiveness of this filter.

Figure 4.16: acceleration data in z-axis before (green) and after (red) filtering

It can be seen easily from figure 4.16 that most of jitters in acceleration signals have been removed The lower standard deviation makes it even more clearly to be seen.

Step and Heading Detection

The filtered accelerations and corresponding yaw angles will be segmented into groups of 50 data samples, representing one second of movement Each segment will then undergo analysis through a function designed to detect steps, estimate step length, and ascertain the heading for each step.

Step Detection

Our step recognition method effectively integrates peak detection with a carefully defined minimal peak distance, which prevents over-counting of steps This approach is widely utilized in various step counters due to its strong performance Additionally, we implement dynamic thresholding by calculating the average of the maximum and minimum acceleration values within a specified window size, enhancing accuracy while adhering to time constraints This combination not only improves step detection but also reduces noise and false peaks in the acceleration signals, ensuring reliable results.

Normally, a traditional peak detection-based step detection can be done by simply implementing equation:

P eak i =Acc(i) ≥(Acc(i−K): Acc(i−1))&&Acc(i) ≥(Acc(i+1) : Acc(i+K))

In the analysis, Acc(i) represents the detected peak at position i, with K denoting the minimum number of samples on both the left and right sides of Acc(i) Based on experimental findings, the value of K is established at 10.

To enhance the accuracy of our step recognition algorithm, we integrated dynamic thresholding, addressing the challenges posed by noise and the complex movements of users in our system.

4.4 Implementation of the traditional peak detection method Dynamic thresholding is built based on the maximal and minimal values of acceleration data in a window size This is represented by Eq.4.7

Aver D = max (Acc(i)) +min(Acc(i))

In our system, the average dynamic threshold (Aver D) plays a crucial role in accurately identifying significant peaks while eliminating false ones The threshold difference (T h D) is defined as the difference between the peak Acc(i) and Aver D, with a value set at 0.05 Any peaks with a T h D less than 0.05 are classified as noise and subsequently removed, ensuring the integrity of the data analysis.

Step Length Estimation

A novel mathematical model is being explored to enhance the precision of step length estimation and positioning This research investigates the significant relationships between step length and various acceleration metrics, including peak value, trough value, variance, and frequency, through a series of meticulously designed experiments Notably, the findings indicate that variance exhibits the strongest correlation with step length The model is represented by the equation v = as² + bs + c, where the coefficients a, b, and c are determined as functions of frequency.

However, all of the sampling data was sourced from 1 volunteer Hence, theoretically, the equations above are solely suitable for that specified volunteer.

A pedestrian's walking style significantly affects variance in step length; a consistent, calm pace results in lower variance, while harsh foot strikes lead to higher variance Additionally, the position of a smartphone can greatly impact this variance To create a more universal model, a tailored parameter k is suggested to accommodate individual differences.

To calibrate parameters effectively, one or more test walks can be conducted Initially, the distance can be estimated using k = 1, and this estimation can then be compared to the actual distance measured by the user The user-specified parameter is calculated using the formula k = d real / d estimated.

(4.11) whered estimated denotes the distances estimated with the initial parameter ofk =1,while d real indicates the real distance during the test walk.

Heading determination

The DeviceMotion angle is crucial for estimating walking direction in our algorithm Initially, this data is stored in an array and then transmitted alongside acceleration data to the movement detection function Each time a step is detected, the system captures the angle at that specific timestamp, which is then utilized as the walking direction.

Position Estimation

According to the PDR method, the 2D position of a pedestrian after the ith step is:

  x i + 1 =x i +step_length i ×cos(heading i ) y i + 1 =y i +step_length i ×sin(heading i ) (4.12)

Our system displays the number of steps, x and y on screen after imple-

4.4 Implementation menting the equation above x and y are coordinates of the user in the ground coordinate system with the xaxis being the initial walking direction However, we could not find any suitable library for plotting the trajectory of users, so we used expo-sharing and expo-file-systemto transfer results to other applications in order to display them.

Figure 4.18 demonstrates the effectiveness of our algorithm, showcasing its performance while a device is held and the user walks straight for about 3 meters, taking 5 steps The results indicate that our system achieves satisfactory outcomes, characterized by minimal errors in both step length and heading.

Figure 4.18: Testing Detect Movement Algorithm

Results

Two main screens of our application as in Fig.5.1 and 5.2.

Figure 5.1: Calibrate Step Length Screen

• On/Off Button: Start and Stop application

• Export Data Button: Export data to other applications in order to display trajectory.

• Reset Button: Reset the step, x and y.

Figure 5.3: Export data to other applications or excel file

Test Scenarios

Test Scenario 1

• The phone is held parallel to the walking direction.

• walking with a trajectory of 2 edges of a rectangle, with a length of 8m and a width of 2.5m.

Test Scenario 2

• The phone is held vertically.

• Walking with a trajectory of 3 edges of a rectangle, with a length of 5m and a width of 2.5m.

Test Scenario 3

• The phone is held perpendicular to the walking direction (landscape mode).

• Walking with a trajectory is 2 edges of a rectangle, with a length of 6m and a width of 1.8m.

Test Scenario 4

• The phone is held in an arbitrary orientation.

• Walking with a trajectory is 2 edges of a rectangle, with length of 6 and width of 1.8m and reverse.

Test Scenario 5

• The phone is held in an arbitrary orientation.

• Walking for more than 100 steps and returning to the initial position.

The outcomes of the aforementioned scenarios demonstrate that our system has effectively achieved the objectives outlined in Chapter 1.2 It provides near real-time positioning updates, delivering data once per second, with 115 out of 116 steps accurately recognized in scenario 5 Furthermore, the deviation of the final position from the initial point is less than 1 meter The primary sources of error stem from step estimation and the inherent instability of the device during movement.

Evaluation

• The system is easy to implement.

• Be able to build on both iOS and Android.

• The measurements are accurate enough to be used in other systems.

• Can be combined with other system to increase accuracy.

• The system can work with any orientation of smartphone.

• The system returns results nearly in real-time.

• The system sometimes lags due to the performance of React Native and high re-render frequency.

• The user interface is not completed yet.

• Cannot handle the case where the user changes the orientation of their smartphone when walking.

• It is possible to trick the algorithm of step detection by standing still and accelerating the accelerometer.

• The accuracy highly depends on step length calibration.

• Cannot display trajectory in the fixed Earth’s coordinate system.

The contribution of the thesis

This thesis presents an indoor positioning strategy that utilizes the built-in inertial sensors of smartphones, addressing key challenges such as step detection, step length estimation, and heading angle determination The proposed method enhances the accuracy and stability of existing positioning systems by serving as a complementary data source However, as the PDR scheme relies on path integration, it is prone to cumulative errors, making it unsuitable for long-term navigation on its own Ideally, this IMU-based approach should work alongside other communication signal-based systems, which can provide initial positioning and correct drift errors from inertial sensors Additionally, the IMU can facilitate navigation in environments where traditional positioning systems like GPS or WLAN are unreliable, ensuring consistent performance and more reliable position tracking.

Result

Our team has developed a handheld smartphone-based step and heading PDR system to enhance indoor positioning capabilities We established various test scenarios to assess the performance of our methodologies through a series of experiments The results indicate that the system meets time constraints and delivers a position with an acceptable mean error Nonetheless, further challenges remain to be addressed to enhance the system's effectiveness and its integration with broader positioning systems.

Future work

• Improving step detection algorithms as well as applying motion mode recog- nition algorithms to handle different motions of the user.

• Testing other step length estimation algorithm algorithms and improving our chosen method as it uses a data set from other researchers.

• Combining with the map matching algorithm or other indoor positioning systems to reduce heading drift and get the initial heading.

Altitude information, including the user's current floor and whether they are using stairs or an elevator, can be analyzed using a barometer By measuring air pressure, a relative altimeter can be calculated and integrated into our system to determine a precise 3-D position.

The initial pedestrian position is crucial for the PDR method and is typically provided by the user in most studies However, this reliance on user input is impractical for real-world applications To address this limitation, integrating other positioning schemes is highly beneficial, as it allows for the initial state to be derived from various alternative information sources.

[1] Woyano and Feyissa Step and Heading System Algorithms for Estimating Position Using Smartphones, IEEE Explore, 8/2020.

[2] X Zhu, Q Li and G Chen,APT: Accurate outdoor pedestrian tracking with smartphones 2013 Proceedings IEEE INFOCOM, 2013, pp 2508-2516, doi: 10.1109/INFCOM.2013.6567057.

[3] Sun Yi, An Indoor Positioning Strategy based on Inertial Sensors, 2016

[4] Julang Ying, Kaveh Pahlavan and Liyuan Xu Using Smartphone Sensors for Localization in BAN, Published: February 27th 2019, DOI: 10.5772/inte- chopen.80472

[5] Weisstein, Eric W Rotation Matrix From MathWorld–A Wolfram Web Re- source https://mathworld.wolfram.com/RotationMatrix.html

The study by Van Thanh Pham et al (2018) presents a highly accurate step counting method utilizing low-cost inertial measurement units to support indoor positioning systems across various walking states This innovative approach enhances the precision of tracking movement indoors, addressing the challenges posed by traditional positioning methods The findings underscore the potential of integrating affordable technology in improving indoor navigation and activity monitoring.

The study by Ling Pei et al explores motion recognition technology to enhance indoor wireless navigation on mobile phones By integrating advanced algorithms, the research aims to improve user experience and accuracy in navigating indoor environments The findings highlight the potential of motion recognition in facilitating seamless navigation, making it a significant advancement in mobile technology This innovative approach could transform how users interact with their surroundings, providing a reliable solution for indoor positioning challenges.

[8] Ken Shoemake Animating Rotation with Quaternion Curves Proc, Published:

Ngày đăng: 03/06/2022, 11:28

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN