mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-16 21:05:32 +03:00
Merge pull request #7461 from iNavFlight/avs-no-p-i-autotune
Don't change P, I and D during FW autotune
This commit is contained in:
commit
67bc9c48fa
3 changed files with 0 additions and 70 deletions
|
@ -1142,26 +1142,6 @@ D-Series telemetry only: Set to 1 to send raw VBat value in 0.1V resolution for
|
|||
|
||||
---
|
||||
|
||||
### fw_autotune_ff_to_i_tc
|
||||
|
||||
FF to I time (defines time for I to reach the same level of response as FF) [ms]
|
||||
|
||||
| Default | Min | Max |
|
||||
| --- | --- | --- |
|
||||
| 600 | 100 | 5000 |
|
||||
|
||||
---
|
||||
|
||||
### fw_autotune_ff_to_p_gain
|
||||
|
||||
FF to P gain (strength relationship) [%]
|
||||
|
||||
| Default | Min | Max |
|
||||
| --- | --- | --- |
|
||||
| 10 | 0 | 100 |
|
||||
|
||||
---
|
||||
|
||||
### fw_autotune_max_rate_deflection
|
||||
|
||||
The target percentage of maximum mixer output used for determining the rates in `AUTO` and `LIMIT`.
|
||||
|
@ -1182,16 +1162,6 @@ Minimum stick input [%], after applying deadband and expo, to start recording th
|
|||
|
||||
---
|
||||
|
||||
### fw_autotune_p_to_d_gain
|
||||
|
||||
P to D gain (strength relationship) [%]
|
||||
|
||||
| Default | Min | Max |
|
||||
| --- | --- | --- |
|
||||
| 0 | 0 | 200 |
|
||||
|
||||
---
|
||||
|
||||
### fw_autotune_rate_adjustment
|
||||
|
||||
`AUTO` and `LIMIT` adjust the rates to match the capabilities of the airplane, with `LIMIT` they are never increased above the starting rates setting. `FIXED` does not adjust the rates. Rates are not changed when tuning in `ANGLE` mode.
|
||||
|
|
|
@ -2229,24 +2229,6 @@ groups:
|
|||
field: fw_min_stick
|
||||
min: 0
|
||||
max: 100
|
||||
- name: fw_autotune_ff_to_p_gain
|
||||
description: "FF to P gain (strength relationship) [%]"
|
||||
default_value: 10
|
||||
field: fw_ff_to_p_gain
|
||||
min: 0
|
||||
max: 100
|
||||
- name: fw_autotune_p_to_d_gain
|
||||
description: "P to D gain (strength relationship) [%]"
|
||||
default_value: 0
|
||||
field: fw_p_to_d_gain
|
||||
min: 0
|
||||
max: 200
|
||||
- name: fw_autotune_ff_to_i_tc
|
||||
description: "FF to I time (defines time for I to reach the same level of response as FF) [ms]"
|
||||
default_value: 600
|
||||
field: fw_ff_to_i_time_constant
|
||||
min: 100
|
||||
max: 5000
|
||||
- name: fw_autotune_rate_adjustment
|
||||
description: "`AUTO` and `LIMIT` adjust the rates to match the capabilities of the airplane, with `LIMIT` they are never increased above the starting rates setting. `FIXED` does not adjust the rates. Rates are not changed when tuning in `ANGLE` mode."
|
||||
default_value: "AUTO"
|
||||
|
|
|
@ -60,9 +60,6 @@ PG_REGISTER_WITH_RESET_TEMPLATE(pidAutotuneConfig_t, pidAutotuneConfig, PG_PID_A
|
|||
|
||||
PG_RESET_TEMPLATE(pidAutotuneConfig_t, pidAutotuneConfig,
|
||||
.fw_min_stick = SETTING_FW_AUTOTUNE_MIN_STICK_DEFAULT,
|
||||
.fw_ff_to_p_gain = SETTING_FW_AUTOTUNE_FF_TO_P_GAIN_DEFAULT,
|
||||
.fw_ff_to_i_time_constant = SETTING_FW_AUTOTUNE_FF_TO_I_TC_DEFAULT,
|
||||
.fw_p_to_d_gain = SETTING_FW_AUTOTUNE_P_TO_D_GAIN_DEFAULT,
|
||||
.fw_rate_adjustment = SETTING_FW_AUTOTUNE_RATE_ADJUSTMENT_DEFAULT,
|
||||
.fw_max_rate_deflection = SETTING_FW_AUTOTUNE_MAX_RATE_DEFLECTION_DEFAULT,
|
||||
);
|
||||
|
@ -75,9 +72,6 @@ typedef enum {
|
|||
} pidAutotuneState_e;
|
||||
|
||||
typedef struct {
|
||||
float gainP;
|
||||
float gainI;
|
||||
float gainD;
|
||||
float gainFF;
|
||||
float rate;
|
||||
float initialRate;
|
||||
|
@ -98,9 +92,6 @@ static timeMs_t lastGainsUpdateTime;
|
|||
void autotuneUpdateGains(pidAutotuneData_t * data)
|
||||
{
|
||||
for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) {
|
||||
pidBankMutable()->pid[axis].P = lrintf(data[axis].gainP);
|
||||
pidBankMutable()->pid[axis].I = lrintf(data[axis].gainI);
|
||||
pidBankMutable()->pid[axis].D = lrintf(data[axis].gainD);
|
||||
pidBankMutable()->pid[axis].FF = lrintf(data[axis].gainFF);
|
||||
((controlRateConfig_t *)currentControlRateProfile)->stabilized.rates[axis] = lrintf(data[axis].rate/10.0f);
|
||||
}
|
||||
|
@ -124,9 +115,6 @@ void autotuneCheckUpdateGains(void)
|
|||
void autotuneStart(void)
|
||||
{
|
||||
for (int axis = 0; axis < XYZ_AXIS_COUNT; axis++) {
|
||||
tuneCurrent[axis].gainP = pidBank()->pid[axis].P;
|
||||
tuneCurrent[axis].gainI = pidBank()->pid[axis].I;
|
||||
tuneCurrent[axis].gainD = pidBank()->pid[axis].D;
|
||||
tuneCurrent[axis].gainFF = pidBank()->pid[axis].FF;
|
||||
tuneCurrent[axis].rate = currentControlRateProfile->stabilized.rates[axis] * 10.0f;
|
||||
tuneCurrent[axis].initialRate = currentControlRateProfile->stabilized.rates[axis] * 10.0f;
|
||||
|
@ -246,16 +234,6 @@ void autotuneFixedWingUpdate(const flight_dynamics_index_t axis, float desiredRa
|
|||
}
|
||||
|
||||
if (gainsUpdated) {
|
||||
// Set P-gain to 10% of FF gain (quite agressive - FIXME)
|
||||
tuneCurrent[axis].gainP = tuneCurrent[axis].gainFF * (pidAutotuneConfig()->fw_ff_to_p_gain / 100.0f);
|
||||
tuneCurrent[axis].gainP = constrainf(tuneCurrent[axis].gainP, 1.0f, 20.0f);
|
||||
|
||||
// Set D-gain relative to P-gain (0 for now)
|
||||
tuneCurrent[axis].gainD = tuneCurrent[axis].gainP * (pidAutotuneConfig()->fw_p_to_d_gain / 100.0f);
|
||||
|
||||
// Set integrator gain to reach the same response as FF gain in 0.667 second
|
||||
tuneCurrent[axis].gainI = (tuneCurrent[axis].gainFF / FP_PID_RATE_FF_MULTIPLIER) * (1000.0f / pidAutotuneConfig()->fw_ff_to_i_time_constant) * FP_PID_RATE_I_MULTIPLIER;
|
||||
tuneCurrent[axis].gainI = constrainf(tuneCurrent[axis].gainI, 2.0f, 30.0f);
|
||||
autotuneUpdateGains(tuneCurrent);
|
||||
|
||||
switch (axis) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue