Copter: properly set feedforward enabled before exit

This commit is contained in:
Bill Geyer 2022-04-05 23:58:38 -04:00 committed by Randy Mackay
parent cb4f5ac578
commit 836ae87955
2 changed files with 9 additions and 1 deletions

View File

@ -1471,6 +1471,7 @@ public:
bool init(bool ignore_checks) override;
void run() override;
void exit() override;
bool requires_GPS() const override { return false; }
bool has_manual_throttle() const override { return true; }

View File

@ -104,6 +104,13 @@ bool ModeSystemId::init(bool ignore_checks)
return true;
}
// systemId_exit - clean up systemId controller before exiting
void ModeSystemId::exit()
{
// reset the feedfoward enabled parameter to the initialized state
attitude_control->bf_feedforward(att_bf_feedforward);
}
// systemId_run - runs the systemId controller
// should be called at 100hz or more
void ModeSystemId::run()
@ -179,9 +186,9 @@ void ModeSystemId::run()
switch (systemid_state) {
case SystemIDModeState::SYSTEMID_STATE_STOPPED:
attitude_control->bf_feedforward(att_bf_feedforward);
break;
case SystemIDModeState::SYSTEMID_STATE_TESTING:
attitude_control->bf_feedforward(att_bf_feedforward);
if (copter.ap.land_complete) {
systemid_state = SystemIDModeState::SYSTEMID_STATE_STOPPED;