|
a |
|
b/Tools/AnyMocap/CheckAnyMocapConfiguration.any |
|
|
1 |
#ifndef MOCAP_INPUT_DATA_TYPE |
|
|
2 |
#define MOCAP_INPUT_DATA_TYPE "C3D" |
|
|
3 |
#endif |
|
|
4 |
|
|
|
5 |
#ifndef MOCAP_C3D_DATA_PATH |
|
|
6 |
#path MOCAP_C3D_DATA_PATH "<MOCAP_PATH_MAINFILEDIR>" |
|
|
7 |
#endif |
|
|
8 |
|
|
|
9 |
#ifndef MOCAP_CREATE_PARAMETER_ID_SHORTCUT |
|
|
10 |
#if MOCAP_INPUT_DATA_TYPE == "BVH" |
|
|
11 |
#define MOCAP_CREATE_PARAMETER_ID_SHORTCUT 0 |
|
|
12 |
#else |
|
|
13 |
#define MOCAP_CREATE_PARAMETER_ID_SHORTCUT 1 |
|
|
14 |
#endif |
|
|
15 |
#endif |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
// Prefix which can be used by the application to distinques trials |
|
|
19 |
#ifndef MOCAP_OUTPUT_FILENAME_PREFIX |
|
|
20 |
#define MOCAP_OUTPUT_FILENAME_PREFIX "" |
|
|
21 |
#endif |
|
|
22 |
|
|
|
23 |
// Extra prefix which is used by the test framework to avoid overwriting |
|
|
24 |
// the orignal files when running automated tests of the AnyMoCap. |
|
|
25 |
#ifndef MOCAP_TEST_FILENAME_PREFIX |
|
|
26 |
#define MOCAP_TEST_FILENAME_PREFIX "" |
|
|
27 |
#endif |
|
|
28 |
|
|
|
29 |
#ifndef BODY_MODEL_CONFIG_FILE |
|
|
30 |
#path BODY_MODEL_CONFIG_FILE "ExampleFiles/BodyModelConfig_FullBody.any" |
|
|
31 |
#endif |
|
|
32 |
|
|
|
33 |
#ifndef MOCAP_EXTRA_DRIVERS_FILE |
|
|
34 |
#path MOCAP_EXTRA_DRIVERS_FILE "ExampleFiles/ExtraDrivers_PlugInGait.any" |
|
|
35 |
#endif |
|
|
36 |
|
|
|
37 |
#ifndef MOCAP_MARKER_PROTOCOL_FILE |
|
|
38 |
#path MOCAP_MARKER_PROTOCOL_FILE "ExampleFiles/MarkerProtocol_PlugInGait.any" |
|
|
39 |
// HACK workaround add a dummy designvar when the model is loaded without |
|
|
40 |
// markers |
|
|
41 |
Main.Studies.ParameterIdentification = {AnyDesVar dummy = {Val = 0;};}; |
|
|
42 |
#endif |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
#ifndef MOCAP_USE_GRF_PREDICTION |
|
|
46 |
#define MOCAP_USE_GRF_PREDICTION OFF |
|
|
47 |
#endif |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
#ifndef MOCAP_FILTER_JOINT_ANGLES |
|
|
51 |
#define MOCAP_FILTER_JOINT_ANGLES OFF |
|
|
52 |
#endif |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
#ifndef MOCAP_HUMAN_GROUND_RESIDUALS |
|
|
56 |
#if (MOCAP_USE_GRF_PREDICTION == ON) |
|
|
57 |
#define MOCAP_HUMAN_GROUND_RESIDUALS "PelvisWeak" |
|
|
58 |
#else |
|
|
59 |
#define MOCAP_HUMAN_GROUND_RESIDUALS "Pelvis" |
|
|
60 |
#endif |
|
|
61 |
#endif |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
#if (MOCAP_USE_GRF_PREDICTION == ON) & (MOCAP_HUMAN_GROUND_RESIDUALS != "PelvisWeak") |
|
|
65 |
AnyMessage AnyMoCap_msg1= |
|
|
66 |
{ |
|
|
67 |
TriggerPreProcess = 1; |
|
|
68 |
Type = MSG_Error; |
|
|
69 |
Message = strformat("Do NOT manually define value for MOCAP_HUMAN_GROUND_RESIDUALS when using GRF prediction"); |
|
|
70 |
}; |
|
|
71 |
#endif |
|
|
72 |
|
|
|
73 |
|
|
|
74 |
#if MOCAP_INPUT_DATA_TYPE == "C3D" |
|
|
75 |
C3DFileData = { |
|
|
76 |
AnyFolder config_warnings = { |
|
|
77 |
AnyInt filter_transients_warning = warn( |
|
|
78 |
orfun( |
|
|
79 |
andfun( |
|
|
80 |
ltfun( |
|
|
81 |
Main.ModelSetup.C3DFileData.Header.FirstFrameNo/Main.ModelSetup.C3DFileData.Header.VideoFrameRate + 0.04, |
|
|
82 |
Main.Studies.MarkerTracking.tArray[0] |
|
|
83 |
), |
|
|
84 |
gtfun( |
|
|
85 |
Main.ModelSetup.C3DFileData.Header.LastFrameNo/Main.ModelSetup.C3DFileData.Header.VideoFrameRate - 0.04, |
|
|
86 |
Main.Studies.MarkerTracking.tArray[0] |
|
|
87 |
) |
|
|
88 |
), |
|
|
89 |
orfun( |
|
|
90 |
ltfun( |
|
|
91 |
(Main.ModelSetup.C3DFileData.Header.LastFrameNo-Main.ModelSetup.C3DFileData.Header.FirstFrameNo) |
|
|
92 |
/Main.ModelSetup.C3DFileData.Header.VideoFrameRate, |
|
|
93 |
0.1 |
|
|
94 |
), |
|
|
95 |
orfun(eqfun(Main.ModelSetup.TrialSpecificData.nStep, 1), eqfun(Main.ModelSetup.C3DFileData.MarkerFilterIndex, -1)) |
|
|
96 |
) |
|
|
97 |
), |
|
|
98 |
strformat("\n"+ |
|
|
99 |
"------------------------------------------------------------------------------------------------------\n"+ |
|
|
100 |
" The tStart/tEnd are very close to the start/end times of the data in the C3D file. \n"+ |
|
|
101 |
" This can cause inaccurate kinematics at the very start/end of the simulation due to \n"+ |
|
|
102 |
" low-pass filter transients. Consider changing the start/end times of the simulation. \n"+ |
|
|
103 |
"-------------------------------------------------------------------------------------------------------\n")); |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
AnyMessage short_c3d_file_warning1 = |
|
|
107 |
{ |
|
|
108 |
Type = MSG_Warning; |
|
|
109 |
TriggerPreProcess = andfun( |
|
|
110 |
ltfun( |
|
|
111 |
Main.ModelSetup.C3DFileData.Header.LastFrameNo-Main.ModelSetup.C3DFileData.Header.FirstFrameNo+1, |
|
|
112 |
8 |
|
|
113 |
), |
|
|
114 |
gtfun( |
|
|
115 |
Main.ModelSetup.C3DFileData.Header.LastFrameNo-Main.ModelSetup.C3DFileData.Header.FirstFrameNo+1, |
|
|
116 |
1 |
|
|
117 |
) |
|
|
118 |
); |
|
|
119 |
|
|
|
120 |
Message = strformat("\n"+ |
|
|
121 |
"------------------------------------------------------------------------------------------------------\n"+ |
|
|
122 |
" The number of frames in the C3D files is less than 8. This causes problems with both lowpass filters\n"+ |
|
|
123 |
" and b-spline interpolation. \n"+ |
|
|
124 |
" \n"+ |
|
|
125 |
" Note: It is still possible to use C3D files with exactly one frame if low-pass filters are disabled.\n"+ |
|
|
126 |
"-------------------------------------------------------------------------------------------------------\n"); |
|
|
127 |
}; |
|
|
128 |
|
|
|
129 |
AnyMessage short_c3d_file_warning2 = |
|
|
130 |
{ |
|
|
131 |
Type = MSG_Warning; |
|
|
132 |
TriggerConst = andfun( |
|
|
133 |
gteqfun(Main.ModelSetup.C3DFileData.MarkerFilterIndex,0), |
|
|
134 |
eqfun(Main.ModelSetup.C3DFileData.Header.LastFrameNo-Main.ModelSetup.C3DFileData.Header.FirstFrameNo+1, 1) |
|
|
135 |
); |
|
|
136 |
Message = strformat("\n"+ |
|
|
137 |
"------------------------------------------------------------------------------------------------------\n"+ |
|
|
138 |
" Marker filters must be disabled when using files with only a single frame.\n"+ |
|
|
139 |
" I.e. set: ``C3DFileData.MarkerFilterIndex = -1;``\n"+ |
|
|
140 |
"-------------------------------------------------------------------------------------------------------\n"); |
|
|
141 |
}; |
|
|
142 |
}; |
|
|
143 |
}; |
|
|
144 |
#endif |
|
|
145 |
|
|
|
146 |
|
|
|
147 |
#ifndef MOCAP_FORCE_PLATE_FILE |
|
|
148 |
#path MOCAP_FORCE_PLATE_FILE "ExampleFiles/ForcePlates_Type2.any" |
|
|
149 |
#endif |
|
|
150 |
|
|
|
151 |
//IF the AnyMoCapModel is loaded directly: add a example c3d file |
|
|
152 |
#if ANYBODY_FILENAME_MAINFILE == "AnyMoCapModel.any" & MOCAP_NAME_MAINFILEDIR == "Model" |
|
|
153 |
Main.ModelSetup.TrialSpecificData.TrialFileName = "C3D_ExampleFile"; |
|
|
154 |
#endif |
|
|
155 |
|
|
|
156 |
#ifndef MOCAP_C3DSETTINGS |
|
|
157 |
#path MOCAP_C3DSETTINGS "C3DSettings.any" |
|
|
158 |
#endif |
|
|
159 |
|
|
|
160 |
#ifndef MOCAP_BVHSETTINGS |
|
|
161 |
#path MOCAP_BVHSETTINGS "BVHSettings.any" |
|
|
162 |
#endif |
|
|
163 |
|
|
|
164 |
|
|
|
165 |
#ifndef BM_CONFIG_VALUES |
|
|
166 |
#define BM_CONFIG_VALUES ON |
|
|
167 |
#endif |
|
|
168 |
|
|
|
169 |
Macros = |
|
|
170 |
{ |
|
|
171 |
|
|
|
172 |
AnyFolder AnyMoCapWarnings = |
|
|
173 |
{ |
|
|
174 |
|
|
|
175 |
AnySwitchVar filter_analog_zero_phase_warning = warn( |
|
|
176 |
GET_INT_DEFAULT("Main.ModelSetup.C3DFileData.LowPassFilter.FilterForwardBackwardOnOff", 1), |
|
|
177 |
strformat("\n"+ |
|
|
178 |
"------------------------------------------------------------------------------------------------------\n"+ |
|
|
179 |
" C3DFileData.LowPassFilter.FilterForwardBackwardOnOff is set to Off. This is probably not wanted \n"+ |
|
|
180 |
" since it causes a group delay in the force data. Consider switching this setting to On \n"+ |
|
|
181 |
"-------------------------------------------------------------------------------------------------------\n") |
|
|
182 |
); |
|
|
183 |
|
|
|
184 |
AnySwitchVar filter_marker_zero_phase_warning = warn( |
|
|
185 |
GET_INT_DEFAULT("Main.ModelSetup.C3DFileData.Filter.FilterForwardBackwardOnOff", 1), |
|
|
186 |
strformat("\n"+ |
|
|
187 |
"------------------------------------------------------------------------------------------------------\n"+ |
|
|
188 |
" C3DFileData.Filter.FilterForwardBackwardOnOff is set to Off. This is probably not wanted \n"+ |
|
|
189 |
" since it causes a group delay in the marker data. Consider switching this setting to On.\n"+ |
|
|
190 |
"-------------------------------------------------------------------------------------------------------\n") |
|
|
191 |
); |
|
|
192 |
|
|
|
193 |
#ifndef MOCAP_DISABLE_GRAVITY_CHECK |
|
|
194 |
|
|
|
195 |
AnyVec3 GravityDirection = Main.Studies.InverseDynamicStudy.Gravity/vnorm(Main.Studies.InverseDynamicStudy.Gravity); |
|
|
196 |
AnyObjectPtrArray ptrForcePlateDir = DesignVar(ObjSearchRecursive("Main.EnvironmentModel.ForcePlates","*.Corners.DownDirection")); |
|
|
197 |
AnyInt nFP = NumElemOf(ptrForcePlateDir); |
|
|
198 |
|
|
|
199 |
// Difference between forceplate down directions and gravity |
|
|
200 |
// This is implemented a bit complicated to handle the case of no forceplates |
|
|
201 |
AnyFloat GravityDiff = reshape(flatten(Obj2Num(ptrForcePlateDir)),{3, nFP}) |
|
|
202 |
- reshape(repmat(nFP, GravityDirection),{3, nFP}); |
|
|
203 |
AnyFloat AbsDiff = max( arrcat( abs(flatten(GravityDiff)), {0.0})); |
|
|
204 |
AnySwitchVar Gravity_direction = warn(ltfun(AbsDiff, 0.5), |
|
|
205 |
strformat("\n"+ |
|
|
206 |
"------------------------------------------------------------------------------------------------------\n"+ |
|
|
207 |
" Gravity appears inconsistant with one or more of the force plates. This might be an error. \n"+ |
|
|
208 |
" \n"+ |
|
|
209 |
" Please check that Main.ModelSetup.LabSpecificData.Gravity is specified correctly. \n"+ |
|
|
210 |
" Set ``#define MOCAP_DISABLE_GRAVITY_CHECK`` to suppress this check. \n"+ |
|
|
211 |
"-------------------------------------------------------------------------------------------------------\n") |
|
|
212 |
); |
|
|
213 |
#endif |
|
|
214 |
|
|
|
215 |
}; |
|
|
216 |
|
|
|
217 |
|
|
|
218 |
}; |