diff --git a/README.md b/README.md
index f30d670..c4febd9 100644
--- a/README.md
+++ b/README.md
@@ -135,13 +135,13 @@ Complete diagram is Work-in-Progress.
### IMU placement
-Required IMU orientation on the drone is **FLU** (Forward, Left, Up)⁷:
+Default IMU orientation in the code is **LFD** (Left-Forward-Down):
-
+
-In case of using **FRD** orientation (Forward, Right, Down), use [the code for rotation](https://gist.github.com/okalachev/713db47e31bce643dbbc9539d166ce98).
+In case of using other IMU orientation, modify the `rotateIMU` function in the `imu.ino` file.
-*⁷ — This X/Y/Z IMU axis orientation is used in the Flix IMU library, internal accel/gyro/mag axes differ.*
+See [FlixPeriph documentation](https://github.com/okalachev/flixperiph?tab=readme-ov-file#imu-axes-orientation) to learn axis orientation of other IMU boards.
## Version 0
diff --git a/docs/img/flu.svg b/docs/img/flu.svg
deleted file mode 100644
index 2ff7d41..0000000
--- a/docs/img/flu.svg
+++ /dev/null
@@ -1,81 +0,0 @@
-
diff --git a/docs/img/gy91-lfd.svg b/docs/img/gy91-lfd.svg
new file mode 100644
index 0000000..906d1fe
--- /dev/null
+++ b/docs/img/gy91-lfd.svg
@@ -0,0 +1,78 @@
+
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index 106bcd5..60e251c 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -21,6 +21,7 @@ Do the following:
* **Check the IMU data**. Perform `imu` command, check raw accelerometer and gyro output. The output should change as you move the drone.
* **Calibrate the accelerometer.** if is wasn't done before. Perform `ca` command and put the results to `imu.ino` file.
* **Check the attitude estimation**. Connect to the drone using QGroundControl. Rotate the drone in different orientations and check if the attitude estimation shown in QGroundControl is correct.
+* **Check the IMU orientation is set correctly**. If the attitude estimation is rotated, make sure `rotateIMU` function is defined correctly in `imu.ino` file.
* **Check the motors**. Perform the following commands using Serial Monitor:
* `mfr` — should rotate front right motor (counter-clockwise).
* `mfl` — should rotate front left motor (clockwise).
diff --git a/flix/imu.ino b/flix/imu.ino
index 9f29767..e9d9969 100644
--- a/flix/imu.ino
+++ b/flix/imu.ino
@@ -2,9 +2,6 @@
// Repository: https://github.com/okalachev/flix
// Work with the IMU sensor
-// IMU is oriented FLU (front-left-up) style.
-// In case of FRD (front-right-down) orientation of the IMU, use this code:
-// https://gist.github.com/okalachev/713db47e31bce643dbbc9539d166ce98.
#include
#include
@@ -45,6 +42,16 @@ void readIMU() {
// apply scale and bias
acc = (acc - accBias) / accScale;
gyro = gyro - gyroBias;
+ // rotate
+ rotateIMU(acc);
+ rotateIMU(gyro);
+}
+
+void rotateIMU(Vector& data) {
+ // Rotate from LFD to FLU
+ // NOTE: In case of using other IMU orientation, change this line:
+ data = Vector(data.y, data.x, -data.z);
+ // Axes orientation for various boards: https://github.com/okalachev/flixperiph#imu-axes-orientation
}
void calibrateGyro() {