-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgroup.m
More file actions
executable file
·83 lines (79 loc) · 3.25 KB
/
group.m
File metadata and controls
executable file
·83 lines (79 loc) · 3.25 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
classdef group
% group is static class of enumerated type containing string names of all part of robot body and skin
% Copyright (C) 2019-2021 Jakub Rozlivek and Lukas Rustler
% Department of Cybernetics, Faculty of Electrical Engineering,
% Czech Technical University in Prague
%
% This file is part of Multisensorial robot calibration toolbox (MRC).
%
% MRC is free software: you can redistribute it and/or modify
% it under the terms of the GNU Lesser General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% MRC is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU Lesser General Public License for more details.
%
% You should have received a copy of the GNU Leser General Public License
% along with MRC. If not, see <http://www.gnu.org/licenses/>.
properties(Constant)
leftArm = 'leftArm';
rightArm = 'rightArm';
head = 'head';
torso = 'torso';
leftEye = 'leftEye';
rightEye = 'rightEye';
leftArmSkin = 'leftArmSkin';
rightArmSkin = 'rightArmSkin';
headSkin = 'headSkin';
torsoSkin = 'torsoSkin';
leftLeg = 'leftLeg';
rightLeg = 'rightLeg';
rightMarkers = 'rightMarkers';
leftMarkers = 'leftMarkers';
leftIndex = 'leftIndex';
rightIndex = 'rightIndex';
leftThumb = 'leftThumb';
rightThumb = 'rightThumb';
leftMiddle = 'leftMiddle';
rightMiddle = 'rightMiddle';
leftFinger = 'leftFinger';
rightFinger = 'rightFinger';
dummy = 'dummy';
end
methods(Static)
function newStruct = sort(oldStruct)
% SORT - sort structure in given order
%
% INTPUT - structure to be sorted
% OUTPUT - sorted structure
order = {'torso', 'leftArm', 'rightArm', 'head', 'leftEye', 'rightEye',...
'leftLeg', 'rightLeg', 'leftFinger', 'rightFinger', 'leftIndex', ...
'rightIndex', 'leftThumb', 'rightThumb', 'leftMiddle', 'rightMiddle',...
'leftMarkers', 'rightMarkers', 'torsoSkin', 'leftArmSkin', 'rightArmSkin', ...
'headSkin', 'dummy'};
fnames = fieldnames(oldStruct);
newStruct = {};
for f=order
f = f{1};
if any(ismember(fnames, f))
newStruct.(f) = oldStruct.(f);
end
end
end
function idx = getSortedIndex(name)
% getSortedIndex - get index of the body part
%
% INTPUT - body part name
% OUTPUT - body part index
order = {'torso', 'leftArm', 'rightArm', 'head', 'leftEye', 'rightEye',...
'leftLeg', 'rightLeg', 'leftFinger', 'rightFinger', 'leftIndex', ...
'rightIndex', 'leftThumb', 'rightThumb', 'leftMiddle', 'rightMiddle',...
'leftMarkers', 'rightMarkers', 'torsoSkin', 'leftArmSkin', 'rightArmSkin', ...
'headSkin', 'dummy'};
idx = find(strcmp(name, order));
end
end
end