Skip to content

Commit

Permalink
Plane: add flag to disable wp speed scaling on heading and groundtrack
Browse files Browse the repository at this point in the history
  • Loading branch information
magate committed Sep 4, 2024
1 parent 2e1af82 commit 745d2ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ArduPlane/quadplane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ const AP_Param::GroupInfo QuadPlane::var_info[] = {
// @Bitmask: 20: Force RTL mode-forces RTL mode on rc failsafe in VTOL modes overriding bit 5(USE_QRTL)
// @Bitmask: 21: Tilt rotor-tilt motors up when disarmed in FW modes (except manual) to prevent ground strikes.
// @Bitmask: 22: Scale FF by the ratio of VTOL to plane angle P gains in Position 1 phase of transition into VTOL flight as well as reducing VTOL angle P based on airspeed.
// @Bitmask: 23: Disable waypoint speed scaling based on heading and groundtrack angle difference
AP_GROUPINFO("OPTIONS", 58, QuadPlane, options, 0),

AP_SUBGROUPEXTENSION("",59, QuadPlane, var_info2),
Expand Down Expand Up @@ -2998,7 +2999,7 @@ float QuadPlane::get_scaled_wp_speed(float target_bearing_deg) const
{
const float yaw_difference = fabsf(wrap_180(degrees(plane.ahrs.get_yaw()) - target_bearing_deg));
const float wp_speed = wp_nav->get_default_speed_xy() * 0.01;
if (yaw_difference > 20) {
if (!option_is_set(QuadPlane::OPTION::DISABLE_WAYPOINT_SPEED_SCALING) && yaw_difference > 20) {
// this gives a factor of 2x reduction in max speed when
// off by 90 degrees, and 3x when off by 180 degrees
const float speed_reduction = linear_interpolate(1, 3,
Expand Down
1 change: 1 addition & 0 deletions ArduPlane/quadplane.h
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ class QuadPlane
FS_RTL=(1<<20),
DISARMED_TILT_UP=(1<<21),
SCALE_FF_ANGLE_P=(1<<22),
DISABLE_WAYPOINT_SPEED_SCALING=(1<<23),
};
bool option_is_set(OPTION option) const {
return (options.get() & int32_t(option)) != 0;
Expand Down

0 comments on commit 745d2ca

Please sign in to comment.