-
Notifications
You must be signed in to change notification settings - Fork 0
/
PlantController.h
53 lines (39 loc) · 927 Bytes
/
PlantController.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* PlantController.h
*
* Created on: Apr 1, 2013
* Author: dam7633
*/
#ifndef PLANTCONTROLLER_H_
#define PLANTCONTROLLER_H_
#include "ControlLoop.h"
#include "Sensor.h"
#include "Actuator.h"
#include <pthread.h>
#define MAX_INTEGRAL (2)
#define MIN_INTEGRAL (-2)
class PlantContext;
class PlantController: public ControlLoop {
public:
PlantController(Sensor *sensor, Actuator *actuator);
virtual ~PlantController();
void initialize(PlantContext *context);
void step();
void shutdown();
double getProportionalGain();
double getIntegralGain();
double getDerivateGain();
void setParameters(double kp, double ki, double kd);
private:
Sensor *sensor;
Actuator *actuator;
PlantContext *context;
double proportionalGain;
double integralGain;
double derivativeGain;
double integral;
double derivative;
double lastOutput;
pthread_mutex_t parametersMutex;
};
#endif /* PLANTCONTROLLER_H_ */