1
0
Fork 0
mirror of https://github.com/iNavFlight/inav.git synced 2025-07-19 14:25:16 +03:00

Move minimum ground speed to a changeable parameter

This commit is contained in:
MrD-RC 2023-10-30 13:24:55 +00:00
parent 2ac549bfba
commit 13d8fbab90
5 changed files with 22 additions and 5 deletions

View file

@ -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 | 45 |
---
### 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.

View file

@ -1043,6 +1043,12 @@ groups:
default_value: 1000
min: PWM_RANGE_MIN
max: PWM_RANGE_MAX
- name: nav_min_ground_speed
description: "Minimum ground speed for navigation flight modes [m/s]. Default 7 m/s."
default_value: 7
field: nav.min_ground_speed
min: 6
max: 45
- name: nav_mc_hover_thr
description: "Multicopter hover throttle hint for altitude controller. Should be set to approximate throttle value when drone is hovering."
default_value: 1300

View file

@ -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 (currentBatteryProfile->nav.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 = ((currentBatteryProfile->nav.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 - (currentBatteryProfile->nav.min_ground_speed * 100.0f)) > 50) {
throttleSpeedAdjustment += velThrottleBoost;
}

View file

@ -134,6 +134,7 @@ void pgResetFn_batteryProfiles(batteryProfile_t *instance)
.failsafe_throttle = SETTING_FAILSAFE_THROTTLE_DEFAULT, // default throttle off.
.nav = {
.min_ground_speed = SETTING_NAV_MIN_GROUND_SPEED_DEFAULT,
.mc = {
.hover_throttle = SETTING_NAV_MC_HOVER_THR_DEFAULT,
@ -147,7 +148,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)

View file

@ -123,6 +123,8 @@ typedef struct batteryProfile_s {
uint16_t launch_throttle; // Launch throttle
} fw;
uint8_t min_ground_speed; // Minimum navigation ground speed [m/s]
} nav;
#if defined(USE_POWER_LIMITS)