-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmotor.h
More file actions
95 lines (77 loc) · 2.43 KB
/
motor.h
File metadata and controls
95 lines (77 loc) · 2.43 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Navigating with grid and place cells in cluttered environments
// Edvardsen et al. (2020). Hippocampus, 30(3), 220-232.
//
// Licensed under the EUPL-1.2-or-later.
// Copyright (c) 2019 NTNU - Norwegian University of Science and Technology.
// Author: Vegard Edvardsen (https://github.com/evegard).
#ifndef MOTOR_H_INCLUDED
#define MOTOR_H_INCLUDED
#include <tuple>
#include "network.h"
#include "numerical.h"
#include "plot.h"
class MecDiffNetwork;
class MecDiffMotorInput;
class MotorMotorInput;
class MotorNetwork : public Network
{
public:
MotorNetwork(int direction_samples, double scaling_factor, bool normalize);
void commit();
int direction_samples;
double scaling_factor;
bool normalize;
double normalization_spread = 2 * M_PI; // Set to a large-ish value, should
// always be overridden anyways if
// normalization is used
double normalization_peak = 1.0;
bool override_active = false;
double override_direction = 0.0;
double override_strength = 0.0;
double direction = 0.0;
double strength = 0.0;
protected:
void update_neuron_values();
std::tuple<double, double> calculate_direction_and_strength(NeuronActivity activity);
};
class MecDiffMotorInput : public Input
{
public:
MecDiffMotorInput(
MotorNetwork *motor_network,
MecDiffNetwork *mec_diff_network);
void add_inputs();
MotorNetwork *motor_network;
MecDiffNetwork *mec_diff_network;
};
class MotorMotorInput : public Input
{
public:
MotorMotorInput(
MotorNetwork *efferent,
MotorNetwork *afferent);
void add_inputs();
MotorNetwork *efferent;
MotorNetwork *afferent;
};
class BorderMotorInput : public Input
{
public:
BorderMotorInput(MotorNetwork *efferent, Vector *border_sensors);
void add_inputs();
MotorNetwork *efferent;
Vector *border_sensors;
};
class MotorNetworkPlot : public Plot
{
public:
MotorNetworkPlot(MotorNetwork *network,
const char *color, const char *title, bool simplified, double plot_range);
protected:
void dump_plot_commands(std::ostream &gnuplot);
MotorNetwork *network;
const char *color;
bool simplified;
double plot_range;
};
#endif