Global Kalman filter approaches to estimate absolute angles of lower limb segments

Background In this paper we propose the use of global Kalman filters (KFs) to estimate absolute angles of lower limb segments. Standard approaches adopt KFs to improve the performance of inertial sensors based on individual link configurations. In consequence, for a multi-body system like a lower limb exoskeleton, the inertial measurements of one link (e.g., the shank) are not taken into account in other link angle estimations (e.g., foot). Global KF approaches, on the other hand, correlate the collective contribution of all signals from lower limb segments observed in the state-space model through the filtering process. We present a novel global KF (matricial global KF) relying only on inertial sensor data, and validate both this KF and a previously presented global KF (Markov Jump Linear Systems, MJLS-based KF), which fuses data from inertial sensors and encoders from an exoskeleton. We furthermore compare both methods to the commonly used local KF. Results The results indicate that the global KFs performed significantly better than the local KF, with an average root mean square error (RMSE) of respectively 0.942° for the MJLS-based KF, 1.167° for the matrical global KF, and 1.202° for the local KFs. Including the data from the exoskeleton encoders also resulted in a significant increase in performance. Conclusion The results indicate that the current practice of using KFs based on local models is suboptimal. Both the presented KF based on inertial sensor data, as well our previously presented global approach fusing inertial sensor data with data from exoskeleton encoders, were superior to local KFs. We therefore recommend to use global KFs for gait analysis and exoskeleton control. Electronic supplementary material The online version of this article (doi:10.1186/s12938-017-0346-7) contains supplementary material, which is available to authorized users.

A large number of exoskeleton control strategies rely on a reference trajectory obtained from healthy subjects. Based on feedback from relative joint angles and/or absolute segment angles during gait, the exoskeleton assists the patient in performing this reference motion, see Fig. 1. In clinical gait analysis, these angles are used to describe and analyze the walking abilities of patients and athletes. Obtaining accurate absolute angles is thus essential for both exoskeleton control and dynamic gait analysis. However, sensors embedded in the exoskeleton, such as encoders and potentiometers, can only provide relative angles. The error between these measured relative angles and the anatomical joint angles from the patient, strongly depends on the design of the exoskeleton and the attachment of the exoskeleton to the patient. In order to obtain the absolute orientation of the exoskeleton or to correct the error in the encoder measurements, additional sensors such as inertial sensors are used [5,6].
Inertial measurement units (IMUs) commonly consist of three dimensional accelerometers and gyroscopes. IMUs, or magnetic and inertial measurement units (MIMUs), have demonstrated their effectiveness in clinical practice in applications ranging from IMU BTS Potentiometer Fig. 1 Experimental setup of a healthy person wearing the H2 exoskeleton, with passive BTS-markers (Optoelectronic system with reflexive markers from BTS Bioengineering, Italy) and inertial sensors. The inertial sensors and BTS-markers are attached to the exoskeleton using rigid plates In this paper we present a novel global KF, the matricial global KF, based uniquely on inertial sensor data. We furthermore validate the proposed KF presented here, as well as the MJLS-based KF presented in [6], using experimental data. We also include a comparison between the commonly used local KF and the aforementioned global KFs to demonstrate the strength and benefits of global KFs over local KFs. We hypothesize that global filters will outperform the local filter models.

Methods
We first provide a brief introduction to matricial local and MJLS-based models. Subsequently, we introduce the newly developed matricial global model that is based only on inertial sensor data. A more detailed explanation on local and MJLS-based models can be found in Additional file 1 or in [6].

Local models
When applied to inertial sensor data, a local KF is a filter that only uses information from a specific IMU. In the specific case of gait analysis, the local state-space model to estimate absolute segment orientation based on a sensor attached to the lower limb is formulated as: where �θ(t) = θ −θ g and �b g (t) are respectively the orientation estimate and offset errors of the gyroscope, θ is the absolute angle and θ g is the angle estimate calculated from the gyroscope, η g (t) and η b (t) are the Gaussian white noises of the gyroscope and the gyroscope bias, and τ g is the Markov process correlation time [6,18]. Since only the orientation estimate is observable, the output equation is given by: where η a (t) is the Gaussian white noise of the accelerometer. In the filtering implementation, we use z =θ a −θ g , where the orientation estimate from the accelerometer (θ a ) is considered a reliable measurement and replaces the absolute angle (θ).
Once the state-space model and the output equation are defined, KF-based algorithms can be used to estimate the state which represents the correction term �θ. So the absolute angles can be computed as: where θ g is the absolute angle based only on gyroscope data, and � θ the absolute angle estimated by KF.

Matricial local model
Consider now the problem of estimating the absolute angles of the lower limbs, specifically the absolute angles of body, thigh, shank, and foot segments. For sake of simplicity, only one leg is considered. We can use one local model for each segment in a matrix arrangement. The state-space and output equations can be summarized as: are the errors between the absolute angles (θ i ) and the angle estimates calculated by the gyroscopes (θ i g ); and b i , are the errors of the bias generated by the gyroscopes for each segment, for i = {B, T , S, F }, where B, T, S, and F stand for body/trunk, thigh, shank, and foot segments, respectively. The vectors w(t) and v(t) contain the Gaussian white noise of the gyroscopes, gyroscope bias, and accelerometer respectively. The output matrix C is defined as: In this local approach, named here matricial local model, the state-space and output equations are both diagonal or block-diagonal. The system can thus be considered uncoupled. A complete description of this model and its KF algorithm can be found in Additional file 1.

Global models
Global models are composed of matrix arrangements by the same state-space (4) of the matricial local model. The difference lies in the choice of the output matrix, and, as consequence, in the update equations of the KF Algorithms.

MJLS-based model
The Markovian Jump Linear Systems-based model presented in [6] fuses inertial sensors with relative joint sensors embedded in the exoskeleton. Only the IMU that best meets a given threshold criterion is used. We provide a brief overview of the model below, but refer to [6] and Additional file 1 for a more detailed description.
The MJLS-based model for absolute angular estimation of lower limb exoskeletons can be described by the following state-space equations: where �(t) ∈ {B, T , S, F } defines the possible Markovian jumps. The vector of output measurements is defined as: where � IMU = [θ a IMU −θ g IMU ] are the errors between the estimates of the absolute angles calculated for each segment by the accelerometers (θ a IMU ) and the estimates calculated by the gyroscopes (θ g IMU ); and �θ j = [�θ i − �θ i+1 ], for j = {h, k, a}, are the errors of the relative angles of the corresponding joints, j, where h, k and a stand for hip, knee, and ankle. The output matrix C is defined as: where M i , for i = {B, T , S, F }, assumes values of zero or one, according to the angle associated with the value of IMU . The criteria for reliable accelerometer measurements and the Markovian state in discrete time are defined as: where �(k) ∈ {B, T , S, F } describe the lower limb or exoskeleton segments, being the current Markovian state, and ρ(k) is an index that describes the reliability of the accelerometer used at the Markovian state, �(k). The criterion to verify the reliability of the current IMU-reading is given by: where 0 < ζ < 1. For MJLS-based KF Algorithm refer to [6] and Additional file 1.

Matricial global model
In the absence of an exoskeleton, no relative sensor data can be used in the KF. In this case, for example in clinical gait analysis, cooperation between IMUs might improve the estimated absolute angles compared to local KFs. However, noise could also be introduced when the relation between the information used in the update and the segment's orientation is less clear. It is therefore necessary to find the balance between the quantity and the quality of the performed updates. We therefore propose a matricial global KF, fusing the information of several IMUs, and evaluate it using four implementations of the threshold criterion of (15)- (18).
The threshold criterion ( ) differs among four implementations evaluated according to the amount of the reliable sensors, s , s = 1, . . . , 4. s defined from (15) to (18). The minimum quantity of sensors that has to fulfill the threshold based criterion differs from four in (15), to one in (18). For example, if the criterion given for (16) is implemented, at least three accelerometers should be reliable to be used in the update step. In this case, one possible configuration that this criterion can assume is � = ((ρ B,k < ζ B )AND(ρ S,k < ζ S )AND(ρ F ,k < ζ F )), with the accelerometers of the body, shank, and foot being reliable. Notice that the number of updates expected in (18) is greater than in (15). In both filters, matricial local and matricial global, these criteria are used.
where a {i,l,m} are the values of each triaxial accelerometer, g is the earth gravity, and ρ {i,l,m},k are any reliable sensors at instant k being The matricial global model for absolute angular estimation of lower limbs segments can be described as: where C c (t) is the coupled output matrix that designs the relation between the absolute angles of the lower limb segments. The vector of output measurements is defined as: The matrix C c is designed in order to create relations between the four main states (�θ B , �θ T , �θ S , and �θ F ), and consequently the matrix R must be changed. These relations are similar to joint encoders, and are presented by Eqs. (23)-(25).
Additional criteria are proposed in order to verify the reliability of the cross relation between the states in matricial global approach, as can be seen:  16:58 As it can be seen in (29), the correction terms �θ B k+1|k+1 and �θ T k+1|k+1 , for the body and thigh segments are both connected through the weights k j .
However, for the matricial local model, the state-space and output equations are both diagonal or block-diagonal, the system is considered uncoupled which affects the Kalman filter gain (K k+1 ) from (29). In this case k 3 , k 4 , k 5 and k 6 are zero. The gains K k+1 are computed based on P and H-matrices. Since H, P, and R are diagonal, one can say that the K k+1 will be mandatorily diagonal or block diagonal.
Considering the first iteration k = 0 in the Matricial Local KF Algorithm, we have: In the second iteration, k = 1, we have: Again, the KF gain K k+1 is a block diagonal matrix, and by induction it will remain block diagonal and the components k 2 , k 3 , k 4 , k 5 , k 6 , and k 8 will always be zero. So, in the local matricial approach the estimated states are not connected through the components of the Kalman filter gain.
On the other hand, if there are strong relations between the states (x k+1 ) and they are not explicit in the state-space matrix F, the H matrix can be designed such that they are related. The MJLS-based and matricial global models provide this connection, and from the viewpoint of filtering the system becomes coupled and the gains of the KF will not be necessarily zero. Consider for instance the matricial global model with: where the last line of H relates both segments, body and thigh. In this case, this relation can be seen as the encoder angle error. The Gaussian white noise of this relation is added to the R matrix being expressed by σ 2 a BT . Using (29), with the same P k+1 matrix, in the first iteration k = 0 of the Matricial Global KF Algorithm, we have The remaining gains are all zero (k 2 = k 4 = k 6 = k 8 = k 10 = k 12 = 0). So, already in the first iteration, the gains k 3 and k 5 directly relate the states (�θ B and �θ T ), and the gains k 9 and k 11 represent the cross relation between them. Moving to the second iteration k = 1, and considering that P was updated, we will have again the same gains K k+1 different than zero. In other words, the states will be corrected by a weighting of the correction terms of both segments in the KF.

Experimental setup
Data from a single trial of a healthy male subject (age: 33; height: 1m75; weight: 82 kg) experienced in walking with an exoskeleton are presented. The trial consisted of walking on a treadmill at 1.5 km/h for one minute. Kinematic data were obtained from three independent systems, synchronized using an electronic trigger, see Fig. 1.
An optoelectronic system (BTS Bioengineering) was used to produce the reference measurement of absolute segment orientation. Clusters of markers were attached to the segments and sampled at 100 Hz. For each segment one cluster of three markers was used to compute the orientation of that segment.
Four IMUs were attached to the lateral side of the right shank, thigh and the body, and on top of the right foot aligned with the sagittal plane and the longitudinal axis of the foot, see Fig. 1. The inertial sensors used are the TechMCS IMUs (Technaid SL, Spain). IMU data were acquired in digital format at 50 Hz, and transformed offline to physical format. Both the markers and the inertial sensors are attached to the same rigid plate, and aligned to both the exoskeleton and the subject in the sagittal plane.
The exoskeleton used is the H2 [21], a bilateral exoskeleton with six actuated degrees of freedom at the hip, knee, and ankle sagittal plane joints of both legs. Relative joint angles are measured by the H2 using precision industrial potentiometers with a linearity of 0.25% [21]. Potentiometer data were acquired at 1 kHz.
All data were resampled at 50 Hz. The first and last 10 s of the trial were discarded. The remaining 40 seconds were divided into two blocks. The first 20 s were used for optimization of the filter parameters. The remaining 20 s were used for validation of the estimated absolute angles. As the KFs convergence has been demonstrated to be sensitive to the starting point, fifty different starting points were used both in the optimization and validation stage, [22]. The first and last intervals of the validation stage are indicated by horizontal lines in Fig. 2. Filter parameters were optimized using a genetic algorithm [18].

Data analysis
To assess the effects of the filter used on the estimates of the absolute angle of each segment, a four-way analysis of variance (ANOVA) with significance level at 5% was performed with the root mean square error (RMSE) as dependent variable, The four factors were: filter, segment, start point, and samples. A post-hoc Tukey's Least Significant Difference (LSD) testing was performed when needed. All the data processing and statistical analysis were done using custom scripts in Matlab (The Mathworks, USA). Table 1 summarizes the RMSE between the absolute angles obtained from the optic system and each filter, as well as the amount of time (expressed in percentage of total trial duration) the accelerometer data are used to update the filter. Since all but the least stringent matricial (local/global) KFs performed similarly, see Table 2, we only use the matricial KFs based on the criterion (17), in which two or more IMUs have to be reliable in order to be used in the update. As can be seen from Table 1, the global KF solutions achieved a higher accuracy than the local KF, with an average accuracy of 1.202° for the local KF, 0.942 for the MJLS-based KF, and 1.167 for the matricial global KF. The  matricial global performs best for the shank and thigh segments, but offers little to no improvement on the body when compared to the local solution. The MJLS-based KF performs similarly to the matricial global on all segments but the body, where vastly outperforms the other solutions on the body, resulting in an overall best performance for the MJLS-based. The statistical analysis shows that there are significant differences in the filters (F = 404.78 and p = 0.0000) and segments (F = 2480.84 and p = 0.0000) dimensions. The Post-hoc Tukey's LSD demonstrated that, in the filters dimension, the MJLS-based performed better than the other filters, see Fig. 3 and Table 1. Repeating the statistical analysis for the matricial global/local approaches, it shows significant differences between these filters (F = 21.89 and p = 0.0000). The LSD demonstrated that the matricial global performed better than matricial local, see Fig. 4. Furthermore, in segments dimension, the LSD has shown that the body and foot have the worst performance, and no big difference was observed between the thigh and shank, see Fig. 5.

Table 2 Performance index for the matricial global (γC) and local (γUC) filters, with γ varying between 1 and 4 reliable accelerometers, in which, each of the criteria [ in (15)-(18), and ϒ in (26)-(28)] are applied in the matricial filters algorithms
The accelerometer reliability (AR) and accelerometer global reliability (AGR) are also shown  Figure 6a breaks down how the information is used by each segment in the matricial global filter. For example, in the first bar, representing the body, the information obtained directly from the IMU attached to the body makes up 38% (light blue section), the information obtained directly from the IMUs attached to the other segments represents around 20% (orange, grey and yellow sections combined), the remaining 42% is obtained from the relation between the segments. This is not measured directly but represented mathematically through the weights given to the residual error of the relative angle between segments. In the example of the body (first bar of Fig. 6a) the relative angle that contributes most is the hip (dark blue, around 37%). In Fig. 6b, the body segment is estimated by the MJLS-based KF based on information from the IMU (brown section) and the relation between the segments, provided by the encoder data. In the MJLS-based KF this relation is represented by the mechanical structure of the exoskeleton and captured directly by the encoders. In the matricial global this relation is mathematical and derived indirectly by computing the angle between segments. The stronger relation in the MJLS-based KF appears to be particularly helpful for the estimation of the the hip joint movement. In Fig. 6c the local case is shown where no information is shared between the segments. In the MJLS-based model, the Markovian jumps are used to decide which IMU is used to complement the encoder information. Despite all IMUs being eligible for use in a filter update, the IMU attached to the body is never used by the MJLS-based KF.
In contrast to the matricial local KF, both global KFs show a better spread of accelerometer based updates, see Figs. 7 and 8.The local KF does update more often (higher total number of updates) than any of the global solutions presented. Table 2 summarizes the RMSE for the matricial filters (global and local). The accelerometer reliability indicates the percentage of the trial duration when the accelerometers are used to update the estimated absolute angles. A more rigorous criterion resulted in fewer updates and lower accelerometer reliability, see Figs. 2 and 9. Interestingly, with this implementation the updates are fewer and only occur around the stance phase. This criterion results in the use of accelerometers data for only 2.4% of the trial duration, for both matricial filters. On the other hand, the most lenient criterion, (18), updates the estimate in 29.7 and 65.3% for global and local matricial filters respectively. Accelerometer coupled reliabilities, ϒ in (26)-(28), indicate the percentage of the trial duration with coupled accelerometers used together to update the estimated absolute angles, Table 2.
Despite the global filter updating on fewer moments than the local filter, it produces better results in most cases. For example, with the criterion (18), in Table 2 one can see  that the matricial global filter shows an error of 1.243 • , using accelerometer data for 29.2% of the trial, and the accelerometer coupled reliability being 15% of the trial. We can also appreciate that matricial local filter shows an error of 1.529 • , using accelerometer data during 64% of the trial. This suggests the ability of the global filters to take advantage of the relationships between the states expressed in the global model. The RMSE values in Table 2 shows that all but the most lenient implementation result in a similar performance. Statistical analysis revealed that, for the local filter, the usage of the criteria (16) and (18), differed significantly from the other two matricial KF implementations (F = 194.15 and p = 0.0000). No significant differences were found among the other implementations, Fig. 10 enhances these, where the confidence intervals for each implementation is shown in blue. The same analysis, for the global filter, revealed that the criterion (17) differed significantly from the other three matricial global KF implementations (F = 18.58 and p = 0.0000), despite the matricial global KFs performance appear to be less sensitive to the criterion used. No significant differences were found among the other implementations criteria, see Fig. 10. Figures 2 and 9 shows the corresponding absolute angle of the body, for both local and global matricial filters. For the most stringent criterion the estimate is in better agreement with the reference. These results suggest that the quality of the update is more important than the quantity. This is also shown in Figs. 2c and 9c where, despite the frequent updates, the least stringent implementation is unable to converge to the reference at a faster rate than the other implementations.
The results for the thigh and shank are better than those for the body and foot, with RMSE values most of time smaller than 1 for all but the least strict implementation. Nonetheless, a trend towards better performance can also be observed as the criterion becomes more stringent. Fig. 10 reports the results of the difference matricial KF implementations for each segment are included in the online appendix (see Additional

RMSE(°)
Filter criterion (γ) Fig. 10 Pos-hoc LSD test, comparing matricial global with matricial local filters. Where red color represent the matricial global and the blue color the matricial local. The filter criterion γ assuming 1-4 are respectively the Eqs. (18) to (15) Page 17 of 20 Nogueira et al. BioMed Eng OnLine (2017) 16:58 file 2). The statistical analysis shows that the performance of the matricial filters, local and global, are strongly dependent on the segment (F = 3726.16 and p = 0.0000) and (F = 4317.77 and p = 0.0000).

Discussion
The body is the only segment that was not used in the MJLS-based KF updates, since it never achieves the criteria performance Eqs. (12) and (13). This means that in MJLSbased KF the residual error used to estimate the absolute angles for each segment does not include the residual angle error of the body segment. However, the segment with the best improvement by the MJLS-based KF was the body segment, which demonstrate the strong influence of the this global approach. The MJLS-based appears to achieve this better performance through a high number of updates with only the best inertial sensor signal at each instant.
The matricial global KF proposed and validated in this paper, as well as the MJLSbased KF proposed in [6], outperformed the local KF (Table 1). Mean RMSE dropped from 1.202 for the local KF to 1.167 for the matricial global KF, and 0.942 for the MJLSbased KF. It is thus beneficial to take advantage of the information present in other segments and the relation between segments. Fig. 6 clarifies just how big the contribution of this indirect information is. This is also the only difference between the matricial global and the matricial local filters.
In the MJLS-based KF this relation is more explicit and measured directly by the potentiometers embedded in the exoskeleton. Surprisingly, no real differences in terms of the RMSE at the level of the thigh and shank were found between the MJLS-based and the matricial global KFs. The MJLS-based KF did vastly outperform the matricial global KF for the absolute orientation of the body.
The relative joint angle is a main contributor to determine body orientation (Fig. 6a, b. Likely the potentiometer data is of higher quality, partly explaining why the MJLS-based KF performed much better at the body level.
The best combination of sensors based on the criteria and ϒ used in the KF updates likely depends on the task. In this paper, data from a gait trial were analyzed. Results in terms of RMSE and the statistical analysis were similar across the diverse implementations of the matricial global KFs tested in this work. This might be due to the rather slow walking speed, 1.5 m/s, and the cyclic nature of gait. For other tasks a clearer difference might exist. The matricial global and MJLS-based KFs differ in the information that is fused in their models. The matricial global KF only relies on IMU data, and can thus also be applied to clinical gait analysis or gait monitoring. The MJLS-based relies on the information from the potentiometers embedded in the exoskeleton, and is therefore suited to be embedded in the control algorithm.
The information from the potentiometer data, the joint angles, thus proved to be more useful than the additional information from the remaining IMUs. In the matricial global KF, the relation between the IMUs is incorporated in the model through the output matrices. The better performance of the MJLS-based compared to the matricial global KF might be due to the more reliable relation between segments when using the relative angles from the potentiometers, compared to the relative angles obtained through IMUs. Additionally, the fact that in the MJLS-based only the most reliable accelerometer is used to estimate the absolute angles may have contributed to the observed improvement.
In the Fig. 6 was shown the strong influence of the KF gain in global models, where in most cases of Fig. 6a more than 50% of the information originates from the relation between segments. In Fig. 6b with exception from the foot, the encoder data is the dominant information to determine segment orientation.
In the MJLS-based the foot segment was the only segment with RMSE greater than 1°, Table 1. This might have been due to a less optimal fit between the subject's foot and the exoskeleton, as well as the fitting of the sagittal plane exoskeleton to the ankle. Unlike the knee, the ankle has substantial movement and range of movement outside of the sagittal plane.
The hinge joint of the exoskeleton used and most widely available exoskeleton restricting motion with a functional advantage in many cases, but the method is still valid. The body or pelvis is currently the most common location to place an inertial sensor to obtain absolute orientation of an exoskeleton. Our results indicate that the best options would be the thigh or shank segments, since they have more instants in which the accelerometers are reliable (Fig. 11), and the accuracy achieved in matricial local KF is greater for these segments ( Table 2). The effect of this is also present in the matricial global KF. These results thus indicate that if the only goal of the sensor is to obtain absolute orientation of the exoskeleton, that it is best to not place it at the body.
Future work should consider exoskeletons with a more physiological ankle joint for the MJLS-based. The performance of the presented filters was segment dependent, a hybrid approach should therefore be considered with a different solution for the end-segments of the exoskeleton's chain (body and foot). Furthermore, additional trials should be done on pathological gait and over a more extensive dataset.

Conclusion
We presented and validated a novel global KF, and validated the MJLS-based KF [6] previously presented by the authors. Both global filters outperformed the commonly used local KF. Our results thus suggest that global KF solutions are superior to local KF