Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC_Attitude:Add TKOFF/LAND Only Weathervaning option #23043

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions libraries/AC_AttitudeControl/AC_WeatherVane.cpp
Expand Up @@ -90,7 +90,7 @@ const AP_Param::GroupInfo AC_WeatherVane::var_info[] = {
// @Param: OPTIONS
// @DisplayName: Weathervaning options
// @Description: Options impacting weathervaning behaviour
// @Bitmask: 0:Use pitch when nose or tail-in for faster weathervaning
// @Bitmask: 0:Use pitch when nose or tail-in for faster weathervaning, 1:Only Weathervane in landings or takeoffs
// @User: Standard
AP_GROUPINFO("OPTIONS", 9, AC_WeatherVane, _options, 0),

Expand All @@ -107,10 +107,11 @@ AC_WeatherVane::AC_WeatherVane(void)
bool AC_WeatherVane::get_yaw_out(float &yaw_output, const int16_t pilot_yaw, const float hgt, const float roll_cdeg, const float pitch_cdeg, const bool is_takeoff, const bool is_landing)
{
Direction dir = (Direction)_direction.get();
if ((dir == Direction::OFF) || !allowed || (pilot_yaw != 0) || !is_positive(_gain)) {
if ((dir == Direction::OFF) || !allowed || (pilot_yaw != 0) || !is_positive(_gain)|| (!(is_takeoff || is_landing) && (bool(uint8_t(_options.get()) & uint8_t(Options::TAKEOFF_OR_LAND_ONLY))))) {
// parameter disabled, or 0 gain
// disabled temporarily
// dont't override pilot
// not in takeoff and landing when option for only those cases is set
reset();
return false;
}
Expand Down
1 change: 1 addition & 0 deletions libraries/AC_AttitudeControl/AC_WeatherVane.h
Expand Up @@ -33,6 +33,7 @@ class AC_WeatherVane {

enum class Options {
PITCH_ENABLE = (1<<0),
TAKEOFF_OR_LAND_ONLY = (1<<1),
};

// Paramaters
Expand Down