2014-git-work/arduino/dev/PDControl.h

39 lines
644 B
C
Raw Normal View History

2013-09-16 17:37:33 +09:00
/*
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