mirror of
https://github.com/okalachev/flix.git
synced 2025-07-27 17:49:33 +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:
parent
415f0e9ad5
commit
57e83040b8
@ -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));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user