mirror of
https://github.com/okalachev/flix.git
synced 2026-01-12 05:57:52 +00:00
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
This commit is contained in:
@@ -29,10 +29,9 @@ void applyAcc()
|
|||||||
{
|
{
|
||||||
// test should we apply accelerometer gravity correction
|
// test should we apply accelerometer gravity correction
|
||||||
float accNorm = acc.norm();
|
float accNorm = acc.norm();
|
||||||
if (accNorm < ACC_MIN * ONE_G || accNorm > ACC_MAX * ONE_G) {
|
bool landed = !motorsActive() && abs(accNorm - ONE_G) < ONE_G * 0.1f;
|
||||||
// use accelerometer only when we're not accelerating
|
|
||||||
return;
|
if (!landed) return;
|
||||||
}
|
|
||||||
|
|
||||||
// calculate accelerometer correction
|
// calculate accelerometer correction
|
||||||
Vector up = attitude.rotate(Vector(0, 0, -1));
|
Vector up = attitude.rotate(Vector(0, 0, -1));
|
||||||
|
|||||||
Reference in New Issue
Block a user