3D Orientation Estimation Using Inertial Sensors

– Recently, inertial sensors have been widely used in the measurement of 3D orientations because of their small size and relative low cost. One of the useful applications in the area of Neurorehabilitation is to assess the upper limb motion for patients who are under neurorehabilitation. In this paper, the computation of the 3D orientation is discussed utilising the outputs from accelerometers, gyroscopes and magnetometers. Different 3D orientation representations are discussed to give recommendations for different use scenarios. Based on the results form the 3D orientation, 2D and 3D position tracking techniques are also calculated by considering the joint links and kinematics constraints from the upper limb segments. The results showed that the performance using complementary filter can make good estimation of the orientation.

Particularly in the area of Neurorehabilitation, there is continuous interests in using inertial sensors in tracking human body motion [10], [11].The small size of the inertial sensors make them possible to be attached on the limbs, therefore a number of studies have been done in tracking the human limbs based on inertial sensors [12]- [14].Inertial sensors built for medical purposes usually are very expensive such as Xsens MTx sensors and Shimmer sensors.These sensors can provide accurate 3D orientation even 3D position data with the companies' software.More recently, there is growing interest in low cost inertial sensors for example gaming sensors [5], [15] and smart wearables [16] in health related research especially for upper limb assessment in Neurorehabilitation.However, the low cost sensors only provide raw outputs of accelerometer, gyroscope and magnetometer.The calculation of 3D orientation can be challenging for clinical users.Also the selection of the sensors can be different depending on different user scenarios.
The aim of this study is to propose the selection criteria and 3D orientation computation and presentation.Section II introduces the basic working principles and most important parameters of these sensors (3D accelerometer, 3D gyroscope, and 3D magnetometer).The criteria for selecting the sensors according to the different applications in which the sensors will be used are discussed.Section III focuses on the 3D orientation representations.Section IV discusses the 3D orientation computation algorithms based on the raw sensors outputs.Section V briefly mentions 3D position tracking and finally Section VI concludes the paper.

II. Embedded sensors in the inertial sensing unit
Inertial sensing units usually consist of a tri-axis accelerometer, a tri-axis gyroscope and a tri-axis magnetometer.Theoretically speaking, the inertial measuring unit is able to measure 3D acceleration, 3D rate of turn and 3D magnetic field.Sensor orientation can be calculated using the initial orientation and the subsequent changes of orientation using data from the gyroscope output.However, because of errors inherent in using only the gyroscope output the orientation is better estimated using data fusion where the outputs from the accelerometer and magnetometer are also L. Bai included in the estimation.The details of the orientation computation methods will be presented in Section IV.

II.1. Accelerometer
Accelerometers are widely used in inertial navigation systems in ships and airplanes.Basic working principle of the accelerometer and selection criteria is presented in this section.
The accelerometer is a device for measuring acceleration which is defined as change of velocity with time.Normally, the accelerometer is made up of three components: a proof mass, a suspension which helps locate the mass and secondary transducer which converts force to an electrical signal (either a voltage or a charge) which should be proportional to the acceleration [17].Thus, the general acceleration transducer principle is to measure the force acting on a mass as it is accelerated.The force is measured by a secondary transducer which will develop an electrical signal -either as a voltage or a charge.There are various types of accelerometers, for example, mechanical accelerometers, capacitive accelerometers, piezoelectric accelerometers, thermal accelerometers, Hall-effect accelerometers, which are named based on different technologies applied, among which capacitive, piezoelectric, piezoresistive accelerometers are most commonly used.The development of MEMS technology [18][19] has enabled the integration of the mass and the force sensing sensor into a single chip.This integration of the sensor and processing circuitry has resulted in sensors which are relatively inexpensive and small enough to be used to track human motion, to be incorporated in handheld game controllers and in mobile phones.
For the measurement of the human upper limb motion, a sensor containing a tri-axial accelerometer is necessary.Important parameters are resolution, dynamic range, linearity, bandwidth and sensitivity.The dynamic range defines the maximum positive and negative accelerations that the accelerometer can measure and is typically specified in g's.It can also be known as the full scale range.The required dynamic range will depend on the application.For example, ±5 to ±8 g is enough for a fall detection accelerometer while ±50g is used in measurement for high impact studies such as crash detection.To measure the human upper limb motion, ±5 g is enough [20].Linearity is used to express the deviation of the relationship between the acceleration (input) and voltage (output), from an ideal straight line.This parameter partly defines the sensor accuracy and indicates the deviation from the specified sensitivity over the devices operating range.It is often specified as a percentage with respect to full scale (%FS).Bandwidth is the sensor operating frequency range over which the specified linearity and sensitivity apply and it is usually measured in Hz.As is known that humans are not able to create body motion much beyond the 10-12 Hz, a sensor bandwidth of 30-60 Hz is adequate for human motion monitoring.Sensitivity is the scale factor or gain of the sensor, which is measured in terms of change in output acceleration to change in the input measured.Accelerometer sensitivity is typically specified in units (mV/g) for analogue-output and LSB/g for digital output.It is affected by the temperature and this dependence is generally specified as percentage change per ºC.Therefore, for neurorehabilitation applications in upper limb motion monitoring, a device with an accelerometer with dynamic range of ± 5g and a bandwidth of the order of 60 Hz is required, which is well within typical MEMS accelerometer specification.

II.2. Gyroscope
The Gyroscope measures the angular motion of an object relative to a specified inertial reference frame [21] and therefore the changes in sensor orientation can, in theory, be calculated through integrating the gyro output.Gyroscopes are widely used in inertial measurement units for inertial navigation, robotics, computer input devices, game controllers and so on.The MEMS gyro units usually measure rate of turn or rotation.Therefore, to estimate the change in orientation it is necessary to integrate this signal.
Rotating the gyro sensor results in a Coriolis force.According to the Coriolis Effect, there will be Coriolis force Coriolis F  acting on the object when the object whose mass is m is travelling with velocity V  along the x-axis and angular velocity   rotates along the z-axis as described in Equation (1).The Coriolis force causes objects to move away from the observer on an outward trajectory.This force is perpendicular to both the velocity and the angular velocity (along the negative y-axis) as shown in Fig. 1.The vibrating tuning fork gyro is most commonly used in MEMS devices.The Coriolis force causes a mechanical structure to vibrate inside the MEMS devices, of which a vibrating tuning fork is usually selected as the proof mass whose inertia forms the basis of the measurement.It is a type of vibratory gyro and contains two masses which are able to resonate at certain amplitude but in opposite directions.The rotation of the tines causes the Coriolis force, in which case, the tines are excited in the plane of the tines.Forces are detected through measuring the changes in capacitance.Displacement from the plane of oscillation is then measured to produce a signal related to the system's rate of rotation.
The key parameters for specifying the performance of the gyroscope are the Linearity (% FS), Bandwidth, Dynamic range and Sensitivity.Additionally, the Noise density (dps/√Hz) defines the standard resolution for both analog and digital gyroscopes.As with all devices, the gyroscope has several sources of errors whose effect have to be minimised.The most significant are the constant bias and Angular Random Walk (ARW).The constant bias is the signal output from the gyro with zero rotation and it can, in theory, be eliminated after static measurements.However any errors in the estimation of the offset or changes in the offset over the measurement period will also be integrated when calculating the change in orientation of the gyro unit.ARW is the noise specification for the gyroscope in the units of °/√hr [22] and it is the outcome of integrating the white noise in the gyro signal and is represented by the Equation (2).This noise specification is directly used in angle calculation and describes the average deviation that caused by the integration of the signal.
where σ is the standard deviation of the white noise and t is the sample rate.

II.3. Magnetometer
The third sensor incorporated in the inertial sensor is the magnetometer.This helps to locate the sensor in the global reference frame.This information is used to relate the reference frames of individual sensor units to each other and is also used in the data fusion process to help correct the errors from the orientation estimations using accelerometers and gyroscopes.The first magnetometer was invented by Gauss in 1833 [23].Magnetometers can now be manufactured using MEMS technology.This results in the availability of magnetometers with low mass, small size, and low power consumption, makes it straightforward to integrate them into MEMS inertial sensing unit and popular devices such as Smartphones.
There are several types of magnetometers such as fluxgate magnetometers, hall-effect magnetometers, and magneto-resistive magnetometers.Here only the magneto-resistive magnetometer is introduced as it is the type of magnetometer that is widely used in commercial inertial sensors.When this material is placed in an external magnetic field which is perpendicular to the current, the direction of the magnetisation angle α will change which causes a change in the material resistivity.The resistance R depends on the strength of the magnetic field [23].Hence by measuring changes in resistance the magnetic field can be calculated.The key magnetometer specification parameters are similar to those of the accelerometer and gyroscope.
The key parameters which are useful in selecting a magnetometer include the Number of Axes, Accuracy, Bandwidth and Resolution.There is no typical requirement of the magnetometer in the human motion tracking.But it is noted that the presence of ferromagnetic materials can cause distortions in the local earth magnetic field, therefore causing the error in orientation estimation.

III. 3D orientation tracking
For assessment of the upper limb motion in the Neurorehabilitation setting, the required measurement parameters are the rotation angles of the upper and lower arms and the relative joint L. Bai positions of the upper limb during the movement.
In order to be able to develop these algorithms it is necessary to discuss the concept of 3D orientation and reference frames.Once this has been done the estimation of individual sensor or limb segment orientation based on the data from accelerometer, gyroscope and magnetometer data can be introduced.Finally, the 3D modelling of the upper limbshoulder, elbow, wrist and hand -using multiple inertial sensors will be developed.
Usually, an object's orientation and position is given relative to a specified or local reference frame.For example, when measuring upper limb movements this reference frame might be the trunk reference frame.However, in order to relate each sensor and segment motion to this local reference frame two other reference frames have to be used.These are the sensor reference frame and the global reference frame.Firstly, the movement of the sensors in their individual (sensor) reference frames have to be transformed into a common global reference frame.This means that the relative orientations of the sensors are now known.The sensor orientation can then be translated into a suitable local reference frame -in this case the trunk reference frame.
Usually, in order to track the changes in orientation of the sensor during the movement, the rotations relative to the global reference frames are used.The three most common ways to represent the orientation of the sensor in 3D space are to use the Euler angle, the Rotation matrix and Quaternions.One of the most important aspects for calculating the sensor's 3D orientation is its reference frame, where 3D orientation refers to the relationship between the current sensor reference and the initial sensor reference frame as the sensor orientation changes.How to choose the most appropriate of the orientation representation methods will be discussed in Section III.4 where a comparison will be made between these three orientation representation methods.

III.1. The Euler angle
The Euler angle, Leonhard Euler [24], uses three angles to describe how the 3D orientation of an object changes as it is moved from one reference frame (x-y-z) to another reference frame (x2-y2-z2).The Euler angle can be represented by different ways of specifying the 3D rotation between the sensor reference frame and the global reference frame as shown in Table 1 below.Usually, the angles are positive while they are rotating along the counter-clockwise of the corresponding axis of its sensor reference frame.As shown in Table 1, these different Euler angle definitions are based on the sequence of the rotation on each axes.Take the example of rotation around the axes in the order of rotating around the z-axis, then the y-axis and then the x-axis (ZYX definition) to show how the 3D Euler rotation is formed.This could be to change the sensor orientation from the changing sensor reference frame to the global (fixed) reference frame.This rotation sequence (ZYX) has been adopted by all the inertial sensors used for the currently commercial available inertial sensors for biomechanical applications or gaming sensors such as Wiimote, Sony Move.Initially, the sensor reference frame is aligned with the global reference frame.As shown in Fig. 3, according to the ZYX definition of Euler angle, the sensor is rotated by an angle ψ about the z-axis of the global reference frame (x, y, z) so that the x-axis and y-axis are transformed to the new x1-axis and y1-axis.Therefore, the new sensor reference frame is (x1-y1-z), which is at an angle ψ to the global reference frame around its z-axis.Secondly, the sensor is then rotated by an angle θ about the y1-axis of the new updated reference frame (x1-y1-z) so that the x1-axis and the z-axis are now the x2-axis and z1-axis.Therefore, the new reference frame becomes (x2-y1-z1), which is at an angle θ about the y1-axis of the previous sensor reference frame (x1-y1-z).Thirdly, the sensor is rotated through an angle ϕ about the x2-axis of the reference frame (x2-y1-z1) and the y2-axis, z2-axis.The final reference is then L. Bai (x2-y2-z2), which is at an angle ϕ about the x2-axis of the previous sensor reference frame (x2-y1-z1).The complete rotation is from the initial reference frame (x-y-z) to the final reference frame (x2-y2-z2), and the orientation of the final reference frame to the initial reference frame, which is the global reference frame, is defined as (ϕ, θ, ψ).
These rotation angles ϕ, θ, and ψ are known as the Roll, Pitch and Yaw of the Euler angle.When a 3D rotation has been made through the above sequence from the global reference frame, the Roll, Pitch and Yaw represent the angles with respect to the global reference frame.
The advantage of using the Euler angle for representing the rotation of the current sensor reference frame relative to the global reference frame is its intuitiveness, which is thought to make easier for researchers to visualise an angular rotation motion.However, there is a problem with this approach.This is because if the Pitch, θ, rotates through 90 degrees, it becomes impossible to distinguish between Roll and Yaw rotations.This behaviour is called the Gimbal lock [25].This loss of one degree of freedom (one rotation has no effect) happens when two of the axes are in the same parallel plane as shown in Fig. 4. It can be seen from orientation output from an Xsens MTx sensor in Fig. 5, the Pitch output is stabilised close to 90 degrees while the outputs of the Roll and Yaw are changing significantly, which indicates the uncertainty of Roll and Yaw output when Pitch is starting to approach 90 degrees.This is a fundamental problem associated with using the Euler angle.Therefore, if it is expected that the sensor Pitch will approach 90 or -90 degrees an alternative method must be used.If this method is used in computation of the position of the upper limb motion, it will cause unpredictable errors when the pitch is approaching to ±90 degrees.Therefore, in order to avoid this problem, two alternative representation methods, the Rotation matrix and the Quaternion are now considered and discussed.

III.2. The Rotation Matrix
The Rotation matrix is used to perform the rotation of a vector in 3D Euclidean space.Its working principle is to rotate the vector (this vector can represent kinematic measurements e.g.acceleration, velocity or position in 3D space) from its initial reference frame to the final reference frame.In order to illustrate this orientation representation, first a 2D Rotation matrix is introduced in the following text.Then a 3D representation will be developed.For example, a 2D vector whose coordinates is (x0, y0) in x-y reference frame is rotated by an angle θ becomes (x1, y1) in the x'-y' reference frame shown in the Fig. 6.

Fig. 6. The formation of 2D rotation matrix
The coordinates in the new reference x'-y' reference frame (x1, y1) related to its initial reference L. Bai frame are as presented in the following equations: Therefore, the rotation between the initial reference frame and the new reference frame can be presented by Rotation matrix R(θ).R(θ) converts the vectors from the initial reference frame to the new reference frame.Similarly, a 3D rotation matrix can be represented as shown in Equations ( 6), ( 7) and ( 8), in which Rx(ϕ), Ry(θ) and Rz(ψ) represent the rotation of ϕ, θ and ψ around X, Y and Z respectively.
The angles in the above equations correspond to the Euler angles: Roll (ϕ), Pitch (θ), and Yaw (ψ).The biomechanical inertial sensor Xsens MTx as well as the gaming sensor Sony Move utilise the rotation matrix RGS to define the rotation between the sensor reference frame and global reference frame.This rotation matrix converts the vector (which can be acceleration, velocity or position) from the sensor reference frame to the global reference frame as shown in Equation ( 9).
The Rotation matrix is a very good orientation presentation for the 3D description of orientation.This is especially so for the complicated translation of the sensor position between the different reference frames, the position is usually presented as a 3×1 vector.The new position will be obtained when the initial position (3×1 vector) is multiplied by a rotation (the 3×3 Rotation matrix).The Rotation matrix is used in solving a range of problems in robotics not only the representation of the orientation but also the forward and inverse manipulator kinematics [26].The advantages and disadvantages of the Rotation matrix and other rotation representation will be discussed in section III.4.

III.3. The Quaternion
The Quaternion is a four dimensional vector.Its defining equation is as follows: The Quaternion vector represents a rotation through an angle α about the rotational axis.Equation ( 10) above can also be written as: , , , q q q q q GS = , as this form makes it easier to use in the computation process for rotating a vector.One important characteristic of the quaternion is its relationship to the complex conjugate (*) qGS: . This characteristic is useful in the rotation of the vector from one reference frame to another.The quaternion qGS rotates the vector from the sensor reference frame to the global reference frame using Equation (11).
Compared with the use of the Euler angle, both the Rotation matrix and the Quaternion have the advantages of avoiding the problem of Gimbal lock.An advantage of the Quaternion over Rotation matrix is that it is more compact (4 numbers in Quaternion representation) than Rotation matrix (9 numbers in Rotation matrix representation), which helps with the data storage and makes its numerical calculations more efficient.The Euler angle has the advantages of minimum representation (only 3 numbers in Euler angle representation).Here the numbers refer to the numbers which are saved for the computation.The Quaternion is a compromise between the Euler angles and the Rotation matrix.Therefore, if the appropriate computational power is available, the rotation matrix is the preferred technique.

III.4. Comparison of rotation representations
From the view of saving the storage and transmission costs, use of the Euler angles is the best choice since it only contains three components.But these three components are not uniquely linked mathematically due to possibility of Gimbal lock.Because the likelihood of the conditions for Gimbal lock occurring during upper limb motion is high this makes the use of the Euler angles unsuitable for 3D upper limb position tracking in this application.The Quaternion and Rotation matrix are better choices.Considering the complexity of the mathematical operations of these two rotation representations, the Quaternion requires lower computational power.However, the use of the Rotation matrix provides an easier way of representing the 3D reference frame transaction in calculating 3D position, in which the computation of the position (3×1 vector) has been changed into matrix multiplication of the Rotation matrix (3×3 matrix) and initial position (3×1 vector).If the data is processed offline and the difference between these three rotation representations in the requirement for computational power and memory is not a significant factor.There, the rotation matrix is a good option as the main rotation representation for studies in the area of upper limb motion monitoring in neurorehabilitation.

IV. Orientation computation algorithm
It may be thought that all the data required for monitoring orientation can be obtained from the accelerometer and the question is raised as to why gyroscopes and magnetometers are required.The following section will seek to explain why an accelerometer only is not able to reliably estimate orientation.

IV.1. Roll and Pitch computation using the accelerometer
It is not possible to get accurate rotation movement from only acceleration data when there is also translational movement.However, when there is no translational movement, the accelerometer output can be used to measure the sensor Roll and Pitch rotation as shown in Fig. 7.The assumption that the average acceleration due to translational movement is zero is made here.The Equation ( 12) and ( 13) below are used to calculate Roll and Pitch angle, and the Ax, Ay and Az are the total acceleration (measurable acceleration) on x-axis, y-axis, and z-axis respectively: When there is Roll and Pitch applied on the accelerometer, there will be the components of the 'gravity' of the accelerometer's x and y axes.However, since Yaw will not cause the change of the gravity components, the Yaw computation cannot be estimated solely by using an accelerometer.

IV.2. Yaw computation by accelerometer and magnetometer
Yaw cannot be computed by the accelerometer alone, but it can be estimated by including information relating the sensors orientation relative to local magnetic north.This is achieved by estimating the heading (Yaw) from the magnetometer output when the sensor is at rest (Equation ( 14)) [5] and then using the change in magnetometer output to estimate yaw.Roll (ϕ), Pitch (θ), and Yaw (ψ).(14) in which, magx, magy and magz are the magnetometer outputs from the inertial sensors on x, L. Bai y and z axes.The Equation ( 14) is used to compute the Yaw for the computation of 3D orientation from inertial sensors when they undergo rotational and translational motion [27].

IV.3. 3D orientation computation using Complementary filter
Although the 3D orientation can be tracked using the accelerometer together with the magnetometer, linear and rotational acceleration will also occur at the same time.This will introduce unacceptable errors into the tracking of changes in sensor orientation tracking.Therefore, the gyroscope is used to provide rate of turn in order to obtain more accurate estimate of changes in sensor orientation.
In actual measurement, the offsets and changes in offsets in the gyro, accelerometer and magnetometer data can result in significant errors in the estimate of position of the order of meters after a couple of seconds.It has been found that the accelerometer is a good indicator of static or low frequency changes in orientation while gyroscope is a good indicator of higher changes in orientation.Therefore, the main idea of using the Complementary filter is to combine or fuse the lower frequency components of the signal (about 0.05 Hz) taken from accelerometer with the higher frequency components from the gyroscope.This should help reduce the effect of these errors.Therefore, the basic idea of the sensor fusion is to add the accelerometer signal through a low-pass filter and the gyroscope signal through a high-pass filter.The Complementary filter is one of the techniques used to fuse the estimates of orientation obtained from the gyro, accelerometer and magnetometer outputs as described in Equation ( 15) [5].
The effectiveness of this filter will now be evaluated by applying the Complementary filter to the raw accelerometer, gyroscope and magnetometer data from the Xsens MTx sensor and comparing the result with the MTx sensor calibrated output which uses the Xsens internal algorithm based on a Kalman filter (XKF).In this test the sensor has only been rotated around the y-axis in the sensor reference frame and the sample rate is 100 Hz.The plot shown in Fig. 8 is the results of the above test using the different methods to compute the orientation.

3D measurement of position
As shown in Fig. 9 flow chart, there are two ways of calculating the position.The Kinematic model, which is based on the upper limb segments linked by joints, derives the position of each upper limb segment from the magnitude of the angle used to perform the rotation of the matrix.Multiple sensors are required to build up the Kinematic model [28].DR method [26] uses double integration of the linear acceleration which has been corrected for gravity from measurable acceleration to calculate position, of which only one sensor on a specific upper limb joint or segment is needed.

V.2. Kinematic model
Based on the kinematic geometry, the displacement of the multi-linked skeleton of human upper limb can be described by the rotation of the upper limb segments about a reference point (shoulder is chosen in this study).For simplification, the human upper limb segments have been treated as the rigid bodies.The links (joints of the upper limb) between the rigid bodies (upper limb segments) are rigid links and the whole upper limb can be seen as a kinematic chain.The model will now be developed L. Bai and some of the assumptions introduced, firstly in for 2D and then for 3D movement [4].
In order to develop a usable kinematic model, it is helpful to introduce some restrictions or assumptions concerning the movement of the segments and links (joints).The validity of these assumptions can then be assessed as the model is tested.A simple kinematic model [28] can be developed if the shoulder is assumed to be a fixed reference point and two sensors are attached on the upper arm and forearm respectively so that the wrist and elbow movement can be tracked.With this configuration the movement of the upper and lower arm can then be tracked relative to the shoulder -or shoulder reference frame.If the shoulder cannot be kept stationary and measurements are being carried out relative to another reference frame -e.g. when tracking peg position in the 9HPT, then an additional sensor can be attached to the shoulder and it is then assumed that the trunk is stationary.The trunk reference frame can be used as the reference frame.A fourth sensor can be attached on the hand when hand movement is to be tracked.

V.3. Dead Reckoning
In order to explore the feasibility of using a single sensor to track the movement of one segment, the DR method [29] is used.This method is of interest because, if successful, it could enable simpler setups for some clinical tests using only one sensor to measure the movement of a particular limb segment e.g. the hand.This would be attractive in terms of system cost and set-up time.The use of a single sensor would provide information on additional parameters such as timing of specific movements within the test, acceleration, velocity profiles and the path followed by the limb during the tests.If these parameters can be reliably measured, then a novel research and assessment tool will have been developed.
The basis of the DR method is to estimate the current sensor position by using the previous position and to double integrate the translational acceleration over elapsed time to estimate the change in position.However, the gravitational component in the measurable acceleration data must first be subtracted from the measurable acceleration by applying the Quaternion or Rotation matrix data.Additionally, the gravitational component in each axis will change as the sensor orientation changes.Therefore, it is necessary to track the orientation as well as the translational acceleration of the sensor in order to be able to remove the gravitational component from the acceleration.

VI. Conclusion
In this paper, the 3D orientation computation and presentation is discussed.The basic working principles and most important parameters of the sensors including 3D accelerometer, 3D gyro-scope, and 3D magnetometer are presented.The criteria for selecting the sensors according to the different applications in which the sensors can be used are discussed.Three different types of 3D orientation representations are presented.A comparison has been made between these three orientation representation methods.3D position tracking based on the 3D orientation and kinematic model has been briefly mentioned.