Making an ESP32-based quadcopter from scratch
Python arduinoautopilotcontrol-theorydroneesp32flight-controlflight-controllermavlinkquadcopterquadcopter-firmwareuav
Apply accelerometer in estimation only when we're landed and stable Accelerometer gives only motors specific force in flight, which makes it useless to determine the current vertial
Oleg Kalachev57e83040b867
diff --git a/flix/estimate.ino b/flix/estimate.inoindex b8445a7..6302e9f 100644--- a/flix/estimate.ino+++ b/flix/estimate.ino@@ -29,10 +29,9 @@ void applyAcc(){// test should we apply accelerometer gravity correctionfloat accNorm = acc.norm();- if (accNorm < ACC_MIN * ONE_G || accNorm > ACC_MAX * ONE_G) {- // use accelerometer only when we're not accelerating- return;- }+ bool landed = !motorsActive() && abs(accNorm - ONE_G) < ONE_G * 0.1f;++ if (!landed) return;// calculate accelerometer correctionVector up = attitude.rotate(Vector(0, 0, -1));