Added load/save gain overloads for float arrays to PID,
supports mavlink style gain get/set now git-svn-id: https://arducopter.googlecode.com/svn/trunk@928 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
parent
00e7f9b6d0
commit
7598c02f51
@ -132,6 +132,24 @@ PID::save_gains(int address)
|
||||
eeprom_write_word((uint16_t *) (address + 6), (int)_imax/100);
|
||||
}
|
||||
|
||||
void
|
||||
PID::load_gains(float * gain_array)
|
||||
{
|
||||
_kp = gain_array[0]/ 1000.0;
|
||||
_ki = gain_array[1]/ 1000.0;
|
||||
_kd = gain_array[2]/ 1000.0;
|
||||
_imax = gain_array[3]/ 1000.0;
|
||||
}
|
||||
|
||||
void
|
||||
PID::save_gains(float * gain_array)
|
||||
{
|
||||
gain_array[0] = _kp * 1000;
|
||||
gain_array[1] = _ki * 1000;
|
||||
gain_array[2] = _kd * 1000;
|
||||
gain_array[3] = _imax * 1000;
|
||||
}
|
||||
|
||||
/*
|
||||
float
|
||||
read_EE_compressed_float(int address, byte places)
|
||||
|
@ -13,6 +13,8 @@ public:
|
||||
void reset_I();
|
||||
void load_gains(int address);
|
||||
void save_gains(int address);
|
||||
void load_gains(float * gain_array);
|
||||
void save_gains(float * gain_array);
|
||||
void set_P(float p);
|
||||
void set_I(float i);
|
||||
void set_D(float d);
|
||||
|
Loading…
Reference in New Issue
Block a user