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

Add deadband

This commit is contained in:
Pawel Spychalski (DzikuVx) 2019-12-26 18:19:52 +01:00
parent f80e44ac41
commit c5bc1903f7
4 changed files with 9 additions and 3 deletions

View file

@ -1667,6 +1667,10 @@ groups:
- name: nav_use_fw_yaw_control - name: nav_use_fw_yaw_control
field: fw.useFwNavYawControl field: fw.useFwNavYawControl
type: bool type: bool
- name: nav_fw_yaw_deadband
field: fw.yawControlDeadband
min: 0
max: 90
- name: PG_TELEMETRY_CONFIG - name: PG_TELEMETRY_CONFIG
type: telemetryConfig_t type: telemetryConfig_t

View file

@ -167,6 +167,7 @@ PG_RESET_TEMPLATE(navConfig_t, navConfig,
.cruise_yaw_rate = 20, // 20dps .cruise_yaw_rate = 20, // 20dps
.allow_manual_thr_increase = false, .allow_manual_thr_increase = false,
.useFwNavYawControl = 0, .useFwNavYawControl = 0,
.yawControlDeadband = 0,
} }
); );
@ -3212,10 +3213,10 @@ void navigationUsePIDs(void)
0.0f, 0.0f,
NAV_DTERM_CUT_HZ NAV_DTERM_CUT_HZ
); );
navPidInit(&posControl.pids.fw_heading, (float)pidProfile()->bank_fw.pid[PID_POS_HEADING].P / 10.0f, navPidInit(&posControl.pids.fw_heading, (float)pidProfile()->bank_fw.pid[PID_POS_HEADING].P / 10.0f,
(float)pidProfile()->bank_fw.pid[PID_POS_HEADING].I / 10.0f, (float)pidProfile()->bank_fw.pid[PID_POS_HEADING].I / 10.0f,
(float)pidProfile()->bank_fw.pid[PID_POS_HEADING].D / 10.0f, (float)pidProfile()->bank_fw.pid[PID_POS_HEADING].D / 100.0f,
0.0f, 0.0f,
2.0f 2.0f
); );

View file

@ -217,6 +217,7 @@ typedef struct navConfig_s {
uint8_t cruise_yaw_rate; // Max yaw rate (dps) when CRUISE MODE is enabled uint8_t cruise_yaw_rate; // Max yaw rate (dps) when CRUISE MODE is enabled
bool allow_manual_thr_increase; bool allow_manual_thr_increase;
bool useFwNavYawControl; bool useFwNavYawControl;
uint8_t yawControlDeadband;
} fw; } fw;
} navConfig_t; } navConfig_t;

View file

@ -359,7 +359,7 @@ static void updatePositionHeadingController_FW(timeUs_t currentTimeUs, timeDelta
float yawAdjustment = navPidApply2( float yawAdjustment = navPidApply2(
&posControl.pids.fw_heading, &posControl.pids.fw_heading,
0, 0,
navHeadingError, applyDeadband(navHeadingError, navConfig()->fw.yawControlDeadband * 100),
US2S(deltaMicros), US2S(deltaMicros),
-limit, -limit,
limit, limit,