-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMotorCortex.m
46 lines (28 loc) · 1.34 KB
/
MotorCortex.m
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
classdef MotorCortex < handle
%MOTORCORTEX Controls the actors of the agent
% Detailed explanation goes here
properties(Access=private,Constant=true)
% set maximum movement cell value
MAX_MOVEMENT = 30;
end
methods
function obj = MotorCortex()
% The constructor
%TODO?
end
function movement = update(~, movementCells)
% This function receives the activity of movementCells [left, straight, right] and
% calculates the resulting motor commands with values between 0 and 0.5. This vector can
% later (in Agent class) be used for velocity calculations
movement = [0 0];
% add the straight values to the motor commands
movement(1) = movementCells(2);
movement(2) = movementCells(2);
% add activity of turning cell to motor commands
movement(1) = movement(1) + movementCells(1) ;
movement(2) = movement(2) + movementCells(3) ;
% normalize so that values are between 0 and 0.5 (for tan in Environment class)
movement = movement ./ (2*max(movement));
end
end
end