a b/MATLAB/TEST_plugin.m
1
%-------------------------------------------------------------------------%
2
% Copyright (c) 2019 Modenese L.                                          %
3
%    Author:   Luca Modenese                                              %
4
%    email:    l.modenese@imperial.ac.uk                                  % 
5
% ----------------------------------------------------------------------- %
6
7
%% TEST1: use model built on purpose to test 
8
9
% Load Library
10
import org.opensim.modeling.*;
11
12
% verification
13
osimModel_name = '../tests/MFD_tests/testModel.osim'; 
14
IK_mot_file = '../tests/MFD_tests/testKinematics_file.mot';
15
MFD_sto_file = './test_results/test1.sto';
16
bodyOfInterest_name = 'MovingBody';
17
bodyExpressResultsIn_name = 'ground';
18
effec_att = 'false';
19
test_input = [];
20
vis_on = 'false';
21
22
validated_results_folder = '../_test_data/MFD_tests/validated_res';
23
24
res_anatAttach_local = getMuscleForceDirection(osimModel_name,...
25
    IK_mot_file,...
26
    MFD_sto_file,...
27
    bodyOfInterest_name,...
28
    bodyExpressResultsIn_name,...
29
    effec_att,...
30
    vis_on,...
31
    []);
32
33
% res_effectAttach_local = getMuscleForceDirection(osimModel_name,...
34
%     IK_mot_file,...
35
%     bodyOfInterest_name,...
36
%     bodyExpressResultsIn_name,...
37
%     'true',...
38
%     vis_on,...
39
%     []);
40
% 
41
% res_effectAttach_ground = getMuscleForceDirection(osimModel_name,...
42
%     IK_mot_file,...
43
%     bodyOfInterest_name,...
44
%     'ground',...
45
%     'true',...
46
%     vis_on,...
47
%     []);
48
% 
49
% res_anatAttach_ground = getMuscleForceDirection(osimModel_name,...
50
%     IK_mot_file,...
51
%     bodyOfInterest_name,...
52
%     'ground',...
53
%     'false',...
54
%     vis_on,...
55
%     []);
56
57
58
% res_anatAttach_local
59
% res_anatAttach_ground
60
% res_effectAttach_ground
61
% res_effectAttach_local
62
% 
63
% res_anatAttach_local_val = sto2Mat(fullfile(validated_results_folder,'LOCAL_ANATOM_MuscleForceDirection_vectors.sto'));
64
% 
65
% res_anatAttach_ground.rowheaders
66
% res_effectAttach_ground
67
% res_effectAttach_local
68
%--------------------------------------------------------------------------
69
%% TEST3: simple arm26 model
70
osimModel_name = '../test_data/Arm26/arm26.osim';
71
IK_mot_file = '../test_data/Arm26/elbow_flexion.mot';
72
bodyOfInterest_name = 'r_humerus';
73
bodyExpressResultsIn_name = 'ground';
74
effective_attachm = 'false';
75
test_input = [];
76
% 
77
% 
78
% N_frame_test = 5;
79
muscleLinesOfActionStruct = getMuscleForceDirection(osimModel_name,...
80
                                                                IK_mot_file,...
81
                                                                bodyOfInterest_name,...
82
                                                                bodyExpressResultsIn_name,...
83
                                                                effective_attachm,...
84
                                                                'true',...
85
                                                                []);
86
                                    
87
%% TEST3: gait2392 model                                       
88
                                                            
89
osimModel_name              = '../tests/gait2392/subject01.osim';
90
IK_mot_file                 = '../tests/gait2392/subject01_walk1_ik.mot';
91
bodyOfInterest_name         = 'femur_r';
92
bodyExpressResultsIn_name   = [];
93
effective_attachm           = 'true';
94
test_input = [];
95
N_frame_test = 5;
96
muscleLinesOfActionStruct = getMuscleForceDirection(osimModel_name,...
97
                                                                IK_mot_file,...
98
                                                                bodyOfInterest_name,...
99
                                                                bodyExpressResultsIn_name,...
100
                                                                effective_attachm,...
101
                                                                'true',...
102
                                                                 []);