AugustinLetourneur

  • Jul 18, 2024
  • Joined Jun 14, 2024
  • 0 best answers
  • It's a simple code like the code in the conversation above, my goal is really to understand how I can get the data from the magnetometer because I only receive zeros from this sensor value. I think it is not defined.

    from depthai_sdk import OakCamera
    from depthai_sdk.classes import IMUPacket
    from time import sleep
    
    with OakCamera() as oak:
    imu = oak.create_imu()
    imu.config_imu(report_rate=400, batch_report_threshold=5)
    
    def callback(packet: IMUPacket):
    print(packet)
    sleep(1)
    
    oak.callback(imu.out.main, callback=callback)
    oak.start(blocking=True)
    
    # from depthai_sdk import OakCamera
    # from depthai_sdk.classes import IMUPacket
    
    # def callback(packet: IMUPacket):
    # for d in packet.data:
    # gyro: dai.IMUReportGyroscope = d.gyroscope
    # accel: dai.IMUReportAccelerometer = d.acceleroMeter
    # mag: dai.IMUReportMagneticField = d.magneticField
    # print(gyro.x, gyro.y, gyro.z)
    # print(accel.x, accel.y, accel.z)
    # print(mag.x, mag.y, mag.z)
    
    # with OakCamera() as oak:
    # imu = oak.create_imu()
    # imu.config_imu(report_rate=10, batch_report_threshold=2)
    # print(oak.device.getConnectedIMU())
    # oak.callback(imu, callback=callback)
    # oak.start(blocking=True)
  • Hi, Is it possible to read the data from the magnetometer in the terminal? I have the impression that it has not been defined. Would you know how to find out the magnetometer data ?

    IMU Packet: ['Accelerometer [m/s2]: (x: 0.08, y: -0.34, z: -9.89), Gyroscope [rad/s]: (x: -0.00, y: 0.00, z: -0.01))', 'Accelerometer [m/s2]: (x: 0.05, y: -0.35, z: -9.92), Gyroscope [rad/s]: (x: 0.00, y: -0.01, z: 0.00))', 'Accelerometer [m/s2]: (x: 0.07, y: -0.34, z: -9.91), Gyroscope [rad/s]: (x: -0.01, y: -0.00, z: -0.01))', 'Accelerometer [m/s2]: (x: 0.06, y: -0.34, z: -9.90), Gyroscope [rad/s]: (x: -0.01, y: 0.00, z: -0.01))', 'Accelerometer [m/s2]: (x: 0.06, y: -0.35, z: -9.91), Gyroscope [rad/s]: (x: -0.01, y: 0.00, z: 0.00))']