Relative position and orientation determination
Change of position and orientation can be estimated by integration of acceleration and angular velocity signals obtained from inertial sensor modules. In this study, inertial sensing is fused with a magnetic measurement system to estimate the relative position and orientation of the sensor with respect to the magnetic source, \(\user2{p}^{c}_{s}\) and \(\user2{R}^{c}_{s},\) respectively. Figure 1 shows the measurement system used to estimate the relative position and orientation of an Inertial and Magnetic Measurement System (IMMS) with respect to the magnetic source. The IMMS contains a 3D accelerometer, a 3D gyroscope, and a 3D magnetometer. A schematic overview of a configuration with a coil around the z-axis is shown in Fig. 2. The global frame is denoted by \(\Uppsi_{g},\) the magnetic source frame by \(\Uppsi_{c},\) the coil frame by \(\Uppsi_{cz},\) the sensor frame by \(\Uppsi_{s},\) and the estimated sensor frame by \(\hat{\Uppsi}_{s}.\) It should be noted that the coil frame \(\Uppsi_{cz}\) is rigidly connected to magnetic source frame \(\Uppsi_{c}.\) The reason to include both is that the magnetic source can have multiple coils attached to it with individual relative positions and orientations with respect to the magnetic source. Both the movement of the source and sensor should be estimated, since the source and sensor can move independently. Orientation is estimated by integration of angular velocity using the following differential equation [1]:
$$ \dot{\user2{R}}^{g}_{s} = {\user2{R}}^{g}_{s}\tilde{\varvec{\omega}}^{s,g}_{s}, $$
(1)
where \(\user2{R}^{g}_{s}\) denotes the rotation matrix describing the orientation of the sensor frame \(\Uppsi_{s}\) with respect to the global frame \(\Uppsi_{g}.\) The columns of \(\user2{R}^{g}_{s}\) are the unit axes of frame \(\Uppsi_{s}\) expressed in frame \(\Uppsi_{g}: {\user2{R}}^{g}_{s} =\left({\user2{X}}^{g}_{s} \;{\user2{Y}}^{g}_{s}\; {\user2{Z}}^{g}_{s}\right).\) The angular velocity \({\varvec{\omega}}^{s,g}_{s}\) of frame \(\Uppsi_{s}\) with respect to \(\Uppsi_{g},\) expressed in \(\Uppsi_{s}\) as measured by the inertial sensor is represented in skew-symmetric matrix form, indicated by the tilde operator (∼):
$$ \tilde{\varvec{\omega}}^{s,g}_{s} =\left( \begin{array}{lll} 0 & - \omega _{z} & \omega _{y} \\ \omega _{z} & 0 & - \omega _{x} \\ - \omega _{y} & \omega _{x} & 0 \end{array}\right), $$
(2)
where the indices ()s,g
s
have been omitted for readability. The accelerometer signal consists of a sensor acceleration component \(\user2{a}^{s}\) and a gravitational acceleration component \(\user2{g}^{s}: \user2{s}^{s} =\user2{a}^{s}-\user2{g}^{s}.\) The orientation \(\user2{R}^{g}_{s}\) is used to remove the gravitational acceleration \(\left(\user2{a}^{g} =\user2{R}^{g}_{s} \user2{s}^{s}+\user2{g}^{g}\right)\) [20], and the change of position in global coordinates is obtained by double integration of the sensor acceleration component \(\user2{a}^{g}.\) It should be noted that the orientation of the source with respect to the global \(\user2{R}^{g}_{c}\) is obtained in similar way using the acceleration \(\user2{s}^{c}\) measured by the accelerometer of the inertial sensor attached to the source, and its angular velocity \({\varvec{\omega}}^{c,g}_{c}\) measured by the gyroscope.
The relative orientation of the sensor with respect to the magnetic source \(\user2{R}^{c}_{s}\) is obtained by
$$ \dot{\user2{R}}^{c}_{s} = {\user2{R}}^{c}_{s}\tilde{\varvec{\omega}}^{s,c}_{s}, $$
(3)
where the angular velocity is given by the difference between the angular velocities of the sensor and the source, both expressed in the same coordinate system
$$ {\varvec{\omega}}^{s,c}_{s} = {\varvec{\omega}}^{s,g}_{s} - \left({\user2{R}}^{g}_{s}\right)^{T} {\user2{R}}^{g}_{c} {\varvec{\omega}}^{c,g}_{c}. $$
(4)
Subsequently, the relative position \(\user2{p}^{c}_{s}\) is obtained by
$$ \begin{aligned} {\user2{a}}^{c}_{s} &= \left({\user2{R}}^{g}_{c}\right)^{T} \left({\user2{R}}^{g}_{s} {\user2{s}}^{s} - {\user2{R}}^{g}_{c} {\user2{s}}^{c} \right) = {\user2{R}}^{c}_{s} {\user2{s}}^{s} - {\user2{s}}^{c} \\ {\user2{v}}^{c}_{s} &= {\user2{v}}_{0} + \int\limits_{t_{0}}^{t}{\user2{a}}^{c}_{s}(\tau)\hbox{d}\tau \\ {\user2{p}}^{c}_{s} &= {\user2{p}}_{0} + \int\limits_{t_{0}}^{t}{\user2{v}}^{c}_{s}(\tau)\hbox{d}\tau. \end{aligned} $$
(5)
Filter structure
In this study, a complementary filter, commonly used for inertial navigation [2], is designed which operates on the errors in the state variables using a feedback structure (Fig. 3). The inertial measurements are not used purely as measurements, but rather as an input of the process model to form the reference trajectory against which the measurements of inclination and magnetic field are compared. The position and velocity change over time are extracted from measured inertial acceleration (Eq. 5) and the orientation is estimated from measured angular velocity (Eq. 3). It is the actual measurement minus the predicted measurement that forms the measurement error that is fed into the fusion filter. We chose to use an Extended Kalman Filter (EKF) that operates on the error states to fuse inertial with magnetic sensing. The error states for the filter are chosen as
$$ \delta {\user2{x}} =\left(\begin{array}{lllll} \delta {\user2{p}} & \delta {\user2{v}} & \delta {\varvec{\theta}} & \delta {\user2{a}} & \delta {\varvec{\omega}}\end{array}\right)^{T}, $$
(6)
where \({\delta}\user2{p}\) denotes the position error, \({\delta}\user2{v}\) the velocity error, \(\delta {\varvec{\theta}}\) the orientation error, \({\delta}\user2{a}\) the accelerometer bias, and \(\delta {\varvec{\omega}}\) the gyroscope bias. In general, the state space equations are given by
$$ \dot{\delta{\user2{x}}} = {\user2{f}}\left(\delta {\user2{x}}\right) + {\user2{w}}_{x} $$
(7)
$$ \delta {\user2{y}} = {\user2{h}}\left(\hat{\user2{x}}\right) - {\user2{y}} + {\user2{w}}_{y}, $$
(8)
where \(\user2{f}\left( {\delta}\user2{x} \right)\) denotes the function used to propagate the state vector \({\delta}\user2{x}\) in time, \(\user2{y}\) the measurement, and \(\user2{h}\left( \hat{\user2{x}} \right)\) the function which maps the estimated state vector \(\hat{\user2{x}}\) to the predicted measurement \(\hat{\user2{y}}.\) The additive process and measurement noises are denoted by \(\user2{w}_{x}\) and \(\user2{w}_{y}\) with covariances \(\user2{Q}_{x}\) and \(\user2{Q}_{y},\) respectively. The measurement model consists of a magnetic update \({\delta}\user2{y}_{m}\) and an inclination update \({\delta}\user2{y}_{i}.\) The inclination update is necessary, since an inaccurate estimation of inclination introduces integration drift caused by an incorrect removal of gravitational acceleration.
The recursive algorithm for a Kalman filter consists of a prediction step and an update step. Since the EKF resets the error states to zero immediately after a measurement, only the covariance is updated in the prediction step
$$ {\user2{P}}^{-}_{k} = {\user2{F}}_{k-1} {\user2{P}}_{k-1} {\user2{F}}_{k-1}^{T} + {\user2{Q}}_{x,k-1}, $$
(9)
where \(\user2{P}^{-}_{k}\) denotes the error covariance associated with the state \({\delta}\user2{x}\) at time instant k, and \(\user2{F}_{k}\) denotes the discrete process model that propagates the state in time. It should be noted that a minus superscript ()− denotes the a priori estimate. If a measurement becomes available, the state and covariance are updated resulting in the a posteriori estimate
$$ \begin{aligned} \delta \hat{{\user2{x}}}_{k} &= {\user2{K}}_{k} \delta {\user2{y}}_{k} \notag \\ {\user2{P}}_{k} &= \left({\user2{I}}-{\user2{K}}_{k}{\user2{H}}_{k}\right){\user2{P}}_ {k}^{-} \\ \delta {\user2{y}}_{k} &= \hat{{\user2{y}}}^{-}_{k} - {\user2{y}}_{k} \\ {\user2{K}}_{k} &= {\user2{P}}_{k}^{-} {\user2{H}}_{k}^{T} \left( {\user2{H}}_{k} {\user2{P}}_{k}^{-} {\user2{H}}_{k}^{T} + \user2{Q}_{y,k}\right)^{-1} \end{aligned} $$
(10)
with \(\user2{K}_{k}\) the Kalman gain, \(\user2{H}_{k}\) the linearized measurement model, and \(\user2{I}\) the identity matrix. Based on an estimation of the uncertainty associated with the position and orientation, represented on the diagonal of the covariance matrix \(\user2{P}_{k},\) the system decides when a magnetic update is necessary. In order to decide which coil needs to be actuated, the covariance update (Eq. 10) is calculated for each of the source coils that can be actuated. The system chooses to actuate only that coil with the highest contribution to the reduction of the uncertainty.
In Sect. 2.3, it is shown that the prediction of the state (Eq. 7) can be described by a linear equation using a single matrix \(\left(\user2{f}\left(\delta \user2{x}\right) =\user2{F}\delta \user2{x}\right).\) The nonlinear measurement models for the magnetic update \({\user2{h}}_{m}\left(\hat{\user2{x}}\right)\) and the inclination update \({\user2{h}}_{i}\left(\hat{\user2{x}}\right)\) as well as their linearized versions are described in Sect. 2.4.
Process model
The error equations that comprise the process model can be derived by writing the derivative of the state as a function of the state itself, according to Eq. 7. The error state \({\delta}\user2{x}\) denotes the difference between the true state \(\user2{x}\) and an estimation of the state \(\hat{\user2{x}}.\) For the position error, velocity error, accelerometer bias, and gyroscope bias, the relation is simply given by
$$ \hat{\user2{x}} = {\user2{x}} + \delta {\user2{x}}. $$
(11)
For the orientation error \(\delta {\varvec{\theta}},\) rotation matrices are used
$$ \hat{\user2{R}}^{c}_{s} = {\user2{R}}^{c}_{s} \delta {\user2{R}} \approx {\user2{R}}^{c}_{s} \left({\user2{I}} + \tilde{\delta {\varvec{\theta}}} \right) \Rightarrow \tilde{\delta {\varvec{\theta}}} \approx \left({\user2{R}}^{c}_{s}\right)^{T} \hat{\user2{R}}^{c}_{s} - {\user2{I}}. $$
(12)
The derivative of the orientation error is found by applying Eqs. 12, 3, and neglecting the product of errors
$$ \dot{\tilde{\delta {\varvec{\theta}}}} = \left(\dot{\user2{R}}^{c}_{s}\right)^{T} \hat{\user2{R}}^{c}_{s} + \left({\user2{R}}^{c}_{s}\right)^{T} \dot{\hat{\user2{R}}}^{c}_{s} \approx \tilde{\delta {\varvec{\omega}}} - \tilde{\varvec{\omega}}^{s,c}_{s} \tilde{\delta {\varvec{\theta}}} + \tilde{\delta {\varvec{\theta}}} \tilde{\varvec{\omega}}^{s,c}_{s}. $$
(13)
The vector representation of the orientation error \(\dot{\delta {\varvec{\theta}}}\) is found by inspecting the individual terms of the skew-symmetric matrix \(\dot{\tilde{\delta {\varvec{\theta}}}}\)
$$ \dot{\delta {\varvec{\theta}}} = \delta {\varvec{\omega}} - \tilde{\varvec{\omega}}^{s,c}_{s} \delta {\varvec{\theta}}. $$
(14)
The derivative of the velocity error is found by applying Eqs. 5, 11, 12 and neglecting the product of errors
$$ \dot{\delta{\user2{v}}} = \dot{\hat{\user2{v}}}^{c}_{s} - \dot{\user2{v}}^{c}_{s} = {\user2{R}}^{c}_{s} \delta {\user2{a}} - {\user2{R}}^{c}_{s} \tilde{{\user2{s}}^{s}} \delta {\varvec{\theta}}, $$
(15)
and the derivative of the position
$$ \dot{\delta {\user2{p}}}= \delta {\user2{v}}. $$
(16)
The accelerometer bias and gyroscope bias are modeled as first-order Markov processes
$$ \begin{aligned} \dot{\delta {\user2{a}}} &= - \beta_{a} \delta {\user2{a}} + \sqrt{2 \sigma^{2}_{a} \beta_{a} } {\user2{u}}\\ \dot{\delta {\varvec{\omega}}} &= - \beta_{\omega} \delta {\varvec{\omega}} + \sqrt{2 \sigma^{2}_{\omega} \beta_{\omega} }{\user2{u}}, \end{aligned} $$
(17)
where \(\user2{u}\) denotes unity white noise. Summarizing, the following state equations have been found
$$ \begin{aligned} \dot{\delta \user2{p}} &= \delta {\user2{v}}\\ \dot{\delta {\user2{v}}} &= {\user2{R}}^{c}_{s} \delta {\user2{a}} - {\user2{R}}^{c}_{s} \tilde{{\user2{s}}^{s}} \delta {\varvec{\theta}}\\ \dot{\delta {\varvec{\theta}}} &= \delta {\varvec{\omega}} - \tilde{{\varvec{\omega}}}^{s,c}_{s} \delta {\varvec{\theta}}\\ \dot{\delta {\user2{a}}} &= - \beta_{a} \delta {\user2{a}}\\ \dot{\delta {\varvec{\omega}}} & = - \beta_{\omega} \delta {\varvec{\omega}}. \end{aligned} $$
(18)
Measurement model
This section describes the measurement models that are used to update the estimation of the state. First, the model for the magnetic update \({\user2{h}}_{m}\left(\hat{\user2{x}}\right)\) and its linearized version \(\user2{H}_{m}\) are described, followed by the model for the inclination update \({\user2{h}}_{i}\left(\hat{\user2{x}}\right)\) and its linearized version \(\user2{H}_{i}.\)
Magnetic update
The magnetic measurement model is used to predict the field generated by the source coil at the location of the sensor based on an estimation of the position and orientation of the sensor. Figure 2 shows a configuration with a coil around the z axis, which means frames \(\Uppsi_{cz}\) and \(\Uppsi_{c}\) are aligned. The position of both frames with respect to each other is denoted by \(\user2{p}^{c}_{cz}.\) Applying the measurement model proposed in a previous study [18] to the configuration shown in Fig. 2 results in
$$ \hat{{\user2{y}}}_{m} = {\user2{h}}_{m}\left(\hat{\user2{x}}\right) = \hat{\user2{B}}^{s} = \left(\hat{{\user2{R}}}^{cz}_{s}\right)^{T} \hat{\user2{B}}^{cz}, $$
(19)
where \(\hat{\user2{B}}^{s}\) denotes the magnetic field measured by the sensor, and \(\hat{\user2{R}}^{cz}_{s} = \left({\user2{R}}^{c}_{cz}\right)^{T} \hat{\user2{R}}^{c}_{s}\) denotes the relative orientation of the sensor with respect to the coil. The magnetic field that is generated by the source coil at the location of the sensor expressed in coil coordinates is found by applying the Biot–Savart law to a circular wire loop (see Appendix), and expressing the results in cartesian coordinates
$$ \hat{\user2{B}}^{cz}(\hat{\user2{p}}^{cz}_{s}) = \frac{\mu_{0} N I} {2\pi\sqrt{\left(\sqrt{\hat{p}_{x}^2 + \hat{p}_{y}^2}+b\right)^{2} + \hat{p}_{z}^{2}}}\left( \begin{array}{l} \frac{\hat{p}_{x}\hat{p}_{z}} {\hat{p}_{x}^2 + \hat{p}_{y}^2}\left( -K(k) + \frac{b^2 + \hat{p}_{x}^2 + \hat{p}_{y}^2 + \hat{p}_{z}^2}{\left(\sqrt{\hat{p}_{x}^2 + \hat{p}_{y}^2}-b\right)^2 + \hat{p}_{z}^2}E(k)\right) \\ \frac{\hat{p}_{y}\hat{p}_{z}} {\hat{p}_{x}^2 + \hat{p}_{y}^2}\left( -K(k) + \frac{b^2 + \hat{p}_{x}^2 + \hat{p}_{y}^2 + \hat{p}_{z}^2}{\left(\sqrt{\hat{p}_{x}^2 + \hat{p}_{y}^2}-b\right)^2 + \hat{p}_{z}^2}E(k) \right) \\ K(k) + \frac{b^2 - \hat{p}_{x}^2 - \hat{p}_{y}^2 - \hat{p}_{z}^2} {\left(\sqrt{\hat{p}_{x}^2 + \hat{p}_{y}^2}-b\right)^2 + \hat{p}_{z}^2}E(k) \end{array}\right), $$
(20)
with μ0 the magnetic permeability of vacuum \((4\pi \cdot 10^{-7}\;\hbox{T}\;\hbox{m}^{2}/\hbox{A}),\)
N the number of windings, I the current applied, and b the radius of the coil. It should be noted that the indices ()cz
s
have been omitted for readability. The relative position of the sensor with respect to the coil is given by \(\hat{\user2{p}}^{cz}_{s} = \left({\user2{R}}^{c}_{cz}\right)^{T} \left(\hat{\user2{p}}^{c}_{s} - {\user2{p}}^{c}_{cz}\right),\) and
$$ \begin{aligned} k &= \sqrt{\frac{4b\sqrt{\hat{p}_{x}^2 + \hat{p}_{y}^2}} {\left(\sqrt{\hat{p}_{x}^2 + \hat{p}_{y}^2}+b\right)^2 + \hat{p}_{z}^2}}\\ K(k) &= \int\limits^{\pi/2}_{0}\frac{1} {\sqrt{1-k^{2}\sin^{2}{\phi}}}\hbox{d}\phi \\ E(k) &= \int\limits^{\pi/2}_{0}{\sqrt{1-k^{2}\sin^{2}{\phi}}}\hbox{d}\phi. \end{aligned} $$
(21)
The linearized model is given by
$$ {\user2{H}}_{m} = \frac{\partial \hat{\user2{y}}_{m}}{\partial \delta {\user2{x}}} =\left( \begin{array}{llllll} \left(\hat{{\user2{R}}}^{cz}_{s}\right)^{T} & \frac{\partial \hat{\user2{B}}^{cz}}{\partial \delta {\user2{p}}} & {\user2{0}} & \tilde{\hat{\user2{B}}}^{s} & {\user2{0}} & {\user2{0}} \end{array}\right). $$
(22)
The partial derivatives of the estimated field with respect to the position error \(\left( \left(\hat{\user2{R}}^{cz}_{s}\right)^{T} \frac{\partial \hat{\user2{B}}^{cz}}{\partial \delta \user2{p}} \right)\) result in a rather lengthy and complicated expressions and are therefore not shown.
Inclination update
The inclination can be updated only during periods of low acceleration. Therefore, the measured acceleration is tested in advance for deviations from the gravitational acceleration. In case of significant deviations, the measurement noise is set to extremely high values such that the acceleration is not used to update the inclination during these intervals. The measurement equation for the inclination update is found by expressing the gravitational acceleration in sensor coordinates and adding the accelerometer bias
$$ \hat{\user2{y}}_{i}^{s} = {\user2{h}}_{i}\left(\hat{\user2{x}}\right) = \left(\hat{\user2{R}}^{g}_{s}\right)^{T} {\user2{g}}^{g} + \delta {\user2{a}} = \left(\hat{\user2{R}}^{c}_{s}\right)^{T} \left(\hat{\user2{R}}^{g}_{c}\right)^{T} {\user2{g}} ^{g} + \delta {\user2{a}}, $$
(23)
where \(\user2{g}^g\) denotes the gravitational acceleration in global coordinates.
The linearized model is given by
$$ {\user2{H}}_{i} = \frac{\partial \hat{\user2{y}}_{i}^{s}}{\partial \delta \user2{x}} =\left( \begin{array}{lllll} {\user2{0}} & {\user2{0}} & \tilde{\hat{\user2{g}}}^{s} & {\user2{I}} & {\user2{0}} \end{array}\right), $$
(24)
with \(\hat{\user2{g}}^{s}\) being the estimated inclination in sensor coordinates.
Experimental methods
The measurement system, as shown in Fig. 1, consisted of two IMMS modules (MTx with Xbus, Xsens Technologies B.V.), and three coils mounted orthogonal with respect to each other. Each coil was a circular coil with 50 windings and a radius of 0.055 m. The IMMS modules were sampled at 100 Hz. The maximum current that could be delivered by the driving electronics was 1.5 A. The driving electronics were controlled realtime by sending messages to the Xbus via a wireless Bluetooth connection. At certain time instants, the magnetic system generates magnetic pulses that were measured by the magnetometer of the IMMS. For each pulse, the mean and standard deviation were calculated which were both fed into the EKF. For validation, the relative position and orientation estimated by the fusion filter were compared to a reference optical position measurement system (Vicon, Oxford Metrics). Three markers with a diameter of 25 mm were attached to each IMMS. The reference data was obtained at a sample frequency of 100 Hz.
During the experiments, the system decided realtime when an actuation was required and which of the three coils should be actuated based on an estimation of the uncertainty associated with the position and orientation. The actuation current (1.3 A) and pulse duration (30 ms) were fixed. The complete experiment consisted of three parts. In the first experiment, the three source coils with IMMS were placed on a flat surface. An IMMS was moved around the source while varying the position and orientation. In the second experiment, the three source coils with IMMS were attached to the lower back of a subject, and the subject performed several movements with respect to the standing posture. With an IMMS attached to the back at the level of the first thoracic vertebra, the subject performed flexion/extension and rotation of the back. With an IMMS attached to the upper leg, the subject performed hip flexion/extension, and with an IMMS attached to the upper arm, the subject performed shoulder abduction/adduction. In the third experiment, the subject walked through the laboratory at a self-selected speed. The IMMS was attached to the upper leg and to the back at the level of the first thoracic vertebra.