|
a |
|
b/Tools/AnyMocap/AnatomicalJointAnglesTemplate.any |
|
|
1 |
// This file contains two templates. One which only measures anatomical joint angles |
|
|
2 |
// and one which measures both joint angles and projects the external joint moment |
|
|
3 |
// vectors onto the rotation axis. |
|
|
4 |
// |
|
|
5 |
// The CreateJointMeasures template creates a folder with measures of |
|
|
6 |
// the anatomical joint angles. Angles are measured based on the |
|
|
7 |
// Grood&Suntay convention also recommended by ISB. |
|
|
8 |
// |
|
|
9 |
// Inputs are AnyRefFrame derived classes which represent the antomical |
|
|
10 |
// coordinate system for the segments. In the example below; all *StaticMarkerFrame |
|
|
11 |
// variables represent embedded cordinate-systems (AnyRefNodes) between which the |
|
|
12 |
// joint angles are measured. |
|
|
13 |
// |
|
|
14 |
// NOTE: The reference coordinate system needs to be defined in the model. Otherwise |
|
|
15 |
// the code will not work. If this template should produce joint angles as |
|
|
16 |
// recommended by ISB, then the coordinate systems (StaticMarkerFrame's) must be |
|
|
17 |
// alligned as recommended by ISB. |
|
|
18 |
// |
|
|
19 |
// EXAMPLE: |
|
|
20 |
// CreateJointMeasures Right ( |
|
|
21 |
// PELVIS_FRAME= BodyModelRef.Trunk.SegmentsLumbar.PelvisSeg.StaticMarkerFrame, |
|
|
22 |
// THIGH_HIP_FRAME = BodyModelRef.Right.Leg.Seg.Thigh.HipStaticMarkerFrame, |
|
|
23 |
// THIGH_KNEE_FRAME = BodyModelRef.Right.Leg.Seg.Thigh.KneeStaticMarkerFrame, |
|
|
24 |
// SHANK_KNEE_FRAME = BodyModelRef.Right.Leg.Seg.Shank.KneeStaticMarkerFrame, |
|
|
25 |
// SHANK_ANKLE_FRAME = BodyModelRef.Right.Leg.Seg.Shank.AnkleStaticMarkerFrame, |
|
|
26 |
// FOOT_ANKLE_FRAME = BodyModelRef.Right.Leg.Seg.Foot.AnkleStaticMarkerFrame, |
|
|
27 |
// ) = { Sign = 1;}; |
|
|
28 |
// |
|
|
29 |
// |
|
|
30 |
// The CreateJointAnglesAndMomentMeasures does the same CreateJointMeasures |
|
|
31 |
// template. Additionally it also takes the three moment vectors as input, and |
|
|
32 |
// calculate the moment vector projection onto the rotation axis. Note that the |
|
|
33 |
// first and last rotation axis is not necessaryly perpendicular with Grood&Suntay |
|
|
34 |
// convention so the projected moments may not make sense in physical way. However, |
|
|
35 |
// they are often used in littereature so they are worth knowing. |
|
|
36 |
// |
|
|
37 |
// EXAMPLE: |
|
|
38 |
// CreateJointAnglesAndMomentMeasures Left ( |
|
|
39 |
// PELVIS_FRAME= BodyModelRef.Trunk.SegmentsLumbar.PelvisSeg.StaticMarkerFrame, |
|
|
40 |
// THIGH_HIP_FRAME = BodyModelRef.Left.Leg.Seg.Thigh.HipStaticMarkerFrame, |
|
|
41 |
// THIGH_KNEE_FRAME = BodyModelRef.Left.Leg.Seg.Thigh.KneeStaticMarkerFrame, |
|
|
42 |
// SHANK_KNEE_FRAME = BodyModelRef.Left.Leg.Seg.Shank.KneeStaticMarkerFrame, |
|
|
43 |
// SHANK_ANKLE_FRAME = BodyModelRef.Left.Leg.Seg.Shank.AnkleStaticMarkerFrame, |
|
|
44 |
// FOOT_ANKLE_FRAME = BodyModelRef.Left.Leg.Seg.Foot.AnkleStaticMarkerFrame, |
|
|
45 |
// HIPMOMENT = BodyModelRef.Left.Leg.MomentMeasure.HipNetMoment.M, |
|
|
46 |
// KNEEMOMENT = BodyModelRef.Left.Leg.MomentMeasure.KneeNetMoment.M, |
|
|
47 |
// ANKLEMOMENT = BodyModelRef.Left.Leg.MomentMeasure.AnklePlantarFlexionNetMoment.M |
|
|
48 |
// ) = { Sign = -1;}; |
|
|
49 |
// |
|
|
50 |
// |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
#class_template CreateJointMeasures (PELVIS_FRAME,THIGH_HIP_FRAME,THIGH_KNEE_FRAME,SHANK_KNEE_FRAME,SHANK_ANKLE_FRAME,FOOT_ANKLE_FRAME){ |
|
|
55 |
|
|
|
56 |
#var AnyInt Sign = 1; |
|
|
57 |
|
|
|
58 |
AnyKinMeasureLinComb HipFlexion = { |
|
|
59 |
AnyKinRotational HipMeasure ={ |
|
|
60 |
AnyRefFrame &PelvisRef = ...PELVIS_FRAME ; |
|
|
61 |
AnyRefFrame &ThighRef = ...THIGH_HIP_FRAME ; |
|
|
62 |
Type=RotAxesAngles; |
|
|
63 |
Axis1 = z; Axis2 = x; Axis3 = y; |
|
|
64 |
}; |
|
|
65 |
OutDim = 1; |
|
|
66 |
Coef = {{1,0,0}}*180/pi; |
|
|
67 |
}; |
|
|
68 |
AnyKinMeasureLinComb HipAdduction = { |
|
|
69 |
AnyKinRotational &HipJoint =.HipFlexion.HipMeasure; |
|
|
70 |
Coef = .Sign *{{0,1,0}}*180/pi; |
|
|
71 |
OutDim = 1; |
|
|
72 |
}; |
|
|
73 |
AnyKinMeasureLinComb HipInternalRotation ={ |
|
|
74 |
AnyKinRotational &HipJoint =.HipFlexion.HipMeasure; |
|
|
75 |
Coef =.Sign *{{0,0,1}}*180/pi; |
|
|
76 |
OutDim = 1; |
|
|
77 |
}; |
|
|
78 |
|
|
|
79 |
AnyKinMeasureLinComb KneeFlexion = { |
|
|
80 |
AnyKinRotational KinRot ={ |
|
|
81 |
AnyRefFrame &ThighRef = ...THIGH_KNEE_FRAME; |
|
|
82 |
AnyRefFrame &ShankRef = ...SHANK_KNEE_FRAME; |
|
|
83 |
Type=RotAxesAngles; |
|
|
84 |
Axis1 = z; Axis2 = x; Axis3 = y; |
|
|
85 |
}; |
|
|
86 |
Coef =-1*{{1,0,0}}*180/pi; |
|
|
87 |
OutDim = 1; |
|
|
88 |
}; |
|
|
89 |
AnyKinMeasureLinComb KneeAdduction = { |
|
|
90 |
AnyKinRotational &KinRot = .KneeFlexion.KinRot; |
|
|
91 |
Coef =.Sign *{{0,1,0}}*180/pi; |
|
|
92 |
OutDim = 1; |
|
|
93 |
}; |
|
|
94 |
AnyKinMeasureLinComb KneeInternalRotation = { |
|
|
95 |
AnyKinRotational &KinRot = .KneeFlexion.KinRot; |
|
|
96 |
Coef =.Sign *{{0,0,1}}*180/pi; |
|
|
97 |
OutDim = 1; |
|
|
98 |
}; |
|
|
99 |
|
|
|
100 |
|
|
|
101 |
AnyKinMeasureLinComb AnkleDorsiFlexion = { |
|
|
102 |
AnyKinRotational KinRot ={ |
|
|
103 |
AnyRefFrame &ShankRef = ...SHANK_ANKLE_FRAME; |
|
|
104 |
AnyRefFrame &FootRef = ...FOOT_ANKLE_FRAME; |
|
|
105 |
Type=RotAxesAngles; |
|
|
106 |
Axis1 = z; Axis2 = x; Axis3 = y; |
|
|
107 |
}; |
|
|
108 |
Coef ={{1,0,0}}*180/pi; |
|
|
109 |
OutDim = 1; |
|
|
110 |
}; |
|
|
111 |
AnyKinMeasureLinComb AnkleInversion ={ |
|
|
112 |
AnyKinRotational &KinRot =.AnkleDorsiFlexion.KinRot; |
|
|
113 |
Coef =.Sign*{{0,1,0}}*180/pi; |
|
|
114 |
OutDim = 1; |
|
|
115 |
}; |
|
|
116 |
AnyKinMeasureLinComb AnkleInternalRotation = { |
|
|
117 |
AnyKinRotational &KinRot =.AnkleDorsiFlexion.KinRot; |
|
|
118 |
Coef = .Sign*{{0,0,1}}*180/pi; |
|
|
119 |
OutDim = 1; |
|
|
120 |
}; |
|
|
121 |
|
|
|
122 |
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
}; |
|
|
126 |
|
|
|
127 |
#class_template CreateJointAnglesAndMomentMeasures (PELVIS_FRAME,THIGH_HIP_FRAME,THIGH_KNEE_FRAME,SHANK_KNEE_FRAME,SHANK_ANKLE_FRAME,FOOT_ANKLE_FRAME, HIPMOMENT, KNEEMOMENT, ANKLEMOMENT ){ |
|
|
128 |
|
|
|
129 |
#var AnyInt Sign = 1; |
|
|
130 |
AnyKinMeasureLinComb HipFlexion = { |
|
|
131 |
AnyVar M_Projected = -..PELVIS_FRAME.Axes'[2]*..HIPMOMENT'; |
|
|
132 |
AnyKinRotational HipMeasure ={ |
|
|
133 |
AnyRefFrame &PelvisRef = ...PELVIS_FRAME ; |
|
|
134 |
AnyRefFrame &ThighRef = ...THIGH_HIP_FRAME ; |
|
|
135 |
Type=RotAxesAngles; |
|
|
136 |
Axis1 = z; Axis2 = x; Axis3 = y; |
|
|
137 |
}; |
|
|
138 |
Coef = {{1,0,0}}*180/pi; |
|
|
139 |
OutDim = 1; |
|
|
140 |
}; |
|
|
141 |
AnyKinMeasureLinComb HipAdduction = { |
|
|
142 |
AnyVar M_Projected = .Sign*cross(..PELVIS_FRAME.Axes'[2],..THIGH_HIP_FRAME.Axes'[1])*..HIPMOMENT'; |
|
|
143 |
AnyKinRotational &HipJoint =.HipFlexion.HipMeasure; |
|
|
144 |
Coef =.Sign *{{0,1,0}}*180/pi; |
|
|
145 |
OutDim = 1; |
|
|
146 |
}; |
|
|
147 |
AnyKinMeasureLinComb HipInternalRotation ={ |
|
|
148 |
AnyVar M_Projected = -1*.Sign*..THIGH_HIP_FRAME.Axes'[1]*..HIPMOMENT'; |
|
|
149 |
AnyKinRotational &HipJoint =.HipFlexion.HipMeasure; |
|
|
150 |
Coef =.Sign *{{0,0,1}}*180/pi; |
|
|
151 |
OutDim = 1; |
|
|
152 |
}; |
|
|
153 |
|
|
|
154 |
AnyKinMeasureLinComb KneeFlexion = { |
|
|
155 |
AnyVar M_Projected = ..THIGH_KNEE_FRAME.Axes'[2]*..KNEEMOMENT'; |
|
|
156 |
AnyKinRotational KinRot ={ |
|
|
157 |
AnyRefFrame &ThighRef = ...THIGH_KNEE_FRAME; |
|
|
158 |
AnyRefFrame &ShankRef = ...SHANK_KNEE_FRAME; |
|
|
159 |
Type=RotAxesAngles; |
|
|
160 |
Axis1 = z; Axis2 = x; Axis3 = y; |
|
|
161 |
}; |
|
|
162 |
Coef =-1*{{1,0,0}}*180/pi; |
|
|
163 |
OutDim = 1; |
|
|
164 |
}; |
|
|
165 |
AnyKinMeasureLinComb KneeAdduction = { |
|
|
166 |
AnyVar M_Projected = .Sign*cross(..THIGH_KNEE_FRAME.Axes'[2], ..SHANK_KNEE_FRAME.Axes'[1])*..KNEEMOMENT'; |
|
|
167 |
AnyKinRotational &KinRot = .KneeFlexion.KinRot; |
|
|
168 |
Coef =.Sign *{{0,1,0}}*180/pi; |
|
|
169 |
OutDim = 1; |
|
|
170 |
}; |
|
|
171 |
AnyKinMeasureLinComb KneeInternalRotation = { |
|
|
172 |
AnyVar M_Projected = -1*.Sign*..SHANK_KNEE_FRAME.Axes'[1]*..KNEEMOMENT'; |
|
|
173 |
AnyKinRotational &KinRot = .KneeFlexion.KinRot; |
|
|
174 |
Coef =.Sign *{{0,0,1}}*180/pi; |
|
|
175 |
OutDim = 1; |
|
|
176 |
}; |
|
|
177 |
|
|
|
178 |
|
|
|
179 |
AnyKinMeasureLinComb AnkleDorsiFlexion = { |
|
|
180 |
AnyVar M_Projected = -1*..SHANK_ANKLE_FRAME.Axes'[2]*..ANKLEMOMENT'; |
|
|
181 |
AnyKinRotational KinRot ={ |
|
|
182 |
AnyRefFrame &ShankRef = ...SHANK_ANKLE_FRAME; |
|
|
183 |
AnyRefFrame &FootRef = ...FOOT_ANKLE_FRAME; |
|
|
184 |
Type=RotAxesAngles; |
|
|
185 |
Axis1 = z; Axis2 = x; Axis3 = y; |
|
|
186 |
}; |
|
|
187 |
Coef ={{1,0,0}}*180/pi; |
|
|
188 |
OutDim = 1; |
|
|
189 |
}; |
|
|
190 |
AnyKinMeasureLinComb AnkleInversion ={ |
|
|
191 |
AnyVar M_Projected = .Sign*cross(..SHANK_ANKLE_FRAME.Axes'[2],..FOOT_ANKLE_FRAME.Axes'[1])*..ANKLEMOMENT'; |
|
|
192 |
AnyKinRotational &KinRot =.AnkleDorsiFlexion.KinRot; |
|
|
193 |
Coef =.Sign*{{0,1,0}}*180/pi; |
|
|
194 |
OutDim = 1; |
|
|
195 |
}; |
|
|
196 |
AnyKinMeasureLinComb AnkleInternalRotation = { |
|
|
197 |
AnyVar M_Projected = -1*.Sign*..FOOT_ANKLE_FRAME.Axes'[1]*..ANKLEMOMENT'; |
|
|
198 |
AnyKinRotational &KinRot =.AnkleDorsiFlexion.KinRot; |
|
|
199 |
Coef = .Sign*{{0,0,1}}*180/pi; |
|
|
200 |
OutDim = 1; |
|
|
201 |
}; |
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
|
206 |
}; |