Closed guanming001 closed 4 years ago
I tried to increase the update rate to close to 90 Hz by modifying the function inv_icm20948_augmented_sensors_update_odr
in Icm20948Augmented.c
Replace *updatedDelayPtr = lDelayInMs;
with *updatedDelayPtr = 10;
to hardcode the delay as 10 ms
``` void inv_icm20948_augmented_sensors_update_odr(struct inv_icm20948 * s, unsigned char androidSensor, unsigned short * updatedDelayPtr) { unsigned short lDelayInMs = 0xFFFF; // max value of uint16_t, so that we can get min value of all enabled sensors switch(androidSensor) { case ANDROID_SENSOR_GRAVITY: case ANDROID_SENSOR_GAME_ROTATION_VECTOR: case ANDROID_SENSOR_LINEAR_ACCELERATION: AUGMENTED_SENSOR_GET_6QUAT_MIN_ODR(s, lDelayInMs); // *updatedDelayPtr = lDelayInMs; *updatedDelayPtr = 10; // Added by GM to set output data rate to 100 Hz break; case ANDROID_SENSOR_WAKEUP_GRAVITY: case ANDROID_SENSOR_WAKEUP_GAME_ROTATION_VECTOR: case ANDROID_SENSOR_WAKEUP_LINEAR_ACCELERATION: AUGMENTED_SENSOR_GET_6QUATWU_MIN_ODR(s, lDelayInMs); // *updatedDelayPtr = lDelayInMs; *updatedDelayPtr = 10; // Added by GM to set output data rate to 100 Hz break; case ANDROID_SENSOR_ORIENTATION: case ANDROID_SENSOR_ROTATION_VECTOR: AUGMENTED_SENSOR_GET_9QUAT_MIN_ODR(s, lDelayInMs); // *updatedDelayPtr = lDelayInMs; *updatedDelayPtr = 10; // Added by GM to set output data rate to 100 Hz break; case ANDROID_SENSOR_WAKEUP_ORIENTATION: case ANDROID_SENSOR_WAKEUP_ROTATION_VECTOR: AUGMENTED_SENSOR_GET_9QUATWU_MIN_ODR(s, lDelayInMs); // *updatedDelayPtr = lDelayInMs; *updatedDelayPtr = 10; // Added by GM to set output data rate to 100 Hz break; default : break; } } ```
Hey Guan,
I have also changed the value to 10, but i see no change in quaternion output. Have you done anything else?
thanks!
EDIT:
i added the line rc = inv_icm20948_set_sensor_period(&icm_device, idd_sensortype_conversion(INV_SENSOR_TYPE_GAME_ROTATION_VECTOR), 10); in the working.ino file and now i see the quaternions much much faster!
Could you please share the program you have to visualize quaternions?
thanks :)
Thank you very much for making this useful library!
I was able to modify the 20948_Working.ino code to stream INV_SENSOR_TYPE_ROTATION_VECTOR that uses 9-axis DMP at around 40 Hz.
May I check if it is possible to further increase the update rate?
Thank you.