forked from ange-yaghi/engine-sim
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgovernor.h
More file actions
42 lines (33 loc) · 819 Bytes
/
governor.h
File metadata and controls
42 lines (33 loc) · 819 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
35
36
37
38
39
40
41
42
#ifndef ATG_ENGINE_SIM_GOVERNOR_H
#define ATG_ENGINE_SIM_GOVERNOR_H
#include "throttle.h"
class Governor : public Throttle {
public:
struct Parameters {
double minSpeed;
double maxSpeed;
double minVelocity;
double maxVelocity;
double k_s;
double k_d;
double gamma;
};
public:
Governor();
virtual ~Governor();
void initialize(const Parameters ¶ms);
virtual void setSpeedControl(double s);
virtual void update(double dt, Engine *engine);
protected:
double m_minSpeed;
double m_maxSpeed;
double m_minVelocity;
double m_maxVelocity;
double m_k_s;
double m_k_d;
double m_gamma;
double m_targetSpeed;
double m_currentThrottle;
double m_velocity;
};
#endif /* ATG_ENGINE_SIM_GOVERNOR_H */