AP_TECS: added reset() method

used at end of VTOL takeoff
This commit is contained in:
Andrew Tridgell 2020-02-06 15:43:16 +11:00
parent bf544136c1
commit 04b307aafc
2 changed files with 11 additions and 2 deletions

View File

@ -911,7 +911,7 @@ void AP_TECS::_update_pitch(void)
void AP_TECS::_initialise_states(int32_t ptchMinCO_cd, float hgt_afe)
{
// Initialise states and variables if DT > 1 second or in climbout
if (_DT > 1.0f)
if (_DT > 1.0f || _need_reset)
{
_integTHR_state = 0.0f;
_integSEB_state = 0.0f;
@ -927,6 +927,7 @@ void AP_TECS::_initialise_states(int32_t ptchMinCO_cd, float hgt_afe)
_flags.reached_speed_takeoff = false;
_DT = 0.1f; // when first starting TECS, use a
// small time constant
_need_reset = false;
}
else if (_flight_stage == AP_Vehicle::FixedWing::FLIGHT_TAKEOFF || _flight_stage == AP_Vehicle::FixedWing::FLIGHT_ABORT_LAND)
{

View File

@ -116,7 +116,12 @@ public:
void use_synthetic_airspeed(void) {
_use_synthetic_airspeed_once = true;
}
// reset on next loop
void reset(void) override {
_need_reset = true;
}
// this supports the TECS_* user settable parameters
static const struct AP_Param::GroupInfo var_info[];
@ -320,6 +325,9 @@ private:
float _land_pitch_min = -90;
// need to reset on next loop
bool _need_reset;
// internal variables to be logged
struct {
float SKE_weighting;