Lesson 2: Adding a segment

The first step of building the hand pump model is to add a segment which will eventually become the hand wheel driving the pump. Start by opening the HandPump.Main.any file in AnyBody™. In the main file you can toggle between different versions of the body model and it can be advantageous to select alight version while building the model. This will allow us to get the model up and running without spending a lot of time on reloads. To do so we will use a body model without muscles. A bit down in the main file you will find the following:

AnyFolder HumanModel = {
    
    AnyFolder &Mannequin=.Model.Mannequin;
    
    
    // Select the body model:
    // ----------------------
    // This file contains a list of all body parts, select them to create
    // the body model wanted.
    #include  "BodyPartsSetup.any"
    
    // This file creates the body model from the selected list.
    #include  "..\..\..\Body\AAUHuman\BodyModels\GenericBodyModel\BodyModel.any"

Double click on the line "BodyPartsSetup.any" to open the file. This is the file controlling the construction of the body. We will get back to it in detail in lesson 6 , for the moment we will only remove the muscles of our body. Please make the following modifications:

// Trunk: 1 included, 0 not included
// *********************************
#define TRUNK 1
// This is just the bones,
// Choose one of the following options to add muscles
#define TRUNK_SIMPLE_MUSCLES 0


// RightArm: 1 included, 0 not included
// ************************************
#define RIGHT_ARM 1
// This is just the bones,
// Choose one of the following options to add muscles
#define RIGHT_ARM_SIMPLE_MUSCLE 0
#define RIGHT_ARM_SIMPLE_MUSCLE_ONLY_ON_NECK 0
#define RIGHT_ARM_MUS_3E 0


// LeftArm: 1 included, 0 not included
// ***********************************
#define LEFT_ARM 1
// This is just the bones,
// Choose one of the following options to add muscles
#define LEFT_ARM_SIMPLE_MUSCLES 0
#define LEFT_ARM_SIMPLE_MUSCLES_ONLY_ON_NECK 0
#define LEFT_ARM_MUS_3E 0


// RightLeg: 1 included, 0 not included
// ************************************
#define RIGHT_LEG 1
// This is just the bones,
// Choose one of the following options to add muscles
#define RIGHT_LEG_SIMPLE_MUSCLES 0
#define RIGHT_LEG_MUS_3E 0


// LeftLeg: 1 included, 0 not included
// ***********************************
#define LEFT_LEG 1
// This is just the bones,
// Choose one of the following options to add muscles
#define LEFT_LEG_SIMPLE_MUSCLES 0
#define LEFT_LEG_MUS_3E 0

Thenload the model by pressing F7.

Before we add the wheel segment, let us spend just a few moments considering where to place it. The file structure of the application looks like this:

These files are organized according to the principle that the model is divided into three parts:

  1. The model parts concerned with the human body. These are imported from the Body part of the repository.
  2. The model parts concerned with the environment. These are the parts that are modeled bottom-up for each new application.
  3. A section connecting the body parts to the environment.

The wheel we are about to add is not a part of the human body. It logically belongs to the model's environment, and these parts are defined in the Environment.any file. Please openEnvironment.any:

AnyFolder EnvironmentModel = {
  
  /* **********************************************************
  This folder contains the definition of the Environment
  - GlobalRefFrame
  
  ********************************************************** */  
  
  AnyFixedRefFrame GlobalRef = {
   Origin ={0.0,0.0,0.0}; 
    #include "drawcoorsystem.any"
    AnyDrawRefFrame drw={};    
    
  };//GlobalRef
};

As you can see, it is extremely simple containing only a global reference frame, which in this model plays the role of a floor to stand on. We shall add a hand wheel to the model, but first we shall define a point on the global reference frame about which the hand wheel will eventually revolve:

AnyFolder EnvironmentModel = {
  
  /* **********************************************************
  This folder contains the definition of the Environment
  - GlobalRefFrame
  
  ********************************************************** */  
  
  AnyFixedRefFrame GlobalRef = {
   Origin ={0.0,0.0,0.0}; 
    #include "drawcoorsystem.any"
    AnyDrawRefFrame drw={};
    
   AnyRefNode Hub = {
      sRel = {0.4, 1.4, 0.0};
      AnyDrawNode drw = {};
    };
  };//GlobalRef
};

When you reload the model and open a Model View Window you will see that a point has appeared in the form of a little grey ball in front of the chest. The next step is to define the wheel:

Place the cursor just below the definition of GlobalRef. Go to the ClassTab in the left pane Editor Window; unfold the class list and find AnySeg. Right-click the class and insert a class template. You will obtain this:

AnyFixedRefFrame GlobalRef = {
   Origin ={0.0,0.0,0.0}; 
    #include "drawcoorsystem.any"
    AnyDrawRefFrame drw={};
    
    AnyRefNode Hub = {
      sRel = {0.4, 1.4, 0.0};
      AnyDrawNode drw = {};
    };
  };//GlobalRef
  
  AnySeg <ObjectName> = 
  {
    //r0 = {0, 0, 0};
    //rDot0 = {0, 0, 0};
    //Axes0 = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
    //omega0 = {0, 0, 0};
    Mass = 0;
    Jii = {0, 0, 0};
    //Jij = {0, 0, 0};
    //sCoM = {0, 0, 0};
  };

We fill in the blanks and add a draw segment:

AnySeg Wheel = {
   r0 = .GlobalRef.Hub.sRel;
    Mass = 5;
    Jii = {0.003, 0.003, 0.3};
    AnyDrawSeg drw = {};
  };

Notice that we have given the wheel mass properties that cause the draw segment to take on a wheel shape. We shall also add two points to the wheel that can subsequently function as handles:

AnySeg Wheel = {
    r0 = .GlobalRef.Hub.sRel;
    Mass = 5;
    Jii = {0.003, 0.003, 0.3};
   AnyRefNode rHandle = {
      sRel = {0.2, 0, 0.1};
    };
    AnyRefNode lHandle = {
      sRel = {-0.2, 0, -0.1};
    };
    AnyDrawSeg drw = {};
  };

Next we fix the wheel segment to the hub node by means of a revolute joint (notice that every time a new object is inserted it can be done from the Classes tree):

AnySeg Wheel = {
    r0 = .GlobalRef.Hub.sRel;
    Mass = 5;
    Jii = {0.003, 0.003, 0.3};
    AnyRefNode rHandle = {
      sRel = {0.2, 0, 0.1};
    };
    AnyRefNode lHandle = {
      sRel = {-0.2, 0, -0.1};
    };
    AnyDrawSeg drw = {};
  };
  
 AnyRevoluteJoint WheelHub = {
    AnyRefFrame &Hub = .GlobalRef.Hub;
    AnyRefFrame &Wheel = .Wheel;
    Axis = z;
  };

Finally, let us define a driver to make the wheel rotate:

AnyRevoluteJoint WheelHub = {
    AnyRefFrame &Hub = .GlobalRef.Hub;
    AnyRefFrame &Wheel = .Wheel;
    Axis = z;
  };
 AnyKinEqSimpleDriver WheelTurn = {
    AnyRevoluteJoint &Hub = .WheelHub;
    DriverVel = {-pi};
  };

The model has now gone from being static to moving and to see it move we must increase the number of time steps in the model. This happens in the study section of the Main file:

AnyBodyStudy Study = {
    AnyFolder &Model = .Model;
    
    tEnd = 1.0;
    Gravity = {0.0, -9.81, 0.0};
    nStep = 10;

  }; // End of study

Please reload the model and run the kinematic analysis. You shouldsee the wheel turning half a round.

Here's some emergencyhelp if you are having problems making the model work: HandPump.2.zip contains the three modified files from this lesson.

The next step is to hook the hands up to the handles and get the arms moving in Lesson 3: Kinematics .

AnyBody Technology A/S · Niels Jernes vej 10 · DK-9220 Aalborg Ř · Denmark · Tel. +45 9635 4286 · Fax. +45 9635 4599            Sitemap