mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-19 22:35:19 +03:00
Add deadband
This commit is contained in:
parent
f80e44ac41
commit
c5bc1903f7
4 changed files with 9 additions and 3 deletions
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -3215,7 +3216,7 @@ void navigationUsePIDs(void)
|
||||||
|
|
||||||
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
|
||||||
);
|
);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue