39 lines
644 B
C
39 lines
644 B
C
|
/*
|
||
|
PDControl.h
|
||
|
(C)2013 kou029w - MIT License
|
||
|
*/
|
||
|
#ifndef PDControl_h
|
||
|
#define PDControl_h
|
||
|
|
||
|
#include <Arduino.h>
|
||
|
|
||
|
class PDControl_c{
|
||
|
public:
|
||
|
PDControl_c();
|
||
|
PDControl_c(int p, int d);
|
||
|
PDControl_c(int p, int d, float decR);
|
||
|
int operator()(int input);
|
||
|
int lastInput;
|
||
|
int diff;
|
||
|
int Kp;
|
||
|
int Kd;
|
||
|
float diffDecayRate;
|
||
|
};
|
||
|
|
||
|
class FastPDControl_c{
|
||
|
public:
|
||
|
FastPDControl_c();
|
||
|
FastPDControl_c(int p, int d);
|
||
|
FastPDControl_c(int p, int d, uint8_t hl);
|
||
|
int operator()(int input);
|
||
|
int lastInput;
|
||
|
int diff;
|
||
|
int Kp;
|
||
|
int Kd;
|
||
|
uint8_t diffHalfLife;
|
||
|
private:
|
||
|
uint8_t _count;
|
||
|
};
|
||
|
|
||
|
#endif
|