Skip to content

Commit ca24eee

Browse files
JacobAdamsenJacob Hilmar Adamsenmelund
authored
Tutorial snippet updates (#23)
* Tutorial snippet updates * Tutorial images and text changes * Tutorial snippets in Getting started * Tutorial snippets in Modeling the human body * Created whole folders for snippet files * Update tests * Used cmd.exe to create lib in ci test * Merge commit '118df158da292f4b7f185ff8d0172692779da1e9' * Updates to tutorial Modeling the Human Body. New folder structure * Final updates to the first 4 tutorials. * Update file paths in lesson1.md * rename1 * rename2 * Tutorial updates - file structure, images and more * Update file path in lesson2.md --------- Co-authored-by: Jacob Hilmar Adamsen <jha@anybodytech.com> Co-authored-by: Morten Enemark Lund <mel@anybodytech.com>
1 parent 50ab484 commit ca24eee

272 files changed

Lines changed: 65182 additions & 6814 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,31 @@ jobs:
6666
- uses: actions/checkout@v4
6767
with:
6868
fetch-depth: 0
69+
path: tutorials
70+
- uses: actions/checkout@v4
71+
with:
72+
repository: anybody/ammr
73+
ref: master
74+
path: ammr
75+
76+
- shell: cmd
77+
run: |
78+
echo #include "%GITHUB_WORKSPACE%/ammr/libdef.any" > libdef.any
6979
80+
7081
- uses: prefix-dev/setup-pixi@v0.8.1
7182
with:
7283
cache: true
7384
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
7485
environments: test
86+
manifest-path: tutorials/pixi.toml
7587
activate-environment: true
7688

7789
- name: Test Snippets
7890
if: ${{ !github.event.pull_request.head.repo.fork && github.repository == 'anybody/tutorials' }}
79-
run: pytest
91+
run: |
92+
cd tutorials
93+
pytest
8094
env:
8195
RLM_LICENSE: ${{ secrets.LICENSE_TEST_SERVER }}
8296
RLM_LICENSE_PASSWORD: ${{ secrets.LICENSE_TEST_SERVER_PASSWORD }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#path __BM_PLUGIN_FILE__ "BodyModelConfiguration.any"
2+
#define BM_CONFIG_PLUGIN __BM_PLUGIN_FILE__
3+
4+
// -----------------------------------------------------------------------------------
5+
// The BodyModel configuration can be modified using BodyModel GUI plugin
6+
// or by manually editing this file.
7+
//
8+
// Please see this this file for more information on the options:
9+
// #path HTML_DOC "<AMMR_PATH_DOC>/bm_config/index.html"
10+
// -----------------------------------------------------------------------------------
11+
12+
#define BM_MANNEQUIN_DRIVER_DEFAULT ON
13+
14+
// Enable the TLEM2 lower extremity model
15+
#define BM_LEG_MODEL _LEG_MODEL_TLEM2_
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
2+
DrawSettings ={
3+
4+
5+
//This is the color definitions of the nodes and segments
6+
Colors = {
7+
AnyBodyRed = {149/256,51/256,55/256}; //AnyBody standard red
8+
AnyBodyGreen = {47/256,131/256,80/256}; //AnyBody standard green
9+
AnyBodyBlue = {82/256,85/256,111/256}; //AnyBody standard blue
10+
AnyBodyYellow= {235/256,197/256,17/256}; //AnyBody standard yellow
11+
AnyBodyPaleYellow = {248/256,204/256,115/256}; //AnyBody standard pale yellow
12+
AnyBodyGrey = {153/256,153/256,153/256}; //AnyBody standard grey
13+
14+
Nodes = AnyBodyPaleYellow;
15+
Segments = AnyBodyPaleYellow;
16+
};
17+
18+
Muscle ={
19+
RGB = .Colors.AnyBodyRed;
20+
Visible =On;
21+
DrawScaleOnOff =Off;
22+
Bulging =0.0;
23+
ColorScale =1.0;
24+
RGBColorScale = {0.957031, 0.785156, 0.785156};
25+
MaxStress = 2500000.000000; //N/m^2 //This number is for graphics only!
26+
Opacity =1.0;
27+
DrawScale =
28+
{
29+
EnableCreasing = Off;
30+
CreasingAngle = 0.524;
31+
EnableWireframe = Off;
32+
EnableSmoothing = On;
33+
Param = 0.0;
34+
ParamArray = {0.0, 0.167, 0.333, 0.5, 0.667, 0.833, 1.0};
35+
RGBArray = {{0.0, 0.0, 0.6}, {0.0, 0.0, 1.0}, {0.0, 1.0, 1.0}, {0.0, 1.0, 0.0}, {1.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, {0.6, 0.0, 0.0}};
36+
OpacityArray = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
37+
};
38+
};
39+
40+
41+
BonesOpacity ={
42+
43+
GlobalCoef = 1;
44+
45+
Skull = 1*GlobalCoef;
46+
Thorax = 1*GlobalCoef;
47+
Pelvis = 1*GlobalCoef;
48+
Sacrum = 1*GlobalCoef;
49+
L5 = 1*GlobalCoef;
50+
L4 = 1*GlobalCoef;
51+
L3 = 1*GlobalCoef;
52+
L2 = 1*GlobalCoef;
53+
L1 = 1*GlobalCoef;
54+
55+
RightFoot = 1*GlobalCoef;
56+
RightShank = 1*GlobalCoef;
57+
RightThigh = 1*GlobalCoef;
58+
59+
LeftFoot = 1*GlobalCoef;
60+
LeftShank = 1*GlobalCoef;
61+
LeftThigh = 1*GlobalCoef;
62+
63+
64+
RightClavicula = 1*GlobalCoef;
65+
RightScapula = 1*GlobalCoef;
66+
RightHumerus = 1*GlobalCoef;
67+
RightUlna = 1*GlobalCoef;
68+
RightRadius = 1*GlobalCoef;
69+
RightHand = 1*GlobalCoef;
70+
71+
LeftClavicula = 1*GlobalCoef;
72+
LeftScapula = 1*GlobalCoef;
73+
LeftHumerus = 1*GlobalCoef;
74+
LeftUlna = 1*GlobalCoef;
75+
LeftRadius = 1*GlobalCoef;
76+
LeftHand = 1*GlobalCoef;
77+
78+
79+
// For leg TD only.
80+
RightTalus = 1*GlobalCoef;
81+
RightPatella = 1*GlobalCoef;
82+
83+
LeftTalus = 1*GlobalCoef;
84+
LeftPatella = 1*GlobalCoef;
85+
86+
87+
// For detailed cervical model only.
88+
C1 = 1*GlobalCoef;
89+
C2 = 1*GlobalCoef;
90+
C3 = 1*GlobalCoef;
91+
C4 = 1*GlobalCoef;
92+
C5 = 1*GlobalCoef;
93+
C6 = 1*GlobalCoef;
94+
C7 = 1*GlobalCoef;
95+
};
96+
97+
98+
99+
SegmentAxes ={
100+
RGB ={0,0,1};
101+
ScaleXYZ ={0.0001,0.00001,0.00001};
102+
};
103+
BML ={
104+
ScaleXYZ ={0.0006,0.0006,0.0006};
105+
RGB = .Colors.AnyBodyBlue;
106+
};
107+
JointAxesProximal = {
108+
RGB = .Colors.AnyBodyRed;
109+
ScaleXYZ = {0.015,0.015,0.015};
110+
};
111+
JointAxesDistal = {
112+
RGB = .Colors.AnyBodyGreen;
113+
ScaleXYZ = {0.01,0.01,0.01};
114+
};
115+
116+
117+
SegmentNodes ={
118+
ScaleXYZ ={0.0005,0.0005,0.0005};
119+
RGB = .Colors.AnyBodyRed;
120+
};
121+
WrapGeometry ={
122+
RGB ={1,1,1};
123+
};
124+
125+
DrawSettingsSupport={
126+
Lin={
127+
ScaleFactor=0.004;
128+
RGB = {0,0,1};
129+
Thickness = 0.004;
130+
HeadThickness = 2*Thickness;
131+
HeadLength = 3*Thickness;
132+
};
133+
Rot={
134+
ScaleFactor=0.08;
135+
RGB = {1,0,0};
136+
Thickness = 0.075;
137+
HeadThickness = 2*Thickness;
138+
HeadLength = 5*Thickness;
139+
};
140+
};
141+
142+
143+
Marker={
144+
Color={0,0,1};
145+
Radius=0.00;
146+
147+
};
148+
149+
}; //DrawSettings
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
AnyFolder Environment = {
2+
//^ Environment files are used to include objects surrounding human,
3+
//^ e.g. global reference frame
4+
5+
AnyFixedRefFrame GlobalRef =
6+
{
7+
AnyDrawRefFrame drw={ScaleXYZ=0.3*{1,1,1};};
8+
9+
AnyRefNode RightFootPrint = {
10+
//^ Positioning of the right foot.
11+
//^ Ground-foot constraints can be excluded with: #define EXCLUDE_FOOT_CONSTRAINTS
12+
sRel = HeelPosition;
13+
ARel = RotMat({0,0,0}, ToeDirection, {0,10,0});
14+
AnyDrawRefFrame drw = {RGB = {0,0.7,0}; ScaleXYZ = 0.1*{1,1,1};};
15+
};
16+
17+
AnyRefNode LeftFootPrint = {
18+
//^ Positioning of the right foot.
19+
//^ Ground-foot constraints can be excluded with: #define EXCLUDE_FOOT_CONSTRAINTS
20+
sRel = HeelPosition;
21+
ARel = RotMat({0,0,0}, ToeDirection, {0,10,0});
22+
AnyDrawRefFrame drw = {RGB = {0,0.7,0}; ScaleXYZ = 0.1*{1,1,1};};
23+
};
24+
};
25+
};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
//-------- GRFPrediction for the right leg
3+
// See: #include "<ANYBODY_PATH_AMMR>/Tools/GRFPrediction/FootPlateConditionalContact.any"
4+
FootPlateConditionalContact GRF_Prediction_Right(
5+
NORMAL_DIRECTION = "Y",
6+
NUMBER_OF_NODES = 25,
7+
NODES_FOLDER = FootNodes,
8+
PLATE_BASE_FRAME = Main.Model.Environment.GlobalRef,
9+
GLOBAL_REF = Main.Model.Environment.GlobalRef,
10+
SHOW_TRIGGER_VOLUME = ON
11+
) =
12+
{
13+
CreateFootContactNodes25 FootNodes(
14+
foot_ref=Main.HumanModel.BodyModel.Right.Leg.Seg.Foot
15+
) = {};
16+
17+
// Additional force plate settings
18+
Settings =
19+
{
20+
LimitDistHigh = 0.025; // Vertical height
21+
FrictionCoefficient = 0.8;
22+
};
23+
};
24+
25+
26+
//-------- GRFPrediction for the right leg
27+
// See: #include "<ANYBODY_PATH_AMMR>/Tools/GRFPrediction/FootPlateConditionalContact.any"
28+
FootPlateConditionalContact GRF_Prediction_Left(
29+
NORMAL_DIRECTION = "Y",
30+
NUMBER_OF_NODES = 25,
31+
NODES_FOLDER = FootNodes,
32+
PLATE_BASE_FRAME = Main.Model.Environment.GlobalRef,
33+
GLOBAL_REF = Main.Model.Environment.GlobalRef,
34+
SHOW_TRIGGER_VOLUME = ON
35+
) =
36+
{
37+
CreateFootContactNodes25 FootNodes(
38+
foot_ref=Main.HumanModel.BodyModel.Left.Leg.Seg.Foot
39+
) = {};
40+
41+
Settings =
42+
{
43+
LimitDistHigh = 0.025;
44+
FrictionCoefficient = 0.8;
45+
};
46+
};
47+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
2+
// Center of Mass drivers can be excluded
3+
// by setting #define EXCLUDE_COM_BALANCE_DRIVERS
4+
#ifndef EXCLUDE_COM_BALANCE_DRIVERS
5+
6+
//Constraint the collective CoM to be right above the GlobalRef
7+
AnyKinDriver CenterOfMassDriver = {
8+
AnyKinMeasure& CoM = ..BodyModel.Interface.CenterOfMass;
9+
AnyFunConst Position = {
10+
Value = Main.Model.CenterOfMassXZ;
11+
};
12+
MeasureOrganizer = {0,2}; // Only the x and z directions
13+
Reaction.Type = {Off,Off};
14+
15+
};
16+
// Ankles are assigned a lower weight so most of the
17+
// center of mass balancing will happen at the ankle joint.
18+
Main.Model.DefaultMannequinDrivers.DefaultWeakDriverWeight = 0.01;
19+
Main.Model.DefaultMannequinDrivers.AnkleDriverLeftFlexion.WeakDriverWeight = 0.001;
20+
Main.Model.DefaultMannequinDrivers.AnkleDriverRightFlexion.WeakDriverWeight = 0.001;
21+
22+
#endif
23+
24+
25+
26+
// Foot driver constraints can be excluded
27+
// by setting #define EXCLUDE_FOOT_CONSTRAINTS
28+
#ifndef EXCLUDE_FOOT_CONSTRAINTS
29+
30+
// Default drivers for the pelvis position is set to zero
31+
// since foot drivers determine the position of the model
32+
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverPosX.WeakDriverWeight = 0;
33+
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverPosY.WeakDriverWeight = 0;
34+
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverPosZ.WeakDriverWeight = 0;
35+
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverRotX.WeakDriverWeight = 0;
36+
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverRotY.WeakDriverWeight = 0;
37+
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverRotZ.WeakDriverWeight = 0;
38+
39+
40+
AnyFolder Right =
41+
{
42+
AnyKinEq HeelFloorContraint = {
43+
AnyKinLinear HeelMeasure = {
44+
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.RightFootPrint;
45+
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Right.Leg.Seg.Foot.HeelContactNodeLow;
46+
};
47+
Reaction.Type = {Off,Off,Off};
48+
};
49+
50+
AnyKinEq ToeDirectionContraint =
51+
{
52+
AnyKinLinear ToeDirection = {
53+
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.RightFootPrint;
54+
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Right.Leg.Seg.Foot.BigToeNode;
55+
};
56+
MeasureOrganizer = {1,2}; // Only y,z direction
57+
Reaction.Type = {Off,Off};
58+
};
59+
};
60+
61+
AnyFolder Left =
62+
{
63+
AnyKinEq HeelFloorContraint = {
64+
AnyKinLinear HeelMeasure = {
65+
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.LeftFootPrint;
66+
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Left.Leg.Seg.Foot.HeelContactNodeLow;
67+
};
68+
Reaction.Type = {Off,Off,Off};
69+
};
70+
71+
AnyKinEq ToeDirectionContraint =
72+
{
73+
AnyKinLinear ToeDirection = {
74+
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.LeftFootPrint;
75+
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Left.Leg.Seg.Foot.BigToeNode;
76+
};
77+
MeasureOrganizer = {1,2}; // Only y,z direction
78+
Reaction.Type = {Off,Off};
79+
};
80+
};
81+
82+
#endif

0 commit comments

Comments
 (0)