calibrate enclosure motion outputs

This commit is contained in:
Jay
2026-08-17 10:44:28 -04:00
parent 07d47f99a4
commit a5c3087ee4
5 changed files with 167 additions and 10 deletions
+11 -5
View File
@@ -8,7 +8,8 @@ This milestone does four things:
1. Detects and verifies both sensors by their identification registers.
2. Configures each sensor for a nominal 100 Hz raw output rate.
3. Emits timestamped, sensor-native raw readings over the XIAO USB connection.
4. Maps both sensors into a shared enclosure coordinate frame for validation.
4. Maps both sensors into a shared enclosure coordinate frame and emits both raw
and calibrated readings.
BLE transport and phone-side storage come after the wired sensor path is proven.
@@ -48,7 +49,11 @@ enclosure Y = -native X
enclosure Z = native Z
```
No software calibration, software filtering, or sensor fusion is performed yet.
Software calibration is applied after enclosure-axis mapping. Accelerometer
offset and per-axis scale were measured with a six-face enclosure test. Gyroscope
zero-rate bias and polarity were measured; its 17.5 mdps/LSB scale remains the
nominal datasheet value. Sensor-native and mapped raw counts remain in every
record for diagnostics. No software filtering or sensor fusion is performed yet.
The ESP32-C3 polls at exactly 100 Hz, but each sensor has an independent internal
sample clock. The status registers are read immediately before each XYZ read so a
@@ -79,13 +84,14 @@ Exit the serial monitor with `Ctrl-]`.
After startup metadata, records use CSV:
```text
sequence,poll_timestamp_us,accel_x_raw,accel_y_raw,accel_z_raw,gyro_x_raw,gyro_y_raw,gyro_z_raw,accel_native_x_raw,accel_native_y_raw,accel_native_z_raw,gyro_native_x_raw,gyro_native_y_raw,gyro_native_z_raw,accel_int_source,gyro_status,loop_overrun_count
sequence,poll_timestamp_us,accel_x_raw,accel_y_raw,accel_z_raw,gyro_x_raw,gyro_y_raw,gyro_z_raw,accel_x_mg,accel_y_mg,accel_z_mg,gyro_x_mdps,gyro_y_mdps,gyro_z_mdps,accel_native_x_raw,accel_native_y_raw,accel_native_z_raw,gyro_native_x_raw,gyro_native_y_raw,gyro_native_z_raw,accel_int_source,gyro_status,loop_overrun_count
```
`poll_timestamp_us` is the ESP32-C3 monotonic time immediately before the status
and data reads. It is not the sensors' physical sample time. The axes in the first
six sample columns use the enclosure frame above. Native columns remain available
for diagnostics.
six sample columns use the enclosure frame above. Calibrated acceleration is in
integer milligravity (`mg`), and bias-corrected angular rate is in integer
millidegrees per second (`mdps`). Native columns remain available for diagnostics.
Status bits: