Skip to content

Commit 4d63f88

Browse files
committed
cleanup + change PID FF
1 parent b71547a commit 4d63f88

4 files changed

Lines changed: 4 additions & 6 deletions

File tree

docs/Settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3628,7 +3628,7 @@ FF gain of altitude PID controller. Not used if nav_fw_alt_use_position is set O
36283628

36293629
| Default | Min | Max |
36303630
| --- | --- | --- |
3631-
| 10 | 0 | 255 |
3631+
| 30 | 0 | 255 |
36323632

36333633
---
36343634

src/main/fc/settings.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,7 @@ groups:
21492149
max: 255
21502150
- name: nav_fw_pos_z_ff
21512151
description: "FF gain of altitude PID controller. Not used if nav_fw_alt_use_position is set ON (Fixedwing)"
2152-
default_value: 10
2152+
default_value: 30
21532153
field: bank_fw.pid[PID_POS_Z].FF
21542154
min: 0
21552155
max: 255

src/main/flight/pid.c

Lines changed: 1 addition & 1 deletion
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, 10);
182+
PG_REGISTER_PROFILE_WITH_RESET_TEMPLATE(pidProfile_t, pidProfile, PG_PID_PROFILE, 11);
183183

184184
PG_RESET_TEMPLATE(pidProfile_t, pidProfile,
185185
.bank_mc = {

src/main/navigation/navigation_fixedwing.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ static void updateAltitudeVelocityAndPitchController_FW(timeDelta_t deltaMicros)
147147
// Default control based on climb rate (velocity)
148148
float targetValue = desiredClimbRate;
149149
float measuredValue = navGetCurrentActualPositionAndVelocity()->vel.z;
150-
pidControllerFlags_e pidFlags = 0; // PID_DTERM_FROM_ERROR;
151150

152151
// Optional control based on altitude (position)
153152
if (pidProfile()->fwAltControlUsePos) {
@@ -193,11 +192,10 @@ static void updateAltitudeVelocityAndPitchController_FW(timeDelta_t deltaMicros)
193192

194193
targetValue = desiredAltitude;
195194
measuredValue = currentAltitude;
196-
pidFlags = 0; // use measurement for D term
197195
}
198196

199197
// PID controller to translate desired target error (velocity or position) into pitch angle [decideg]
200-
float targetPitchAngle = navPidApply2(&posControl.pids.fw_alt, targetValue, measuredValue, US2S(deltaMicros), minDiveDeciDeg, maxClimbDeciDeg, pidFlags);
198+
float targetPitchAngle = navPidApply2(&posControl.pids.fw_alt, targetValue, measuredValue, US2S(deltaMicros), minDiveDeciDeg, maxClimbDeciDeg, 0);
201199

202200
// Apply low-pass filter to prevent rapid correction
203201
targetPitchAngle = pt1FilterApply4(&pitchFilterState, targetPitchAngle, getSmoothnessCutoffFreq(NAV_FW_BASE_PITCH_CUTOFF_FREQUENCY_HZ), US2S(deltaMicros));

0 commit comments

Comments
 (0)