Skip to content

Commit 512b677

Browse files
committed
add pos_z_ff
1 parent 47d03d8 commit 512b677

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

docs/Settings.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3602,6 +3602,16 @@ D gain of altitude PID controller (Fixedwing)
36023602

36033603
---
36043604

3605+
### nav_fw_pos_z_ff
3606+
3607+
FF gain of altitude PID controller (Fixedwing)
3608+
3609+
| Default | Min | Max |
3610+
| --- | --- | --- |
3611+
| 10 | 0 | 255 |
3612+
3613+
---
3614+
36053615
### nav_fw_pos_z_i
36063616

36073617
I gain of altitude PID controller (Fixedwing)

src/main/cms/cms_menu_imu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ static const OSD_Entry cmsx_menuPidAltMagEntries[] =
227227
OTHER_PIDFF_ENTRY("ALT P", &cmsx_pidPosZ.P),
228228
OTHER_PIDFF_ENTRY("ALT I", &cmsx_pidPosZ.I),
229229
OTHER_PIDFF_ENTRY("ALT D", &cmsx_pidPosZ.D),
230+
OTHER_PIDFF_ENTRY("ALT FF", &cmsx_pidPosZ.FF),
230231

231232
OTHER_PIDFF_ENTRY("VEL P", &cmsx_pidVelZ.P),
232233
OTHER_PIDFF_ENTRY("VEL I", &cmsx_pidVelZ.I),

src/main/fc/settings.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,12 @@ groups:
21472147
field: bank_fw.pid[PID_POS_Z].D
21482148
min: 0
21492149
max: 255
2150+
- name: nav_fw_pos_z_ff
2151+
description: "FF gain of altitude PID controller (Fixedwing)"
2152+
default_value: 10
2153+
field: bank_fw.pid[PID_POS_Z].FF
2154+
min: 0
2155+
max: 255
21502156
- name: nav_fw_alt_control_response
21512157
description: "Adjusts the deceleration response of fixed wing altitude control as the target altitude is approached. Decrease value to help avoid overshooting the target altitude."
21522158
default_value: 40
@@ -4390,15 +4396,15 @@ groups:
43904396
field: safeAltitudeDistance
43914397
min: 0
43924398
max: 10000
4393-
- name: geozone_safehome_as_inclusive
4399+
- name: geozone_safehome_as_inclusive
43944400
description: "Treat nearest safehome as inclusive geozone"
43954401
type: bool
43964402
field: nearestSafeHomeAsInclusivZone
43974403
default_value: OFF
43984404
- name: geozone_safehome_zone_action
43994405
description: "Fence action for safehome zone"
44004406
default_value: "NONE"
4401-
field: safeHomeFenceAction
4407+
field: safeHomeFenceAction
44024408
table: fence_action
44034409
type: uint8_t
44044410
- name: geozone_mr_stop_distance
@@ -4412,4 +4418,4 @@ groups:
44124418
default_value: RTH
44134419
field: noWayHomeAction
44144420
table: geozone_rth_no_way_home
4415-
type: uint8_t
4421+
type: uint8_t

src/main/flight/pid.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static EXTENDED_FASTRAM bool angleHoldIsLevel = false;
179179
static EXTENDED_FASTRAM float fixedWingLevelTrim;
180180
static EXTENDED_FASTRAM pidController_t fixedWingLevelTrimController;
181181

182-
PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE, 9);
182+
PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE, 10);
183183

184184
PG_RESET_TEMPLATE(pidProfile_t, pidProfile,
185185
.bank_mc = {
@@ -242,8 +242,8 @@ PG_RESET_TEMPLATE(pidProfile_t, pidProfile,
242242
[PID_POS_Z] = {
243243
.P = SETTING_NAV_FW_POS_Z_P_DEFAULT, // FW_POS_Z_P * 100
244244
.I = SETTING_NAV_FW_POS_Z_I_DEFAULT, // FW_POS_Z_I * 100
245-
.D = SETTING_NAV_FW_POS_Z_D_DEFAULT, // FW_POS_Z_D * 100
246-
.FF = 0,
245+
.D = SETTING_NAV_FW_POS_Z_D_DEFAULT, // FW_POS_Z_D * 200
246+
.FF = SETTING_NAV_FW_POS_Z_FF_DEFAULT, // FW_POS_Z_FF * 100
247247
},
248248
[PID_POS_XY] = {
249249
.P = SETTING_NAV_FW_POS_XY_P_DEFAULT, // FW_POS_XY_P * 100
@@ -1206,7 +1206,7 @@ void FAST_CODE pidController(float dT)
12061206

12071207
// Limit desired rate to something gyro can measure reliably
12081208
pidState[axis].rateTarget = constrainf(rateTarget, -GYRO_SATURATION_LIMIT, +GYRO_SATURATION_LIMIT);
1209-
1209+
12101210
#ifdef USE_ADAPTIVE_FILTER
12111211
adaptiveFilterPushRate(axis, pidState[axis].rateTarget, currentControlRateProfile->stabilized.rates[axis]);
12121212
#endif

src/main/navigation/navigation.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4961,7 +4961,7 @@ void navigationUsePIDs(void)
49614961
navPidInit(&posControl.pids.fw_alt, (float)pidProfile()->bank_fw.pid[PID_POS_Z].P / 100.0f,
49624962
(float)pidProfile()->bank_fw.pid[PID_POS_Z].I / 100.0f,
49634963
(float)pidProfile()->bank_fw.pid[PID_POS_Z].D / 200.0f,
4964-
0.0f,
4964+
(float)pidProfile()->bank_fw.pid[PID_POS_Z].FF / 100.0f,
49654965
NAV_DTERM_CUT_HZ,
49664966
0.0f
49674967
);

0 commit comments

Comments
 (0)