|
a |
|
b/Application/Examples/ShoulderBag/ShoulderBag.Main.any |
|
|
1 |
#include "../libdef.any" |
|
|
2 |
|
|
|
3 |
/* ---------------------------------------------------------------------------- |
|
|
4 |
This is a posture prediction problem based on the standing model. It |
|
|
5 |
simulates a person carrying a bag on the shoulder and tries to predict |
|
|
6 |
the postural changes due to this. |
|
|
7 |
---------------------------------------------------------------------------- */ |
|
|
8 |
Main = { |
|
|
9 |
|
|
|
10 |
// ---------------------------------------------------------- |
|
|
11 |
// Path to draw settings |
|
|
12 |
// ---------------------------------------------------------- |
|
|
13 |
#include "Model/DrawSettings.any" |
|
|
14 |
|
|
|
15 |
// ---------------------------------------------------------- |
|
|
16 |
// Body Model Configuration |
|
|
17 |
// ---------------------------------------------------------- |
|
|
18 |
#include "Model/BodyModelConfiguration.any" |
|
|
19 |
|
|
|
20 |
// The Mannequin file specifies load-time positions for all the segments |
|
|
21 |
// in the HumanModel. This is important for the model's ablity to resolve |
|
|
22 |
// all the kinematic constraints when the model is analyzed. |
|
|
23 |
// The mannequin file also drives those degrees of freedom of the human |
|
|
24 |
// model that are not governed by problem-specific drivers at run time. |
|
|
25 |
#include "Model/Mannequin.any" |
|
|
26 |
|
|
|
27 |
// Model of the human body to be used for the analysis |
|
|
28 |
#include "<ANYBODY_PATH_BODY>/HumanModel.any" |
|
|
29 |
|
|
|
30 |
/// The actual model where all components are assembled |
|
|
31 |
AnyFolder Model={ |
|
|
32 |
/// Body model without default drivers |
|
|
33 |
AnyFolder &BodyModel=.HumanModel.BodyModel; |
|
|
34 |
/// Reference to the mannequin folder (used by drivers) |
|
|
35 |
AnyFolder &Mannequin =.HumanModel.Mannequin; |
|
|
36 |
|
|
|
37 |
#include "Model/Environment.any" |
|
|
38 |
|
|
|
39 |
AnyFolder ModelEnvironmentConnection = { |
|
|
40 |
// This file converts values in the "Mannequin.any" file to Axes matrices |
|
|
41 |
#include "Model/JointsAndDrivers.any" |
|
|
42 |
}; |
|
|
43 |
|
|
|
44 |
}; |
|
|
45 |
|
|
|
46 |
|
|
|
47 |
AnyBodyStudy Study = { |
|
|
48 |
AnyFolder &Model = .Model; |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
tEnd = 1.0; |
|
|
52 |
Gravity = {0.0, -9.81, 0.0}; |
|
|
53 |
nStep = 1; |
|
|
54 |
|
|
|
55 |
AnyOutputFun MaxAct = { |
|
|
56 |
Val = .MaxMuscleActivity; |
|
|
57 |
}; |
|
|
58 |
}; // End of study |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
/// This optimization study demonstrates the use of posture prediction. |
|
|
63 |
/// The underlying assumption is that a person will attain the posture that |
|
|
64 |
/// minimizes the muscular effort. Thus, the study defines a number of postural |
|
|
65 |
/// variables and tries to find the combination that reduces the maximum |
|
|
66 |
/// muscle activity as much as possible. |
|
|
67 |
AnyOptStudy PostureOptimization = { |
|
|
68 |
LogFile = "Output/Optimization.log"; |
|
|
69 |
AnyDesVar HipFlex = { |
|
|
70 |
Val = Main.Model.Mannequin.Posture.Right.HipFlexion; |
|
|
71 |
Min = Val - 10; |
|
|
72 |
Max = Val + 10; |
|
|
73 |
}; |
|
|
74 |
|
|
|
75 |
AnyDesVar PelvisThoraxExt = { |
|
|
76 |
Val = Main.Model.Mannequin.Posture.PelvisThoraxExtension; |
|
|
77 |
Min = Val - 10; |
|
|
78 |
Max = Val + 10; |
|
|
79 |
}; |
|
|
80 |
|
|
|
81 |
AnyDesVar PelvisThoraxLat = { |
|
|
82 |
Val = Main.Model.Mannequin.Posture.PelvisThoraxLateralBending; |
|
|
83 |
Min = Val - 10; |
|
|
84 |
Max = Val + 10; |
|
|
85 |
}; |
|
|
86 |
|
|
|
87 |
AnyDesVar CoMx = { |
|
|
88 |
Val = Main.Model.ModelEnvironmentConnection.Drivers.CoMDriver.DriverPos[0]; |
|
|
89 |
Min = Val - 0.05; |
|
|
90 |
Max = Val + 0.05; |
|
|
91 |
}; |
|
|
92 |
|
|
|
93 |
/// Objective function: MaxMuscleActivity = Muscular effort. |
|
|
94 |
AnyDesMeasure MaxMuscleAct = { |
|
|
95 |
Val = max(..Study.MaxAct()); /// Max of muscle activity |
|
|
96 |
Type = ObjectiveFun; |
|
|
97 |
}; |
|
|
98 |
|
|
|
99 |
/// Definition of the Analysis |
|
|
100 |
Analysis = { |
|
|
101 |
AnyOperation &Analysis = ..Study.InverseDynamics; |
|
|
102 |
}; |
|
|
103 |
}; |
|
|
104 |
|
|
|
105 |
// Include an operation sequence to run all required steps of your application (see Operations tab) |
|
|
106 |
#include "<ANYBODY_PATH_MODELUTILS>\Operations\RunAppSequence.any" |
|
|
107 |
|
|
|
108 |
}; //Main |
|
|
109 |
|