Skip to content

Commit

Permalink
Change cyclic cross-coupling scale
Browse files Browse the repository at this point in the history
- CC gain => x10 stronger
- CC cutoff => /10 smaller

This allows using much higher gains needed by large helis,
and lower and more fine grained cutoff frequencies.

The previous defaults were gain = 25, cutoff = 15.
In order to get the same effect, set gain = 3 cutoff = 150.
  • Loading branch information
pmattila committed Aug 14, 2024
1 parent 2be125d commit 81666ca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/flight/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ void INIT_CODE pidInitProfile(const pidProfile_t *pidProfile)
pid.cyclicCrossCouplingGain[FD_ROLL] = pid.cyclicCrossCouplingGain[FD_PITCH] * pidProfile->cyclic_cross_coupling_ratio / -100.0f;

// Cross-coupling derivative filters
difFilterInit(&pid.crossCouplingFilter[FD_PITCH], pidProfile->cyclic_cross_coupling_cutoff, pid.freq);
difFilterInit(&pid.crossCouplingFilter[FD_ROLL], pidProfile->cyclic_cross_coupling_cutoff, pid.freq);
difFilterInit(&pid.crossCouplingFilter[FD_PITCH], pidProfile->cyclic_cross_coupling_cutoff / 10.0f, pid.freq);
difFilterInit(&pid.crossCouplingFilter[FD_ROLL], pidProfile->cyclic_cross_coupling_cutoff / 10.0f, pid.freq);

// Initialise sub-profiles
governorInitProfile(pidProfile);
Expand Down
2 changes: 1 addition & 1 deletion src/main/flight/pid.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#define YAW_F_TERM_SCALE 0.000025f
#define YAW_B_TERM_SCALE 1.0e-6f

#define CROSS_COUPLING_SCALE 0.1e-6f
#define CROSS_COUPLING_SCALE 1.0e-6f

typedef struct {
float P;
Expand Down
4 changes: 2 additions & 2 deletions src/main/pg/pid.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ void resetPidProfile(pidProfile_t *pidProfile)
.yaw_collective_dynamic_gain = 0,
.yaw_collective_dynamic_decay = 25,
.pitch_collective_ff_gain = 0,
.cyclic_cross_coupling_gain = 25,
.cyclic_cross_coupling_gain = 5,
.cyclic_cross_coupling_ratio = 0,
.cyclic_cross_coupling_cutoff = 15,
.cyclic_cross_coupling_cutoff = 150,
.angle.level_strength = 40,
.angle.level_limit = 55,
.horizon.level_strength = 40,
Expand Down

0 comments on commit 81666ca

Please sign in to comment.