-
Notifications
You must be signed in to change notification settings - Fork 0
/
PV_Controller.h
53 lines (32 loc) · 963 Bytes
/
PV_Controller.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
#ifndef PV_CONTROLLER_H
#define PV_CONTROLLER_H
#include "json.hpp"
using json = nlohmann::json;
// We can't include tiny_dnn here because of a conflict in the #definition of PI...
// Therefore we must do some forward declarations to be able to use tinydnn stuff
// as part of our class.
namespace tiny_dnn{
class sequential;
class graph;
template <typename NetType>
class network;
};
using namespace tiny_dnn;
class PV_Controller
{
public:
PV_Controller(json data);
std::vector<float> evaluate(double timestep, std::vector<float> sensors = {});
std::vector<float> inputs;
int n_in;
int n_recurrent;
int n_hidden;
int n_out;
bool enable_osc = true;
private:
network<graph>* net; // tiny-dnn network
std::vector<float> recurrent_state;
double phase = 0; // current phase of the oscillator, between 0 and 2pi
double freq; // oscillator frequency in hz
};
#endif //PV_CONTROLLER_H