Hi All,
I am attempting to use the Motion DMP to get the Rotation Vector with the ICM20948. All data is coming back from the device in the 9 axis Quat format, but the position it is representing as 0,0,0 is always dependent upon the real world orientation. Meaning, if I start the device flat it returns 0,0,0 and will correctly, but if I start the device on a 45 degree pitch it will also return 0,0,0; all data now being relative to this initial world orientation.
I would have expected the DMP to take into account the MEMS sensor inputs as part of its initial orientation calculation. Have other people seen this? Have they over come it?
Any initial code to reference on how this is supposed to be done using this driver?
inv_icm20948_register_aux_compass(&(icm_device[index]), INV_ICM20948_COMPASS_ID_AK09916, i2cCompassAddress); rc = inv_icm20948_write_reg(&(icm_device[index]), REG_BANK_SEL, 0, 1);
if (rc != 0) {
return rc;
}
// This should be 0xEA = Page 36 of sheet
rc = inv_icm20948_get_whoami(&(icm_device[index]), &whoami);
if (rc != 0) {
return rc;
}
while (whoami != 0xEA);
/* Setup accel and gyro mounting matrix and associated angle for current board */
inv_icm20948_init_matrix(&(icm_device[index]));
// Load the DMP
rc = inv_icm20948_initialize(&(icm_device[index]), dmp3_image, sizeof(dmp3_image));
inv_icm20948_register_aux_compass(&(icm_device[index]), INV_ICM20948_COMPASS_ID_AK09916, i2cCompassAddress);
rc = inv_icm20948_initialize_auxiliary(&(icm_device[index]));
if (rc != 0) {
return rc;
}
// Initialize the matrix
int ii;
for (ii = 0; ii < INV_ICM20948_SENSOR_MAX; ii++)
{
inv_icm20948_set_matrix(&(icm_device[index]), cfg_mounting_matrix, (inv_icm20948_sensor)ii);
}
inv_icm20948_set_fsr(&(icm_device[index]), INV_ICM20948_SENSOR_GAME_ROTATION_VECTOR, (const void *)&cfg_acc_fsr);
inv_icm20948_set_fsr(&(icm_device[index]), INV_ICM20948_SENSOR_RAW_ACCELEROMETER, (const void *)&cfg_acc_fsr);
inv_icm20948_set_fsr(&(icm_device[index]), INV_ICM20948_SENSOR_ACCELEROMETER, (const void *)&cfg_acc_fsr);
inv_icm20948_set_fsr(&(icm_device[index]), INV_ICM20948_SENSOR_RAW_GYROSCOPE, (const void *)&cfg_gyr_fsr);
inv_icm20948_set_fsr(&(icm_device[index]), INV_ICM20948_SENSOR_GYROSCOPE, (const void *)&cfg_gyr_fsr);
inv_icm20948_set_fsr(&(icm_device[index]), INV_ICM20948_SENSOR_MAGNETIC_FIELD_UNCALIBRATED, (const void *)&cfg_gyr_fsr);
inv_icm20948_set_fsr(&(icm_device[index]), INV_ICM20948_SENSOR_ROTATION_VECTOR, (const void *)&cfg_gyr_fsr);
/* re-initialize base state structure */
inv_icm20948_init_structure(&(icm_device[index]));
// Now that Icm20948 device was initialized, we can proceed with DMP image loading
// This step is mandatory as DMP image are not store in non volatile memory
rc = inv_icm20948_load(&(icm_device[index]), dmp3_image, sizeof(dmp3_image));
if (rc != 0) {
return rc;
}
// Set mode
inv_icm20948_set_lowpower_or_highperformance(&(icm_device[index]), 1);
rc = inv_icm20948_enable_sensor(&icm_device, INV_ICM20948_SENSOR_GYROSCOPE, 1);
rc = inv_icm20948_enable_sensor(&icm_device, INV_ICM20948_SENSOR_ACCELEROMETER, 1);
rc = inv_icm20948_enable_sensor(&icm_device, INV_ICM20948_SENSOR_MAGNETIC_FIELD_UNCALIBRATED, 1);
rc = inv_icm20948_enable_sensor(&(icm_device[index]), INV_ICM20948_SENSOR_ROTATION_VECTOR, 1);
Thanks