BACKGROUND: I am using a series of IMUs (Inertial Measurement Units - acc, gyro and magnetometer) to try and estimate human joint angles (e.g knee joint angle). I am using the data from three IMUs and passing the data through an ahrs filter in Matlab to give me a quaternion (or Direction Consine Matrix - DCM) representation of each IMU in the global NED (North, East, Down) frame.
A single IMU is placed arbitrarily on the thigh, and one is placed arbitrarily on the shank. The third IMU is positioned carefully so that the forwards/backwards axes of IMU coordinate system is aligned with the forwards/backwards axes of the body coordinate system (this is placed on the foot, where the foot (body) coordinate system is assumed to be the aligned the shank and thigh). - I hope this all makes sense so far!
MY QUESTION: My question is regarding the theory behind the approach I am taking (see methodology heading below). I am new to using IMUs and have very little experience with DCMs and quaternions. I am pretty sure some of my approach is not quite correct, as it does not seem to really matter how out of line with the forward/backward direction my foot/base sensor is - I still seem to get the same joint angle estimation. Does the approach that I am taking make mathematical sense?
Quick Note:
$DCM_{bx}$: represents the x component of the DCM for the updated body coordinate system.
$DCM_{ox}$: represents the x component of the DCM for the original coordinate frame (foot sensor).
$q_{tho}$: is the original quaternion representation of the thigh sensor in the global frame.
$q_{thu}$: is the quaternion representation of the thigh sensor aligned with the body frame.
Please note I have left out shank, and y, z subscript variations for brevity, as the methodology is obviously the same.
METHODOLOGY:
The first step I am taking is to establish a body coordinate system for which the knee joint angle will be estimated. As the foot sensor is aligned in the forward/backward direction, I am assuming that I can first start by transforming the initial orientation to also align with the vertical axes using a DCM. Lets say that the updated body coordinate frame is:
$DCM_b = \begin{bmatrix}DCM_{bx} & DCM_{by} & DCM_{bz}\end{bmatrix}$
where:
$DCM_{bz} = \begin{bmatrix}0 & 0 & 1\end{bmatrix}^T$
$DCM_{by}:$ is the cross product of $DCM_{bz}$ and $DCM_{oz}$ transposed.
$DCM_{bx}:$ is the cross product of $DCM_{by}$ and $DCM_{bz}$ transposed.
I am then converting $DCM_b$ to a quaternion representation $q_b$ so I can use this to transform each of the thigh and shank original sensor orientations (in the global frame) to align with the body coordinate frame (also in the global frame). I am doing this by:
$q_{thu} = q_b \otimes *q_{tho}$
where * represents the quaternion conjugate.
Next, to get the orientation of the thigh and shank sensor at each time instance (k) in the body frame, I am using:
$q_{th(k)} = q_{tho(k)} \otimes q_{thu}$
Finally, the joint angle can be estimated from the relative orientation of the thigh and shank sensor in the body frame by:
$q_{knee(k)} = q_{thu(k)}^- \otimes q_{shu(k)}$
where "-" is the quaternion inverse.
Any thoughts, advice or corrections on the math used in my methodology, or the theory behind the methodology itself would be very much appreciated as I feel like I am getting more and more confused the more I research others' methods online.
Please let me know if you require any further information. Thanks in advance.
Ben