tecs: added method to handle ekf height resets

Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
Roman 2016-10-17 23:10:16 +02:00
parent 1e1bf7e4bb
commit ae7f61b0bf
1 changed files with 14 additions and 0 deletions

View File

@ -267,6 +267,20 @@ public:
_detect_underspeed_enabled = enabled; _detect_underspeed_enabled = enabled;
} }
// in case of a height reset driven by the estimator we need
// to allow TECS to swallow the step in height and demanded height instantaneously
void handle_alt_step(float delta_alt, float altitude) {
// add height reset delta to all variables involved
// in filtering the demanded height
_hgt_dem_in_old += delta_alt;
_hgt_dem_prev += delta_alt;
_hgt_dem_adj_last += delta_alt;
// reset height states
_integ3_state = altitude;
_integ1_state = _integ2_state = 0.0f;
}
private: private:
struct tecs_state _tecs_state; struct tecs_state _tecs_state;