I’m working on an impulse that uses an accelerometer with a range of +/- 16G (the LSM6DSO). And my impulse has recorded data using that range. Here is a typical feature sample:
(Note I have 2 IMUs on this project. This is collecting accX1,accY1,accZ1,accX2,accY2,accZ2; hence the 6 lines.)
Now in the exported Arduino examples, there is this line near the top:
#define MAX_ACCEPTED_RANGE 2.0f // starting 03/2022, models are generated setting range to +-2, but this example use Arudino library which set range to +-4g. If you are using an older model, ignore this value and use 4.0f instead
Which later down in the example code is used to cap the data that is saved into the buffer:
IMU.readAcceleration(buffer[ix], buffer[ix + 1], buffer[ix + 2]);
for (int i = 0; i < 3; i++) {
if (fabs(buffer[ix + i]) > MAX_ACCEPTED_RANGE) {
buffer[ix + i] = ei_get_sign(buffer[ix + i]) * MAX_ACCEPTED_RANGE;
}
}
I’m trying to figure out why this is. The nano_ble33_sense-accelerometer.ino
example does this, but the Nano BLE33 Sense uses a LSM9DS1 IMU, which is also capable of +/-16G.
Why does the cap used in the examples set such a low max range?
The code comment implies that the model itself is limited to +/-2G. But if a model is a “Fusion” model like mine (since there are 6 axes rather than 3), does that limit somehow get applied anyway?