Skip to content
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

Tutorial snippet updates #23

Merged
merged 16 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 14 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
16 changes: 15 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,31 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
path: tutorials
- uses: actions/checkout@v4
with:
repository: anybody/ammr
ref: master
path: ammr

- shell: cmd
run: |
echo #include "%GITHUB_WORKSPACE%/ammr/libdef.any" > libdef.any


- uses: prefix-dev/setup-pixi@v0.8.1
with:
cache: true
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'master' }}
environments: test
manifest-path: tutorials/pixi.toml
activate-environment: true

- name: Test Snippets
if: ${{ !github.event.pull_request.head.repo.fork && github.repository == 'anybody/tutorials' }}
run: pytest
run: |
cd tutorials
pytest
env:
RLM_LICENSE: ${{ secrets.LICENSE_TEST_SERVER }}
RLM_LICENSE_PASSWORD: ${{ secrets.LICENSE_TEST_SERVER_PASSWORD }}
Expand Down
79 changes: 79 additions & 0 deletions A_Getting_started/Snippets/lesson2/snip.NewModel.main-1.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//expect_errors = ["Cannot open file", "Model loading skipped"]

#include "libdef.any"

Main =
{
// BodyModel configuration:
// Specify which limb segments to include, the type of muscles, joints, scaling etc
#include "Model/BodyModelConfiguration.any"

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


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

// Compose the model used by the study
AnyFolder Model =
{
// Center of Mass (COM) position in the ground YZ plane
// COM balance driver can be excluded with:
// #define EXCLUDE_COM_BALANCE_DRIVERS
AnyVector CenterOfMassXZ = {0,0};

// Positioning of the right and left feet.
// Ground-foot constraints can be excluded with:
// #define EXCLUDE_FOOT_CONSTRAINTS
Environment.GlobalRef.RightFootPrint = {
AnyVec3 HeelPosition = {-0.08, 0, 0.14};
AnyVec3 ToeDirection = {1, 0, 0.1};
};
Environment.GlobalRef.LeftFootPrint = {
AnyVec3 HeelPosition = {-0.08, 0, -0.14};
AnyVec3 ToeDirection = {1, 0, -0.1};
};

// Include the body part of the Human model
AnyFolder &BodyModel = .HumanModel.BodyModel;

// Include the default mannequin drivers
AnyFolder &DefaultMannequinDrivers = .HumanModel.DefaultMannequinDrivers;

// Environment files are used to include objects surrounding human,
// e.g. global reference frame
#include "Model\Environment.any"

AnyFolder ModelEnvironmentConnection =
{
// This file contains all contraints to simulate the standing human
#include "Model/JointsAndDrivers.any"

// Ground reaction force prediction
#include "Model/GRFPrediction.any"
};
};
// Define Study for running kinematics and inverse dynamics simulation analyses
AnyBodyStudy Study =
{
// Include the Model within the Study
AnyFolder &Model = .Model;

Gravity={0.0, -9.81, 0.0};
nStep = 11;

// Overdeterminate solver is needed while using the
// soft default mannequin drivers.
Kinematics.SolverType = KinSolOverDeterminate;
InitialConditions.SolverType = Kinematics.SolverType ;
};
// This is readymade simulation package including some pre-processing steps and the InverseDynamics analysis
#include "Model\RunAppSequence.any"

}; //Main

20 changes: 20 additions & 0 deletions A_Getting_started/Snippets/lesson2/snip.NewModel.main-2.any
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//expect_errors = ["'HumanModel' when 'Main' was expected", "Model loading skipped"]

//# BEGIN SNIPPET 1
// Default mannequin position values
HumanModel.Mannequin = {
Posture = {
Right = {
};
Left = {
};
};

PostureVel= {
Right = {
};
Left = {
};
};
};
//# END SNIPPET 1
Loading