I would like to reset/remove offset quaternion data from real-time IMU sensor recordings. E.g. I get [-0.754, -0.0256, 0.0321, 0.324] (XYZW) when I start recordings. I would like to reset this to be [0, 0, 0, 1] when I start recording, as I am using it to rotate a 3D object which initial quaternion values are [X: 0, Y: 0, Z: 0, W: 1].
I tried subtracting all quaternion data from the first as so:
counter = 0
quat = getting_sensor_data_from_somewhere()
while True:
if counter == 1:
offset = quat
calib_data = [x1 -x2 for x1, x2 in zip(quat, offset)
However, it doesn't seem to be the right solution. I am a bit confused of why W should be 1. Can you help me?
The 3D model are from ThreeJS libraries.