Lesson 5: Starting with a new model

In the previous lessons we have been constructing our model by modification of an existing application, namely the Standing Model. In some cases it may be difficult to find an existing model that is sufficiently similar to what you want to obtain. In such a case it can be reasonable to begin the modeling project from a new model rather than an existing model. This is what we shall explore in the forthcoming lessons. We shall design a model of a single leg stepping on a pedal. Such a model is much more numerically efficient than the model of the previous lessons, and therefore it makes no sense to begin the project from the standing model as we did before.

Let us first review the structure of the repository in slightly more detail. One of the objectives of its structure is to enable a clear division between the body parts and the applications we hook them up to. This comes through in the data structure of the model we are going to construct. Here is a brief overview of the principles behind that structure.

 

The model is primarily divided into three folders (a folder is a container of different objects much like a directory can contain files) as shown above. In fact, the structure contains a few more parts that we will get to later, but the elements shown above are the more important.

In the middle you see the "HumanModel". This is where we keep the body parts that we are importing from the BRep part of the repository. This folder contains objects such as segments (bones), joints, muscles, and ligaments. We also keep information about the scaling of the model in this folder.

It is just as important to notice what this folder does not contain: movement drivers, forces, and joints between the model and the environment. The external hardware parts of the models such as chairs, bicycles, tools, or, in the present case, a pedal are stored in the Environment.

To link the body model together with the environment we create a "ModelEnvironmentConnection" folder typically containing the joint between the objects of the two former folders.

The "Mannequin" part of the model is used for specification of postures, and we shall return to this issue in more detail later.

Without further ado, let us start building the foot pedal model. The toolbar button "New Main" will generate an empty model that looks much like this (we have changed the name of the MyModel folder to MyPedal):

// This model demonstrates the construction of a foot pedal example
Main = {
  // The actual body model goes in this folder
  AnyFolder MyPedal = {
    // Global Reference Frame
    AnyFixedRefFrame GlobalRef = {
    }; // Global reference frame
  }; // MyPedal
  // The study: Operations to be performed on the model
  AnyBodyStudy MyStudy = {
    AnyFolder &Model = .MyPedal;
    RecruitmentSolver = MinMaxSimplex;
    Gravity = {0.0, -9.81, 0.0};
  };
}; // Main

The comments have been adapted to reflect the fact that we are going to construct a pedal example. Please press the save button (or Ctrl-S) and save the model in a new directory under ARep, for instance using the file name Pedal.Main.any. Notice that the use of the "Main" suffix is a good way to indicate that this is the starting point of the pedal application.

The model can be compiled, but it does not do much, and in any case we shall restructure it right away. As indicated above, we wish to separate the parts that deal with the environment into a dedicated file. Press the "New Include" button.

This gives you an empty window. Now fill the following into the new include file:

AnyFolder EnvironmentModel = {
};

This folder is for keeping stuff that forms the environment. In this case it is the global reference frame, i.e. ground, and the pedal that the foot is going to step on. In fact, let's move the global reference frame to this folder right away. Simply cut the GlobalRef definition from the Pedal.Main.any file and insert it into the include file (notice that new AnyScript code is written in red while existing code has the usual syntax highlighting):

AnyFolder EnvironmentModel = {
  // Global Reference Frame
  AnyFixedRefFrame GlobalRef = {
  }; // Global reference frame
};

It is time to save the new include file. Click the "Save" button or Ctrl-S and save it under the name of "Environment.any" in the same directory as the Main file.

The next step is to add an include statement in the Main file that incorporates the environment into the model:

Main = {
  // The actual body model goes into this folder
  AnyFolder MyPedal = {
    #include "Environment.any"
  }; // MyPedal

We now have the framework for adding the pedal to the model. We are presuming a pedal hinged in one end and the foot pushing in the other. We define the segment and the hinge in the Environment.any file:

AnyFolder EnvironmentModel = {
  // Global Reference Frame
  AnyFixedRefFrame GlobalRef = {
  }; // Global reference frame
  AnySeg Pedal = {
    Mass = 2;
    Jii = {0.05, 0.001, 0.05};
    AnyRefNode Hinge = {
      sRel = {0, -0.15, 0};
    };
    AnyRefNode FootNode = {
      sRel = {0, 0.15, 0};
    };
    AnyDrawSeg drw = {};
  };
  AnyRevoluteJoint HingeJoint = {
    Axis = z;
    AnyFixedRefFrame &Ground = .GlobalRef;
    AnyRefNode &Pedal = .Pedal.Hinge;
  };
};

If you load the model and open a Model View, then you will see the new segment:

 

It is hinged to the origin of the global reference frame, but there is not much else to see. In the next lesson we shall look at how we can import a leg model from the repository to step on the pedal.

Next up is Lesson 6: Importing a Leg Model.

AnyBody Technology A/S · Niels Jernes Vej 10 · DK-9220 Aalborg Ø · Denmark · Tel. +45 9635 4286 · Fax. +45 9635 4599
Copyright (c) AnyBody Technology A/S · 2006 · All rights reserved · Email webmaster@anybodytech.com