Based on recent testing results (https://github.com/PX4/Firmware/pull/14175) I tβ¦hink it's time to start gradually switching to the new InvenSense IMU drivers.
- 8 kHz gyro, 4 kHz accel
- DLPF disabled
- scheduled using data ready interrupts where possible (most boards)
- FIFO is emptied at 1 kHz, but can adjusted via `IMU_GYRO_RATEMAX` from 250 Hz - 2000 kHz.
### Comparison with Master (pixracer multicopter 4001)
- small cpu decrease depending on setup
- the actual transfer is done with DMA, but each DMA transaction is relatively expensive to setup and start (I'd estimate ~ 50 us), then once it's complete we have significantly more data to process (filter and integrate)
- cpu usage decreases by about 2% with the default rate (1 kHz like current master)
- cpu usage decreases by about 5% with IMU_GYRO_RATEMAX = 400 Hz
- due to the current hardcoded integration time this causes the attitude controller to now run at 400 Hz, but it's still a good cpu decrease overall
- sensor pipeline is effectively unchanged at the moment, but these drivers also publish raw `sensor_accel_fifo` and `sensor_gyro_fifo` for logging/analysis and will be used directly later.
- control latency increase due to FIFO transfer time
- IMU_GYRO_RATEMAX 2000 Hz: 205 us (master) --> 271 us (PR) (NOTE: master limited to 1 kHz)
- IMU_GYRO_RATEMAX 1000 Hz (default): 205 us (master) --> 360 us (PR)
- IMU_GYRO_RATEMAX 400 Hz: 205 us (master) --> 639 us (PR)
- The icm20602 on the pixracer is a particularly bad case because the sensor is 10 MHz max, but due to the board clock configuration it's actually running at closer to 5.5 MHz. In other cases it's not quite as bad (eg mpu9250 @ 20 MHz).
- If anyone views this as a problem we could probably shave off some latency by emptying the FIFO more intelligently as it fills rather than conservatively checking the number of samples, then transferring only that many.
``` Console
nsh> listener sensor_accel_fifo
TOPIC: sensor_accel_fifo
sensor_accel_fifo_s
timestamp: 21640837 (0.002277 seconds ago)
timestamp_sample: 21640175
device_id: 3607306 (Type: 0x37, SPI:1 (0x0B))
dt: 250.0000
scale: 0.0047
x: [-52, -56, -55, -55, -56, -56, -47, -59, -45, -54, 0, 0, 0, 0, 0, 0]
y: [363, 357, 356, 369, 356, 359, 361, 375, 357, 363, 0, 0, 0, 0, 0, 0]
z: [-2006, -2009, -2007, -2007, -2005, -2013, -2023, -2017, -2013, -2007, 0, 0, 0, 0, 0, 0]
samples: 10
nsh> listener sensor_gyro_fifo
TOPIC: sensor_gyro_fifo
sensor_gyro_fifo_s
timestamp: 216006743 (0.002315 seconds ago)
timestamp_sample: 216006122
device_id: 3672842 (Type: 0x38, SPI:1 (0x0B))
dt: 125.0000
scale: 0.0010
x: [2, 4, -6, -18, 14, -4, 2, 7, 3, 1, -6, 17, -12, 0, 2, -12, -2, 2, -3, -2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
y: [36, -52, -119, -11, 35, -48, -74, -5, 10, -70, -64, -3, 10, -60, -72, 3, 6, -52, -61, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
z: [7, -12, 8, -9, 6, 6, -4, 14, -9, 3, -2, 2, 8, 0, 5, 5, -25, 14, 2, -11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
samples: 20
```
### TODO:
- [x] review rotation change (comment below)
- [x] test px4_fmu-v4 (pixracer)
- [x] test px4_fmu-v4pro (pixhawk 3 pro)