As flexion increases, the range of rotation readings decrease. Flexion at 0o offers a full 90o to -90o of rotation, while flexion at 60o only allows for 40o to -35o of rotation. This issue was addressed in our design phase. Since the change in range is linearly proportional to flexion, we can remap the values read by the sensors based on what degree of flexion the leg is at. As flexion increases, the mapping constraints will decrease linearly with it to always output a value from 90o to -90o.
Previous iterations of the code attempted to calculate the Euler angle using a rotation matrix to calculate the intrinsic rotation of the device using the external rotation angles. However, the values were found to not be accurate, most likely due to the absence of the abduction angle. Our current method is an experimental solution that may differ from device to device. If we were to widen the scope of the project we may be able to develop a code/device that accurately measures intrinsic rotation using a rotation matrix. This would likely involve quaternion angle calculations to alleviate calculation strains on the microcontroller.