Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/main/fc/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1361,11 +1361,6 @@ groups:
default_value: 15
min: 1
max: 60
- name: servo_autotrim_iterm_rate_limit
Comment thread
sensei-hacker marked this conversation as resolved.
description: "Maximum I-term rate of change (units/sec) for autotrim to be applied. Prevents trim updates during maneuver transitions when I-term is changing rapidly. Only applies when using `feature FW_AUTOTRIM`."
default_value: 2
min: 0
max: 50

- name: PG_CONTROL_PROFILES
type: controlConfig_t
Expand Down
3 changes: 2 additions & 1 deletion src/main/flight/servos.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ void processServoAutotrimMode(void)
#define SERVO_AUTOTRIM_CENTER_MAX 1700
#define SERVO_AUTOTRIM_UPDATE_SIZE 5
#define SERVO_AUTOTRIM_ATTITUDE_LIMIT 50 // 5 degrees
#define SERVO_AUTOTRIM_ITERM_RATE_LIMIT 30 // ~90th percentile during stable cruise (blackbox-derived)

void processContinuousServoAutotrim(const float dT)
{
Expand Down Expand Up @@ -646,7 +647,7 @@ void processContinuousServoAutotrim(const float dT)
for (int axis = FD_ROLL; axis <= FD_PITCH; axis++) {
// For each stabilized axis, add 5 units of I-term to all associated servo midpoints
const float axisIterm = getAxisIterm(axis);
const bool itermIsStable = itermRateOfChange[axis] < servoConfig()->servo_autotrim_iterm_rate_limit;
const bool itermIsStable = itermRateOfChange[axis] < SERVO_AUTOTRIM_ITERM_RATE_LIMIT;

if (fabsf(axisIterm) > SERVO_AUTOTRIM_UPDATE_SIZE && itermIsStable) {
const int8_t ItermUpdate = axisIterm > 0.0f ? SERVO_AUTOTRIM_UPDATE_SIZE : -SERVO_AUTOTRIM_UPDATE_SIZE;
Expand Down
1 change: 0 additions & 1 deletion src/main/flight/servos.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ typedef struct servoConfig_s {
uint8_t tri_unarmed_servo; // send tail servo correction pulses even when unarmed
uint8_t servo_autotrim_rotation_limit; // Max rotation for servo midpoints to be updated
uint8_t servo_autotrim_iterm_threshold; // How much of the Iterm is carried over to the servo midpoints on each update
uint8_t servo_autotrim_iterm_rate_limit; // Max I-term rate of change (units/sec) to apply autotrim
} servoConfig_t;

PG_DECLARE(servoConfig_t, servoConfig);
Expand Down
Loading