Box weight included in GaitFullBody 1.5

Hi Moonki

Happy New Year!

Could you please help me with getting the correct (PedalModel or AMMRv) so I can follow the"Getting Started: Modeling" lessons.


Here is the problem so far…

in the lesson “Getting Started: Modeling” I wasn’t able to find the template as instructed in “Lesson 1: Starting with a new Model

But was able to find the complete “PedalModel.zip.” in “Lesson 4: Kinetics - Computing Forces

So in the latest AMMR.v1.5, I place this PedalModel with the other Examples. I get this error message…

[SIZE=1][SIZE=1][COLOR=#0000ff][SIZE=1][COLOR=#0000ff]ERROR(SCR.SCN1)[/SIZE] : [SIZE=1]C:/U…s/d…l/D…s/A…g/A…n/E…s/M…l/MyPedal.main.any[/SIZE] : Cannot open file : [SIZE=1]C:\Users\dstambol\Documents\AMMRV1.5_2014_Testing\Body\AAUHuman\HumanModel.any
[/SIZE]Model loading skipped
[/COLOR][/SIZE][/COLOR][/SIZE]
In AAUHuman there is not HumanModel,

Sincerely
Damon

Hi Damon,

Happy new year, too!

It seems that now you are looking our web version tutorial.

If you want to make your models based on the templates,
you should use our latest AMMR V1.6 version, not AMMR V1.5.

Best regards,
Moonki

Hi Moonki
I think Ill stay with my 1.5 model. besides the ones that you did in the beginning, I have already made additional changes to it.

To do the turtoral to learn how to put the box into the 1.5 model. So I think i need to use 1.6 for the turtorial?

I could not find 1.6, can you give me the link please.

Sincelly
Damon

Hi Moonki

Its not clear to me, can you please explain further what you mean by "the file shows exactly how to use the class template to create your model"?

Sincerely
Thanks
Damon

Damon,

  1. If you want to use AMMR V1.6 then you should download and install the latest AnyBody version.

  2. If you open and load the ‘SolidModelingTestDemo.Main.any’ file then you can find the following piece of code:

       CreateBox Box1(
       InputName = Box1,
       InputPlacement = Main.MyModel.Segs,
       InputLengthX = Main.DesignParameters.box_length_x,
       InputLengthY = Main.DesignParameters.box_length_y,
       InputLengthZ = Main.DesignParameters.box_length_z,
       InputDensity = Main.DesignParameters.box_density)
       =
       {
         Pos0 = Main.DesignParameters.box_r0;
         RotAnglesInDegree0 = Main.DesignParameters.box_Axes0_in_deg;
         Color = Main.DesignParameters.box_color;
         Opacity = 0.5;
         ScaleFactorForLocalFrame = 1;
         ScaleFactorForLocalRefNodes  = 0.2;
       };

This actually shows the example use of the class template.

Hi Moonki

Wow, I've been trying for the past month to use the entire class_template box code that is within the Solidmodelingtestdemo.

So now, I added this piece of code into the general template and got this error. Can you please help me with the next step to get this working?

Sincerely thanks
Damon
[SIZE=1]
ERROR(SCR.PRS11)
[/SIZE] : [SIZE=1]C:/Users/ds..l/D..s/+..l/1..x/BOX FINAL/Box.any[/SIZE] : '(' unexpected
Model loading skipped

Here is the code.

[SIZE=3]// This is modeling a box that will move by motion capture, that will later
//be transfered into the full body model
[/SIZE]Main = {
[SIZE=3]// The actual body model goes in this folder
[/SIZE][SIZE=3]AnyFolder[/SIZE] MyModel = {
[SIZE=3]// Global Reference Frame
[/SIZE][SIZE=3]AnyFixedRefFrame[/SIZE] GlobalRef = {
};[SIZE=3]// Global reference frame
[/SIZE]
CreateBox Box1(
InputName = Box1,
InputPlacement = Main.MyModel.Segs,
InputLengthX = Main.DesignParameters.box_length_x,
InputLengthY = Main.DesignParameters.box_length_y,
InputLengthZ = Main.DesignParameters.box_length_z,
InputDensity = Main.DesignParameters.box_density)

{
Pos0 = Main.DesignParameters.box_r0;
RotAnglesInDegree0 = Main.DesignParameters.box_Axes0_in_deg;
Color = Main.DesignParameters.box_color;
Opacity = 0.5;
ScaleFactorForLocalFrame = 1;
ScaleFactorForLocalRefNodes = 0.2;

[SIZE=3]// Todo: Add points for grounding of the model here
[/SIZE]}; [SIZE=3]// Global reference frame
[/SIZE][SIZE=3]// Todo. Add the model elements such as
[/SIZE][SIZE=3]// segments, joints, and muscles here.
[/SIZE]}; [SIZE=3]// MyModel

[/SIZE][SIZE=3]// The study: Operations to be performed on the model
[/SIZE][SIZE=3]AnyBodyStudy[/SIZE] MyStudy = {
[SIZE=3]AnyFolder[/SIZE] &Model = .MyModel;
Gravity = {0.0, -9.81, 0.0};
};
}; // Main

Hi Damon,

I think you should first try to understand the concept of the class template.
Followings are the explanation of the class template from AnyBody Reference Manual:

Class Templates
can only define a collection of objects. You cannot implement an algoritmic functionality, like member functions, as you might expect knowing other object-oriented programming language. Also at this point, AnyScript is merely a declarative language.
Instances of Class Templates
are in principle folder-object, i.e., object of class AnyFolder. This AnyFolder will contain all the members that have been defined as members in the Class Template.
Member initialization control:
Class Templates offers encapsulation of the members, similar to the functionality known from the normal built-in classes. All members are accessible for instance from AnyBody™ Model Tree Views, but initialization of the members from the script in controlled. Members can be Denied-Access, Optional-Initialization, or Obligatory-Initialization members, respectively. By default, initialization is denied but using the #var-specifier initilization can be allowed, please refer to the previous section for syntax details. Existence of default values determines whether a member may or must be initialized.
Class Template argument
Class Templates can have template arguments, i.e., arguments used during the instantion of the object. Since these argument are being used by the preprocessor, they must resolvable by the preprocesser. This put limits on what such arguments can hold; in principle it can hold preprocesser values, i.e., values defined by #define-statements or expressions hereof, just like the values allowed in #if-statements and the like. In addition however, object references can be parsed through the template argument list. Object references require type declarations in the template argument list needed for argument validation.
Arguments just holding preprocesser values do not require any type specification, but such arguments can contain default values. Inside the Class Template, this type of arguments can be regarded as preprocesser identifiers as if they were created by #define-statements in normal AnyScript code.

Conditional code:
The template arguments can be used inside the Class Template to control active pathes of the code. This is done by preprocesser #if-statements. This is powerful feature for building advanced “user-defined classes” by means of Class Templates.
Instantiation of Class Templates
(or declaration of Class Template objects) are in principle like built-in classes, except that Class Template may need the template arguments to be specified. This is in principle done like
Syntax:
<class_template_name> <identifier> (<identifier1>=<value>,…) = {

<multi-line-code>

};
where <identifier> is the object name, and <identifier1> is a template argument name.

Notice that template arguments can be listed in any sequence, not matching the Class Template definition, but you must specify the argument name in the list. This syntax has been chosen in order to accomodate very long argumnet list, where many (most) arguments have default values that often does not need modification. This is expected to be the case larger, advanced “classes” defined using Class Templates.

And attached please find two examples files for the use of class template which may be helpful to you.

Best regards,
Moonki

(P.S: I will be out of office for two weeks so I may not be able to answer during these days. So please get familiar with the concept of the class template with easier examples. :slight_smile: )

Thanks Moonki for you guidance, I will get familiar with the class template.
Sincerely, thanks Damon

Hi Moonki

Welcome back.

I understand how the class template method works, I went through your two examples and watched several YouTube examples. I have started work on the code to get the box to move by itself with C3D markers. But the code in the solid works is much more complicated than the examples. I can program, but I am not a full time programmer. So would it be possible for me to upload what I have in the forum, to get some starter tips from you how to go forward please?

Sincerely
Damon

Hi Damon,

This forum does not guarantee the complete debugging of a specific model.

But we can give you some tips based on how complex your model is.

Best regards,
Moonki

Hi Moonki

I agree, this is a better approach. “Give a man a fish and he eats for a day, but teach him how to fish and he eats for life”

This morning I think im on to something, so I’ll keeep trying to get the box move.

If I get stuck on something;

  • would you rather me put specific pieces of code into this forum?

-Or, since I’m only working on the template code (to get the box to move) so you would be very familar with this code, I could upload the entire code and highlight the problem area?

Sincerly
Damon

Hi Damon,

If you think that using a class template for box is too difficult for you,
then you can just define an AnySeg object with proper mass properties.

You can find the proper mass properties of a box here:
http://en.wikipedia.org/wiki/List_of_moments_of_inertia

I attached a zip file which contains a unit sized box STL file.

So simply speaking, you can create your box very easily like this:

AnySeg MyBox = 
{
  Mass = ?; // Determine the mass as you want!
  Jii = {?, ?, ?}; // Determine the moments of inertia as you want!

  AnyDrawSTL DrawBox = 
  {
     FileName = "UnitBox.STL";
     RGB = {0, 1, 0};
     ScaleXYZ = {?, ?, ? }; // Determine the size as you want!
  };

  AnyRefNode MarkerNode1 = { ... };
  AnyRefNode MarkerNode2 = { ... };
};

I think that this way of creating a box will be much more easier to you rather than using a class template currently.

Of course you can upload your model if you want. But if your model is too complex then definitely it will take some time for us to review it.

I hope this may be helpful to you.

Best regards,
Moonki

Hi Moonki

I replaced the pendulum with the box in lesson 1 using your code above, and now I see a box instead of a pendulum, and also am able to make it move with simple drivers, thanks :). So from this point, I'll continue to follow the same lessons to get the box to move with C3D motion capture.

Sincerely
Damon

Hi Moonki

Will using class template greatly simplify adding the box code into the AnyBody Gaitfullbody model?

The reason I’m asking is because if it will greatly simplify the programming it takes to get the box in the AnyBody Gaitfullbody model, I’d rather spend the time now to get class template approach working.

From the previous posts it sounds like I need to upgrade to the AMMR 1.6 Gaitfullbody model, because AMMR 1.6 works better with class templates, is this correct?

Sincerely
Damon

Hi Damon,

It’s up to your preference.

Both using the class template and using just an AnySeg will work for your purpose.

But if you are not very familiar with the class template, then it may be more difficult for you to add some markers and drivers on top of it.

So please just do as you feel more comfortable…

Best regards,
Moonki

Thanks Moonki

Since I’m making better progress with the segment method, I’ll continue with using the segment method.

Sincerely thanks
Damon

Hi Moonki

I moved the box code into “Lesson 4: Parameter identification”, (the lesson with the pendulum and multiple markers), and its working fine.

Now I’m going to include the box code into the GaitFullBody model. Can you please help me with the location to insert the AnySeg code into GaitFullBOdy. You had advised in the beginning to put the box code into EnvironmentModel Folder within the GaitFullBody Model. I am finding this code in the GaiFullBody Main file. So do I put the box code into this AnyFolder EnvironmentModel code section?

AnyFolder EnvironmentModel =
{
//Model of the floor and force plates this is where the force plates are defined
AnyFolder &BodyModelRef=.BodyModel;
//This environment file makes use of automatic detecteion of which foot are incontact with which plate
#include “EnvironmentAutoDetection.any”
//This environment file has no automatic detecteion of which foot are incontact with which plate it has to be set manually
//#include “Environment.any”
};

What sections of the box code goes into the Environment file?

Sincerely thank you for helping me with this
Damon

Hi Damon,

I think you have already enough knowledge of AnyBody to decide this kind of problem. :slight_smile:

Anywhere in EnvironmentModel folder will be fine.

Just , for example, you can create a sub-folder which is called ‘Segs’.

Then:

AnyFolder Segs = 
{
  AnySeg Box =
  {
    ...
  };
  ...
};

Don’t hesitate to try first as you imagine! :slight_smile:

Best regards,
Moonki

Hi Moonki

Thanks for the compliment, your encourgement, and for the template. The box with nodes is within the Full model now on the floor, its cool to see it in there.

I’m following the same steps, but in the model tab, in the Points/Markers folders, i’m not finding the PosInterpol code.

Is defining the markers in the main file ok, or should I be defining the markers in the ModelSetup, any file? What do you think?

Sincerly
Damon

Hi Damon,

In the ‘ModelSetup.any’ file there are all the marker definitions for the human segments. And they are using some special class templates for that purpose.

But for the markers regarding the box, you can’t use that class template.

If you could see the tutorial (Making Things Move), then you know that you can use ‘AnyKinDriverMarker’ class to driver your box according to the related markers.

So it does not matter where you can define your code.

Best regards,
Moonki