Skip to content

Commit 74119a1

Browse files
marknolanclaude
andcommitted
DEV-922 Write mag driver-form alignment as a literal (Copilot review)
matrixInverse3x3 on the mag applied matrix (determinant -1) stamps -0.0 into all six zero entries, which survives serialization and fails Arrays.deepEquals against 0.0. The matrix is its own inverse, so write the driver-form literal directly; ASM_PC_00032 guards that it really is the inverse of the applied form. The accel/gyro inverse (det +1) computes canonical 0.0 entries and stays derived. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent fea5a79 commit 74119a1

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ShimmerDriver/src/main/java/com/shimmerresearch/verisense/sensors/SensorLSM6DSV.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,13 @@ public static final class DatabaseConfigHandle {
261261
// matrix with cross-axis terms.
262262
public static final double[][] DEFAULT_ALIGNMENT_LSM6DSV_ACCEL_GYRO =
263263
UtilCalibration.matrixInverse3x3(APPLIED_ALIGNMENT_LSM6DSV_ACCEL_GYRO);
264-
public static final double[][] DEFAULT_ALIGNMENT_LIS2MDL_MAG =
265-
UtilCalibration.matrixInverse3x3(APPLIED_ALIGNMENT_LIS2MDL_MAG);
264+
/* The mag applied matrix is its own inverse (an involution), but deriving it via
265+
* matrixInverse3x3 would stamp -0.0 into the zero entries (its determinant is -1),
266+
* which survives serialization and fails Arrays.deepEquals against 0.0 - so the
267+
* driver-form matrix is written out as a literal. ASM_PC_00032 guards that it
268+
* really is the inverse of the applied form. (The accel/gyro inverse above is
269+
* det +1 and computes canonical 0.0 entries, so it stays derived.) */
270+
public static final double[][] DEFAULT_ALIGNMENT_LIS2MDL_MAG = {{1,0,0},{0,0,1},{0,1,0}};
266271

267272
// Accel sensitivity (LSB per m/s^2) = 32768/(FS_g*9.80665)
268273
public static final double[][] SENS_ACCEL_2G = {{1670.703,0,0},{0,1670.703,0},{0,0,1670.703}};

0 commit comments

Comments
 (0)