Using the Nicla Vison LSM6DSOX IMU I am trying the measure the orientation of the camera and using these values I parse them via USB to create a 3D graph however I am experiencing extreme values of drift. The code to get the values are based on the examples eg
# LSM6DSOX Gyro example.
import time
from lsm6dsox import LSM6DSOX
from machine import Pin
from machine import SPI
lsm = LSM6DSOX(SPI(5), cs=Pin("PF6", Pin.OUT_PP, Pin.PULL_UP))
while True:
print("Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}".format(*lsm.accel()))
print("Gyroscope: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}".format(*lsm.gyro()))
print("")
time.sleep_ms(100)
The output looks like this but the gyroscope values are massive whilst being stationary.
Accelerometer: x: 0.014 y: 0.051 z: 1.000
Gyroscope: x: 0.671 y: 0.061 z: -0.122
Accelerometer: x: 0.015 y: 0.051 z: 1.000
Gyroscope: x: 0.610 y: 0.061 z: -0.122
Accelerometer: x: 0.015 y: 0.051 z: 1.000
Gyroscope: x: 0.671 y: 0.061 z: -0.183
Accelerometer: x: 0.015 y: 0.052 z: 1.000
Gyroscope: x: 0.671 y: 0.061 z: -0.183
What methods can be used to zero these values as the adafruit standalone sensor claims to have an uncalibrated offset of only 0.0175 rad/s. Any help would be appreciated