diff --git a/docs/Settings.md b/docs/Settings.md index a634d2eabda..841b7cfba4c 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -3692,6 +3692,16 @@ When ON, NAV engine will slow down when switching to the next waypoint. This pri --- +### nav_min_ground_speed + +Minimum ground speed for navigation flight modes [m/s]. Default 7 m/s. + +| Default | Min | Max | +| --- | --- | --- | +| 7 | 6 | 50 | + +--- + ### nav_min_rth_distance Minimum distance from homepoint when RTH full procedure will be activated [cm]. Below this distance, the mode will activate at the current location and the final phase is executed (loiter / land). Above this distance, the full procedure is activated, which may include initial climb and flying directly to the homepoint before entering the loiter / land phase. diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index bcc0d99a08b..4d349b7e0be 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -2486,6 +2486,12 @@ groups: field: general.auto_speed min: 10 max: 2000 + - name: nav_min_ground_speed + description: "Minimum ground speed for navigation flight modes [m/s]. Default 7 m/s." + default_value: 7 + field: general.min_ground_speed + min: 6 + max: 50 - name: nav_max_auto_speed description: "Maximum speed allowed in fully autonomous modes (RTH, WP) [cm/s] [Multirotor only]" default_value: 1000 diff --git a/src/main/navigation/navigation.c b/src/main/navigation/navigation.c index 2861adc8fee..82cb7461f07 100644 --- a/src/main/navigation/navigation.c +++ b/src/main/navigation/navigation.c @@ -97,7 +97,7 @@ STATIC_ASSERT(NAV_MAX_WAYPOINTS < 254, NAV_MAX_WAYPOINTS_exceeded_allowable_rang PG_REGISTER_ARRAY(navWaypoint_t, NAV_MAX_WAYPOINTS, nonVolatileWaypointList, PG_WAYPOINT_MISSION_STORAGE, 2); #endif -PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 5); +PG_REGISTER_WITH_RESET_TEMPLATE(navConfig_t, navConfig, PG_NAV_CONFIG, 6); PG_RESET_TEMPLATE(navConfig_t, navConfig, .general = { @@ -132,6 +132,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig, #endif .waypoint_load_on_boot = SETTING_NAV_WP_LOAD_ON_BOOT_DEFAULT, // load waypoints automatically during boot .auto_speed = SETTING_NAV_AUTO_SPEED_DEFAULT, // speed in autonomous modes (3 m/s = 10.8 km/h) + .min_ground_speed = SETTING_NAV_MIN_GROUND_SPEED_DEFAULT, // Minimum ground speed (m/s) .max_auto_speed = SETTING_NAV_MAX_AUTO_SPEED_DEFAULT, // max allowed speed autonomous modes .max_auto_climb_rate = SETTING_NAV_AUTO_CLIMB_RATE_DEFAULT, // 5 m/s .max_manual_speed = SETTING_NAV_MANUAL_SPEED_DEFAULT, diff --git a/src/main/navigation/navigation.h b/src/main/navigation/navigation.h index d4ee6e078ed..b5c7953e12a 100644 --- a/src/main/navigation/navigation.h +++ b/src/main/navigation/navigation.h @@ -245,6 +245,7 @@ typedef struct navConfig_s { #endif bool waypoint_load_on_boot; // load waypoints automatically during boot uint16_t auto_speed; // autonomous navigation speed cm/sec + uint8_t min_ground_speed; // Minimum navigation ground speed [m/s] uint16_t max_auto_speed; // maximum allowed autonomous navigation speed cm/sec uint16_t max_auto_climb_rate; // max vertical speed limitation cm/sec uint16_t max_manual_speed; // manual velocity control max horizontal speed diff --git a/src/main/navigation/navigation_fixedwing.c b/src/main/navigation/navigation_fixedwing.c index 86746023c77..f1bff8f804d 100755 --- a/src/main/navigation/navigation_fixedwing.c +++ b/src/main/navigation/navigation_fixedwing.c @@ -60,9 +60,8 @@ #define NAV_FW_BASE_PITCH_CUTOFF_FREQUENCY_HZ 2.0f #define NAV_FW_BASE_ROLL_CUTOFF_FREQUENCY_HZ 10.0f -// If we are going slower than NAV_FW_MIN_VEL_SPEED_BOOST - boost throttle to fight against the wind +// If we are going slower than the minimum ground speed (navConfig()->general.min_ground_speed) - boost throttle to fight against the wind #define NAV_FW_THROTTLE_SPEED_BOOST_GAIN 1.5f -#define NAV_FW_MIN_VEL_SPEED_BOOST 700.0f // 7 m/s // If this is enabled navigation won't be applied if velocity is below 3 m/s //#define NAV_FW_LIMIT_MIN_FLY_VELOCITY @@ -552,10 +551,10 @@ int16_t applyFixedWingMinSpeedController(timeUs_t currentTimeUs) previousTimePositionUpdate = currentTimeUs; if (deltaMicrosPositionUpdate < MAX_POSITION_UPDATE_INTERVAL_US) { - float velThrottleBoost = (NAV_FW_MIN_VEL_SPEED_BOOST - posControl.actualState.velXY) * NAV_FW_THROTTLE_SPEED_BOOST_GAIN * US2S(deltaMicrosPositionUpdate); + float velThrottleBoost = ((navConfig()->general.min_ground_speed * 100.0f) - posControl.actualState.velXY) * NAV_FW_THROTTLE_SPEED_BOOST_GAIN * US2S(deltaMicrosPositionUpdate); // If we are in the deadband of 50cm/s - don't update speed boost - if (fabsf(posControl.actualState.velXY - NAV_FW_MIN_VEL_SPEED_BOOST) > 50) { + if (fabsf(posControl.actualState.velXY - (navConfig()->general.min_ground_speed * 100.0f)) > 50) { throttleSpeedAdjustment += velThrottleBoost; } diff --git a/src/main/sensors/battery.c b/src/main/sensors/battery.c index 3eaeecc5f08..3745ed7a8ea 100644 --- a/src/main/sensors/battery.c +++ b/src/main/sensors/battery.c @@ -134,7 +134,6 @@ void pgResetFn_batteryProfiles(batteryProfile_t *instance) .failsafe_throttle = SETTING_FAILSAFE_THROTTLE_DEFAULT, // default throttle off. .nav = { - .mc = { .hover_throttle = SETTING_NAV_MC_HOVER_THR_DEFAULT, }, @@ -147,7 +146,6 @@ void pgResetFn_batteryProfiles(batteryProfile_t *instance) .launch_throttle = SETTING_NAV_FW_LAUNCH_THR_DEFAULT, .launch_idle_throttle = SETTING_NAV_FW_LAUNCH_IDLE_THR_DEFAULT, // Motor idle or MOTOR_STOP } - }, #if defined(USE_POWER_LIMITS)