Copter: implement is_landing and is_taking_off for use by lua

This commit is contained in:
Tatsuya Yamaguchi 2023-05-19 11:56:52 +09:00 committed by Tom Pittenger
parent 7ebc2256bc
commit fdac668782
2 changed files with 14 additions and 0 deletions

View File

@ -443,6 +443,18 @@ bool Copter::has_ekf_failsafed() const
return failsafe.ekf; return failsafe.ekf;
} }
// returns true if vehicle is landing. Only used by Lua scripts
bool Copter::is_landing() const
{
return flightmode->is_landing();
}
// returns true if vehicle is taking off. Only used by Lua scripts
bool Copter::is_taking_off() const
{
return flightmode->is_taking_off();
}
#endif // AP_SCRIPTING_ENABLED #endif // AP_SCRIPTING_ENABLED
bool Copter::current_mode_requires_mission() const bool Copter::current_mode_requires_mission() const

View File

@ -679,6 +679,8 @@ private:
// lua scripts use this to retrieve EKF failsafe state // lua scripts use this to retrieve EKF failsafe state
// returns true if the EKF failsafe has triggered // returns true if the EKF failsafe has triggered
bool has_ekf_failsafed() const override; bool has_ekf_failsafed() const override;
bool is_landing() const override;
bool is_taking_off() const override;
#endif // AP_SCRIPTING_ENABLED #endif // AP_SCRIPTING_ENABLED
void rc_loop(); void rc_loop();
void throttle_loop(); void throttle_loop();