-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFSR.m
More file actions
54 lines (49 loc) · 1.47 KB
/
Copy pathFSR.m
File metadata and controls
54 lines (49 loc) · 1.47 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
FSR_default = struct( ...
'fsr_1',uint16(0), ...
'fsr_2',uint16(0), ...
'fsr_3',uint16(0), ...
'fsr_4',uint16(0), ...
'fsr_x',uint8(0), ...
'fsr_y',uint8(0));
FSR_bus = Simulink.Bus.createObject(FSR_default);
bus_name = FSR_bus.busName;
FSR_bus = eval(bus_name);
clear(bus_name);
clear('bus_name');
for i=1:length(FSR_bus.Elements)
element = FSR_bus.Elements(i);
if strcmp(element.Name,'fsr_1')
element.Description = 'FSR Sensor 1';
element.Min = 0;
element.Max = 65535;
elseif strcmp(element.Name,'fsr_2')
element.Description = 'FSR Sensor 2';
element.Min = 0;
element.Max = 65535;
elseif strcmp(element.Name,'fsr_3')
element.Description = 'FSR Sensor 3';
element.Min = 0;
element.Max = 65535;
elseif strcmp(element.Name,'fsr_4')
element.Description = 'FSR Sensor 4';
element.Min = 0;
element.Max = 65535;
elseif strcmp(element.Name,'fsr_x')
element.Description = 'FSR Center X';
element.Min = 0;
element.Max = 255;
elseif strcmp(element.Name,'fsr_y')
element.Description = 'FSR Center Y';
element.Min = 0;
element.Max = 255;
else
error('invalid element name "%s"',element.Name);
end
FSR_bus.Elements(i) = element;
end
clear element
clear i
FSR_scale = 1000; % point per N (from specs)
FSR_max = 254; % X/Y maximum value
FSR_no_load = 255; % no load X/Y value
FSR_sample_time = 0.001;