1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-24 00:35:34 +03:00

first good version

This commit is contained in:
Sergey 2022-04-14 20:56:37 +03:00
parent 71e491fc12
commit 78c2060093
No known key found for this signature in database
GPG key ID: 4A7AC190CD92FE01
2 changed files with 8 additions and 5 deletions

View file

@ -21,6 +21,7 @@
#include <string.h>
#include <math.h>
#include "common/log.h"
#include "platform.h"
#include "blackbox/blackbox.h"

View file

@ -537,6 +537,9 @@ static void estimationPredict(estimationContext_t * ctx)
posEstimator.est.pos.z += posEstimator.imu.accelNEU.z * sq(ctx->dt) / 2.0f * accWeight;
posEstimator.est.vel.z += posEstimator.imu.accelNEU.z * ctx->dt * sq(accWeight);
}
if (ARMING_FLAG(SIMULATOR_MODE)) {
posEstimator.est.pos.z = baro.BaroAlt;
}
/* Prediction step: XY-axis */
if ((ctx->newFlags & EST_XY_VALID)) {
@ -848,17 +851,16 @@ void initializePositionEstimator(void)
pt1FilterInit(&posEstimator.surface.avgFilter, INAV_SURFACE_AVERAGE_HZ, 0.0f);
}
static bool isInitialized = false;
/**
* Update estimator
* Update rate: loop rate (>100Hz)
*/
void updatePositionEstimator(void)
{
if (ARMING_FLAG(SIMULATOR_MODE)) {
posEstimator.est.pos.z = baro.BaroAlt;
//return;
}
static bool isInitialized = false;
// todo: why this const is inside function?
// static bool isInitialized = false;
if (!isInitialized) {
initializePositionEstimator();