— This paper focuses on s tep length estimation using inertial measurement sensors. Accurate step length estimation has a number of useful health applicati ons, including its use in char acteri zing the postural instability of Parkinson’s disease patients. Three different sensor configurations are studied using sensors on the shank and/or thigh of a human subject. The estimation problem has several challenges due to unknown measurement bias, misalignment of the sensors on the body and the desire to use a minimum number of sensors. A nonlinear estimation problem is formulated that aims to estimate shank angle, thigh angle, bias parameters of the inerti al sensors and step lengths. A nonlinear observer is designed using Lyapunov analysis and requires solving an LMI to find a stabilizing observer gain. It turns out that global stability over the entire operating region can only be obtained by using switched gains, one gain for each piecewise monotonic region of the nonlinear output function . Experimental results are presented on the performance of the nonlinear observer and compared with gold standard reference measurements from an infrared camera capture system. An innovative technique that utilizes three sensors is shown to provide a step length accuracy nearly equal to that of the four -sensor configuration. I. INTRODUCTION Inertial measurement unit ( IMU ) sensors are widely used in navigation and stabilization systems. However, they suffer from measurement bias and drift that highly degrade the accuracy of integration -based position estimation algorithms in a short period of time after initialization . The unreliability of integration based position estimation from IMUs has been wide ly known for many years [1]. Therefore, IMUs are usually used in combination with other sensors like GPS, magnetometers or cameras. For example, Sukkarieh , et al. studied a combination of IMU and GPS signals through a Kalman Filter for a navigation application [2]. Wang and Rajamani estimated al titude by finding the direction cosine matrix using a combination of accelerometer and magnetometer measurements [3]. Since GPS satellit e systems are not accurate enough for c entimeter -level accuracy , IMUs have often been used with a combination of radar or camera systems in autonomous vehicle applications . For example, an IMU with Camera [4], an IMU -Lidar combination [5] and an IMU -GPS-Camera system [6] have been described in the literature . In addition, there are multiple papers that develop different stochastic filters to increase the accuracy and A. Nouriani is a Ph. D. student in Mechanical Engineering at the University of Minnesota – Twin Cities, Minneapolis, MN 55455, USA. (e- mail: nouri011@umn.edu). Robert McGovern is an Assistant Professor in the Department of Neurosurgery, University of Minnesota -Twin Cities, Minneapolis, MN 55455, USA. (e -mail: rmcgover@umn.edu) optimize the performance of th ese sensor combinations [7]– [9]. For the purpose of everyday human body motion tracking and s tep length es timation , GPS is not accurate enough and does not work well indoors. Camera systems are expensive, impractical to widely implement and raise many privacy concerns . Therefore , researchers have tried to find model - based methods to estimate body motions from IMUs . For instance, Matthews tried to solve a simplified three degree of freedom kinetic model of human gait using a Newton -Euler approach and simplifying assumptions on the internal body forces [10]. In another research study , Ketema and Gebre- Egziabher used a kinematic model of gait and presumed constraints on the gait pattern by assuming certain relations between the motions of the limbs to one another [11]. The problem with the se approaches is they make several assumptions on the initial and boundary conditions and utilize gait constraints , which are not uniformly correct for different persons and situations. Wein berg used an empirical relation to calculate step lengths from accelerometers [12] , Jahn, et al. compared some of these empirical and geometrical models with each other [13]. Davidson and Takala introduced a Kalman filter for estimation of velocity and step lengths from IMU acceleration measurements and compared its performance to empirical relations [14]. For estimation of the tilt angle and the measurement bias of IMUs we need nonlinear models and algorithms [15]. There are two major types of approaches in nonlinear observer design - high gain observers for triangular structure systems [16], [17] and linear matrix inequality based observers [18]. High gain observers are popular but have to address issues regardin g noise sensitivity , high frequency model uncertainty and re quirements on model structure [19]–[21]. On the other hand, LMI-based observers have been studied and developed for specific class es of nonlinear systems in the literature. For example, Wang developed LMI -based observers to handle nonlinear systems that have bounded Jacobians [22] , Jeon introduced a gridded LMI -based observer for a nonlinear system with a wide range of operating conditions [23]. Rajamani et al. showed some important drawbacks of LMI - based observers for non- monotonic nonlinear systems and present ed a solution by introducing a hybrid swit ched-gain observer [24]. R. Rajamani is a Professor of Mechanical Engineering at the University of Minnesota – Twin Cities, Minneapolis, MN 55455, USA. (e- mail: rajamani@umn.edu). Step Length Estimation with Wearable Sensors Using a Switched- Gain Nonlinear Observer Ali Nouriani, R obert A. McGovern and R ajesh Rajamani Manuscript accepted for publication in the journal Biomedical Signal Processing and Control This research develops a hybrid switched -gain nonlinear observer for the step length estimation problem and pr esents a design based on solving a linear matrix inequality for each monotonic region in a nonlinear output function. The objective of this nonlinear observer is to estimate the real -time vertical in-plane angle of the IMU relative to the gravity vector as well as to estimate the real -time bias values of the accelerometer and gyroscope . The estimated real-time angle is used in finding the orientation of the body limb segment and also for transforming the acceleration s to the inertial frame. This information is utilized in three different approaches for estimation of human step length : i) The f irst method integrates the linear acceleration components of the shank sensors and provides the velocity and displacement of the sensors in space and hence the step lengths by assuming zero initial conditions at the start moment of each step. Only two sensors are needed. ii) The s econd method estimates the orientations of multiple sensors and takes a dvantage of the geometry of the body to estimate step lengths . Four sensors (one on each shank and thigh ) are needed. iii) The third method utilizes only three sensors (one sensor on a thigh and two sensors on the two shanks) and assum es that each leg has a stance and swing phase during walking, with the thigh angular trajectory being symmetric between the two legs . A preliminary version of these results was published in a conference paper [25]. This journal submission of the manuscript has the following additional contributions compared to the conference version: a) This manuscript utilizes switched gains to ensure global stability of the observer over a large range of operating conditions for thigh and shank angles. The conference version had a constant observer gain, ensured only local stability , and only allowed limited operation over 0 to 30 degrees. b) The conference version only had the two- sensor and four- sensor configurations while this manuscript proposes an innovative three -sensor configuration which is shown to provide almost the same level of accuracy as the 4 -sensor configuration. c) Complete proofs of all theoretical results are provided. d) Significant additional experimental results are included here compared to the conference version of the paper. In previous literature, t here are three typical alternative methods for step length estimation: 1. Integration of accelerometer signals, but without calculation of tilt angles and without transformation of sensor -axes signals to inertia l-axes signals. Fig 10 and 11 in this paper show the insufficiency of this method. 2. Estimation of the gravity vector using SO(3) attitude estimation methods. This type of approach is well established in the aerospace UAV community , e.g. [26], [27]. Some challenges in using this type of approach for wearable application s include the significant influence of local magnetic field disturbances due to ferromagnetic objects in the surroundings, and the conversion of a linear estimation problem into a nonlinear estimation problem when bias parameters are included in the plant model. While good estimation results with this type of estimation approach have been shown for UAV and other aerospace applications, there are less demonstrations of real- world performance in wearable medical applications. 3. Estimation with the same dynamic model presented in this paper but using stochastic approaches like the extended Kalman Filter (EKF), instead of using a nonlinear observer [11]. The disadvantages of the EKF for this application are the presence of non -monotonic nonlinear functions in the measurement equations which leads to poor robustness when there are model errors in the output nonlinear functions, as has been demonstrated by other publications in literature [28]. The remainder of this paper is organized as follows. In Section II, the nonlinear observer design algorithm is formulated . In Section III, three different step length estimation method s are described. In Section IV, experimental results for validating the accuracy of the nonlinear observer and the step length estimation methods are presented . Finally, section V presents the conclusions . II. N ONLINEAR OBSERVER This paper assumes the use of either an IMU sensor on the shank (lower leg) or two IMU sensors, one each on the shank and thigh (upper leg), as shown in Fig.1. The axes of the IMU sensor and the attachment of it to a body limb segment are shown in Fig. 2 . 𝜃𝜃 is the real- time absolute (inertial) angle of the limb segment and 𝜓𝜓 is the unknown orientation angle of the sensor on the limb (due to small misalignment s). Although 𝜓𝜓 is unknown, it does not change with time, while the s egment angle 𝜃𝜃 may continuously change with time. The sensor fixed axes are defined as (𝑥𝑥,𝑦𝑦) and the inertial frame fixed axes are (𝑋𝑋,𝑌𝑌) as shown in Fig. 2. The variables 𝑎𝑎𝑥𝑥, 𝑎𝑎𝑦𝑦, 𝑎𝑎𝑋𝑋 and 𝑎𝑎𝑌𝑌 are the true accelerations along these axes respectively. Fig. 1. The mounting of the sensors on shank and thigh of the left leg. Manuscript accepted for publication in the journal Biomedical Signal Processing and Control 𝜃𝜃 𝜓𝜓𝑦𝑦𝑥𝑥 𝑌𝑌𝑋𝑋Sensor Fig. 2. The mounting and assumed axes of the sensor on a segment limb. The sensor is shown in red. Sensor -fixed axes are defined as (𝑥𝑥,𝑦𝑦) and the inertial frame axes are (𝑋𝑋,𝑌𝑌) . 𝜃𝜃 is the real- time absolute (inertial) angle of the limb segment and 𝜓𝜓 is the unknown mounting orientation angle of the sensor on the limb A. Mathematical model The orientation o f each sensor is 𝜃𝜃+𝜓𝜓, where 𝜃𝜃 is the real-time angle of the shank and 𝜓𝜓 is the additional unknown mounting angle of the sensor on the shank. Let 𝜙𝜙=𝜃𝜃+𝜓𝜓. (1) Then the measurement s of the accelerometers can be described by outputs 𝑦𝑦1 and 𝑦𝑦2: 𝑦𝑦2=𝑎𝑎𝑦𝑦𝑦𝑦=𝑎𝑎𝑦𝑦−𝑔𝑔cos(𝜙𝜙)+𝑏𝑏𝑎𝑎𝑦𝑦 (2) 𝑦𝑦1=𝑎𝑎𝑥𝑥𝑦𝑦=𝑎𝑎𝑥𝑥−𝑔𝑔sin(𝜙𝜙)+𝑏𝑏𝑎𝑎𝑥𝑥 (3) The g yroscope signal measured by the sensor is described by the known input : 𝑢𝑢=𝜔𝜔𝑔𝑔𝑔𝑔=�𝜃𝜃̇+𝜓𝜓̇�𝑦𝑦𝑚𝑚𝑎𝑎𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚=𝜃𝜃̇+𝑏𝑏𝑔𝑔𝑔𝑔 (4) Here 𝑏𝑏𝑎𝑎𝑥𝑥, 𝑏𝑏𝑎𝑎𝑦𝑦 and 𝑏𝑏𝑔𝑔𝑔𝑔 are the unknown bias values of the accelerometer and the gyro scope measurements and are assumed to be constant. The relationship s of the inertial accelerations to the sensor measured accelerations are given by : 𝑎𝑎𝑋𝑋=𝑎𝑎𝑥𝑥cos(𝜃𝜃+𝜓𝜓)+𝑎𝑎𝑦𝑦sin(𝜃𝜃+𝜓𝜓) (5) 𝑎𝑎𝑌𝑌=𝑎𝑎𝑦𝑦cos(𝜃𝜃+𝜓𝜓)−𝑎𝑎𝑥𝑥sin(𝜃𝜃+𝜓𝜓) (6) Then the overall dynamics of the sensor system on each lower leg can be described by the following equations: 𝜙𝜙̇=𝜔𝜔𝑔𝑔𝑔𝑔+𝑏𝑏𝑔𝑔𝑔𝑔 (7) 𝑏𝑏̇𝑎𝑎𝑥𝑥=0 𝑏𝑏̇𝑎𝑎𝑦𝑦=0 𝑏𝑏̇𝑔𝑔𝑔𝑔=0 In matrix form, the system dynamics are: 𝑑𝑑𝑥𝑥 𝑑𝑑𝑑𝑑=𝑑𝑑 𝑑𝑑𝑑𝑑 ⎩⎨⎧𝜙𝜙 𝑏𝑏𝑎𝑎𝑥𝑥 𝑏𝑏𝑎𝑎𝑦𝑦 𝑏𝑏𝑔𝑔𝑔𝑔⎭⎬⎫ =�0001 0000 0000 0000� ⎩⎨⎧𝜙𝜙 𝑏𝑏𝑎𝑎𝑥𝑥 𝑏𝑏𝑎𝑎𝑦𝑦 𝑏𝑏𝑔𝑔𝑔𝑔⎭⎬⎫ +�1 0 0 0�𝜔𝜔𝑔𝑔𝑔𝑔 (8) 𝑦𝑦=�𝑦𝑦1 𝑦𝑦2�=ℎ(𝐸𝐸𝑥𝑥)+𝐶𝐶𝑥𝑥+𝐷𝐷𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖 (9) where 𝐸𝐸=[1000] (10) 𝐶𝐶=�0100 0010� 𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖=�𝑎𝑎𝑥𝑥 𝑎𝑎𝑦𝑦� and ℎ(𝐸𝐸𝑥𝑥)=�ℎ1(𝐸𝐸𝑥𝑥) ℎ2(𝐸𝐸𝑥𝑥)�=�−𝑔𝑔sin𝜙𝜙 −𝑔𝑔cos𝜙𝜙� In general system notation form , the system model is 𝑑𝑑 𝑑𝑑𝑑𝑑𝑥𝑥=𝐴𝐴𝑥𝑥+𝐵𝐵𝜔𝜔𝑔𝑔𝑔𝑔 (11) 𝑦𝑦=𝐶𝐶𝑥𝑥+ℎ(𝐸𝐸𝑥𝑥)+𝐷𝐷𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖 (12) B. Development of LMI -based observer design algorithm: Let the o bserver be given as 𝑑𝑑 𝑑𝑑𝑑𝑑𝑥𝑥�=𝐴𝐴𝑥𝑥�+𝐵𝐵𝜔𝜔𝑔𝑔𝑔𝑔+𝐿𝐿{𝑦𝑦− 𝐶𝐶𝑥𝑥�−ℎ(𝐸𝐸𝑥𝑥�)} (13) Let the e stimation error be: 𝑥𝑥�=𝑥𝑥−𝑥𝑥� (14) Then the e stimation error dynamics are given by: 𝑥𝑥�̇=𝑥𝑥̇−𝑥𝑥�̇=𝐴𝐴𝑥𝑥�−𝐿𝐿𝐶𝐶𝑥𝑥�−𝐿𝐿ℎ(𝐸𝐸𝑥𝑥)+𝐿𝐿ℎ(𝐸𝐸𝑥𝑥�)−𝐿𝐿𝐷𝐷𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖 or 𝑥𝑥�̇=(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑥𝑥�−𝐿𝐿ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−𝐿𝐿𝐷𝐷𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖 (15) where ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)=ℎ(𝐸𝐸𝑥𝑥)−ℎ(𝐸𝐸𝑥𝑥�). Lemma 1: The nonlinear difference function ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�) satisfies the quadratic inequality 𝑉𝑉1=[𝑥𝑥�𝑇𝑇ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝑇𝑇] Θ �𝑥𝑥� ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)� ≤0 (16) where Manuscript accepted for publication in the journal Biomedical Signal Processing and Control Θ= ⎣⎢⎢⎢⎡𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇𝑁𝑁𝐸𝐸+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇 𝑀𝑀𝐸𝐸 2−𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇 2 −𝑀𝑀𝐸𝐸 +𝑁𝑁𝐸𝐸 2𝐼𝐼⎦⎥⎥⎥⎤ with 𝑀𝑀=�𝑀𝑀1 0 0𝑀𝑀2� and 𝑁𝑁=�𝑁𝑁1 0 0𝑁𝑁2� being diagonal matrices containing the lower and upper bounds on the partial derivates of ℎ1(𝐸𝐸𝑥𝑥)=−𝑔𝑔sin𝜙𝜙 and ℎ2(𝐸𝐸𝑥𝑥)=−𝑔𝑔cos𝜙𝜙 respectively. Proof: From the differential mean value theorem, ∃ 𝑧𝑧=𝐸𝐸𝑥𝑥 such that [25] ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)=�⋮ ℎ𝑖𝑖(𝐸𝐸𝑥𝑥)−ℎ𝑖𝑖(𝐸𝐸𝑥𝑥�) ⋮� = ⎣⎢⎢⎢⎢⎢⎡𝜕𝜕ℎ1 𝜕𝜕(𝐸𝐸𝑥𝑥)� 𝑔𝑔=𝑔𝑔10 0 0 ⋮⋱⋱ 0 0 ⋱ 0 0⋯ 0𝜕𝜕ℎ𝑦𝑦 𝜕𝜕(𝐸𝐸𝑥𝑥)� 𝑔𝑔=𝑔𝑔𝑚𝑚⎦⎥⎥⎥⎥⎥⎤ (𝐸𝐸𝑥𝑥−𝐸𝐸𝑥𝑥�) (17) Then, using the lower and upper Jacobian bounds : ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−𝑀𝑀𝐸𝐸𝑥𝑥�= ⎣⎢⎢⎢⎢⎡𝜕𝜕ℎ1 𝜕𝜕(𝐸𝐸𝑥𝑥)� 𝑔𝑔=𝑔𝑔1−𝑀𝑀10 0 0 ⋮ ⋱⋱ 0 0 ⋱ 0 0 ⋯ 0𝜕𝜕ℎ𝑚𝑚 𝜕𝜕(𝐸𝐸𝑥𝑥)� 𝑔𝑔=𝑔𝑔𝑚𝑚−𝑀𝑀𝑦𝑦⎦⎥⎥⎥⎥⎤ 𝐸𝐸𝑥𝑥� (18) and ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−𝑁𝑁𝐸𝐸𝑥𝑥�= diag�𝜕𝜕ℎ1 𝜕𝜕(𝐶𝐶𝑥𝑥)� 𝑔𝑔=𝑔𝑔1−𝑁𝑁1,………, 𝜕𝜕ℎ𝑦𝑦 𝜕𝜕(𝐶𝐶𝑥𝑥)� 𝑔𝑔=𝑔𝑔𝑚𝑚−𝑁𝑁𝑦𝑦 �𝐸𝐸𝑥𝑥� (19) From ( 18) and ( 19), it follows that �ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−𝑀𝑀𝐸𝐸𝑥𝑥��𝑇𝑇�ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−𝑁𝑁𝐸𝐸𝑥𝑥�� =𝑥𝑥�𝑇𝑇𝐸𝐸𝑇𝑇 𝑑𝑑𝑑𝑑𝑎𝑎𝑔𝑔 �…,�𝜕𝜕ℎ𝑖𝑖 𝜕𝜕(𝐶𝐶𝑥𝑥)� 𝑔𝑔=𝑔𝑔𝑖𝑖−𝑀𝑀𝑖𝑖�𝑇𝑇 �𝜕𝜕ℎ𝑖𝑖 𝜕𝜕(𝐶𝐶𝑥𝑥)� 𝑔𝑔=𝑔𝑔𝑖𝑖−𝑁𝑁𝑖𝑖�,….�𝐸𝐸𝑥𝑥� (20) Since each of the terms in the diagonal matrix is non - positive, the following negative definite inequality follows �ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−𝑀𝑀𝐸𝐸𝑥𝑥��𝑇𝑇�ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−𝑁𝑁𝐸𝐸𝑥𝑥��≤0 (21) Equation (2 1) can be rewritten as [𝑥𝑥�𝑇𝑇ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝑇𝑇]�𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇𝑁𝑁𝐸𝐸−𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇 −𝑁𝑁𝐸𝐸 𝐼𝐼�𝑇𝑇 �𝑥𝑥� ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)�≤0 (22) Since 𝑀𝑀 and 𝑁𝑁 can also be switched in (2 2), a symmetric form of (2 2) is 𝑉𝑉1=[𝑥𝑥�𝑇𝑇ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝑇𝑇] �𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇𝑁𝑁𝐸𝐸+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇𝑀𝑀𝐸𝐸 2−𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇 2 −𝑀𝑀𝐸𝐸+𝑁𝑁𝐸𝐸 2𝐼𝐼��𝑥𝑥� ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)� ≤0 (23) QED. Theorem 1 : If the acceleration input 𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖 is zero, then the errors in the estimates of the angle and the bias parameters will converge globally exponentially to zero, if the observer gain is selected so that the following LMI -equivalent inequality 𝑆𝑆<0 (24) yields a positive definite solution 𝑃𝑃>0 and an observer gain solution 𝐿𝐿, with the elements of the matrix 𝑆𝑆 defined as 𝑠𝑠11=(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑇𝑇𝑃𝑃+𝑃𝑃(𝐴𝐴−𝐿𝐿𝐶𝐶)−𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇𝑁𝑁𝐸𝐸+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇𝑀𝑀𝐸𝐸 2+𝜎𝜎𝑃𝑃 𝑠𝑠12=−𝑃𝑃𝐿𝐿+ 𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇 2 𝑠𝑠21=−𝐿𝐿𝑇𝑇𝑃𝑃+𝑀𝑀𝐸𝐸 +𝑁𝑁𝐸𝐸 2 𝑠𝑠22=−𝐼𝐼. Proof: Consider the Lyapunov function candidate 𝑉𝑉=𝑥𝑥�𝑇𝑇𝑃𝑃𝑥𝑥� (25) with 𝑃𝑃>0 being a positive definite matrix. Then 𝑉𝑉̇=𝑥𝑥�̇𝑇𝑇𝑃𝑃𝑥𝑥�+𝑥𝑥�𝑇𝑇𝑃𝑃𝑥𝑥�̇ = 𝑥𝑥�𝑇𝑇[(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑇𝑇𝑃𝑃+𝑃𝑃(𝐴𝐴−𝐿𝐿𝐶𝐶)]𝑥𝑥� −𝑥𝑥�𝑇𝑇𝑃𝑃𝐿𝐿ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−ℎ�𝑇𝑇(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝐿𝐿𝑇𝑇𝑃𝑃𝑥𝑥� −𝑥𝑥�𝑇𝑇𝑃𝑃𝐿𝐿𝐷𝐷𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖−𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖𝑇𝑇𝐷𝐷𝑇𝑇𝐿𝐿𝑇𝑇𝑃𝑃𝑥𝑥𝑃 (26) If 𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖=0, then 𝑉𝑉̇= 𝑥𝑥�𝑇𝑇[(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑇𝑇𝑃𝑃+𝑃𝑃(𝐴𝐴−𝐿𝐿𝐶𝐶)]𝑥𝑥�− 𝑥𝑥�𝑇𝑇𝑃𝑃𝐿𝐿ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)−ℎ�𝑇𝑇(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝐿𝐿𝑇𝑇𝑃𝑃𝑥𝑥� (27) or 𝑉𝑉̇= [𝑥𝑥�𝑇𝑇ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝑇𝑇]�(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑇𝑇𝑃𝑃+𝑃𝑃(𝐴𝐴−𝐿𝐿𝐶𝐶)−𝑃𝑃𝐿𝐿 −𝐿𝐿𝑇𝑇𝑃𝑃 0��𝑥𝑥� ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)� Using the S -Procedure Lemma [29], 𝑉𝑉̇<0 if and only if there exists 𝜖𝜖>0 such that 𝑉𝑉̇≤𝜖𝜖𝑉𝑉1. Hence, 𝑉𝑉̇<0 if and only if [𝑥𝑥�𝑇𝑇ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝑇𝑇]�(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑇𝑇𝑃𝑃+𝑃𝑃(𝐴𝐴−𝐿𝐿𝐶𝐶)−𝑃𝑃𝐿𝐿 −𝐿𝐿𝑇𝑇𝑃𝑃 0��𝑥𝑥� ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)� ≤ Manuscript accepted for publication in the journal Biomedical Signal Processing and Control 𝜖𝜖[𝑥𝑥�𝑇𝑇ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)𝑇𝑇]�𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇𝑁𝑁𝐸𝐸+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇𝑀𝑀𝐸𝐸 2−𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇 2 −𝑀𝑀𝐸𝐸 +𝑁𝑁𝐸𝐸 2𝐼𝐼��𝑥𝑥� ℎ�(𝐸𝐸𝑥𝑥,𝐸𝐸𝑥𝑥�)� or 𝑆𝑆<0 (28) where 𝑠𝑠11=(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑇𝑇𝑃𝑃 𝜖𝜖+𝑃𝑃 𝜖𝜖(𝐴𝐴−𝐿𝐿𝐶𝐶)−𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇𝑁𝑁𝐸𝐸+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇𝑀𝑀𝐸𝐸 2 𝑠𝑠12=−𝑃𝑃𝐿𝐿/𝜖𝜖+ 𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇 2 𝑠𝑠21=−𝐿𝐿𝑇𝑇𝑃𝑃 𝜖𝜖+𝑀𝑀𝐸𝐸 +𝑁𝑁𝐸𝐸 2 𝑠𝑠22=−𝐼𝐼 Replacing 𝑃𝑃 by a new positive definite matrix 𝑃𝑃1=𝑃𝑃/𝜖𝜖, and adding a 𝜎𝜎𝑃𝑃 term to the (1,1) entry for a guaranteed exponential convergence rate of 𝜎𝜎/2 , the result follows. Remark : Low-pass filtered versions of 𝑦𝑦1 and 𝑦𝑦2 can be used in the observer so that the dynamic components are removed and 𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖 can indeed be negligible. In other words, 𝑦𝑦2=𝑎𝑎𝑦𝑦𝑦𝑦=𝑎𝑎𝑦𝑦−𝑔𝑔cos(𝜃𝜃+𝜓𝜓)+𝑏𝑏𝑦𝑦 𝑦𝑦1=𝑎𝑎𝑥𝑥𝑦𝑦=𝑎𝑎𝑥𝑥−𝑔𝑔sin(𝜃𝜃+𝜓𝜓)+𝑏𝑏𝑥𝑥 while 𝑦𝑦2_𝑙𝑙𝑙𝑙𝑙𝑙 _𝑖𝑖𝑎𝑎𝑚𝑚𝑚𝑚=−𝑔𝑔cos(𝜃𝜃+𝜓𝜓)+𝑏𝑏𝑦𝑦 𝑦𝑦1_𝑙𝑙𝑙𝑙𝑙𝑙 _𝑖𝑖𝑎𝑎𝑚𝑚𝑚𝑚 =−𝑔𝑔sin(𝜃𝜃+𝜓𝜓)+𝑏𝑏𝑥𝑥 Hence, �𝑦𝑦1_𝑙𝑙𝑙𝑙𝑙𝑙𝑖𝑖𝑎𝑎𝑚𝑚𝑚𝑚 𝑦𝑦2_𝑙𝑙𝑙𝑙𝑙𝑙𝑖𝑖𝑎𝑎𝑚𝑚𝑚𝑚�=𝐶𝐶𝑥𝑥+ℎ(𝐸𝐸𝑥𝑥), instead of �𝑦𝑦1 𝑦𝑦2�=𝐶𝐶𝑥𝑥+ ℎ(𝐸𝐸𝑥𝑥)+𝐷𝐷𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖, and thus 𝐴𝐴𝑖𝑖𝑖𝑖𝑖𝑖𝑚𝑚𝑖𝑖=�𝑎𝑎𝑥𝑥 𝑎𝑎𝑦𝑦�=0. C. Hybrid observer using switched gains It turns out that due to the output function for 𝑦𝑦2, i.e. ℎ2(𝐸𝐸𝑥𝑥), being non-monotonic as shown in Fig. 3, the LMI (24) does not have a common feasible solution over the entire operating range of 𝜙𝜙. Instead it is found to be feasible only in each of the monotonic r egions R1, R2 and R3 shown in Fig. 3. This can be understood as follows: The matrix 𝐴𝐴 by itself is not stable for the given value of 𝐴𝐴 in equations (8) – (10). When the nonlinear function ℎ(𝐸𝐸𝑥𝑥) is non-monotonic, then the matrices 𝑀𝑀 and 𝑁𝑁 are diagonal matrices with 𝑁𝑁>0 and 𝑀𝑀<0. Hence the 𝑠𝑠11 element 𝑠𝑠11=(𝐴𝐴−𝐿𝐿𝐶𝐶)𝑇𝑇𝑃𝑃+𝑃𝑃(𝐴𝐴−𝐿𝐿𝐶𝐶)−𝐸𝐸𝑇𝑇𝑀𝑀𝑇𝑇𝑁𝑁𝐸𝐸+𝐸𝐸𝑇𝑇𝑁𝑁𝑇𝑇𝑀𝑀𝐸𝐸 2+𝜎𝜎𝑃𝑃 cannot be negative definite which rules out a feasible solution to the LMI (24). On the other hand, in each monotonic region 𝑀𝑀 and 𝑁𝑁 are both positive or negative definite (have the same sign). This enables a feasible solution to the LMI (24) in each monotonic region. It is proved in [24] that a hybrid nonlinear observer which uses multiple constant -gain stable regions and switch es between these stable gains with adequate dwell time after each switching is globally asymptotically stable. Thus, a single gain observer does not exist for the entire operating region and instead we need to solve equation (24 ) for each monotonic region of the nonlinear function ℎ and find three different values of the observer gain. Then we switch between these 3 observer gains . Fig. 3 shows that in region 1 and region 3, both outputs are monotonic but in region 2 only the first output is monotonic . Therefore , the observers in region 1 and region 3 are designed based on both outputs and the observers in region 2 uses only the first output. Finally , a hybrid switching -gain observer with three constant gains is designed for the system. By solving the LMI of equation (2 4) using YALMIP in MATLAB , the three constant observer gains are obtained . Fig. 3. Assumed constant -gain regions of the observer. In regions R1 and R3 both outputs are used but in region R2 only the first output is used. III. STEP LENGTH ESTIMATION In this part three different methods are conside red for estimating step lengths using configurations of two, three and four sensors respectively on the two legs of the subject . I) In the first method, it is assumed that there are only two sensors (one attached to each shank) and an integrator -based method is used to estimate step length. II) In the second method, we assume four sensors in all - one sensor on the shank and one on the thigh of each leg, and the estimated angles of both the shank and the thigh are used to find the step length. III) In the third method, we assume there is one sensor attached to each shank and a third sensor is attached to one of the thighs. A. Integrator -based estimation (two sensors configuration ) If there is only one sensor on each shank , we can find the step lengths based on the double -integration of the linear acceleration of the foot in the inertial frame. For this, we need to find the real -time orientation of the sensor relative to the -60 -40 -20 0 20 40 60 (deg)-10-50510gravity component h(Ex) (m/s2) R1R2 R3 output1 output2 Manuscript accepted for publication in the journal Biomedical Signal Processing and Control inertial frame and then transfer the corrected/ unbiased accelerations (found from the nonlinear obse rver) using the following direction cosine matrix (DCM) to the inertial frame. Subsequently, the gravity component from the transformed accelerations need to be removed. Then the resulting dynamic accelerations are double integrated from the end of one step to the end of the next step. The DCM is given by: 𝑅𝑅(𝜙𝜙)=�cos (𝜙𝜙)−sin (𝜙𝜙) sin (𝜙𝜙) cos (𝜙𝜙)� (29) The relationship between iner tial and sensor accelerations is given by �𝑎𝑎𝑋𝑋 𝑎𝑎𝑌𝑌�=𝑅𝑅(𝜙𝜙)�𝑎𝑎𝑥𝑥 𝑎𝑎𝑦𝑦� (30) The end of each is step is found based on the high peaks experienced in the RMS signal of each accelerometer. Fig. 4 shows that the end of each step has a clear local maximum in the RMS signal which is because of heel -strike s [10]. The start of integration is found based on the assumption of step -by-step walking. This means that the beginning of each step coincides with the end o f the previous step. Experimental data has shown that starting integration earlier than the real lift off does not degrade accuracy because the foot is stationary. On the other hand, the accuracy degrades very fast if the integration is started late. In practice, therefore, we have seen good accuracy when we assume foot lift off happens at the end of the previous step. Fig. 4. An example of the RMS signal of the right shank acceleration and its local maximums that are used to identify the heel -strikes of each step B. Angle -based estimation (four sensor s configuration ) Another method is to estimate the step lengths from the geometry of the body during in- plane walking. Fig. 5 shows a schematic model of the body and the angles of each limb. In this method we need to use four sensors, one sensor on each shank and thigh to be able to estimate the angles of both shank and thigh in real -time. Based on Fig. 5 we can calculate the real-time relative position of the fee t using the following simple trigonometric equations and so find the step lengths at the end of each step. For example, assume that the right foot is on the ground and the left leg is swinging then we have the position of right foot relative to the left foot as: 𝑋𝑋𝑚𝑚/𝑙𝑙=𝐿𝐿𝑚𝑚𝑚𝑚sin(𝜃𝜃𝑚𝑚𝑚𝑚(𝑑𝑑))+𝐿𝐿𝑖𝑖𝑚𝑚sin(𝜃𝜃𝑖𝑖𝑚𝑚(𝑑𝑑)) +𝐿𝐿𝑚𝑚𝑙𝑙sin(𝜃𝜃𝑚𝑚𝑙𝑙(𝑑𝑑))+𝐿𝐿𝑖𝑖𝑙𝑙sin(𝜃𝜃𝑖𝑖𝑙𝑙(𝑑𝑑)) (31) 𝑌𝑌𝑚𝑚/𝑙𝑙=𝐿𝐿𝑚𝑚𝑙𝑙cos(𝜃𝜃𝑚𝑚𝑙𝑙(𝑑𝑑))+𝐿𝐿𝑖𝑖𝑙𝑙cos(𝜃𝜃𝑖𝑖𝑙𝑙(𝑑𝑑)) −𝐿𝐿𝑚𝑚𝑚𝑚cos(𝜃𝜃𝑚𝑚𝑚𝑚(𝑑𝑑))−𝐿𝐿𝑖𝑖𝑚𝑚cos(𝜃𝜃𝑖𝑖𝑚𝑚(𝑑𝑑)) (32) 𝜃𝜃𝑚𝑚𝑚𝑚𝜃𝜃𝑚𝑚𝑙𝑙𝜃𝜃𝑖𝑖𝑙𝑙𝜃𝜃𝑖𝑖𝑚𝑚 𝐿𝐿𝑚𝑚𝑚𝑚𝐿𝐿𝑖𝑖𝑚𝑚 𝐿𝐿𝑖𝑖𝑙𝑙 𝐿𝐿𝑚𝑚𝑙𝑙 𝑋𝑋𝑚𝑚/𝑙𝑙𝑌𝑌𝑚𝑚/𝑙𝑙 Fig. 5. Schematic of body during in- plane walking. The angles of right shank, right thigh, left shank, and left thigh with vertical axis are shown as 𝜃𝜃𝑚𝑚𝑚𝑚, 𝜃𝜃𝑖𝑖𝑚𝑚, 𝜃𝜃𝑚𝑚𝑙𝑙, and 𝜃𝜃𝑖𝑖𝑙𝑙 respectively. Also the length of right shank, right thigh, left shank, and left thigh are 𝐿𝐿𝑚𝑚𝑚𝑚, 𝐿𝐿𝑖𝑖𝑚𝑚, 𝐿𝐿𝑚𝑚𝑙𝑙, and 𝐿𝐿𝑖𝑖𝑙𝑙 respectively. The time of end of each step is found from the high peaks experienced in the RMS signal of each accelerometer as discussed in the previous section and shown in Fig 4. If we assume that we detect an end of st ep in the left foot, the step length is therefore computed as below: 𝑆𝑆𝑑𝑑𝑆𝑆𝑆𝑆 𝑙𝑙𝑆𝑆𝑙𝑙𝑔𝑔𝑑𝑑ℎ=𝐿𝐿𝑚𝑚𝑚𝑚sin(𝜃𝜃𝑚𝑚𝑚𝑚(𝑑𝑑𝑚𝑚𝑙𝑙))+𝐿𝐿𝑖𝑖𝑚𝑚sin(𝜃𝜃𝑖𝑖𝑚𝑚(𝑑𝑑𝑚𝑚𝑙𝑙)) +𝐿𝐿𝑚𝑚𝑙𝑙sin(𝜃𝜃𝑚𝑚𝑙𝑙(𝑑𝑑𝑚𝑚𝑙𝑙))+𝐿𝐿𝑖𝑖𝑙𝑙sin(𝜃𝜃𝑖𝑖𝑙𝑙(𝑑𝑑𝑚𝑚𝑙𝑙)) (33) in which 𝑑𝑑𝑚𝑚𝑙𝑙 is the time at the end of left foot step. C. Polynomial angle-based estimation (three sensor s configuration ) In this method, we utilize only one of the thigh sensors and estimate the angle of the other thigh by a polynomial function of time, based on the first leg’s thigh angle and then use Eq. (33) again to estimate the step lengths from the geometry of in-plane walking. We divide walking in to the two main parts of swing and stance phases based on the angles of the thigh and shank as shown in Fig. 6. During the sta nce phase, the foot is on the Manuscript accepted for publication in the journal Biomedical Signal Processing and Control ground and the angle of the shank and thigh are almost equal (shank and thigh are aligned ). However, during the swing phase, the leg is swinging in the air and the angle of thigh diverges from that of the shank. For the swing phase we estimate the thigh angle from a polynomial fitted to the swing phase angle of the other leg as described below: 1) Estimate left thigh angle 𝜃𝜃�𝑑𝑑𝑙𝑙 using the nonlinear observer described in equation (13) since we have IMU on the left thigh . 2) Fit a 4 th order polynomial to the estimated left thigh angle 𝜃𝜃�𝑖𝑖𝑙𝑙 using least squares: 𝜃𝜃�𝑑𝑑𝑙𝑙(𝑑𝑑)=𝑆𝑆4𝑑𝑑4+𝑆𝑆3𝑑𝑑3+𝑆𝑆2𝑑𝑑2+𝑆𝑆1𝑑𝑑+𝑆𝑆0 (34) in which t shows time , 𝑆𝑆𝑖𝑖 are the polynomial coefficients found from a least squares solution , and 𝜃𝜃𝑖𝑖𝑙𝑙 is the estimated left thigh angle. 3) Estimate the right thigh angle using the calculated polynomial by shifting the time relative to the start of the right footstep . 𝜃𝜃�𝑑𝑑𝑡𝑡(𝑑𝑑)=𝑆𝑆4(𝑑𝑑−𝑑𝑑𝑠𝑠𝑡𝑡)4+𝑆𝑆3(𝑑𝑑−𝑑𝑑𝑠𝑠𝑡𝑡)3 +𝑆𝑆2(𝑑𝑑−𝑑𝑑𝑚𝑚𝑚𝑚)2+𝑆𝑆1(𝑑𝑑−𝑑𝑑𝑚𝑚𝑚𝑚)+𝑆𝑆0 (35) in which 𝑑𝑑𝑚𝑚𝑚𝑚 shows the start time of the right footstep . Fig. 7 shows the angles of shank and thigh of both legs during stance and swing phase. The shank angles of both left and right legs, and the thigh angle of the left leg are estimated from the nonlinear observer. The thigh angle of the right leg is assumed to be e qual to the shank angle during stance phase, however during swing phase it is estimated by a polynomial fitted using least squares to the left leg thigh angle estimat es. This figure shows that we can estimate the right thigh angle successfully by this meth od. IV. E XPERIMENTAL RESULTS Inexpensive commercial Inertial Measurement Unit s (IMU s) made by MbientLab Inc. are used as the measurement sensors. Each device has a 32 -Bit ARM Cortex M4F processor powered by a high capacity CR2450 Lithium Coin Cell. The internal measurement sensor is a Bosch BMI160 consist ing of a three -axis accelerometer and a thre e-axis gyroscope [30]. The data from the IMU is sampled at a 100Hz frequency and swing stance Fig. 7. Angles of shank and thigh of both legs during stance and swing phase. Both angles of left leg and shank angle of right leg are from nonlinear observer. The thigh angle of the right leg is assumed to be equal to the shank angle during stance phase, however during swing phase it is estimated by a polynomial fitted using least squares to the left leg estimates . Stance leg Swing leg Fig. 6. Schematic of swing and stance phases of walking. During stance phase, the foot is on the ground and the thigh angle of the swing leg is almost equal to the shank angle. During swing phase, foot is swinging in the air and the thigh angle diverges from shank angle. Manuscript accepted for publication in the journal Biomedical Signal Processing and Control stored on a flash memory and also could be streamed through Bluetooth conne ctivity to a smartphone or computer . The IMU and its sensor -fixed frame are shown in Fig. 8. 𝑥𝑥𝑦𝑦 𝑧𝑧 Fig. 8. Inertial measurement unit board, case and its sensor -fixed frame. The experiments were performed on one healthy subject with IRB approval. The sensor s were m ounted on the subject as shown in Fig. 1. Since the experiment is not designed to study a medical hypothesis, multiple subjects were not recruited. There was no special effort made to align the sensors. The alignment of the sensor is automatically compensated for by the estimation algorithms. The experiment s are designed to demonstrate the performance of the estimation algorithm in comparison to a gold standard infrared camera measurement system. An IR motion tracking camera is used as an accurate reference sensor with which the e stimated step lengths and angles from the nonlinear observer are compared . The IR camera setup is an OptiTrack V120:Trio model which is a self - contained and factory calibrated camera and uses three cameras and built -in software to track passive markers attached to the body with sub- millimeter accuracy . The sample rate of the camera system is 120 Hz [31]. The experiments were performed on one healthy subject with IRB approval. Tests were conducted consisting of walking and stumbling in both forward and backward directions to observe the accuracy of the estimations in both low and high acceleration motions . The term “stumbling” means simulation of near -fall activities. Stumbling was included in addition to walking in order to show that our algorithm works in the presence of disturbances and to prepare for o ther future studies. The first 30 seconds of the test is walking, and the rest of the test data consists of walking and stumbling. An optimum value of 𝜎𝜎=0.45 for the convergence rate was found numerically to yield the minimum estimation error. We can compare the overall accuracy of the shank angle estimation of the nonlinear observer with the IR camera measurements in Fig. 9 . It can b e seen that the shank angle estimates track the IR camera angle estimates very closely. To show the effect and the importance of the nonlinear observer on estimation of the step lengths we plotted the direct double integration of the raw IMU acceleration measurement to find foot displacement in Fig.10. Fig. 10. Right leg horizontal displacement from IR camera and direct double integration of IMU acceleration measurements. Also, the tilt angles from direct integration of gyro measurements are compared to IR camera measurement s in Fig. 11. As the figures show, the direct integration of gyro has a linear growing drift while double integration of accelerations results in an exponent ial growing position drifts due to not 0 10 20 30 40 50 60 70 t (s)-0.500.511.522.53x (cm)105Right leg horizontal displacement IR measured Double integration0 10 20 30 40 50 60 time (sec)-40-2002040sr (deg)Right shank tilt angle(deg) IR Camera Nonlinear observer 22 23 24 25 26 time (sec)-40-2002040 Fig. 9. Right shank tilt angle from IR camera and nonlinear observer. Manuscript accepted for publication in the journal Biomedical Signal Processing and Control having removed the bias and tilt angle errors in IMU measurements. Fig. 11. Right shank tilt angle from IR camera and direct integration of IMU gyro measurements. Fig. 12 shows a comparison of step length estimation of all three observer -based methods with the IR camera. Based on the shown results the average accuracy of the two-sensor integrator -based method is found to be 91.42%, for the three - sensor angle -based method is 94.64% and for the four-sensor angle based is 95.67%. The reason for this difference is that the integrator -based method depends on the initial conditions and measurement biases with high sensitivity because of double integration while the angle -based method use s the real - time estimation of the angles and is independent of initial conditions and much less influenced by the bias errors . Also the reason for the difference between four and three sensor methods is that the three sensor method relies on a polynomial for the estimation of right thigh angle while the four sensor method estimates it by the nonlinear observer from direct measurement of all 4 IMUs. The latter 30 second of the test includes the stumbling part of the test . In this part, we see more errors, especially in the integration mode . The average step length error in the second half of the test is 5 .93% for the four-sensor angle -based method while it is 1 0.34% for the three sensor and 26 .32% for the integrator -based method. Again, the integrat ion mode shows more sensitivity to the initial conditions and errors due to the impulses during stumbling. Also, the polynomials become less accurate due to differences between walking and stumbling. The estimated bias from the nonlinear observer is shown for the horizontal axis accelerations in Fig. 13. This estimation shows that the bias changes as the foot accelerates and decelerates which makes sense since micro -electro - mechanical sensors are known to have slow time-varying drift in the bias [1]. Fig. 1 4 shows the tilt angle error obtained by taking the difference between the estimated angle of the nonlinear observer and the reference value from the IR camera. The IR camera data is exported to 100 Hz sample rate using OptiTrack built-in software and synchronized to the IMU data using MATALB cross correlation tools. The maximum angle error is about 2 degrees over the range of -40 to +30 degrees which is an acceptable error using inexpensive IMUs. Therefore, the maximum error rate is 2.86% in the walking part . The second part of the test (stumbling) shows higher peaks and maximum angle error is 3 degrees which shows about 4.29% max error in the stumbling part. The horizontal position estimation error of the right foot for the methods of two, three and four sensor estimation computed by comparing with the IR camera are shown in Fig. 15. The angle mode obviously has superior accuracy relative to the integration mode in this figure. The maximum error is 3.54 cm (7.63%) for the 4 -sensor mode and 5.12 cm (12.81%) for the 3-sensor mode. On the other hand, the maximum error is 11.34 cm (28.35%) for the 2 -sensor integration mode. The maximum error becomes smaller if we neglect the stumbling part of the test. Maximum error is 2.94 cm (6.67%) for the 4- sensor angle mode and 3.97 cm (8.94%) for the 3 -sensor mode, while the max erro r is 9.43 cm (19.52%) for the integration mode in just the first part of the test. V. C ONCLUSIONS This paper has presented three step length estimation approaches using a nonlinear switched -gain observer based on measurements from IMUs worn on leg segments. The observer estimates the orientation and measurement bias of each IMU . A switched -gain strategy is used for the observer in which three piecewise working regions are utilized in each of which the output function is monotonic. The orientation of the sens or and measurement bias are estimated in real -time, the bias and gravity components are removed from it to find the true linear accelerations, and then the accelerations are transformed to the inertial frame. Using this observer, three different approaches are presented for the step length estimation. First, we assumed the use of sensors only on each shank and the step lengths are found by integration of the linear inertial -frame accelerations of each leg from the start to the end of each step. In the secon d approach, we assume there is one sensor attached to each shank and a third sensor is attached to one of the thighs. In the third method, we assume each leg has two sensors, one sensor on the shank and one on the thigh, and the step length is estimated using the estimated angles of the limb segments and the geometry of the body posture. The second method which utilizes a sensor in only one of the two thighs utilizes an innovative approach to estimate the orientation angle of the other thigh by assuming sym metric motion between thighs during the swing phase. The results of these estimators are compared to results from an expensive IR camera motion capture system by performing tests of walking and stumbling in the forward and backward directions. The results show that the angles of the limbs are estimated very accurately, as verified by the IR camera. The integrator -based method is a simpler strategy and needs less resources due to the low number (just 2) of sensors. However, the angle -based method shows bette r accuracy in terms of step length estimation since it is not sensitive to the 0 10 20 30 40 50 60 70 time (sec)-120-100-80-60-40-2002040sr (deg)Right shank tilt angle(deg) IR measured Direct integration Manuscript accepted for publication in the journal Biomedical Signal Processing and Control initial conditions and errors caused by double integration. The four-sensor method uses two sensors for the thighs and estimates both thigh angles from measurement of IMUs while the three -sensor configuration estimates the thigh angle of one foot by fitting a polynomial to the estimated angle of the other foot. The three -sensor method shows comparable accuracy to the four -sensor mode while it does fall a little behind during more disturbances in stumbling experiments. Further, the accuracy of the three- sensor method may also fall when the gait of the subject is non -symmetric. The developed nonlinear switched -gain observer can be a powerful tool in the estimation of the orientation angles and bias values of IMU sensors which have many problems in general with drifts and errors. This method has the potential to be applied wherever IMUs are employed including navigation and stabilization problems. Two step length estimators are introduced as successful applications of this observer. These step estimators could help us monitor activity and health of ordinary people, as well as of athlet es and patients. Fig. 12. Right leg horizontal displacement from IR camera and nonlinear observer in integrate and angle modes. Fig. 13. Estimated right leg accelerometer horizontal bias using nonlinear observer. Manuscript accepted for publication in the journal Biomedical Signal Processing and Control Fig. 14. Right leg tilt angle error of nonlinear observer compared to the IR camera measurement. Fig. 15. Right leg horizontal displacement error in both integration and angle modes. First 30 seconds show normal walking and the second half shows stumbling. 0 10 20 30 40 50 60 time (sec)-3-2-10123E sr (deg)Right shank tilt angle error Manuscript accepted for publication in the journal Biomedical Signal Processing and Control