Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PID{
- double proportional_gain = 1.0f;
- double intigral_gain = 1.0f;
- double derivitve_gain = 1.0f;
- private:
- double x_1;
- double x_2;
- double intigral;
- public:
- double PID(double error) {
- x_1 = x_2;
- x_2 = error;
- intigral = intigral + error;
- return ((intigral * intigral_gain) + (error * proprotional_gain) + ((x_2 - x_1) * derivitive_gain));
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement