Skip to content

Commit

Permalink
Tutorial snippet updates (#23)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Morten Enemark Lund <[email protected]>
  • Loading branch information
3 people authored Sep 17, 2024
1 parent 50ab484 commit ca24eee
Show file tree
Hide file tree
Showing 272 changed files with 65,182 additions and 6,814 deletions.
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/[email protected]
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#path __BM_PLUGIN_FILE__ "BodyModelConfiguration.any"
#define BM_CONFIG_PLUGIN __BM_PLUGIN_FILE__

// -----------------------------------------------------------------------------------
// The BodyModel configuration can be modified using BodyModel GUI plugin
// or by manually editing this file.
//
// Please see this this file for more information on the options:
// #path HTML_DOC "<AMMR_PATH_DOC>/bm_config/index.html"
// -----------------------------------------------------------------------------------

#define BM_MANNEQUIN_DRIVER_DEFAULT ON

// Enable the TLEM2 lower extremity model
#define BM_LEG_MODEL _LEG_MODEL_TLEM2_
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@

DrawSettings ={


//This is the color definitions of the nodes and segments
Colors = {
AnyBodyRed = {149/256,51/256,55/256}; //AnyBody standard red
AnyBodyGreen = {47/256,131/256,80/256}; //AnyBody standard green
AnyBodyBlue = {82/256,85/256,111/256}; //AnyBody standard blue
AnyBodyYellow= {235/256,197/256,17/256}; //AnyBody standard yellow
AnyBodyPaleYellow = {248/256,204/256,115/256}; //AnyBody standard pale yellow
AnyBodyGrey = {153/256,153/256,153/256}; //AnyBody standard grey

Nodes = AnyBodyPaleYellow;
Segments = AnyBodyPaleYellow;
};

Muscle ={
RGB = .Colors.AnyBodyRed;
Visible =On;
DrawScaleOnOff =Off;
Bulging =0.0;
ColorScale =1.0;
RGBColorScale = {0.957031, 0.785156, 0.785156};
MaxStress = 2500000.000000; //N/m^2 //This number is for graphics only!
Opacity =1.0;
DrawScale =
{
EnableCreasing = Off;
CreasingAngle = 0.524;
EnableWireframe = Off;
EnableSmoothing = On;
Param = 0.0;
ParamArray = {0.0, 0.167, 0.333, 0.5, 0.667, 0.833, 1.0};
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}};
OpacityArray = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
};
};


BonesOpacity ={

GlobalCoef = 1;

Skull = 1*GlobalCoef;
Thorax = 1*GlobalCoef;
Pelvis = 1*GlobalCoef;
Sacrum = 1*GlobalCoef;
L5 = 1*GlobalCoef;
L4 = 1*GlobalCoef;
L3 = 1*GlobalCoef;
L2 = 1*GlobalCoef;
L1 = 1*GlobalCoef;

RightFoot = 1*GlobalCoef;
RightShank = 1*GlobalCoef;
RightThigh = 1*GlobalCoef;

LeftFoot = 1*GlobalCoef;
LeftShank = 1*GlobalCoef;
LeftThigh = 1*GlobalCoef;


RightClavicula = 1*GlobalCoef;
RightScapula = 1*GlobalCoef;
RightHumerus = 1*GlobalCoef;
RightUlna = 1*GlobalCoef;
RightRadius = 1*GlobalCoef;
RightHand = 1*GlobalCoef;

LeftClavicula = 1*GlobalCoef;
LeftScapula = 1*GlobalCoef;
LeftHumerus = 1*GlobalCoef;
LeftUlna = 1*GlobalCoef;
LeftRadius = 1*GlobalCoef;
LeftHand = 1*GlobalCoef;


// For leg TD only.
RightTalus = 1*GlobalCoef;
RightPatella = 1*GlobalCoef;

LeftTalus = 1*GlobalCoef;
LeftPatella = 1*GlobalCoef;


// For detailed cervical model only.
C1 = 1*GlobalCoef;
C2 = 1*GlobalCoef;
C3 = 1*GlobalCoef;
C4 = 1*GlobalCoef;
C5 = 1*GlobalCoef;
C6 = 1*GlobalCoef;
C7 = 1*GlobalCoef;
};



SegmentAxes ={
RGB ={0,0,1};
ScaleXYZ ={0.0001,0.00001,0.00001};
};
BML ={
ScaleXYZ ={0.0006,0.0006,0.0006};
RGB = .Colors.AnyBodyBlue;
};
JointAxesProximal = {
RGB = .Colors.AnyBodyRed;
ScaleXYZ = {0.015,0.015,0.015};
};
JointAxesDistal = {
RGB = .Colors.AnyBodyGreen;
ScaleXYZ = {0.01,0.01,0.01};
};


SegmentNodes ={
ScaleXYZ ={0.0005,0.0005,0.0005};
RGB = .Colors.AnyBodyRed;
};
WrapGeometry ={
RGB ={1,1,1};
};

DrawSettingsSupport={
Lin={
ScaleFactor=0.004;
RGB = {0,0,1};
Thickness = 0.004;
HeadThickness = 2*Thickness;
HeadLength = 3*Thickness;
};
Rot={
ScaleFactor=0.08;
RGB = {1,0,0};
Thickness = 0.075;
HeadThickness = 2*Thickness;
HeadLength = 5*Thickness;
};
};


Marker={
Color={0,0,1};
Radius=0.00;

};

}; //DrawSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
AnyFolder Environment = {
//^ Environment files are used to include objects surrounding human,
//^ e.g. global reference frame

AnyFixedRefFrame GlobalRef =
{
AnyDrawRefFrame drw={ScaleXYZ=0.3*{1,1,1};};

AnyRefNode RightFootPrint = {
//^ Positioning of the right foot.
//^ Ground-foot constraints can be excluded with: #define EXCLUDE_FOOT_CONSTRAINTS
sRel = HeelPosition;
ARel = RotMat({0,0,0}, ToeDirection, {0,10,0});
AnyDrawRefFrame drw = {RGB = {0,0.7,0}; ScaleXYZ = 0.1*{1,1,1};};
};

AnyRefNode LeftFootPrint = {
//^ Positioning of the right foot.
//^ Ground-foot constraints can be excluded with: #define EXCLUDE_FOOT_CONSTRAINTS
sRel = HeelPosition;
ARel = RotMat({0,0,0}, ToeDirection, {0,10,0});
AnyDrawRefFrame drw = {RGB = {0,0.7,0}; ScaleXYZ = 0.1*{1,1,1};};
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

//-------- GRFPrediction for the right leg
// See: #include "<ANYBODY_PATH_AMMR>/Tools/GRFPrediction/FootPlateConditionalContact.any"
FootPlateConditionalContact GRF_Prediction_Right(
NORMAL_DIRECTION = "Y",
NUMBER_OF_NODES = 25,
NODES_FOLDER = FootNodes,
PLATE_BASE_FRAME = Main.Model.Environment.GlobalRef,
GLOBAL_REF = Main.Model.Environment.GlobalRef,
SHOW_TRIGGER_VOLUME = ON
) =
{
CreateFootContactNodes25 FootNodes(
foot_ref=Main.HumanModel.BodyModel.Right.Leg.Seg.Foot
) = {};

// Additional force plate settings
Settings =
{
LimitDistHigh = 0.025; // Vertical height
FrictionCoefficient = 0.8;
};
};


//-------- GRFPrediction for the right leg
// See: #include "<ANYBODY_PATH_AMMR>/Tools/GRFPrediction/FootPlateConditionalContact.any"
FootPlateConditionalContact GRF_Prediction_Left(
NORMAL_DIRECTION = "Y",
NUMBER_OF_NODES = 25,
NODES_FOLDER = FootNodes,
PLATE_BASE_FRAME = Main.Model.Environment.GlobalRef,
GLOBAL_REF = Main.Model.Environment.GlobalRef,
SHOW_TRIGGER_VOLUME = ON
) =
{
CreateFootContactNodes25 FootNodes(
foot_ref=Main.HumanModel.BodyModel.Left.Leg.Seg.Foot
) = {};

Settings =
{
LimitDistHigh = 0.025;
FrictionCoefficient = 0.8;
};
};

Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@

// Center of Mass drivers can be excluded
// by setting #define EXCLUDE_COM_BALANCE_DRIVERS
#ifndef EXCLUDE_COM_BALANCE_DRIVERS

//Constraint the collective CoM to be right above the GlobalRef
AnyKinDriver CenterOfMassDriver = {
AnyKinMeasure& CoM = ..BodyModel.Interface.CenterOfMass;
AnyFunConst Position = {
Value = Main.Model.CenterOfMassXZ;
};
MeasureOrganizer = {0,2}; // Only the x and z directions
Reaction.Type = {Off,Off};

};
// Ankles are assigned a lower weight so most of the
// center of mass balancing will happen at the ankle joint.
Main.Model.DefaultMannequinDrivers.DefaultWeakDriverWeight = 0.01;
Main.Model.DefaultMannequinDrivers.AnkleDriverLeftFlexion.WeakDriverWeight = 0.001;
Main.Model.DefaultMannequinDrivers.AnkleDriverRightFlexion.WeakDriverWeight = 0.001;

#endif



// Foot driver constraints can be excluded
// by setting #define EXCLUDE_FOOT_CONSTRAINTS
#ifndef EXCLUDE_FOOT_CONSTRAINTS

// Default drivers for the pelvis position is set to zero
// since foot drivers determine the position of the model
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverPosX.WeakDriverWeight = 0;
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverPosY.WeakDriverWeight = 0;
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverPosZ.WeakDriverWeight = 0;
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverRotX.WeakDriverWeight = 0;
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverRotY.WeakDriverWeight = 0;
Main.Model.DefaultMannequinDrivers.PelvisGroundDriverRotZ.WeakDriverWeight = 0;


AnyFolder Right =
{
AnyKinEq HeelFloorContraint = {
AnyKinLinear HeelMeasure = {
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.RightFootPrint;
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Right.Leg.Seg.Foot.HeelContactNodeLow;
};
Reaction.Type = {Off,Off,Off};
};

AnyKinEq ToeDirectionContraint =
{
AnyKinLinear ToeDirection = {
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.RightFootPrint;
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Right.Leg.Seg.Foot.BigToeNode;
};
MeasureOrganizer = {1,2}; // Only y,z direction
Reaction.Type = {Off,Off};
};
};

AnyFolder Left =
{
AnyKinEq HeelFloorContraint = {
AnyKinLinear HeelMeasure = {
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.LeftFootPrint;
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Left.Leg.Seg.Foot.HeelContactNodeLow;
};
Reaction.Type = {Off,Off,Off};
};

AnyKinEq ToeDirectionContraint =
{
AnyKinLinear ToeDirection = {
AnyRefFrame &FootPrint = Main.Model.Environment.GlobalRef.LeftFootPrint;
AnyRefFrame &Heel = Main.HumanModel.BodyModel.Left.Leg.Seg.Foot.BigToeNode;
};
MeasureOrganizer = {1,2}; // Only y,z direction
Reaction.Type = {Off,Off};
};
};

#endif
Loading

0 comments on commit ca24eee

Please sign in to comment.