mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
lsm9ds1_mag: fix orientation (#13925)
- X is aligned with -X of lsm9ds1 accel/gyro - Z is up (RHC), flip z for publication
This commit is contained in:
@@ -194,10 +194,11 @@ void LSM9DS1_MAG::Run()
|
|||||||
if (mreport.STATUS_REG_M & STATUS_REG_M_BIT::ZYXDA) {
|
if (mreport.STATUS_REG_M & STATUS_REG_M_BIT::ZYXDA) {
|
||||||
// X, Y and Z-axis new data available.
|
// X, Y and Z-axis new data available.
|
||||||
|
|
||||||
// sensor X is left, Y is back, and Z is up
|
// sensor Z is up (RHC), flip z for publication
|
||||||
int16_t x = -combine(mreport.OUT_Y_L_M, mreport.OUT_Y_H_M); // X := -Y
|
// sensor X is aligned with -X of lsm9ds1 accel/gyro
|
||||||
int16_t y = -combine(mreport.OUT_X_L_M, mreport.OUT_X_H_M); // Y := -X
|
int16_t x = -combine(mreport.OUT_X_L_M, mreport.OUT_X_H_M);
|
||||||
int16_t z = -combine(mreport.OUT_Z_L_M, mreport.OUT_Z_H_M); // Z := -Z
|
int16_t y = combine(mreport.OUT_Y_L_M, mreport.OUT_Y_H_M);
|
||||||
|
int16_t z = -combine(mreport.OUT_Z_L_M, mreport.OUT_Z_H_M);
|
||||||
|
|
||||||
_px4_mag.update(timestamp_sample, x, y, z);
|
_px4_mag.update(timestamp_sample, x, y, z);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user