Skip to content

Commit 9cc3108

Browse files
author
Jacob Hilmar Adamsen
committed
Content added from the AMMR page
1 parent b21e50b commit 9cc3108

10 files changed

Lines changed: 395 additions & 40 deletions

File tree

A_Getting_started/intro.md

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,50 @@ the model view window
2121
This tutorial relies heavily on using the AnyBody Managed Model Repository (AMMR).
2222
Follow the steps below to unpack a local version of the AMMR.
2323

24-
## Setup the AMMR
25-
26-
Before you continue, you must unpack the entire repository and save it on your
27-
hard disk. To get a copy of the AMMR, press the Demo tab in the AnyBody
28-
assistant dialog box.
29-
30-
![...](_static/intro/image1.png)
31-
32-
Following the instructions in the Demo tab will install a copy of the AMMR in
33-
your documents folder by default. It is good practice to create a second local
34-
copy of the AMMR so that you do not overwrite the original AMMR folder by
35-
accident.
24+
(SettingUpAMMR)=
25+
## Setting Up the AMMR
26+
27+
The *AnyBody Managed Model Repository* (AMMR) is a comprehensive open library of
28+
musculoskeletal models and examples designed to use with the AnyBody Modeling
29+
System. It allows users to configure and combine different body models, which
30+
can be easily integrated into their own simulations and analyses.
31+
32+
The AnyBody Managed Model Repository (AMMR) is included with the AnyBody
33+
Modeling System, but it needs to be manually installed or unpacked after
34+
installing AnyBody. You can install the AMMR from the AnyBody Assistant dialog
35+
that appears when AnyBody starts.
36+
37+
To get a copy of the latest AMMR files, press the Demo tab in the AnyBody
38+
assistant dialog box. Then select the *“Install the demo repository by clicking*
39+
*this link”*
40+
41+
```{figure} _static/intro/image1.png
42+
:alt: AMMR setup
43+
:class: bg-primary
44+
:align: center
45+
```
46+
47+
This installs a copy of the AMMR locally in your documents folder by default (e.g.
48+
{{AMMR_DEMO_INST_DIR}}). If
49+
there are multiple users using your computer, each of them will have to follow
50+
this guide. It is good practice to create a second local copy of the AMMR so
51+
that you do not overwrite the original AMMR folder by accident. There you can
52+
initialise a git repository in which you can version you models, keep a backup,
53+
or share them easily with the community.
54+
55+
:::{important}
56+
AnyBody Modelling System comes with a version of AMMR (not necessarily the
57+
latest) placed in the installation folder of the software. Do not directly use
58+
these files for your actual work as updates or reinstallation of AnyBody can
59+
overwrite your changes. So always **copy the files from the AMMR folder to your**
60+
**working folder** before using them.
61+
:::
3662

3763
## AMMR structure
3864

3965
Open a file manager and navigate to the directory where you unpacked the
40-
repository. You should see a folder structure that includes the following
41-
subfolders:
66+
repository (default is your documents folder). You should see a folder structure
67+
that includes the following subfolders:
4268

4369
- **Application**: Includes demo simulations of activities such as cycling,
4470
lifting a box, or propelling a wheelchair.

A_Getting_started/lesson1.md

Lines changed: 153 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,16 @@ location of the file is shown in the title bar:
6060
```
6161

6262
:::{warning}
63-
If you saved your model in an other location be
63+
If you saved your model in another location be
6464
sure to modify the {file}`../libdef.any` file so it points
6565
to AMMR repository you want to use.
66+
67+
The following line should always refer correctly to the libdef file
68+
regardless of where you save your model.
69+
70+
```AnyScriptDoc
71+
#include "<ANYBODY_PATH_INSTALLDIR>/AMMR/libdef.any"
72+
```
6673
:::
6774

6875
(loading-a-model)=
@@ -88,7 +95,7 @@ another file loading priority by right-clicking its tab and select “Load Model
8895
## The model view
8996

9097
When loading is completed, the Model View window opens and shows the standing
91-
model: (You can open it manually from View -> Model Views).
98+
model. You can open it manually from View -> Model Views.
9299

93100
```{image} _static/lesson1/image_5.png
94101
:alt: Model view
@@ -110,5 +117,149 @@ functions, so keyboard shortcuts have been provided:
110117
- If you have a scrolling wheel on your mouse, this will zoom the model
111118
in and out.
112119

120+
## Understanding the AnyScript Model Structure
121+
122+
This Human Standing Model is a model from the AnyBody Managed Model Repository
123+
(AMMR). It uses the [Human Model](https://anyscript.org/ammr/beta/body/models.html#the-body-model)
124+
from the AMMR, which is used by most models you will encounter when using the AMMR.
125+
Regardless of complexity, all models share a common structure used to set them
126+
up.
127+
128+
The models will typically have the following overall structure (*notice*, the
129+
AnyScript below is not excatly the same as the Standing Model used in this
130+
tutorial, but contains the same overall structure):
131+
132+
```AnyScriptDoc
133+
// Include the libdef file from the AMMR
134+
#include "libdef.any"
135+
136+
Main =
137+
{
138+
// Define the BodyModel configuration
139+
#include "Model/BodyModelConfiguration.any"
140+
141+
// Include the Human model from AMMR
142+
#include "<ANYBODY_PATH_BODY>/HumanModel.any"
143+
144+
// Define desired posture or movement of the model
145+
#include "Model\Mannequin.any"
146+
147+
// Compose the model
148+
AnyFolder Model =
149+
{
150+
AnyFolder &BodyModel = .HumanModel.BodyModel;
151+
AnyFolder Drivers = {...};
152+
AnyFolder Environment = {...};
153+
};
154+
155+
// Configuring the Study
156+
AnyBodyStudy Study =
157+
{
158+
AnyFolder &Model= .Model;
159+
Gravity = {0.0, -9.81,0.0}; // Gravity Vector
160+
nStep = 10; // Number of steps
161+
tStart = 0; // Start time
162+
tEnd = 10.0; // End time
163+
};
164+
};
165+
```
166+
167+
Let us go through the different components of this structure to understand how they work.
168+
169+
### Path to AMMR:
170+
171+
:::{note}
172+
:class: margin
173+
You can open a file by double-clicking on its name in the AnyScript.
174+
:::
175+
176+
```AnyScriptDoc
177+
#include "libdef.any"
178+
```
179+
180+
This means your model will include the content of the file called `libdef.any`.
181+
This file references to another `libdef.any` file located at the top-level
182+
folder of the AMMR, which specifies the AMMR directories to use in your model.
183+
You can have multiple versions of AMMR available on your computer, and this
184+
points to the version you wish to use. This line should be at the very beginning
185+
of your `main.any` file.
186+
187+
### Configuring the Human Model:
188+
189+
```AnyScriptDoc
190+
Main =
191+
{
192+
// Define the BodyModel configuration
193+
#include "Model/BodyModelConfiguration.any"
194+
```
195+
196+
Here, the main declaration of the model, `Main = {}`, is initiated, and this file now
197+
becomes the main model file. All basic AnyScript contains a main file that
198+
defines the model’s structure, contents and the operations to be performed.
199+
200+
The file `BodyModelConfiguration.any` is included, which defines what parts of the
201+
human body model are included, through a number of switches called Body Model
202+
(BM) parameters. BM parameters are always prefixed with `BM_` inside AnyScript.
203+
The values of these parameters are defined by `#define` and `#path` statements.
204+
205+
### Including the Human Model
206+
207+
```AnyScriptDoc
208+
#include "<ANYBODY_PATH_BODY>/HumanModel.any"
209+
```
210+
211+
The AMMR contains multiple musculoskeletal models. The above line includes the
212+
Human Model from the AMMR. The file path `<ANYBODY_PATH_BODY>` is defined in
213+
`libdef.any`.
214+
215+
It is important that the above configuration statements are placed
216+
before this line.
217+
218+
### Defining the Posture and Movement
219+
220+
```AnyScriptDoc
221+
#include "Model\Mannequin.any"
222+
```
223+
224+
This includes the file `Mannequin.any` which defines the posture and movement of
225+
the human body model.
226+
227+
### Composing the Model
228+
229+
```AnyScriptDoc
230+
AnyFolder Model =
231+
{
232+
AnyFolder &BodyModel = .HumanModel.BodyModel;
233+
AnyFolder Drivers = {...};
234+
AnyFolder Environment = {...};
235+
};
236+
```
237+
238+
This is where we combine the `Body` from the Human Model with extra things like
239+
drivers, external loads, and constraints. It could also be any models of the
240+
environment which the body interacts with or many other things.
241+
242+
### The Study section
243+
244+
```AnyScriptDoc
245+
AnyBodyStudy Study =
246+
{
247+
AnyFolder &Model= .Model;
248+
Gravity = {0.0, -9.81,0.0}; // Gravity Vector
249+
nStep = 10; // Number of steps
250+
tStart = 0; // Start time
251+
tEnd = 10.0; // End time
252+
};
253+
```
254+
255+
The `AnyBodyStudy` is where you configure and define your simulation. It
256+
specifies start and end times of the simulation, and the number of steps. It also
257+
configures which solvers are used.
258+
259+
Only the model elements which are referenced to within the Study will be
260+
included in the simulation. In this case, the line `AnyFolder &Model= .Model;`
261+
references to the Model folder, meaning everything in the Model folder is part of the
262+
simulation.
263+
113264
You can now proceed to {doc}`lesson2`.
114265

A_Getting_started/lesson2.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ The script editor currently shows the main file of the model, which includes the
77
line of code `Main = {}`. Any basic AnyScript contains a main file that defines
88
the model's structure and the operations to be performed on the model.
99

10-
The `Mannequin.any` file, included in the main file, determines the posture of
11-
the Standing Model by specifying the angles at the anatomical joints.
12-
13-
Scroll down to the line that says `#include "Model\Mannequin.any"`.
10+
Scroll down to the line that says `#include "Model\Mannequin.any"`. This line
11+
means that your model will include the content of the file called
12+
`Mannequin.any` located in the Model folder, within the main file.
1413

1514
## Mannequin file structure
1615

@@ -20,8 +19,8 @@ Scroll down to the line that says `#include "Model\Mannequin.any"`.
2019
:end-before: //# END SNIPPET 1
2120
```
2221

23-
**This line means that your model will include the content of the
24-
"Mannequin.any" file located in the Model folder, within the main file.**
22+
The `Mannequin.any` file determines the posture of the Standing Model by
23+
specifying the angles at the anatomical joints.
2524

2625
Double-clicking the file name in the editor window after loading
2726
your model opens the mannequin file in a new tab. Then you see the

0 commit comments

Comments
 (0)