[717926]: / MATLAB / TEST_plugin.m

Download this file

102 lines (92 with data), 3.9 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
 96
 97
 98
 99
100
101
102
%-------------------------------------------------------------------------%
% Copyright (c) 2019 Modenese L. %
% Author: Luca Modenese %
% email: l.modenese@imperial.ac.uk %
% ----------------------------------------------------------------------- %
%% TEST1: use model built on purpose to test
% Load Library
import org.opensim.modeling.*;
% verification
osimModel_name = '../tests/MFD_tests/testModel.osim';
IK_mot_file = '../tests/MFD_tests/testKinematics_file.mot';
MFD_sto_file = './test_results/test1.sto';
bodyOfInterest_name = 'MovingBody';
bodyExpressResultsIn_name = 'ground';
effec_att = 'false';
test_input = [];
vis_on = 'false';
validated_results_folder = '../_test_data/MFD_tests/validated_res';
res_anatAttach_local = getMuscleForceDirection(osimModel_name,...
IK_mot_file,...
MFD_sto_file,...
bodyOfInterest_name,...
bodyExpressResultsIn_name,...
effec_att,...
vis_on,...
[]);
% res_effectAttach_local = getMuscleForceDirection(osimModel_name,...
% IK_mot_file,...
% bodyOfInterest_name,...
% bodyExpressResultsIn_name,...
% 'true',...
% vis_on,...
% []);
%
% res_effectAttach_ground = getMuscleForceDirection(osimModel_name,...
% IK_mot_file,...
% bodyOfInterest_name,...
% 'ground',...
% 'true',...
% vis_on,...
% []);
%
% res_anatAttach_ground = getMuscleForceDirection(osimModel_name,...
% IK_mot_file,...
% bodyOfInterest_name,...
% 'ground',...
% 'false',...
% vis_on,...
% []);
% res_anatAttach_local
% res_anatAttach_ground
% res_effectAttach_ground
% res_effectAttach_local
%
% res_anatAttach_local_val = sto2Mat(fullfile(validated_results_folder,'LOCAL_ANATOM_MuscleForceDirection_vectors.sto'));
%
% res_anatAttach_ground.rowheaders
% res_effectAttach_ground
% res_effectAttach_local
%--------------------------------------------------------------------------
%% TEST3: simple arm26 model
osimModel_name = '../test_data/Arm26/arm26.osim';
IK_mot_file = '../test_data/Arm26/elbow_flexion.mot';
bodyOfInterest_name = 'r_humerus';
bodyExpressResultsIn_name = 'ground';
effective_attachm = 'false';
test_input = [];
%
%
% N_frame_test = 5;
muscleLinesOfActionStruct = getMuscleForceDirection(osimModel_name,...
IK_mot_file,...
bodyOfInterest_name,...
bodyExpressResultsIn_name,...
effective_attachm,...
'true',...
[]);
%% TEST3: gait2392 model
osimModel_name = '../tests/gait2392/subject01.osim';
IK_mot_file = '../tests/gait2392/subject01_walk1_ik.mot';
bodyOfInterest_name = 'femur_r';
bodyExpressResultsIn_name = [];
effective_attachm = 'true';
test_input = [];
N_frame_test = 5;
muscleLinesOfActionStruct = getMuscleForceDirection(osimModel_name,...
IK_mot_file,...
bodyOfInterest_name,...
bodyExpressResultsIn_name,...
effective_attachm,...
'true',...
[]);