Skip to content

Commit

Permalink
AC_Autotune: general cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bnsgeyer committed Apr 24, 2024
1 parent e27f3c5 commit 406cc39
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions libraries/AC_AutoTune/AC_AutoTune_Heli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,9 +1158,9 @@ void AC_AutoTune_Heli::updating_rate_ff_up(float &tune_ff, sweep_info &test_data
float test_freq_incr = 0.05f * M_2PI;
next_freq = test_data.freq;
if (test_data.phase > 15.0f) {
next_freq -= test_freq_incr;
next_freq = constrain_float(next_freq - test_freq_incr, 0.1 * M_2PI, max_sweep_freq);
} else if (test_data.phase < 0.0f) {
next_freq += test_freq_incr;
next_freq = constrain_float(next_freq + test_freq_incr, 0.1 * M_2PI, max_sweep_freq);
} else {
if ((test_data.gain > 0.1 && test_data.gain < 0.93) || test_data.gain > 0.98) {
if (tune_ff > 0.0f) {
Expand Down
14 changes: 7 additions & 7 deletions libraries/AC_AutoTune/AC_AutoTune_Heli.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,6 @@ class AC_AutoTune_Heli : public AC_AutoTune
//
// methods to load and save gains
//
// sweep_info contains information about a specific test's sweep results
struct sweep_info {
float freq;
float gain;
float phase;
};


// backup original gains and prepare for start of tuning
void backup_gains_and_initialise() override;
Expand Down Expand Up @@ -143,6 +136,13 @@ class AC_AutoTune_Heli : public AC_AutoTune
uint32_t get_testing_step_timeout_ms() const override;

private:
// sweep_info contains information about a specific test's sweep results
struct sweep_info {
float freq;
float gain;
float phase;
};

// max_gain_data type stores information from the max gain test
struct max_gain_data {
float freq;
Expand Down

0 comments on commit 406cc39

Please sign in to comment.