Improved Single Inertial-Sensor-Based Attitude Estimation during Walking Using Velocity-Aided Observation

This paper presents a Kalman filter-based attitude estimation algorithm using a single body-mounted inertial sensor consisting of a triaxial accelerometer and triaxial gyroscope. The proposed algorithm has been developed for attitude estimation during dynamic conditions such as walking and running. Based on the repetitive properties of the velocity signal of human gait during walking, a novel velocity-aided observation is used as a measurement update for the filter. The performance has been evaluated in comparison to two standard Kalman filters with different measurement update methods and a smoother algorithm which is formulated in the form of a quadratic optimization problem. Whereas two standard Kalman filters give maximum 5 degrees in both pitch and roll error for short walking case, their performance gradually decrease with longer walking distance. The proposed algorithm shows the error of about 3 degrees in 15 m walking case, and indicate the robustness of the method with the same performance in 75 m trials. As far as the accuracy of the estimation is concerned, the proposed method achieves advantageous results due to its periodic error correction capability in both short and long walking cases at varying speeds. In addition, in terms of practicality and stability, with simple parameter settings and without the need of all-time data, the algorithm can achieve smoothing-algorithm-performance level with lower computational resources.


Introduction
The advent of Micro Electro Mechanical Systems (MEMS) technology has made it possible for Inertial Measurement Units (IMU) to attract significant attention due to their miniaturized, low power consumption, and low cost [1]. In particular, the use of inertial sensors has been playing a key role in a wide range of applications requiring attitude (i.e., roll and pitch) and/or heading (i.e., yaw) information such as indoor localization [2,3], unmanned underwater vehicles (UAVs) and spacecraft inertial navigation [4,5], human activity and gesture recognition [6][7][8][9], robots and drones control and stabilization [10,11].
An IMU, typically composed of a three-axis accelerometer, and a three-axis gyroscope, could observe the linear and angular motions, of the target in three-dimensional space to determine attitude in relation to the inertial system. In fact, by combining the inertial sensors with a magnetometer, forming an attitude and heading reference system (AHRS) [12][13][14], much of the current work on the inertial sensing-based orientation estimation has centered on 3-D orientations. However, only the attitude is required without the heading information for various applications such as robot and vehicle stability control [15], human balance issues [16], and gait analysis [17][18][19]. In this paper, the magnetometer is omitted and only the attitude estimation problem is considered using a six-DOF inertial sensor comprised of a triaxial accelerometer and a triaxial gyroscope.
The inertial sensing-based attitude estimation problem usually relies on the following concepts. An accelerometer determines the orientation by sensing the gravitational acceleration about its axes during static conditions. A gyroscope measures the angular rate of rotation along its axes and integrating these rates over time, results in the orientation angles. However, the integration process also accumulates any gyroscope bias or measurement error, and cause attitude drift errors. During dynamic conditions, the accelerometer measures external acceleration as well as gravitational acceleration. Thus the attitude estimation based on the corrupted acceleration is not accurate. The classic strategy to deal with this issue is to use a threshold-based switching technique, which makes use of the fact that the accelerometer should measure only gravitational acceleration (norm 9.81 m/s 2 ) during static conditions [20]. When the norm of the accelerometer output exceeds the gravitational acceleration norm by some pre-defined threshold, it can be determined that there is external acceleration (that is, dynamic conditions). The estimation then switches the measurement signal to gyroscope only until the threshold condition is not met. This method is simple but will be affected by incorrect dynamic state detection and prolonged dynamic conditions. Therefore, a proper fusion of the accelerometer and gyroscope signals is essential in order to address the external acceleration problem and obtain high accuracy attitude estimation.
Recent gait analysis studies show the increasing use of wearable inertial sensor instead of camera-based laboratory systems for measuring attitude during gait [21][22][23]. However, most of the works focus on analysis by monitoring the angle of various joints on the lower extremities (e.g., foot, shank, calf or thigh) whereas only a small number of studies have analyzed upper limb function despite the fact that the upper limbs play an important role in balance and stability maintenance, reduction of mechanical loads on tissue, and improved gait efficiency [24][25][26]. In this article, we focus on estimating attitude of human body during locomotion, particularly upper limb during walking using single IMU.
During walking, the accelerometer outputs are constantly corrupted by linear acceleration caused by the movement of the body, which degrades the attitude estimation performance. For a short distance walking, attitude estimation can be estimated by just integrating gyroscope outputs without using corrupted accelerometer data. However, the attitude estimation becomes inaccurate for longer distance walking.
The key contribution of this paper is to provide a new measurement updating approach to the issue of attitude estimation in human walking scenarios by using some constraints obtained from the almost periodic nature of walking. Experiments are carried out to evaluate the accuracy of the proposed algorithm in attitude estimation with different sensor attachment positions. The properties of the proposed approach are discussed in comparison with two standard Kalman filters with different measurement updating methods and a smoother algorithm using quadratic optimization technique.
The remaining sections are organized as follows: In Section 2, basic definitions and equations of a quaternion-based Kalman filter is given. Measurement updating methods are illustrated in Section 3 with a typical two level measurement update and a proposed method, where a repetitive property of walking velocity signal is used. Experimental setup and results are indicated in Section 4. Discussion, limitations and future works are given in Section 5.

Standard Indirect Kalman Filter for Attitude Estimation
The coordinate transformation of a 3 × 1 position vector r between the body attached sensor coordinate frame and the fixed North-East-Down world coordinate frame is expressed as follows: r b = C b w r w , where the right subscripts b and w imply the corresponding vectors are expressed in the body and world coordinate frames, and C b w ∈ SO(3), simply denoted as C, is the rotation matrix that represents the orientation of the world frame with respect to the body frame. It contains the three unit column vectors of the world coordinate expressed in body coordinate, and can either be represented by the Euler angles or the quaternion.
In this paper, quaternion representation is chosen due to its efficiency in computation. The relationship between quaternion q and its corresponding rotation matrix C(q) is given by In this paper, quaternion q is estimated using standard Kalman filter during walking, where the initial heading is arbitrarily chosen.
The kinematic equation of a rotation is given by [12] where ω ∈ R 3 is the body angular velocity, operation ⊗ represents quaternion multiplication and the symbol Ω(ω) is defined by where [ω×] is the cross product operation on vector ω, and ω is the transpose of ω. Accelerometer and gyroscope outputs y a ∈ R 3 and y g ∈ R 3 are modeled as follows: where a b ∈ R 3 is unknown external acceleration and b g ∈ R 3 is gyroscope bias. The local gravitation vectorg ∈ R 3 is given byg where g ∈ R is the magnitude of the gravitation and n a ∈ R 3 , n g ∈ R 3 are sensor noises. It is assumed that the sensor noises are zero-mean white Gaussian and their covariances are given by E{n a (t)n a (s)} = r a I 3 δ(t − s), E{n g (t)n g (s)} = r g I 3 δ(t − s), where r a ∈ R and r g ∈ R are positive scalars. Letb g ∈ R 3 be an estimate of the gyroscope bias b g with an error b g,e b g =b g + b g,e .
The gyroscope bias b g can be modeled as nearly constanṫ where a small zero-mean Gaussian process noise n b g is added with covariance Q b g δ(t − s) = E{n b g (t)n b g (s)} so that the bias estimation is not stopped soon.
Letq ∈ R 4 be an estimate of q computed from bias-corrected gyroscope output bẏq Since y g −b g = ω due to sensor noise and bias estimation error, the estimated quaternionq is not the same as the true value q. The estimation errorq e ∈ R 4 can be represented in the multiplicative form q =q e ⊗q, (6) or in the rotation matrix expression Assuming that attitude error is small, we can approximateq e ∈ R 4 by 3 × 1 vector q e as follows:q and we can approximate C(q e ) as follows [12]: 3 1 2q e,1 2q e,2 −2q e, 1 1 The state of an indirect Kalman filter is defined by We have the following state equation for an indirect Kalman filter: where Covariance of the process noise is as follows: The measurement equation for an indirect Kalman filter is derived from the sensor output equations. Inserting (7) and (9) into (2), we have Equations (11)-(13) constitute a continuous standard indirect Kalman filter for attitude estimation problem.

Proposed Measurement Updating Methods
In this section, a typical measurement updating method using two level measurement update is given. The algorithm based on this technique together with a new velocity-aided observation is proposed in the later of this section.

Two Level Measurement Updates
When the target is being transformed, including moving and rotating, only the state update Equation (11) is used in the filter without any measurement update. The integrating process might cause accumulate error if the error and bias are not compensated.
A so-called zero-velocity update (ZUPT) technique uses the fact that the velocity must be zero whereas the object is not moving in a specific time interval to reduce the error drift in the integration part of a standard Kalman filter, including position, velocity, and orientation estimations. This technique is usually used with foot-mounted inertial navigation systems, where the foot is stationary during stance phases. However, with the sensor unit attached on human upper body rather than on the feet, it is relatively difficult since there is no periodical instance of zero-velocity during walking.
A more appropriate approach for upper body attitude estimation is to apply gravity measurement (GM) model and the zero-angular-rate update (ZARU) model at detected events. The gravity measurement model employs the acceleration measurement to compensate roll and pitch under the condition that no significant linear acceleration is present. The measured acceleration is considered to be due to gravitational acceleration only Thus, the corresponding measurement equation in the prediction step is given as follows: where The ZARU model relies on the condition that there is no rotational motion at the detected ZARU events, and the gyroscope measurement is due to sensor bias only The measurement equation in the prediction step is given as follows: where

Velocity-Aided Observation
A standard Kalman filter based attitude estimation solution is presented in Section 2. To overcome the external acceleration problem during walking, we derive a new measurement equation, which uses the almost periodic property of human gait during walking. The derivation of this measurement equation is the main contribution of this paper. Figure 1 shows the acceleration norm of a waist-mounted IMU during walking, where we can observe the almost periodic pattern. In Figure 1, the denoted t k represents one peak time index, which corresponds to a double stance (DS) instant and [t k−1 , t k ] interval defines one walking step. Velocities in the world coordinate system at t 1 and t 2 are related by the following equation: Rewriting the velocity equation in the quaternion form including measurement noise term, we obtain Rearranging (23), we obtain the following: wheren (24) can be considered as an attitude measurement equation estimating q e .
We have done a regular straight walking experiment with normal person without any movement disorder. The participants walk along a straight corridor from standing still in their preferred speed and in a most comfortable way. We found from the experiment that people tend to maintain their walking pace at the same speed and the velocity difference at double stance (DS) instant of two consecutive strides is relatively small. In this case, n v,di f f ≈ 0 and (24) can be used as a measurement equation even if we do not know the walking speed v t 1 and v t 2 . The velocity-aided measurement equation can be formed as follows: Since n a is assumed to be white Gaussian noise, the termn v = The remaining question is when we can apply (24) for the filter's measurement updating. In other words, we need a condition to determine whether the termn v,di f f is small enough.
Inserting (2) into (22), we obtain (noise terms are ignored) Noting thatg is a constant, we obtain Now we factorize C w b (t) into two rotation matrices The rotation matrix C w bt 1 denotes the attitude of the body frame at the time t 1 with respect to the world coordinate frame, whereas C bt 1 b (t) is calculated using the current attitude estimation at the time t relative to the last pose t 1 . The later only requires the integration of rotation rate from time t 1 to time t with the initial condition for the rotation matrix C bt 1 b at the start of the integration period is C bt 1 bt 1 , which is the identity matrix. Thus it can be pre-integrated in the body frame of pose t 1 without the actual attitude of the target at the time t 1 . This concept had been presented in [27], where the inertial observations are calculated from pose to pose in the body coordinate frame other than in world coordinate frame.
Inserting (26) into (25), we obtain where ∆v The right hand side of (27) cannot be computed since the rotation matrix C w bt 1 is unknown without initial attitude. However, we can derive a necessary condition that n v,di f f = 0 using the fact C w bt 1 is a rotation matrix. Ifn v,di f f = 0, norms ofg(t 2 − t 1 ) and ∆v t 1 t 2 should be the same.
Based on this observation, we define a function representing the difference between norms ofg(t 2 − t 1 ) and ∆v t 1 t 2 as follows: We introduce a condition to test whethern v,di f f ≈ 0.

Condition 1.
Given acceleration and rotation rate signals between two poses t 1 and t 2 , when the velocity difference signal is small, the following condition is satisfied: where ∈ R is a small threshold.
In the proposed algorithm, (24) is used as a measurement equation for estimating q e when the condition (29) is satisfied.

Practical Implementation
In a standard Kalman-based inertial navigation system, measurement detectors are used to identify the sampling instances where the measurement equations are to be applied. In this section, several heuristic detectors using for the proposed algorithm are presented, which are based on accelerometer and gyroscope outputs.

No-Motion Detection
Gravity measurement update is utilized under the condition that no significant linear acceleration is present. An acceleration-moving-variance detector or an acceleration-magnitude detector can be used to determine when the IMU is stationary. A discrete time index k belongs to a non-moving interval if exist a moving window around k that satisfy the following conditions: where δ a is threshold value and N a is specified window length for detecting the nonmoving intervals. Zero-angular-rate update (ZARU) measurement is performed when no remarkable rotation is present. This can be determined by using a magnitude detector as follows: where δ g is threshold value and N g is specified window length. A combination of above-mentioned detectors can be used to detect the zero-velocity intervals. This paper mainly focuses on the attitude estimation problem in a continuous walking scenario with inertial sensor attached on human upper body other than on one's feet. The foot-mounted sensor attitude estimation result can be improved by applying ZUPT during each stance phase of the gait cycle. However, when a sensor is mounted on human body, zero-velocity intervals are only detected at the stand still periods just before and after the walking trial.

Step Detection
In order to apply velocity-aided measurement update, walking step indices are required. In this paper, a step event is detected from accelerometer output signal. Due to the walking model of a waist-mounted IMU [28], the lowest position of the waist in a gait cycle corresponds to the high peak of the acceleration norm. Therefore, two consecutive detected high peaks of the acceleration norm data can be used to determine a walking step (see Figure 1), and each high peak also corresponds to a double stance instant.
Before applying the peak detection algorithm, the acceleration norm data is filtered using a zero-phase low-pass filter with a normalized cutoff frequency of 0.2π radians/sample. The step event is then determined with the local high peaks using Algorithm 1.

Algorithm 1
Step Detection Algorithm.
Input: Filtered acceleration normỹ a , threshold value B th , window length N s . Output: Double stance indices P H at high peak of acceleration norm.
1: Compute the number of samples N ofỹ a 2: for discrete time k from k = N s + 1 to N − N s do 3: ifỹ a,k > B th andỹ a,k ≥ max(ỹ a,k−N s :ỹ a,k−1 ) andỹ a,k ≥ max(ỹ a,k+1 :ỹ a,k+N s ) then 4: end if 6: end for

Implementation System
This paper uses a consumer-grade IMU MTi-1 sensor from Xsens Technology B.V. where the parameters are listed in Table 1. The wearable node has a size of 4 cm × 3 cm × 1 cm (length × width × height) and consists of an Xsens MTi-1 sensor, a micro SD card slot and a Nordic nRF51822 microcontroller with Bluetooth Low Energy (BLE) supported. The node is attached to different user body locations using a velcro tape. Inertial sensor data were sampled at 100 Hz and saved to the SD card for post-processing. An implementation system is given with registered coordinate system in Figure 3.

Experiment Description
In order to verify the accuracy of the proposed algorithm, five healthy persons were recruited with information given in Table 2. Three experiments were conducted to evaluate the performance of the proposed algorithm. The first experiment was performed inside laboratory space with the help of a motion capture system consisting of six infrared cameras. A rigid frame with three infrared markers was mounted in place with the sensor module. The module was then attached to user's waist. Participants were asked to walk five times in a 3-to-5-m straight line inside working range of the motion capture system. Position data from the tracking system were used for detecting gait cycle and generating reference value for attitude estimation. However, to install a motion capture system, a wide area and a large number of infrared cameras were required. Therefore, equipping a motion capture system for a long walking distance experiment was impractical.
The second experiment was to verify the estimated attitude accuracy during medium walking distance. Volunteers were asked to alternately attach the sensor unit on their waist, neck, and wrist. A corridor 15-m-length was used to take the sensor recording. Each volunteer walked five times along the corridor at their preferred speed.
In the last experiment, users were asked to walk freely two times in long distance (75-m-long in particular), and with varying speed during the trial. The sensor output in all experiments was sampled at frequency of 100 Hz.

Estimation Results
Position data from motion capture system in the first experiment enabled us to obtain gait parameters. Since the sensor and markers module were mounted on user waist, the vertical position of a marker represented the displacement of user's center of mass. Therefore, double stance (DS) indices were equivalent to low peak indices of the vertical position. It can be seen from Figure 4 that double stance indices were also coincident with the high peak indices of the acceleration norm signal. The velocity signal along walking direction also supported our statement in Section 3.2 that during middle of the walking trial, the difference of the velocity at double stance instant of two consecutive strides was relatively small.  In the first experiment, estimated attitude using the proposed algorithm was compared with an offline Kalman-based smoother algorithm [19], which was formulated in the form of a quadratic optimization problem. Ground truth values were calculated from position of three markers. Figures 5 and 6 show a slightly better result from the proposed method in comparison with the smoother. Both results, however, were still very small with the Root Mean Square Error (RMSE) for roll and pitch being less than 2 degrees. In the last two experiments, ground truth from the motion tracker system was not available for long walking distance. Therefore, the smoother algorithm in experiment 1 was chosen to provide reference attitude values. The proposed algorithm was compared with two standard Kalman filters. The first filter, denoted as "KF1" was a standard Kalman filter with zero-velocity measurement update during standing still periods. The target position, velocity, and orientation are estimated. The roll and pitch angle were calculated from estimated quaternion. The second one, denoted as "KF2" was a standard Kalman filter with gravity measurement and zero angular rate update which is given in Section 3.1. Only quaternion and gyroscope bias were estimated and the roll and pitch outputs were from the estimated quaternion. Algorithm descriptions are given in Table 3. Since the estimation error was caused by accumulating error from integration process, standard Kalman filter usually achieved good performance only at an early stage. Hence, we could evaluate the estimation performance by comparing the estimation result at some steps at the end of each trial in the experiment. Figures 7-9 shows an example of the estimated roll and pitch angle estimation and its estimation errors on a 15 m walking trial with three different sensor attachment positions. The result illustrated the similar performance of two standard Kalman filters (KF1 and KF2). The proposed algorithm gave better results in comparison with two aforementioned filters with different measurement updating methods. In particular, maximum estimation errors for both roll and pitch angles were less than 3 degrees for all sensor positions, which was approximately 50% better than two standard Kalman filters (see Table 4).   Experiment 2 was conducted for a longer walking distance and with varying walking speed. Sensors were also attached on user's waist, neck and wrist, respectively. The roll and pitch angle estimation RMSE of the last 10 steps are presented in Figures 10-12 and Table 5.
Generally, two filters KF1 and KF2 showed errors of about 15 to 20 degrees in roll angle estimation, and about 5 to 10 degrees in pitch angle error, which was 4 to 5 times worse in comparison with short walking cases. However, the proposed filter showed similar performance with the short walking distance cases, which was approximately 3 degrees maximum for both roll and pitch angles for all sensor positions.

Discussion
In this paper, a novel filter with a new measurement update has been presented for attitude estimation problem in usual human walking scenarios. The proposed algorithm was evaluated under various circumstances to investigate the variations in the estimation performance. Moreover, three different approaches, a standard Kalman filter with zerovelocity updating (KF1), a standard Kalman filter with two-level measurement observation (KF2) and an offline smoothing algorithm were discussed to compare the performance. The experiments show a promising result with estimation root mean square error smaller than 3 degree for both roll and pitch angles in all three sensor positions. The results for long walking distance indicate the robustness of the proposed algorithm with varying speed and walking distance. Based on a standard Kalman filter with the enhancing measurement update, the proposed algorithm can be used when real-time attitude estimation is necessary.
By introducing a new measurement updating method, the proposed algorithm has enhanced the attitude estimation performance. However, given the required conditions of the experiments, the sort of situations in which the proposed algorithm could be used are limited. That is, people with a lot of gait inconsistency or who have a movement disorder would be excluded in the proposed algorithm. This may open up new directions for our future works, where abnormal gait analysis is required. More complex scenario would be added in future works, such as changing direction and altitude while walking, as well as the presence of obstacles and unforeseen behaviors.