Lesson 1: Modification of an existing application
The Application branch of the repository contains a large amount of applications where different collections of body parts are hooked up to more or less complicated environments. Some of these environments may be extremely simple, such as a floor to stand on, while others may be mechanisms in their own right such as wheel chairs or bicycles with complicated crank mechanisms. In the vast majority of cases, the easiest way to develop a new application is to find a similar existing application, copy it, and modify it to suit your purpose. This is what we shall do in this initial lesson of the building block tutorial.
The standing model
The Examples branch of the Application part of the repositorycontains a number of versions of standing models. These models are useful as starting points for many applications comprising the entire body. In the following we shall perform twomodifications of a static standing model that will transform it to a dynamic model operating a hand-driven pump.
The first step is to go to Application/Examples and locate the directory called StandingModel. Make a copy of the directory and rename the copy to HandPump (or HandPumpTutorial. If you are working on the full version of the repository, there might be a HandPump model already. This model originates from the one from this tutorial). Then go into the new HandPump directory, locate the file named StandingModel.Main.any and rename it to HandPump.Main.any. Then double-click the HandPump.main.any file to open it in the AnyBody™ Modeling System, and we are ready to go.
Before starting to modify the model, time may be invested well in familiarization with its basic structure. The standing model was originally created as an AnyBody™-parallel to so-called digital manikins. It is a model whose posture is controlled by a set of anatomical joint angles specified in the file mannequin.any. If you browse down a little bit into the main file you will come to the following section:
//This file contains joint angles which are used at load time
// for setting the initial positions
#include "Mannequin.any"
// This file contains the exact same joint variables as the mannequin
// file but their values are obtained from the model
// once the kinematic analysis has been done
#include "MannequinValuesFromModel.any"
AnyFolder ModelEnvironmentConnection = {
#include "JointsAndDrivers.any"
};
Double-clicking the line with "Mannequin.any" will open up the mannequin file. Browsing a little down the file will show this:
AnyFolder Mannequin = {
AnyFolder Posture = {
//This controls the position of the pelvi wrt. to the global reference frame
AnyVar PelvisPosX=0.046;
AnyVar PelvisPosY=1.16;
AnyVar PelvisPosZ=0;
//This controls the rotation of the pelvis wrt. to the global reference frame
AnyVar PelvisRotX=0;
AnyVar PelvisRotY=0;
AnyVar PelvisRotZ=0;
// These variables control the rotation of the thorax wrt the
// pelvis
AnyVar PelvisThoraxFlexion=0;
AnyVar PelvisThoraxLateralBending=0;
AnyVar PelvisThoraxRotation=0;
AnyVar NeckExtension=0;
AnyFolder Right = {
//Arm
AnyVar SternoClavicularProtraction=-23; //This value is not used for initial position
AnyVar SternoClavicularElevation=11.5; //This value is not used for initial position
AnyVar SternoClavicularAxialRotation=-20; //This value is not used for initial position
AnyVar GlenohumeralFlexion =-0;
AnyVar GlenohumeralAbduction = 10;
AnyVar GlenohumeralExternalRotation = 0;
AnyVar ElbowFlexion = 0.01;
AnyVar ElbowPronation = -20.0;
AnyVar WristFlexion =0;
AnyVar WristAbduction =0;
AnyVar HipFlexion = 0.0;
AnyVar HipAbduction = 5.0;
AnyVar HipExternalRotation = 0.0;
AnyVar KneeFlexion = 0.0;
AnyVar AnklePlantarFlexion =0.0;
AnyVar AnkleEversion =0.0;
AnyVar SubTalarEversion =0.0;
};
AnyFolder Left = {
This first section of the mannequin file contains the folder Posture of which you can only see a subset in the code above. The posture folder lets you specify anatomical joint angles in degrees, and when you subsequently load and run the model it will assume the posture you have specified. The bottom part of the mannequin file contains this folder:
AnyFolder Load = {
AnyVec3 TopVertebra = {0.000, 0.000, 0.000};
AnyFolder Right = {
AnyVec3 Shoulder = {0.000, 0.000, 0.000};
AnyVec3 Elbow = {0.000, 0.000, 0.000};
AnyVec3 Hand = {0.000, 0.000, 0.000};
AnyVec3 Hip = {0.000, 0.000, 0.000};
AnyVec3 Knee = {0.000, 0.000, 0.000};
AnyVec3 Ankle = {0.000, 0.000, 0.000};
};
AnyFolder Left = {
AnyVec3 Shoulder = {0.000, 0.000, 0.000};
AnyVec3 Elbow = {0.000, 0.000, 0.000};
AnyVec3 Hand = {0.000, 0.000, 0.000};
AnyVec3 Hip = {0.000, 0.000, 0.000};
AnyVec3 Knee = {0.000, 0.000, 0.000};
AnyVec3 Ankle = {0.000, 0.000, 0.000};
};
}; // Loads
This is a set of three dimensional vectors that allow you to apply external loads to various predefined points on the model.
The model has an additional feature concerning its posture control: The ankle angle values in the mannequin.any file are not used. The reason is that the model contains a balancing condition that requires it to keep its total center of mass directly above the global z axison which the ankle points are also placed. To enable the model to accommodate the balance condition it must have some degree of freedom to adjust the center of mass, and this is done via the ankle joints.
With these basic properties of the model in mind, let us proceed to Lesson 2 in which we shall give the model something to hold on to.
