|
a |
|
b/Tools/AnyMocap/JointsAndDriversOptimized.any |
|
|
1 |
AnyFolder JointsAndDrivers = { |
|
|
2 |
AnyComponentDefinition obj = { |
|
|
3 |
NameCast = "OptimizedJointDrivers"; |
|
|
4 |
}; |
|
|
5 |
|
|
|
6 |
#ifdef MOCAP_OUTPUT_FILENAME_PREFIX |
|
|
7 |
AnyStringVar BaseFileName ??= TEMP_PATH + "/" + MOCAP_TEST_FILENAME_PREFIX + MOCAP_OUTPUT_FILENAME_PREFIX + Main.ModelSetup.TrialSpecificData.TrialFileName ; |
|
|
8 |
#else |
|
|
9 |
AnyStringVar BaseFileName ??= "test"; |
|
|
10 |
#endif |
|
|
11 |
|
|
|
12 |
AnyKinDriver JntDriverTrunkFull = { |
|
|
13 |
|
|
|
14 |
#include "InterpolateJointAngleData.any" |
|
|
15 |
FileReader.FileName ??= .BaseFileName + "-rotvec-trunk-full.txt"; |
|
|
16 |
|
|
|
17 |
/// The default data if no joint angles files have been generated. |
|
|
18 |
FileReader.Data0 = repmat( |
|
|
19 |
1, FileReader.Length0, |
|
|
20 |
arrcat({Main.HumanModel.Mannequin.Posture.PelvisPosX, |
|
|
21 |
Main.HumanModel.Mannequin.Posture.PelvisPosY, |
|
|
22 |
Main.HumanModel.Mannequin.Posture.PelvisPosZ, |
|
|
23 |
Main.HumanModel.Mannequin.Posture.PelvisRotX*pi/180, |
|
|
24 |
Main.HumanModel.Mannequin.Posture.PelvisRotY*pi/180, |
|
|
25 |
Main.HumanModel.Mannequin.Posture.PelvisRotZ*pi/180 |
|
|
26 |
},repmat(nDim-6,0.0) |
|
|
27 |
) |
|
|
28 |
); |
|
|
29 |
AnyVector PelvisPosOffset ??= {0,0,0}; |
|
|
30 |
AnyKinMeasureLinComb Measure = { |
|
|
31 |
AnyKinMeasureOrg Input = { |
|
|
32 |
AnyKinMeasure& PelvisPosX = .....BodyModel.Interface.Trunk.PelvisPosX; |
|
|
33 |
AnyKinMeasure& PelvisPosY = .....BodyModel.Interface.Trunk.PelvisPosY; |
|
|
34 |
AnyKinMeasure& PelvisPosZ = .....BodyModel.Interface.Trunk.PelvisPosZ; |
|
|
35 |
|
|
|
36 |
AnyKinMeasure& PelvisRotVec = .....BodyModel.Interface.Trunk.PelvisRotVec; |
|
|
37 |
|
|
|
38 |
AnyKinMeasureOrg& SacrumPelvis = .....BodyModel.Interface.Trunk.Spine.SacrumPelvis; |
|
|
39 |
AnyKinMeasureOrg& L5Sacrum =.....BodyModel.Interface.Trunk.Spine.L5Sacrum; |
|
|
40 |
AnyKinMeasureOrg& L4L5 =.....BodyModel.Interface.Trunk.Spine.L4L5; |
|
|
41 |
AnyKinMeasureOrg& L3L4 =.....BodyModel.Interface.Trunk.Spine.L3L4; |
|
|
42 |
AnyKinMeasureOrg& L2L3 =.....BodyModel.Interface.Trunk.Spine.L2L3; |
|
|
43 |
AnyKinMeasureOrg& L1L2 =.....BodyModel.Interface.Trunk.Spine.L1L2; |
|
|
44 |
AnyKinMeasureOrg& T12L1 =.....BodyModel.Interface.Trunk.Spine.T12L1; |
|
|
45 |
AnyKinMeasureOrg& T1C7 =.....BodyModel.Interface.Trunk.Spine.T1C7; |
|
|
46 |
AnyKinMeasureOrg& C7C6 =.....BodyModel.Interface.Trunk.Spine.C7C6; |
|
|
47 |
AnyKinMeasureOrg& C6C5 =.....BodyModel.Interface.Trunk.Spine.C6C5; |
|
|
48 |
AnyKinMeasureOrg& C5C4 =.....BodyModel.Interface.Trunk.Spine.C5C4; |
|
|
49 |
AnyKinMeasureOrg& C4C3 =.....BodyModel.Interface.Trunk.Spine.C4C3; |
|
|
50 |
AnyKinMeasureOrg& C3C2 =.....BodyModel.Interface.Trunk.Spine.C3C2; |
|
|
51 |
AnyKinMeasureOrg& C2C1 =.....BodyModel.Interface.Trunk.Spine.C2C1; |
|
|
52 |
AnyKinMeasureOrg& C1C0 =.....BodyModel.Interface.Trunk.Spine.C1C0; |
|
|
53 |
}; |
|
|
54 |
OutDim=Input.nDim; |
|
|
55 |
Coef = eye(OutDim); |
|
|
56 |
Const ??= arrcat(.PelvisPosOffset, zeros(1,OutDim-3)[0]); |
|
|
57 |
}; |
|
|
58 |
Reaction.Type = repmat(nDim, Off); |
|
|
59 |
}; |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
#if BM_LEG_LEFT & BM_LEG_MODEL_IS_TLEM |
|
|
64 |
AnyKinDriver JntDriverLeftLegTD = { |
|
|
65 |
|
|
|
66 |
#include "InterpolateJointAngleData.any" |
|
|
67 |
FileReader.FileName = TEMP_PATH + "/" + MOCAP_TEST_FILENAME_PREFIX +MOCAP_OUTPUT_FILENAME_PREFIX + Main.ModelSetup.TrialSpecificData.TrialFileName + "-euler-left_leg_tlem.txt"; |
|
|
68 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
69 |
|
|
|
70 |
AnyKinMeasure& HipFlexion = ...BodyModel.Interface.Left.HipFlexion; |
|
|
71 |
AnyKinMeasure& HipAbduction = ...BodyModel.Interface.Left.HipAbduction; |
|
|
72 |
AnyKinMeasure& HipExternalRotation = ...BodyModel.Interface.Left.HipExternalRotation; |
|
|
73 |
AnyKinMeasure& KneeFlexion = ...BodyModel.Interface.Left.KneeFlexion; |
|
|
74 |
AnyKinMeasure& AnklePlantarFlexion = ...BodyModel.Interface.Left.AnklePlantarFlexion; |
|
|
75 |
AnyKinMeasure& SubTalarEversion = ...BodyModel.Interface.Left.SubTalarEversion; |
|
|
76 |
Reaction.Type = repmat(nDim, Off); |
|
|
77 |
}; |
|
|
78 |
#endif |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
#if BM_LEG_RIGHT & BM_LEG_MODEL_IS_TLEM |
|
|
82 |
AnyKinDriver JntDriverRightLegTD = { |
|
|
83 |
#include "InterpolateJointAngleData.any" |
|
|
84 |
FileReader.FileName = TEMP_PATH + "/" + MOCAP_TEST_FILENAME_PREFIX + MOCAP_OUTPUT_FILENAME_PREFIX + Main.ModelSetup.TrialSpecificData.TrialFileName + "-euler-right_leg_tlem.txt"; |
|
|
85 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
86 |
|
|
|
87 |
AnyKinMeasure& HipFlexion = ...BodyModel.Interface.Right.HipFlexion; |
|
|
88 |
AnyKinMeasure& HipAbduction = ...BodyModel.Interface.Right.HipAbduction; |
|
|
89 |
AnyKinMeasure& HipExternalRotation = ...BodyModel.Interface.Right.HipExternalRotation; |
|
|
90 |
AnyKinMeasure& KneeFlexion = ...BodyModel.Interface.Right.KneeFlexion; |
|
|
91 |
AnyKinMeasure& AnklePlantarFlexion = ...BodyModel.Interface.Right.AnklePlantarFlexion; |
|
|
92 |
AnyKinMeasure& SubTalarEversion = ...BodyModel.Interface.Right.SubTalarEversion; |
|
|
93 |
Reaction.Type = repmat(nDim, Off); |
|
|
94 |
}; |
|
|
95 |
#endif |
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
#if BM_LEG_LEFT & BM_LEG_MODEL == _LEG_MODEL_LEG_ |
|
|
100 |
AnyKinDriver JntDriverLeftLeg = { |
|
|
101 |
#include "InterpolateJointAngleData.any" |
|
|
102 |
FileReader.FileName ??= .BaseFileName + "-euler-left_leg.txt"; |
|
|
103 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
104 |
|
|
|
105 |
AnyKinMeasure& HipFlexion = ...BodyModel.Interface.Left.HipFlexion; |
|
|
106 |
AnyKinMeasure& HipAbduction = ...BodyModel.Interface.Left.HipAbduction; |
|
|
107 |
AnyKinMeasure& HipExternalRotation = ...BodyModel.Interface.Left.HipExternalRotation; |
|
|
108 |
AnyKinMeasure& KneeFlexion = ...BodyModel.Interface.Left.KneeFlexion; |
|
|
109 |
AnyKinMeasure& AnklePlantarFlexion = ...BodyModel.Interface.Left.AnklePlantarFlexion; |
|
|
110 |
AnyKinMeasure& AnkleEversion = ...BodyModel.Interface.Left.AnkleEversion; |
|
|
111 |
Reaction.Type = repmat(nDim, Off); |
|
|
112 |
}; |
|
|
113 |
#endif |
|
|
114 |
|
|
|
115 |
|
|
|
116 |
#if BM_LEG_RIGHT & BM_LEG_MODEL == _LEG_MODEL_LEG_ |
|
|
117 |
AnyKinDriver JntDriverRightLeg = { |
|
|
118 |
#include "InterpolateJointAngleData.any" |
|
|
119 |
FileReader.FileName ??= .BaseFileName + "-euler-right_leg.txt"; |
|
|
120 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
121 |
|
|
|
122 |
AnyKinMeasure& HipFlexion = ...BodyModel.Interface.Right.HipFlexion; |
|
|
123 |
AnyKinMeasure& HipAbduction = ...BodyModel.Interface.Right.HipAbduction; |
|
|
124 |
AnyKinMeasure& HipExternalRotation = ...BodyModel.Interface.Right.HipExternalRotation; |
|
|
125 |
AnyKinMeasure& KneeFlexion = ...BodyModel.Interface.Right.KneeFlexion; |
|
|
126 |
AnyKinMeasure& AnklePlantarFlexion = ...BodyModel.Interface.Right.AnklePlantarFlexion; |
|
|
127 |
AnyKinMeasure& AnkleEversion = ...BodyModel.Interface.Right.AnkleEversion; |
|
|
128 |
Reaction.Type = repmat(nDim, Off); |
|
|
129 |
}; |
|
|
130 |
#endif |
|
|
131 |
|
|
|
132 |
#if BM_ARM_LEFT == ON |
|
|
133 |
AnyKinDriver JntDriverLeftArm = { |
|
|
134 |
#include "InterpolateJointAngleData.any" |
|
|
135 |
FileReader.FileName ??= .BaseFileName + "-rotvec-left_arm_shoulder.txt"; |
|
|
136 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
137 |
|
|
|
138 |
AnyKinMeasure& ThoraxClavicula=...BodyModel.Interface.Left.RotVectorMeasures.ThoraxClavicula; |
|
|
139 |
AnyKinMeasure& ClaviculaScapula=...BodyModel.Interface.Left.RotVectorMeasures.ClaviculaScapula; |
|
|
140 |
AnyKinMeasure& ScapulaHumerus=...BodyModel.Interface.Left.RotVectorMeasures.ScapulaHumerus; |
|
|
141 |
AnyKinMeasure& HumerusUlna=...BodyModel.Interface.Left.ElbowFlexion; |
|
|
142 |
AnyKinMeasure& UlnaRadius=...BodyModel.Interface.Left.ElbowPronation; |
|
|
143 |
AnyKinMeasure& RadiusWrist=...BodyModel.Interface.Left.WristFlexion; |
|
|
144 |
AnyKinMeasure& WristHand=...BodyModel.Interface.Left.WristAbduction; |
|
|
145 |
|
|
|
146 |
Reaction.Type = repmat(nDim, Off); |
|
|
147 |
}; |
|
|
148 |
|
|
|
149 |
#if BM_ARM_DETAILED_HAND |
|
|
150 |
AnyKinDriver JntDriverLeftDetailedHand = { |
|
|
151 |
#include "InterpolateJointAngleData.any" |
|
|
152 |
FileReader.FileName ??= .BaseFileName + "-euler-left_detailed_hand.txt"; |
|
|
153 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
154 |
|
|
|
155 |
AnyKinMeasure& CMC1Flexion = ...BodyModel.Interface.Left.CMCFlexion; |
|
|
156 |
AnyKinMeasure& CMC1Abduction = ...BodyModel.Interface.Left.CMCAbduction; |
|
|
157 |
AnyKinMeasure& MCP1Flexion = ...BodyModel.Interface.Left.MCPFlexion; |
|
|
158 |
AnyKinMeasure& MCP1Abduction = ...BodyModel.Interface.Left.MCPAbduction; |
|
|
159 |
AnyKinMeasure& DIP1 = ...BodyModel.Interface.Left.DIP; |
|
|
160 |
AnyKinMeasure& MCP2 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger2.Jnt.MCP; |
|
|
161 |
AnyKinMeasure& PIP2 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger2.Jnt.PIP; |
|
|
162 |
AnyKinMeasure& DIP2 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger2.Jnt.DIP; |
|
|
163 |
AnyKinMeasure& MCP3 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger3.Jnt.MCP; |
|
|
164 |
AnyKinMeasure& PIP3 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger3.Jnt.PIP; |
|
|
165 |
AnyKinMeasure& DIP3 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger3.Jnt.DIP; |
|
|
166 |
AnyKinMeasure& MCP4 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger4.Jnt.MCP; |
|
|
167 |
AnyKinMeasure& PIP4 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger4.Jnt.PIP; |
|
|
168 |
AnyKinMeasure& DIP4 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger4.Jnt.DIP; |
|
|
169 |
AnyKinMeasure& MCP5 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger5.Jnt.MCP; |
|
|
170 |
AnyKinMeasure& PIP5 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger5.Jnt.PIP; |
|
|
171 |
AnyKinMeasure& DIP5 = ...BodyModel.Left.ShoulderArm.Seg.Hand.Finger5.Jnt.DIP; |
|
|
172 |
Reaction.Type = repmat(nDim, Off); |
|
|
173 |
}; |
|
|
174 |
#endif |
|
|
175 |
|
|
|
176 |
|
|
|
177 |
#endif |
|
|
178 |
|
|
|
179 |
#if BM_ARM_RIGHT == ON |
|
|
180 |
AnyKinDriver JntDriverRightArm = { |
|
|
181 |
#include "InterpolateJointAngleData.any" |
|
|
182 |
FileReader.FileName ??= .BaseFileName + "-rotvec-right_arm_shoulder.txt"; |
|
|
183 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
184 |
|
|
|
185 |
AnyKinMeasure& ThoraxClavicula=...BodyModel.Interface.Right.RotVectorMeasures.ThoraxClavicula; |
|
|
186 |
AnyKinMeasure& ClaviculaScapula=...BodyModel.Interface.Right.RotVectorMeasures.ClaviculaScapula; |
|
|
187 |
AnyKinMeasure& ScapulaHumerus=...BodyModel.Interface.Right.RotVectorMeasures.ScapulaHumerus; |
|
|
188 |
AnyKinMeasure& HumerusUlna=...BodyModel.Interface.Right.ElbowFlexion; |
|
|
189 |
AnyKinMeasure& UlnaRadius=...BodyModel.Interface.Right.ElbowPronation; |
|
|
190 |
AnyKinMeasure& RadiusWrist=...BodyModel.Interface.Right.WristFlexion; |
|
|
191 |
AnyKinMeasure& WristHand=...BodyModel.Interface.Right.WristAbduction; |
|
|
192 |
|
|
|
193 |
Reaction.Type = repmat(nDim, Off); |
|
|
194 |
}; |
|
|
195 |
|
|
|
196 |
#if BM_ARM_DETAILED_HAND |
|
|
197 |
AnyKinDriver JntDriverRightDetailedHand = { |
|
|
198 |
#include "InterpolateJointAngleData.any" |
|
|
199 |
FileReader.FileName ??= .BaseFileName + "-euler-right_detailed_hand.txt"; |
|
|
200 |
FileReader.Data0 = zeros(nDim, FileReader.Length0 ); |
|
|
201 |
|
|
|
202 |
AnyKinMeasure& CMC1Flexion = ...BodyModel.Interface.Right.CMCFlexion; |
|
|
203 |
AnyKinMeasure& CMC1Abduction = ...BodyModel.Interface.Right.CMCAbduction; |
|
|
204 |
AnyKinMeasure& MCP1Flexion = ...BodyModel.Interface.Right.MCPFlexion; |
|
|
205 |
AnyKinMeasure& MCP1Abduction = ...BodyModel.Interface.Right.MCPAbduction; |
|
|
206 |
AnyKinMeasure& DIP1 = ...BodyModel.Interface.Right.DIP; |
|
|
207 |
AnyKinMeasure& MCP2 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger2.Jnt.MCP; |
|
|
208 |
AnyKinMeasure& PIP2 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger2.Jnt.PIP; |
|
|
209 |
AnyKinMeasure& DIP2 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger2.Jnt.DIP; |
|
|
210 |
AnyKinMeasure& MCP3 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger3.Jnt.MCP; |
|
|
211 |
AnyKinMeasure& PIP3 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger3.Jnt.PIP; |
|
|
212 |
AnyKinMeasure& DIP3 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger3.Jnt.DIP; |
|
|
213 |
AnyKinMeasure& MCP4 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger4.Jnt.MCP; |
|
|
214 |
AnyKinMeasure& PIP4 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger4.Jnt.PIP; |
|
|
215 |
AnyKinMeasure& DIP4 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger4.Jnt.DIP; |
|
|
216 |
AnyKinMeasure& MCP5 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger5.Jnt.MCP; |
|
|
217 |
AnyKinMeasure& PIP5 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger5.Jnt.PIP; |
|
|
218 |
AnyKinMeasure& DIP5 = ...BodyModel.Right.ShoulderArm.Seg.Hand.Finger5.Jnt.DIP; |
|
|
219 |
Reaction.Type = repmat(nDim, Off); |
|
|
220 |
}; |
|
|
221 |
#endif |
|
|
222 |
|
|
|
223 |
|
|
|
224 |
#endif |
|
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
}; |
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|