1. Introduction
Applications of inertial measurement units (IMUs) usually need information about the relationship between the device and the sensor, which depends on the mounting orientation. Based on this mounting orientation, it is possible to estimate the attitude of the device or vehicle [
1], to implement strap-down-algorithms [
2], and to analyze the direction of the motion and acceleration [
3]. In some smartphones, for example, the relation between the two coordinate systems is obtained by placing the sensors in alignment with the device coordinate system [
4]. In addition, the mounting orientation can be obtained offline based on high-quality accelerometer data and further information about the environment such as the slope of the road [
1,
5], or a specified horizontal surface [
6,
7]. Furthermore, the method in [
8] uses measurement data of reference points for compensating the installation angles and attitude errors of an INS/GPS/LDS Target Tracker. In addition to the horizontal surface, the method in [
6] uses the acceleration amplitude to estimate the yaw mounting angle. The approach in [
9] evaluates the forward acceleration to identify the longitudinal axis of the vehicle. However, the accuracy of all these methods suffers considerably when using a consumer IMU sensor which is known to be associated with large errors.
For electric bicycles, there is a study on calibrating the orientation of flexion and extension axes of the lower extremities by using IMUs mounted on the bicyclist [
10]. Existing approaches for calibrating the mounting orientation of IMUs placed on electronically power-assisted cycles (EPACs) are, in general, only methods for 2D-systems (see
Figure 1). Such a 2D-correction is enough when the sensor is located in the motor unit of the EPAC. This is because the plane of the printed-circuit-board (PCB) of a mid-mounted motor always has a static parallel relation to the vertical bike frame plane to remain the catenary of the bike chain.
Nevertheless, the frame design provides one degree of freedom regarding the motor orientation, i.e., rotations around the out-of-plane axis. However, the motor mounting angle is very different in EPACs from different manufacturers, leading to different motor orientations. Thus, it is necessary to perform an online 2D-correction for transforming the x- and z-components of the IMU data from the sensor frame (SF) into the bike frame (BF).
Baumgärtner [
12] analyzed the offset errors offline and calibrated the IMU orientation on an EPAC based on a priori knowledge about the road slope as in [
5,
6,
7]. It was reported in [
12] that the error of the estimated motor orientation required for the application of the method should be less than 3°. Based on the measured data during an uphill and downhill scenario on a road with a constant inclination, Ghislanzoni [
13] proposed an approach to estimate the orientation of an accelerometer mounted on a bicycle. However, the results of this method are affected by the sensor biases. Furthermore, this method needs specific motions and thus the estimation cannot be performed in arbitrary cycling scenarios.
In addition, to the best of our knowledge, no method exists in the open literature for 3D-correction and calibration of an IMU which is mounted out of the bike frame and independent of sensor biases.
In this paper, we propose a novel auto-correction method to estimate the 2D- and 3D-orientation of IMUs on electric bicycles. The correction is based on the measured data of common bicycling motions such as accelerations and decelerations as well as roll and steer motions of the system. The bias-compensated mounting orientation is achieved with a speedometer. After transforming the accelerometer data into the vehicle coordinate system, we use a simple and robust method to estimate the sensor biases. In contrast to the method presented in [
14], in our method, a bias-independent mounting orientation correction is carried out at first, and afterwards a sensor offset estimation and compensation is made. This leads to significant advantages regarding the accelerometer error analysis in the bike frame coordinate system. Therefore, an atmospheric pressure sensor is needed for the bias estimation. More importantly, the computation expense required for the estimation is very low so that it can be realized in real-time.
The remainder of this paper is organized as follows. In the next section, we present the challenge of the mounting orientation correction for consumer micro-electro-mechanical systems (MEMS) sensors with large offset errors.
Section 3 introduces the proposed method, provides an analysis of dynamic bike motions, and proposes the solution for the 2D and 3D mounting correction.
Section 4 presents experimental results to demonstrate the applicability of our method.
Section 5 concludes the paper.
2. Challenge
In this study, we consider the estimation of the mounting orientation of IMU in an EPAC as shown in
Figure 1 for a 2D and
Figure 2 for a 3D description.
Based on the mounting orientation, the sensor data can be transformed from the sensor coordinate system (SF) into the bike coordinate system (BF).
If the slope
α (in this paper
α is negative for uphill sections and vice versa [
10]) is known, the 2D mounting orientation
γ can be determined by:
based on a measurement of the two accelerometer-axes
zSF and
xSF in the vertical bike frame plane, corresponding to the true/bias-free accelerations (
xSF,true,
zSF,true).
However, the biases (
xSF,b,
zSF,b) of the accelerometer sensor have a strong influence on the accuracy of
using (1). This influence leads to a discrepancy of the true sensor values which have not been properly considered in previous studies [
5,
6,
7,
8,
9,
12]. Such offset errors exist commonly in the output of consumer MEMS sensors due to temperature effects, factory processes and aging [
15]. Therefore, (1) is modified as:
Now, the mounting orientation γ cannot be determined by a single measurement of the acceleration due to the two more unknowns (xSF,b, zSF,b).
Although biases can be pre-estimated in the sensor frame using the state-of-the-art accelerometer models by solving an ellipsoid-fitting problem [
16,
17,
18,
19,
20], these methods require several static measurement data with different sensor orientations. In addition, for the ellipsoid-fitting, only the gravity of 1 g must be kept during the measurement, which is impossible in bicycling. Some of these methods [
17,
18] use further sensors, e.g., a magnetometer. Moreover, most of these methods use an optimization approach like the Newton method [
16,
19], the quasi-Newton method [
18] or the unscented Kalman filter [
20] to solve the nonlinear ellipsoid-fitting problem. In [
21] a linearization of the nonlinear system was used in fitting the model parameters. Renk et al. performed the fitting based on measured state trajectories during a sufficiently slow motion of a robot arm [
18]. However, since these sufficiently slow moving states have to cover a large portion of the ellipsoid, such methods are not suitable for fitting parameters in accelerometer models placed on EPACs. In general, IMUs can be readily calibrated with a Kalman filter. Nevertheless, in some specific cases, as seen in [
22], the occurring motion data is not sufficient for proper convergence of the filter states. Therefore, the existing filter approaches are not sufficient for the bicycle use case, too, as it has similarities to the task presented in [
22]. Especially in cycling activities in flat areas, the roll and pitch angle of a bicycle exhibits only small variance regarding orientation changes, which will lead to poor performances when using the approaches in [
16,
17,
18,
19,
20]
To evade the necessity of measurement data with different orientations, further sensors (e.g., high-grade GPS data) could be introduced to the Kalman Filter design as shown in [
22].
Streit and Braeuer [
23] estimated the bias of an accelerometer in one axis by observing the wheel speed. However, it requires the accelerometer to be pre-aligned with the bike frame, i.e., the mounting orientation has to be known, which means the IMU is already calibrated.
In addition to the bias, a consumer IMU also has scale and alignment errors. In general, for sensor orientation and attitude estimation, the misalignment and scaling errors of the accelerometer can be neglected [
15,
18], whereas the biases of consumer sensors are significant and can lead to an error of up to 10 [
15].
Based on the above discussion, we conclude that an online correction of the 2D and 3D mounting orientation of a consumer IMU for electrical bicycles remains a challenge. To address this problem, both sensor biases and sensor orientation have to be estimated online.
In general, we can estimate the sensor biases first and the orientation second, or vice versa. In this study, the latter is considered, i.e., the sensor orientation estimation has to be independent of the sensor biases.
3. Method
Our aim in this study is to develop a method to calibrate the mounting orientation of a consumer IMU. The estimation should be based on the data from common bicycling motions. It means that the cyclist does not have to perform specific maneuvers for the estimation. For this purpose, we consider two common cycling motions: a deceleration and a lateral pendulum motion.
3.1. Deceleration
In principle, motions with acceleration and/or deceleration can be used for the mounting orientation estimation. During those motions, the direction points toward (by acceleration) or against (by deceleration) the driving direction of the bicycle. At first, we analyze the dynamic behavior with the help of typical profiles measured by an IMU on an EPAC.
Figure 3a shows an acceleration phase from t = 2 s through t = 6 s and a deceleration phase from t = 8 s through t = 10 s. These phases can be recognized by the speed signal and the acceleration measurement in all three axes (
accSf,x,
accSf,y,
accSf,z) caused by the mounting orientation of the IMU on the bicycle. During the acceleration phase, the oscillation appears because of the pedaling and steering control actions. More importantly, as shown in
Figure 3a, the amplitudes of the deceleration are greater than those of acceleration, which is the typical case during cycling. Therefore, deceleration motions are used in our method.
Assuming that the bicycle does not change its orientation before and during the deceleration, we can estimate a bias-independent driving direction vector
aSF,dec. The principle of the bias independence is presented in
Figure 3b. It can be seen, by taking two deceleration measurements
mSF,I and
mSF,II (i.e., before and during braking) that we can isolate the deceleration components (
) from the other vector components (
in the sensor frame. The two measurements represent the resulting acceleration
mSF. Since the orientation does not change, the bias vector
aSF,b and the gravity vector
aSF,g remain constant. The deceleration vector
aSF,dec can be calculated as follows:
where
The constant orientation of the EPAC during the deceleration can be verified by the gyroscope of the IMU. This means that only braking situations without orientation change will be used.
It should be noted that the deceleration vector
aSF,dec is along the
xBF-axis of the bike system (BF) [
11]. Therefore, the vector
aSF,dec represents a link between the sensor and the bike coordinate system.
3.2. Lateral Dynamics
The inherent instability of the bicycle is mainly due to the unbalanced motion described by the lateral dynamics of cycling. Schwab and Meijaard [
25] investigated this instability and presented an in-depth study on self-stabilizing mechanisms of the bicycle and the influencing factors of the cyclist. When the bicycle is tending to fall to one side, the cyclist has to steer in the direction of the undesired fall to avoid a crash. The related centrifugal acceleration sets the bike upright again. This is in fact the behavior of an inverted pendulum, leading to the oscillation shown in
Figure 3a. The lateral dynamics of cycling can be described with two separate motions. The first one is the sideway rolling or tipping, leading to a rotation
θ around the
xBF-axis. The second one is the steering motion to keep the balance, which ends up with a rotation
ψ around the
zBF-axis. Thus, the combination of both rotations leads to a rotation around a vector
tsSF (tip-steer) which is part of the vertical bike frame plane
xBFzBF, representing another link to the BF.
Figure 4 illustrates this relation and the two rotations, where the vector
tsSF will be estimated by analyzing the gyroscope data of the IMU in the frequency space.
Typical profiles of gyroscope data recorded during a pedaling phase are plotted in
Figure 5a where a predominant oscillation in all three axes can be observed. The phase shift of the profiles shows the temporal relation between the tip motion and the steer motion, reflecting the delayed reaction time of the cyclist. In
Figure 5b, the frequency spectrum of the data shown in
Figure 5a is plotted, which is computed with a fast Fourier transformation (FFT) with a sampling rate
Fs 100 Hz using 300 samples. It can be seen that one peak (i.e., the maximum magnitude) is at the lower end of the spectrum due to the tip-steer motion (
tsSF).
Kooijman et al. [
26] pointed out that during pedaling the inverted pendulum motion has a frequency equal to the pedaling frequency (cadence). This correlation between the cadence and the maximum magnitude in the frequency spectrum can be observed in the data shown in
Figure 5. As a result, evaluating only one single pedaling frequency of the gyroscope data is enough for our purpose and, thus, the computation expense can be significantly reduced. This is made by a convolution or a single multiplication of the current 3 × n gyroscope dataset
and a cosine function describing the current cyclist cadence F
Cad. The rotational rate matrix
has three columns representing the three rotational rate axes of the gyroscope and
n rows corresponding to the number of recorded data points. To calculate the components of the tip-steer motion vector, we need the integration of the absolute convolved or multiplied function values. For the convenience of computation, we calculate the sum of the products
of the discrete signals, which is the unsigned vector
tsSF:
This computation can be interpreted as a product of a measured time series of the sensor data and a specific cosine function with the frequency of the current cyclist cadence.
The summation of the products returns the unsigned tip-steer vector
. This procedure can be derived from a discrete Fourier transformation without an imaginary component and an evaluation of only one defined frequency [
27].
Due to the unsigned magnitudes of the frequency spectrum and the necessity of a signed tip-steer vector, the signs of in (6) have to be determined separately. In total, there are eight possible sign combinations for a vector with three components. Two combinations are always mirrored vectors; these vectors are the same except for their opposite direction. Thus, considering the fact that four sign variations are enough, this leads to a further reduction of the computation time. Each sign variation of tsSF is multiplied by to calculate the four one-dimensional-rotational rate signals. The signal with the maximal amplitude represents the true tip-steer motion and exhibits the correct sign variation.
It should be noted that the estimation of the tip-steer vector tsSF is independent of the gyroscope biases, too, because the method of frequency analysis evaluates only the content of the non-zero frequency data of the gyroscope.
3.3. From Sensor Frame to Bike Frame
3.3.1. Two-Dimensional (2D) Mounting Orientation Estimation
Here, we present a method for a 2D-auto-correction in which only the deceleration vector
aSF,dec is used. This vector is the input for the rotation matrix
used for transforming the
xSF- and
zSF-axes of the sensor frame into the driving (
xBF) and vertical (
zBF) axes of the BF (see
Figure 1). Therefore, the rotation angle
γ between the two coordinate systems is independent of the slope
α due to the compensation of the gravity (see (3)–(5)) and thus can be calculated by
Since the
y-axis of the sensor frame remains the
y-axis of the bike frame for the 2D case, we use the following standard rotation matrix
3.3.2. Three-Dimensional (3D) Mounting Orientation Estimation
For the 3D-auto-correction, both the deceleration and the lateral pendulum motions discussed above are required. By calculating the cross product of the vector
tsSF and the deceleration
aSF,dec, and since these two motions occur in the sensor frame, we can estimate the lateral axis
yBF as a relation to the bike frame (see
Figure 4):
The driving direction axis
xBF represents the sign-inverted and normed deceleration vector
aSF,dec, i.e.,
The vertical axis
zBF is calculated as the cross product of
xBF and
yBF:
As a result, the rotation matrix
transforms the sensor data from the sensor frame to the bike frame:
The acceleration vector
in the BF is the product of the rotation matrix
and the acceleration vector
, which can be expressed for the 2D and 3D rotation matrices as follows
3.4. Bias Estimation in the Bike Frame
As mentioned above, due to the data inaccuracy of a consumer IMU, it is necessary to estimate the sensor biases. The calibration of the gyroscope biases is usually undertaken during phases in which the device is in a “constant position” [
28]. However, the accelerometer biases cannot be determined with the data of a static state [
16]. Thus, we need more cycling scenarios or events together with a standard low-cost bicycle speedometer and an atmospheric pressure sensor to determine the acceleration biases.
The current road slope can be evaluated by integrating the speedometer data [
29,
30] to obtain the distance
ds and estimating the change of the altitude
dh based on the barometer data [
31]. Then, we can calculate the slope:
However, the estimation of α in this way is delayed due to the necessary cycling distance ds as well as a low-pass filter to remove the noise of the pressure signal. Considering these aspects, we determine the biases in the driving direction and in the vertical direction by comparing the measured acceleration with a gravitational component at the slope α during constant speed events. The subtraction of the measured accelerations from the gravitational components represents the acceleration biases and .
The lateral acceleration bias
bacc,BF,y can be estimated based on the consideration that, during pedaling events, the bicycle is, in general, upright. Consequently, all measured and low-pass-filtered acceleration
corresponds to the lateral bias
. Therefore, the acceleration biases
in the three axes are:
3.5. Implementation of the Proposed Approach
Figure 6a shows the implementation of the overall method. The input data are the measured acceleration, rotational rate, speed, and atmospheric pressure.
In the forward path, the mounting orientation is estimated and the acceleration data transformed into the BF. The feedback path presents the event-based bias estimation. These events are cycling scenarios with constant speeds.
The residual of the biases is estimated, transformed into the sensor frame and sent back to the forward path as a bias compensation. This feedback loop is similar to a proportional controller (i.e., the last bias combined with the new estimated remaining bias, existing in the current data), where β, η are the proportional parameters to be tuned. These two parameters are necessary for different handling of the lateral bias bacc,SF,y and the other two biases (bacc,SF,x, bacc,SF,z).
Two MATLAB/Simulink models are implemented to realize our 2D- as well as 3D-auto-correction method, respectively.