mirror of
https://github.com/okalachev/flix.git
synced 2026-01-11 21:46:55 +00:00
Compare commits
1 Commits
imu-rot
...
4d70018d73
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d70018d73 |
@@ -42,6 +42,7 @@ const char* motd =
|
|||||||
"log [dump] - print log header [and data]\n"
|
"log [dump] - print log header [and data]\n"
|
||||||
"cr - calibrate RC\n"
|
"cr - calibrate RC\n"
|
||||||
"ca - calibrate accel\n"
|
"ca - calibrate accel\n"
|
||||||
|
"cl - calibrate level\n"
|
||||||
"mfr, mfl, mrr, mrl - test motor (remove props)\n"
|
"mfr, mfl, mrr, mrl - test motor (remove props)\n"
|
||||||
"sys - show system info\n"
|
"sys - show system info\n"
|
||||||
"reset - reset drone's state\n"
|
"reset - reset drone's state\n"
|
||||||
|
|||||||
@@ -44,6 +44,13 @@ void readIMU() {
|
|||||||
gyro = Quaternion::rotateVector(gyro, rotation.inversed());
|
gyro = Quaternion::rotateVector(gyro, rotation.inversed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void calibrateLevel() {
|
||||||
|
print("Place perfectly level [1 sec]\n");
|
||||||
|
pause(1);
|
||||||
|
Quaternion correction = Quaternion::fromBetweenVectors(Quaternion::rotateVector(Vector(0, 0, 1), attitude), Vector(0, 0, 1));
|
||||||
|
imuRotation = Quaternion::rotate(correction, Quaternion::fromEuler(imuRotation)).toEuler();
|
||||||
|
print("✓ Done: %.3f %.3f %.3f\n", degrees(imuRotation.x), degrees(imuRotation.y), degrees(imuRotation.z));
|
||||||
|
}
|
||||||
|
|
||||||
void calibrateGyroOnce() {
|
void calibrateGyroOnce() {
|
||||||
static Delay landedDelay(2);
|
static Delay landedDelay(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user