ardupilot/libraries/AC_PID/AC_P.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
568 B
C++
Raw Normal View History

/// @file AC_P.cpp
/// @brief Generic P algorithm
#include <AP_Math/AP_Math.h>
#include "AC_P.h"
const AP_Param::GroupInfo AC_P::var_info[] = {
// @Param: P
// @DisplayName: PI Proportional Gain
// @Description: P Gain which produces an output value that is proportional to the current error value
2023-01-03 13:22:36 -04:00
AP_GROUPINFO_FLAGS_DEFAULT_POINTER("P", 0, AC_P, _kp, default_kp),
AP_GROUPEND
};
float AC_P::get_p(float error) const
{
return (float)error * _kp;
}
void AC_P::load_gains()
{
_kp.load();
}
void AC_P::save_gains()
{
_kp.save();
}