Large drift using MMC in NDoF sensor fusion mode

Hi all,

First time posting here. I have had very good experience overall using MMC with iOS API. Great engineering there @ mbientlab. Unfortunately, I observe a large drift in the orientations over time, even though I am using NDoF sensor fusion, which makes MMC unusable for my application. To compare, iPhone's IMUs give out very consistent repeatable orientation readings. I must be setting up the MMCs wrongly. Here is the gist of the code. Can someone review if I am doing everything right? How can I get more repeatability? I suspect I am setting the acc and gyro ranges adequately. Or the NDoF sensor fusion is not getting set properly. Or I need to calibrate the sensors, which I have not.

// set device's tx strenght to maximum
mbl_mw_settings_set_tx_power(device.board, 4)

// setup device's sensor fusion settings
mbl_mw_sensor_fusion_set_mode(device.board, MBL_MW_SENSOR_FUSION_MODE_NDOF)
mbl_mw_sensor_fusion_set_acc_range(device.board, MBL_MW_SENSOR_FUSION_ACC_RANGE_16G)
mbl_mw_sensor_fusion_set_gyro_range(device.board, MBL_MW_SENSOR_FUSION_GYRO_RANGE_2000DPS)
mbl_mw_sensor_fusion_write_config(device.board)

// setup quaternion streaming
let signal = mbl_mw_sensor_fusion_get_data_signal(device.board, MBL_MW_SENSOR_FUSION_DATA_QUATERNION)!

mbl_mw_datasignal_subscribe(signal, bridge(obj: self.cameraViewController!)) { (context, data) in
  let quaternion: MblMwQuaternion = data!.pointee.valueAs()
  let cameraViewController: CameraViewController = bridge(ptr: context!)
  cameraViewController.setOrientation(0, simd_quatf(ix: quaternion.x, iy: quaternion.y, iz: quaternion.z, r: quaternion.w))
}
//mbl_mw_sensor_fusion_clear_enabled_mask(device.board)
mbl_mw_sensor_fusion_enable_data(device.board, MBL_MW_SENSOR_FUSION_DATA_QUATERNION)
mbl_mw_sensor_fusion_start(device.board)

Thanks in advance

Regards

Comments

Sign In or Register to comment.