Tips & Tricks

Tips & Tricks #:

  1. Units in AnyBody
  2. How to resolve kinematic problems in general
  3. Search tool for .any AnyScript files
  4. Unbalanced braces in AnyScript
  5. Dump Locations
  6. Object inserter
  7. Modeling conditional contact depending on posture
  8. Running AnyBody in batch mode
  9. Displaying node trajectories
  10. Interpolation drivers
  11. Norm measures


Tips and tricks #1: Units in AnyBody

The units in AnyBody are model dependent, and we recommend using SI units when building the models. The models in the repository are all based on SI units. This means that the muscles force, Fm, is given in Newtons, if you use the models from the repository.

So there is no settings for units. The user has to use a “matching” set of units when the model is defined.

Other examples:
PMech : [J/S] (Watt)
MaxMuscleActivity : No unit. This is muscle force divided by the strength of the muscle
EKin: [J]
Fm: [N]
Geometry: [m]

Tips and tricks #2: How to resolve kinematic problems in general

1. Make a sketch on how the model is driven and try to imagine what possibly could cause the problem.
2. If the kinematic error occurs in step 0, try to improve the starting conditions
3. Try to omit parts of the model like the arms or legs to detect where the root of the problem is located
4. If the model contains closed chain kinematics, replace these closed chains with joint drivers on the human. In the free PostureMove model in the model repository there are drivers for all the human joints, which can be used as a guideline. With all the closed chain kinematics removed, the model should run kinematically
5. Re-insert the closed chain constraints (in this case the marker drivers) one by one and remove joint drivers accordingly, making sure that a working model is maintained. This will make it easier to locate the problem.

Tips and tricks #3: Search tool for .any AnyScript files

We use a google desktop plug-in which allows you to search in any text file including .any files. If you specify filetype:any, the search will be exclusively in .any files.
 
All you have to do is to add a few lines to the text file which will open during installation. The readme.txt file explains what to do. You are ready to go when the update of the index file has completed.

Tips and tricks #4: Unbalanced braces in AnyScript

Braces {} are used to group things together in AnyScript. They must be coherent and balanced, and if you have one too few or one too many it can completely change the structure of the code, and you can get strange error messages. The best remedy is to use consistent indentations in the code. This makes it easy to follow the brace level and spot mistakes.

The AnyScript editor can indent your code automatically. If you select all the text and press Alt-F8, all lines are indented according to the brace level, and this often makes it much easier to see where the problem is. Beware that the missing brace can be in an include file.

Tips and tricks #5: Dump Locations

A nice little feature available in the AnyBody Modeling System in the Model tab of the AnyScript frame is the Dump Locations command.

If you right click on an object in the tree in the Model tab after you have loaded in your model and then select Dump Locations, the system will tell you the current value of the object (if it has one) and also the location of the object definition and initialization in the AnyScript code.

Tips and tricks #6: Object inserter

Several of our experienced users have not discovered some of the cool facilities in release 2.0. The object inserter is one of them.

Whenever you need to make a reference in AnyScript to an existing object in the model, you can do so via the model tree in the left-hand side of the window:

  1. Place the cursor in the editor window where you wish to insert the name of the existing object.
  2. Go to the model tree and locate the object.
  3. Right-click the object and select "insert full name".

This facility makes model development much easier because you no longer have to keep track of the folder hierarchy. Please refer to the Getting Started with AnyScript tutorial for more information.

Tips and tricks #7: Modeling conditional contact depending on posture

In situations with changing boundary conditions depending on the model posture a trick with a strong artificial pushing muscle can be used model conditional contact. The trick is to let the strength of this muscle depend on for example distances between points. If the distance is less than a certain user defined value the muscle will have a high strength and be capable to provide a force. If the distance is larger than the user defined value it will have no strength.

The artificial pushing muscles can be made using AnyGeneralMuscle by changing its force direction. To create the conditional contact this muscle needs a distance dependent strength model which can be defined by AnyMuscleModelUsr1. This greatly enhances the versatility of models because it makes it possible to model changing boundary conditions depending on the model posture. This is very useful in many scenarios, for example in gait analysis. An example of this can be found in the PedalDemoCondi-tional in the ARep/Aalborg branch of the repository.

Tips and tricks #8: Running AnyBody in batch mode

Most of us hate doing the same task over and over again. You don't need to do this with AnyBody. The AnyBody Modeling System comes with a command line version included. It is named AnyBodyCon.exe ("Con" for console application), and you will find it in the directory where you install AnyBody. The command line version is - as the name indicates - a version of the AnyBody Modeling System with the user interface stripped off. This means that it is executed from a DOS command prompt or - more importantly - by a batch file or another software application.

The Interface Features tutorial lesson 5 explains how to run the console app.

Tips and tricks #9: Displaying node trajectories

When developing models it is often convenient to be able to actually see the trajectory of a certain point (node) in the model such as a marker from a motion capture experiment or perhaps a joint center.

This little demo model shows how this can be done by making use of the AnyChart object.


Trajectory (blue) of a spiraling node

Tips and tricks #10: Interpolation drivers

An example showing graphically the use of a driver function that interpolates between data points spaced in time has become available in the AnyScript Yahoo Group (in the SmallExamples folder). The example visualizes the following types of interpolation as curves: Piecewise linear function, Bezier interpolation, and B-Spline interpolation of variable order.

Tips and tricks #11: Norm measures

The AnyKinMeasureNormComb object integrates several measures into one single measure; in this example one for each grey sphere representing its distance to the red surface.

Driving this measure to zero will enforce “contact” between one of the spheres and the surface at any time during the analysis and “contact” may shift between the spheres. An AnyKinMeasureNorm- Comb object is a norm combination measure which creates a norm-like quantity of the inputs. The measure introduces a weight factor for each input and an offset value. Using the right coefficients it will try to enforce one of the spheres to be in “contact” with the plane of surface at any time.
 
Please note that this is not a traditional surface to surface joint, but in some cases it can be used instead. When using this measure, the parameters of the measure should be carefully adjusted. the Contact can be more or less rigid and exact depending on the parameters of the AnyKinMeasureNormComb.

View the source code of this example here.


More Tips & Tricks will be posted in the future. Stay oriented!

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