APM:Libraries
Classes | Public Types | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
AP_AutoTune Class Reference

#include <AP_AutoTune.h>

Collaboration diagram for AP_AutoTune:
[legend]

Classes

struct  ATGains
 
struct  log_ATRP
 

Public Types

enum  ATType { AUTOTUNE_ROLL = 0, AUTOTUNE_PITCH = 1 }
 

Public Member Functions

 AP_AutoTune (ATGains &_gains, ATType type, const AP_Vehicle::FixedWing &parms, DataFlash_Class &_dataflash)
 
void start (void)
 
void stop (void)
 
void update (float desired_rate, float achieved_rate, float servo_out)
 

Public Attributes

bool running:1
 

Private Types

enum  ATState {
  DEMAND_UNSATURATED, DEMAND_UNDER_POS, DEMAND_OVER_POS, DEMAND_UNDER_NEG,
  DEMAND_OVER_NEG
}
 

Private Member Functions

void check_save (void)
 
void check_state_exit (uint32_t state_time_ms)
 
void save_gains (const ATGains &v)
 
void write_log (float servo, float demanded, float achieved)
 
void log_param_change (float v, const char *suffix)
 
void save_float_if_changed (AP_Float &v, float value, const char *suffix)
 
void save_int16_if_changed (AP_Int16 &v, int16_t value, const char *suffix)
 

Private Attributes

ATGainscurrent
 
ATType type
 
const AP_Vehicle::FixedWingaparm
 
DataFlash_Classdataflash
 
bool saturated_surfaces:1
 
ATGains restore
 
ATGains last_save
 
ATGains next_save
 
uint32_t last_save_ms = 0
 
enum AP_AutoTune::ATState state = DEMAND_UNSATURATED
 
uint32_t state_enter_ms = 0
 

Detailed Description

Definition at line 7 of file AP_AutoTune.h.

Member Enumeration Documentation

◆ ATState

enum AP_AutoTune::ATState
private
Enumerator
DEMAND_UNSATURATED 
DEMAND_UNDER_POS 
DEMAND_OVER_POS 
DEMAND_UNDER_NEG 
DEMAND_OVER_NEG 

Definition at line 80 of file AP_AutoTune.h.

◆ ATType

Enumerator
AUTOTUNE_ROLL 
AUTOTUNE_PITCH 

Definition at line 19 of file AP_AutoTune.h.

Constructor & Destructor Documentation

◆ AP_AutoTune()

AP_AutoTune::AP_AutoTune ( ATGains _gains,
ATType  type,
const AP_Vehicle::FixedWing parms,
DataFlash_Class _dataflash 
)

Definition at line 69 of file AP_AutoTune.cpp.

Member Function Documentation

◆ check_save()

void AP_AutoTune::check_save ( void  )
private

Definition at line 240 of file AP_AutoTune.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_state_exit()

void AP_AutoTune::check_state_exit ( uint32_t  state_time_ms)
private

Definition at line 205 of file AP_AutoTune.cpp.

Referenced by update().

Here is the caller graph for this function:

◆ log_param_change()

void AP_AutoTune::log_param_change ( float  v,
const char *  suffix 
)
private

Definition at line 269 of file AP_AutoTune.cpp.

Referenced by save_float_if_changed(), and save_int16_if_changed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_float_if_changed()

void AP_AutoTune::save_float_if_changed ( AP_Float &  v,
float  value,
const char *  suffix 
)
private

Definition at line 290 of file AP_AutoTune.cpp.

Referenced by save_gains().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_gains()

void AP_AutoTune::save_gains ( const ATGains v)
private

Definition at line 317 of file AP_AutoTune.cpp.

Referenced by check_save(), and stop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_int16_if_changed()

void AP_AutoTune::save_int16_if_changed ( AP_Int16 &  v,
int16_t  value,
const char *  suffix 
)
private

Definition at line 303 of file AP_AutoTune.cpp.

Referenced by save_gains().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void AP_AutoTune::start ( void  )

Definition at line 114 of file AP_AutoTune.cpp.

Referenced by AP_PitchController::autotune_start(), and AP_RollController::autotune_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stop()

void AP_AutoTune::stop ( void  )

Definition at line 152 of file AP_AutoTune.cpp.

Referenced by AP_PitchController::autotune_restore(), and AP_RollController::autotune_restore().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void AP_AutoTune::update ( float  desired_rate,
float  achieved_rate,
float  servo_out 
)

Definition at line 164 of file AP_AutoTune.cpp.

Referenced by AP_PitchController::_get_rate_out(), and AP_RollController::_get_rate_out().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_log()

void AP_AutoTune::write_log ( float  servo,
float  demanded,
float  achieved 
)
private

Definition at line 329 of file AP_AutoTune.cpp.

Referenced by update().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ aparm

const AP_Vehicle::FixedWing& AP_AutoTune::aparm
private

Definition at line 60 of file AP_AutoTune.h.

Referenced by check_state_exit(), and start().

◆ current

ATGains& AP_AutoTune::current
private

Definition at line 55 of file AP_AutoTune.h.

Referenced by check_save(), check_state_exit(), save_gains(), start(), update(), and write_log().

◆ dataflash

DataFlash_Class& AP_AutoTune::dataflash
private

Definition at line 62 of file AP_AutoTune.h.

Referenced by log_param_change(), and write_log().

◆ last_save

ATGains AP_AutoTune::last_save
private

Definition at line 71 of file AP_AutoTune.h.

Referenced by save_gains(), and start().

◆ last_save_ms

uint32_t AP_AutoTune::last_save_ms = 0
private

Definition at line 77 of file AP_AutoTune.h.

Referenced by check_save(), and start().

◆ next_save

ATGains AP_AutoTune::next_save
private

Definition at line 74 of file AP_AutoTune.h.

Referenced by check_save(), and start().

◆ restore

ATGains AP_AutoTune::restore
private

Definition at line 68 of file AP_AutoTune.h.

Referenced by check_save(), start(), and stop().

◆ running

bool AP_AutoTune::running

◆ saturated_surfaces

bool AP_AutoTune::saturated_surfaces
private

Definition at line 65 of file AP_AutoTune.h.

Referenced by check_state_exit(), and update().

◆ state

enum AP_AutoTune::ATState AP_AutoTune::state = DEMAND_UNSATURATED
private

◆ state_enter_ms

uint32_t AP_AutoTune::state_enter_ms = 0
private

Definition at line 87 of file AP_AutoTune.h.

Referenced by start(), and update().

◆ type

ATType AP_AutoTune::type
private

Definition at line 58 of file AP_AutoTune.h.

Referenced by log_param_change(), and write_log().


The documentation for this class was generated from the following files: