Added quaternion estimation function.