CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AC_PID/AC_P.cpp
Views: 1798
1
/// @file AC_P.cpp
2
/// @brief Generic P algorithm
3
4
#include <AP_Math/AP_Math.h>
5
#include "AC_P.h"
6
7
const AP_Param::GroupInfo AC_P::var_info[] = {
8
// @Param: P
9
// @DisplayName: PI Proportional Gain
10
// @Description: P Gain which produces an output value that is proportional to the current error value
11
AP_GROUPINFO_FLAGS_DEFAULT_POINTER("P", 0, AC_P, _kp, default_kp),
12
AP_GROUPEND
13
};
14
15
float AC_P::get_p(float error) const
16
{
17
return (float)error * _kp;
18
}
19
20
void AC_P::load_gains()
21
{
22
_kp.load();
23
}
24
25
void AC_P::save_gains()
26
{
27
_kp.save();
28
}
29
30