Skip to content

Moved a lot of content from the AMMR Page to Tutorials. #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified A_Getting_started/_static/intro/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 40 additions & 15 deletions A_Getting_started/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

# Getting Started Tutorial

:::{note} The AnyBody software comes with an inbuilt model repository - The
:::{note}
The AnyBody software comes with an inbuilt model repository - The
AnyBody Managed Model Repository (AMMR). This tutorial starts with unpacking a
local version of the AMMR. You can skip to {doc}`lesson 1 <lesson1>` if you have
already done this.
Expand All @@ -21,24 +22,48 @@ the model view window
This tutorial relies heavily on using the AnyBody Managed Model Repository (AMMR).
Follow the steps below to unpack a local version of the AMMR.

# Setup the AMMR

Before you continue, you must unpack the entire repository and save it on your
hard disk. To get a copy of the AMMR, press the Demo tab in the AnyBody
assistant dialog box.

![...](_static/intro/image1.png)

Following the instructions in the Demo tab will install a copy of the AMMR in
your documents folder by default. It is good practice to create a second local
copy of the AMMR so that you do not overwrite the original AMMR folder by
accident.
# Seting Up the AMMR

*The AnyBody Managed Model Repository* (AMMR) is a comprehensive open library of
musculoskeletal models and examples designed to use with the AnyBody Modeling
System. It allows users to configure and combine different body models, which
can be easily integrated into their own simulations and analyses.

The AnyBody Managed Model Repository (AMMR) is included with the AnyBody
Modeling System, but it needs to be manually installed or unpacked after
installing AnyBody. You can install the AMMR from the AnyBody Assistant dialog
that appears when AnyBody starts.

To get a copy of the latest AMMR files, press the Demo tab in the AnyBody
assistant dialog box. Then select the “Install the demo repository by clicking
this link”

```{figure} _static/intro/image1.png
:alt: AMMR setup
:class: bg-primary
:align: center
```

This installs a copy of the AMMR locally in your documents folder by default. If
there are multiple users using your computer, each of them will have to follow
this guide. It is good practice to create a second local copy of the AMMR so
that you do not overwrite the original AMMR folder by accident. There you can
initialise a git repository in which you can version you models, keep a backup,
or share them easily with the community.

:::{important}
AnyBody Modelling System comes with a version of AMMR (not necessarily the
latest) placed in the installation folder of the software. Do not directly use
these files for your actual work as updates or reinstallation of AnyBody can
overwrite your changes. So always **copy the files from the AMMR folder to your**
**working folder** before using them.
:::

# AMMR structure

Open a file manager and navigate to the directory where you unpacked the
repository. You should see a folder structure that includes the following
subfolders:
repository (default is your documents folder). You should see a folder structure
that includes the following subfolders:

- **Application**: Includes demo simulations of activities such as cycling,
lifting a box, or propelling a wheelchair.
Expand Down
163 changes: 154 additions & 9 deletions A_Getting_started/lesson1.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ location of the file is shown in the title bar:
:align: center
```

:::{warning}
If you saved your model in an other location be
sure to modify the {file}`../libdef.any` file so it points
to AMMR repository you want to use.
:::{warning}
If you saved your model in an other location be sure to modify the file
{file}`../libdef.any` so it points to AnyBody Managed Model Repository you
want to use.
:::

(loading-a-model)=

## Loading a model

To see the 3D graphical representation of the model you need to load.
To see the 3D graphical representation of the model you need to load it.

**Load/reload is a frequent operation and has been assigned to function key F7.
You may also load your model by clicking** ![Load](_static/lesson1/image_6.png)
**in the toolbar.**
Load/reload is a frequent operation and has been assigned the function key F7.
You may also load your model by clicking ![Load](_static/lesson1/image_6.png)
in the toolbar.

This action will load whatever file is chosen in the text editor. If a file is
already loaded, the above action will simply reload the file until you give
Expand All @@ -88,12 +88,13 @@ another file loading priority by right-clicking its tab and select “Load Model
## The model view

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

```{image} _static/lesson1/image_5.png
:alt: Model view
:class: bg-primary
:align: center
:width: 70%
```

The icons in the toolbar at the top of the Model View window allow you to modify
Expand All @@ -110,5 +111,149 @@ functions, so keyboard shortcuts have been provided:
- If you have a scrolling wheel on your mouse, this will zoom the model
in and out.

## Understanding the AnyScript Model Structure

This Human Standing Model is a model from the AnyBody Managed Model Repository
(AMMR). It uses the [Human Model](https://anyscript.org/ammr/beta/body/models.html#the-body-model)
from the AMMR, which is used by most models you will encounter when using the AMMR.
Regardless of complexity, all models share a common structure used to set them
up.

The models will typically have the following overall structure (*notice*, the
AnyScript below is not excatly the same as the Standing Model used in this
tutorial, but contains the same overall structure):

```AnyScriptDoc
// Include the libdef file from the AMMR
#include "libdef.any"

Main =
{
// Define the BodyModel configuration
#include "Model/BodyModelConfiguration.any"

// Include the Human model from AMMR
#include "<ANYBODY_PATH_BODY>/HumanModel.any"

// Define desired posture or movement of the model
#include "Model\Mannequin.any"

// Compose the model
AnyFolder Model =
{
AnyFolder &BodyModel = .HumanModel.BodyModel;
AnyFolder Drivers = {...};
AnyFolder Environment = {...};
};

// Configuring the Study
AnyBodyStudy Study =
{
AnyFolder &Model= .Model;
Gravity = {0.0, -9.81,0.0}; // Gravity Vector
nStep = 10; // Number of steps
tStart = 0; // Start time
tEnd = 10.0; // End time
};
};
```

Let us go through the different components of this structure to understand how they work.

**Path to AMMR:**

:::{note}
:class: margin
Your can open a file by double-clicking on its name in the AnyScript.
:::

```AnyScriptDoc
#include "libdef.any"
```

This means your model will include the content of the file called `libdef.any`.
This file references to another `libdef.any` file located at the top-level
folder of the AMMR, which specifies the AMMR directories to use in your model.
You can have multiple versions of AMMR available on your computer, and this
points to the version you wish to use. This line should be at the very beginning
of your `main.any` file.

**Configuring the Human Model:**

```AnyScriptDoc
Main =
{
// Define the BodyModel configuration
#include "Model/BodyModelConfiguration.any"
```

Here, the main declaration of the model, `Main = {}`, is initiated, and file now
becomes the main model file. All basic AnyScript contains a main file that
defines the model’s structure, contents and the operations to be performed.

The file `BodyModelConfiguration.any` is included, which defines what parts of the
human body model are included, through a number of switches called Body Model
(BM) parameters. BM parameters are always prefixed with `BM_` inside AnyScript.
The values of these parameters are defined by `#define` and `#path` statements.

**Including the Human Model**

```AnyScriptDoc
#include "<ANYBODY_PATH_BODY>/HumanModel.any"
```

The AMMR contains multiple musculoskeletal models. The above line includes the
Human Model from the AMMR. The file path `<ANYBODY_PATH_BODY>` is defined in
`libdef.any`.

It is important that the configuration statements are placed
before this line.

**Defining the Posture and Movement**

```AnyScriptDoc
#include "Model\Mannequin.any"
```

This includes the file `Mannequin.any` which defines the posture and movement of
the human body model.

**Composing the Model**

```AnyScriptDoc
AnyFolder Model =
{
AnyFolder &BodyModel = .HumanModel.BodyModel;
AnyFolder Drivers = {...};
AnyFolder Environment = {...};
};
```

This is where we combine the `Body` from the Human Model with extra things like
drivers, external loads, and constraints. It could also be any models of the
environment which the body interacts with or many other things.

**The Study section**

```AnyScriptDoc
AnyBodyStudy Study =
{
AnyFolder &Model= .Model;
Gravity = {0.0, -9.81,0.0}; // Gravity Vector
nStep = 10; // Number of steps
tStart = 0; // Start time
tEnd = 10.0; // End time
};
```

The `AnyBodyStudy` is where you configure and define your simulation. It
specifies start and end times of the simulation, and the number of steps. It also
configures which solvers are used.

Only the model elements which are referenced to within the Study will be
included in the simulation. In this case, the line `AnyFolder &Model= .Model;`
references to the Model folder, meaning everything in the Model folder is part of the
simulation.

You can now proceed to {doc}`lesson2`.

13 changes: 6 additions & 7 deletions A_Getting_started/lesson2.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ The script editor currently shows the main file of the model, which includes the
line of code `Main = {}`. Any basic AnyScript contains a main file that defines
the model's structure and the operations to be performed on the model.

The `Mannequin.any` file, included in the main file, determines the posture of
the Standing Model by specifying the angles at the anatomical joints.

Scroll down to the line that says `#include "Model\Mannequin.any"`.
Scroll down to the line that says `#include "Model\Mannequin.any"`. This line
means that your model will include the content of the file called `Mannequin.any`
located in the Model folder, within the main file.

## Mannequin file structure

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

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

Double-clicking the file name in the editor window after loading
your model opens the mannequin file in a new tab. Then you see the
following structure. (In the interest of legibility we have removed many
following structure (in the interest of legibility we have removed many
of the lines):

```{literalinclude} Snippets/lesson2/MyStandingHuman-2/Model/Mannequin.any
Expand Down
13 changes: 8 additions & 5 deletions A_Getting_started_AMMR/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ The AnyBody Managed Model Repository (AMMR), is an open library of musculoskelet
models and examples ready to be used with the AnyBody Modeling System.

The [AMMR documentation](https://anyscript.org/ammr/) is hosted
separately, and contains a few tutorials and other usefull information. The
[Creating a Human Model from scratch](https://anyscript.org/ammr/creating_model_from_scratch.html) tutorial is
recommended for new users.

separately and contains usefull information. See the below links for more information.


```{rubric} AMMR documentation
```

- [Main AMMR documentation](https://anyscript.org/ammr/)
- [Getting started with the AMMR](https://anyscript.org/ammr/getting_started.html)
- [Configuring the Body Model](https://anyscript.org/ammr/bm_config/index.html)
- [Application Examples](https://anyscript.org/ammr/Applications/index.html)
<!-- - [Getting started with the AMMR](https://anyscript.org/ammr/getting_started.html) -->



<!--
References to previous AMMR chapters
```{rubric} AMMR Tutorials
```

Expand All @@ -42,3 +44,4 @@ Scaling: Joint to joint scaling <https://anyscript.org/ammr/Scaling/lesson1.html
Scaling: External Body Measurements <https://anyscript.org/ammr/Scaling/lesson2.html>
Scaling: Segmental scaling factors <https://anyscript.org/ammr/Scaling/lesson3.html>
```
-->
1 change: 1 addition & 0 deletions A_Getting_started_anyscript/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
::: {rst-class} break
:::

(How_to_write_AnyScript)=
# How to write AnyScript

This tutorial introduces the AnyScript modeling language, which is used
Expand Down
15 changes: 11 additions & 4 deletions A_Getting_started_anyscript/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@ System (AMS). It has been specially designed for describing the workings
of the human body and its interactions with environmental objects such as
exoskeletons, sports equipment, workplaces, etc.

**In this tutorial, you will create your first AnyScript model, a
simplified model of an arm.**
In this tutorial, you will create your first AnyScript model, a
simplified model of an arm.

Each lesson (after lesson 1) begins with a link to a file containing the
AnyScript code introduced up to that point. If you have a problem getting your code to work, simply
download the demo files and start from there.
AnyScript code introduced up to that point. If you have a problem getting your
code to work, simply download the demo files and start from there.

:::{seealso}
*The AnyScript Reference Manual* provides comprehensive details on all the
classes, functions, etc. available in AnyScript. You can access The AnyScript
Reference Manual by opening an AnyBody window and selecting 'Help' -> 'AnyScript
Reference' from the top menu.
:::

Let's get started with {doc}`Lesson 1: Basic concepts <lesson1>`

2 changes: 1 addition & 1 deletion A_Getting_started_anyscript/lesson1.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

:::{note}
**To follow this tutorial, it is recommended to first watch the
introductory video found at this link:** "{doc}`Tutorial Overview <../index>`".
introductory video found at this link:** "{doc}`Getting Started <../GettingStarted>`".
:::

To create an AnyScript model from scratch, go to "File menu -> New from
Expand Down
15 changes: 10 additions & 5 deletions A_Getting_started_modeling/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@
# Introduction: Getting Started with Modeling

Developing accurate models of the human body from scratch is an enormous task.
It is thus practical to use the models in the [The AnyBody Managed Model
Repository](https://anyscript.org/ammr/)
It is thus practical to use the models in the
[The AnyBody Managed Model Repository](https://anyscript.org/ammr/)
as a starting template for a new application.

The following elements of the AnyScript language make such templating easier:

- Include files - Which aid templating and sharing model components across different applications
- Body model parameters - For customizing the default AMMR body models

The AMMR installation folder also contains a library of [demo applications](https://anyscript.org/ammr/Applications/index.html)
such as MoCap gait, cycling, leg-press exercises etc. If any of these applications are similar to your end goal, you can copy the
application's model files and then modify them as required.
The AMMR installation folder also contains a library of
[demo applications](https://anyscript.org/ammr/Applications/index.html)
such as MoCap gait, cycling, leg-press exercises etc. If any of these
applications are similar to your end goal you can use the models. To do this,
navigate to the ‘AMMR’ folder in your file explorer and open the ‘Application’
folder. Here, you will find all the available models and examples. Navigate to
the model you want to work on and copy its containing folder and paste it into
your working director. Now, you can safely modify them as required.

**But in this tutorial, you will build a model from the bottom-up using the AMMR model templates.**

Expand Down
Loading
Loading