-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbasicpid.hpp
More file actions
35 lines (24 loc) · 814 Bytes
/
basicpid.hpp
File metadata and controls
35 lines (24 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef BASICPID_HPP
#define BASICPID_HPP
#include <cstdlib>
#include "../libterraclear/src/stopwatch.hpp"
namespace terraclear
{
class basicpid
{
public:
basicpid(double Kp, double Ki, double Kd, uint32_t interval_ms);
virtual ~basicpid();
//tranfsorm between domains i.e. from pixel space to rpm space, etc.
double domain_transform(double from_value, double from_min, double from_max, double to_min, double to_max);
void start();
void stop();
double compute(double Input, double Setpoint);
private:
stopwatch sw;
double lastTime;
double errSum = 0, lastErr = 0;
double kp, ki, kd;
};
}
#endif /* BASICPID_HPP */