From 4f892f88ad8eb89534237d73b44ac1c3dd592b15 Mon Sep 17 00:00:00 2001 From: "Pawel Spychalski (DzikuVx)" Date: Wed, 28 Sep 2016 11:53:48 +0200 Subject: [PATCH] Improvements for FixedWing Iterm limiting --- docs/Cli.md | 2 +- src/main/flight/pid.c | 2 +- src/main/flight/pid.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Cli.md b/docs/Cli.md index 7b4097a2d..7d9013844 100644 --- a/docs/Cli.md +++ b/docs/Cli.md @@ -255,7 +255,7 @@ Re-apply any new defaults as desired. | `nav_max_climb_rate` | Maximum climb/descent rate that UAV is allowed to reach during navigation modes. In cm/s | 10 | 2000 | 500 | Master | UINT16 | | `flaperon_throw_offset` | Defines throw range in us for both ailerons that will be applied (before scaling) when FLAPERON mode is activated. | 100 | 400 | 250 | Profile | UINT16 | | `flaperon_throw_inverted` | Inverts throw offset on both ailerons. Can be used to create SPOILERON or just to change throw direction | OFF | ON | OFF | Profile | UINT8 | -| `fw_iterm_throw_limit` | Limits max/min I-term value in stabilization PID controller in case of Fixed Wing. It solves the problem of servo saturation before take-off/throwing the airplane into the air. By default, error accumulated in I-term can not exceed 1/3 of servo throw (around 165us). | 25 | 500 | 165 | Profile | UINT16 | +| `fw_iterm_throw_limit` | Limits max/min I-term value in stabilization PID controller in case of Fixed Wing. It solves the problem of servo saturation before take-off/throwing the airplane into the air. By default, error accumulated in I-term can not exceed 1/3 of servo throw (around 165us). Set `0` to disable completely. | 0 | 500 | 165 | Profile | UINT16 | ## New iNav specific | `Variable` | Description/Units | Min | Max | Default | Type | Datatype | diff --git a/src/main/flight/pid.c b/src/main/flight/pid.c index 418fa8ecf..96db5f2d5 100644 --- a/src/main/flight/pid.c +++ b/src/main/flight/pid.c @@ -334,7 +334,7 @@ static void pidApplyRateController(const pidProfile_t *pidProfile, pidState_t *p } #ifdef USE_SERVOS - if (STATE(FIXED_WING)) { + if (STATE(FIXED_WING) && pidProfile->fixedWingItermThrowLimit != 0) { pidState->errorGyroIf = constrainf(pidState->errorGyroIf, -pidProfile->fixedWingItermThrowLimit, pidProfile->fixedWingItermThrowLimit); } #endif diff --git a/src/main/flight/pid.h b/src/main/flight/pid.h index a940c8841..12992286d 100644 --- a/src/main/flight/pid.h +++ b/src/main/flight/pid.h @@ -28,7 +28,7 @@ #define MAG_HOLD_RATE_LIMIT_DEFAULT 90 #define FW_ITERM_THROW_LIMIT_DEFAULT 165 -#define FW_ITERM_THROW_LIMIT_MIN 25 +#define FW_ITERM_THROW_LIMIT_MIN 0 #define FW_ITERM_THROW_LIMIT_MAX 500 #define AXIS_ACCEL_MIN_LIMIT 50