Hello,

I would like to have more info about IMU calibration, if there is any documentation about that.

I want to use the magnetometer from my OAK-D W POE (IMU type: BNO086), but my values are fluctuating a lot, even after switching from MAGNETOMETER_RAW to MAGNETOMETER_CALIBRATED. What is supposed to be the difference between these values? Is it possible to calibrate the sensor on my side based on my environment?

import depthai as dai

pipeline = dai.Pipeline()
imu = pipeline.create(dai.node.IMU)
xlinkOut = pipeline.create(dai.node.XLinkOut)
xlinkOut.setStreamName("imu")

imu.enableIMUSensor(dai.IMUSensor.ACCELEROMETER, 500)
imu.enableIMUSensor(dai.IMUSensor.GYROSCOPE_CALIBRATED, 400)
imu.enableIMUSensor(dai.IMUSensor.MAGNETOMETER_CALIBRATED, 100)

imu.setBatchReportThreshold(1)
imu.setMaxBatchReports(10)
imu.out.link(xlinkOut.input)

with dai.Device(pipeline) as device:
    imuQueue = device.getOutputQueue(name="imu", maxSize=50, blocking=False)    
    print("Starting node")

    while True:
        imuData = imuQueue.get()     
        imuPackets = imuData.packets
    
        for imuPacket in imuPackets:
            acceleroValues = imuPacket.acceleroMeter            
            gyroValues = imuPacket.gyroscope
            magnetometerValues = imuPacket.magneticField            
            m_x = magnetometerValues.x
            m_y = magnetometerValues.y
            m_z = magnetometerValues.z
            print(f"X: {m_x}, Y: {m_y}, Z: {m_z}")
  • jakaskerl replied to this.
  • Hi ivan_sc
    Directly from the core docstrings:

        /**
         * Section 2.1.3
         *
         * Magnetic field measurement without any postprocessing, straight from the sensor.
         * Units are [uTesla]
         */
        MAGNETOMETER_RAW = 0x16,
        /**
         * Section 2.1.3
         *
         * The fully calibrated magnetic field measurement.
         * Units are [uTesla]
         */
        MAGNETOMETER_CALIBRATED = 0x03,
        /**
         * Section 2.1.3
         *
         * The magnetic field measurement without hard-iron offset applied.
         * Units are [uTesla]
         */
        MAGNETOMETER_UNCALIBRATED = 0x0f,

    If you want custom recalibration, you currently have to do it on host. Particularly, the noise and random walk calibrations are important. I think Kalibr has some tools to help you: ethz-asl/kalibrwiki/IMU-Noise-Model

    Thanks,
    Jaka

    Hi ivan_sc
    Directly from the core docstrings:

        /**
         * Section 2.1.3
         *
         * Magnetic field measurement without any postprocessing, straight from the sensor.
         * Units are [uTesla]
         */
        MAGNETOMETER_RAW = 0x16,
        /**
         * Section 2.1.3
         *
         * The fully calibrated magnetic field measurement.
         * Units are [uTesla]
         */
        MAGNETOMETER_CALIBRATED = 0x03,
        /**
         * Section 2.1.3
         *
         * The magnetic field measurement without hard-iron offset applied.
         * Units are [uTesla]
         */
        MAGNETOMETER_UNCALIBRATED = 0x0f,

    If you want custom recalibration, you currently have to do it on host. Particularly, the noise and random walk calibrations are important. I think Kalibr has some tools to help you: ethz-asl/kalibrwiki/IMU-Noise-Model

    Thanks,
    Jaka