Integration of AERO


Contents


Introduction

In order to make the GreenSpace environment more realistic, we have chosen to add dynamics to the demonstration. There are several different approaches to create dynamics in a graphical environment, including particle system and rigid body simulations. Particle systems are best for simulating large collections of small like bodies, such as smoke particles or leaves in the wind; while rigid body systems are better for simulating larger bodies of varied shapes (such as cylinders, cubes, and spheres). For the purposes of this phase of GreenSpace, we concentrated our efforts on rigid body simulations.

Rather than construct our own dynamics simulation package, for this early phase of GreenSpace, we turned to the literature to find an existing package which could be integrated into our system. Such a package was expected to provide rigid body simulation, including collision detection.

Researchers at the University of Stuttgart in Germany describe such a system in Virtual Mechanics: Simulation and Animation of Rigid Body Systems and provide source code at their ftp site. The heart of this AERO system may eventually serve as the collision detection and dynamics engine for GreenSpace.


AERO FSB Package

AERO ("Animation Editor for Realistic Object Motion") is an animation system for the visualization of complex rigid body dynamic systems. Over half of the AERO source code is devoted to generating the graphical user interface for manipulating and visualizing dyanimic scenes. However, we are merely interested in the portion of the source code which performs the simulation itself.

Fortunately, the authors of the AERO package have maintained the simulation code as a logically separate C library, named FSB ("Folge Schritt Berechnung"). Unfortunately, all of the FSB filenames, indentifiers, and comments are written in German.

The basic structure of the FSB library is shown below. A set of files are oriented towards the initialization of the simulation itself and another set of files interact to carry ou the simulation.


Initialization


Body Definition

The Body Definition module allows the user to define the shape, size, mass, and other physical characteristics of the objects to be placed in the dynamic environment. There are various standard body types which the user can select from, or the user can compose the basic types into more complex objects.

Once a body has been initialized and placed in a world, one can modify or observe its physical location in three-space. The user has access to an object's position, velocity, angular velocity, quaternion (orientation), acceleration, and angular acceleration.

Additionally, the FSB library allows users to place connections between objects in the form of rods or springs.

The following is a translation file which translates the german identifiers of this module into english indentifiers for our use.

/***************************************************************************** * [koerper] Body Definition * * Functions and variables for defining dynamic bodies. *****************************************************************************/ /*** Object Types ************************************************************/ #define TBody TKoerper #define TCompoundObj TZusGesObj #define TCuboid TQuader #define TCylinder TZylinder #define TForce TKraft #define TMaterialTable TMaterialTabelle #define TMoveType TBewTyp #define TSphere TKugel /*** Body Shapes *************************************************************/ #define fsbCOMPOSEDOBJ ZUSGESOBJ #define fsbCUBOID QUADER #define fsbCYLINDER ZYLINDER #define fsbNAIL NAGEL #define fsbPLANE EBENE #define fsbPOINT PUNKT #define fsbPOINTMASS MPUNKT #define fsbSPHERE KUGEL /*** Movement Types **********************************************************/ #define fsbFREE FREI #define fsbMASS_FREE MASSELOS #define fsbDIRECTED GEFUEHRT #define fsbGRAVITY_FREE GRAV0 #define fsbCOLLISION_POSS KOLL /*** Body Structure Component Definitions ************************************/ #define VNextBody Naechster #define VType Art #define VShape Form #define VMaterial Material #define VMass Masse #define VPosition Position #define Velocity Geshwindigkeit #define AngularVelocity Drehgeschwindigkeit #define Vq q #define VAcceleration Beschleunigung #define VAngularAcceleration Drehbeschleunigung /*** Note: some components ommitted -- see .h file */ #define VMoveType BewTyp #define VForce Kraefte #define VOtherBody OberKoerper #define VBodyId KoerperId /*** Functions ***************************************************************/ /* void fsbSetBodyMass(TBody *k, TReal mass); ********************************/ #define fsbSetBodyMass SetzeKoerperMasse /* void fsbBodyInit(TBody *k, TMaterialTable *MatTab); ***********************/ #define fsbBodyInit KoeIniMech /* void fsbSetBodyMassless(TBody *k, TBoolean nomass); ***********************/ #define fsbSetBodyMassless SetzeKoerperMasselos /* TBoolean fsbQueryBodyMassless(TBody *k); **********************************/ #define fsbQueryBodyMassless IstKoerperMasselos /* void fsbSetBodyGravityfree(TBody *k, TBoolean nograv); ********************/ #define fsbSetBodyGravityfree SetzeKoerperGravlos /* TBoolean fsbQueryBodyGravityfree(TBody *k); *******************************/ #define fsbQueryBodyGravityfree IstKoerperGravlos /* void fsbSetBodyCollisionable(TBody *k, TBoolean coll); ********************/ #define fsbSetBodyCollisionable SetzeKoerperKollmoeglich /* TBoolean fsbQueryBodyCollisionable(TBody *k); *****************************/ #define fsbQueryBodyCollisionable IstKoerperKollmoeglich /* void fsbBodyCopy(TBody *to, TBody *from, TBody *other); *******************/ #define fsbBodyCopy KoerperKopieren /* TBody *fsbBodyAllocate(); *************************************************/ #define fsbBodyAllocate KoerperAllozieren /* void fsbCompoundObjRot(TBody *k); *****************************************/ #define fsbCompoundObjRot ZusGesObjRot

Material Definition

Various material properties can be defined for a dynamic body, such as its density, frictional coefficients, and elasticity. There are a set of predefined material types, such as Iron and Plastic, which set all these parameters to default values. Here again is a translation file which we have written to ease the use of this module.

/***************************************************************************** * [materialien] Material Properties * * A few select variables have been translated below. *****************************************************************************/ /*** Materials ***************************************************************/ #define fsbIRON EISEN #define fsbPLASTIC PLASTIK #define fsbCORK 2 #define fsbICE 3 #define fsbGLASS 4 #define fsbGRANITE 5 #define fsbGOLD 6 #define fsbALU 7 #define fsbWOOD 8 #define fsbCONCRETE 9 #define fsbBRICK 10 #define fsbRUBBER 11 /*** Properties **************************************************************/ /* static char *MatName[33] = {...}; */ #define MatName MatNamen /* static TReal *MatDensity[32] = {...}; */ #define MatDensity MatDichte /* static TReal *MatDynamicFriction[32] = {...}; */ #define MatDynamicFriction MatGleitfaktor /* static TReal *MatStaticFriction[32] = {...}; */ #define MatStaticFriction MatHaftfaktor /* static TReal *MatImpulseResis[32] = {...}; */ #define MatImpulseResis MatStossfaktor /* static TReal *MatElasticity[32] = {...}; */ #define MatElasticity MatDehnfaktor /* static TReal *MatVapor[32] = {...}; */ #define MatVapor MatDaempffaktor /* static unsigned short *MatDefaultR[32] = {...}; */ /* static unsigned short *MatDefaultG[32] = {...}; */ /* static unsigned short *MatDefaultB[32] = {...}; */ /* static TReal *MatTransparency[32] = {...}; */ #define MatTransparency MatDurchsichtigkeit /* static TReal *MatReflexivity[32] = {...}; */ #define MatReflexivity MatReflexion /* static TReal *MatRoughness[32] = {...}; */ #define MatRoughness MatRauhigkeit

Simulation Config

The simulation configuration module allows the user to change such parameters as the simulation time increment and the gravitation factor. A translation file for this module is under construction.

External Forces

External forces can be added to bodies in order to "get the ball rolling". These forces are defined in reference to a body and a time interval. There are three types of external forces which can be specified: in the coordinate system of the body (such as F1), in fixed space coordinates (such as F2), or by giving another point on a different body (such as r4,F3).


State I/O

A world, or state, can either be coded inline or saved to a world file. This module facilitates the reading and writing or world files. Essentially, a world file simply consists of the simulation configuration, definition of bodies, and externally applied forces.


Simulation


State Transition Calculation

This is the main module of the FSB library, originally called Folge Schritt Berechnung. This contains the main simulation routine which is called at each time step to compute the next time interval based on the physical paramters of all objects in the environment.

The following is a flow chart which depicts the general state transition operation:

All of the routines, object types, and variables from this module were important enough to translate:

/***************************************************************************** * [folgeschrittberechnung] State Transition Calculation * * This is the main simulator module. All functions are listed below. *****************************************************************************/ /*** Object Types ************************************************************/ #define TConfigFBB TKonfigFBB #define TWorld TZustand /*** Variable Names **********************************************************/ #define VBodyList KoerperListe #define VTime Zeit #define VMaterialData MaterialDaten /*** Functions ***************************************************************/ /* void fsbRequestConfigFBB(TConfigFBB *Config); *****************************/ #define fsbRequestConfigFBB ErfrageKonfigFBB /* void fsbConfigFBB(TConfigFBB *Config); ************************************/ #define fsbConfigFBB KonfigFBB /* void fsbInitFBB(TWorld *z); ***********************************************/ #define fsbInitFBB InitFBB /* void fsbEndFBB(TWorld *z); ************************************************/ #define fsbEndFBB EndFBB /* void fsbStateTransitionCalc(TWorld *z, TReal dt); *************************/ #define fsbStateTransitionCalc FolgeBildBerechnung /* void fsbUnchangedFBB(TWorld *z); ******************************************/ #define fsbUnchangedFBB UngeaendertFBB

Collision Response

The Collision Response module handles collisions between dynamic bodies with the help of its three support modules: Collision Detection, Contact Forces, and Body Impact.

The Collision Detection module not only determines if two bodies are in contact, but also whether they are resting on eachother, moving away from eachother, or impacting eachother.

Depending on which type of collision it is, the Collision Response module uses different routines from either the Contact Forces module or the Body Impact module to determine what physical situation will result.

In order to determine if a sensor body under our control, such as a user's head or hand, comes in contact with another free moving body in the environment, we will directly access the Collision Detection module translated below:

/***************************************************************************** * [kollision] Collision Detection * * Functions and variables for detecting collisions *****************************************************************************/ /*** Collision Types *********************************************************/ #define fsbRESTING BERUEHRUNG #define fsbCOLLISION KOLLISION #define fsbSEPARATING LOSLOESUNG /*** Collision Structure Component Definitions *******************************/ #define VNextColl Naechste #define VBody1 Koerper1 #define VBody2 Koerper2 #define VType Art #define VDepth Tiefe #define VPos Ort #define VNormal Normale #define VPlaneVec1 EbeneVek1 #define VPlaneVec2 EbeneVek2 #define VPos1 Ort1 #define VPos2 Ort2 #define VPartBody1 TeilKoerper1 #define VPartBody2 TeilKoerper2 /*** Functions ***************************************************************/ /* void fsbCollisionDetection(TWorld *z, TCollision **k); ********************/ #define fsbCollisionDetection KollisionsErkennung /* void fsbBodyCollision(TCollision **k, TBody *k1, TBody *k2); **************/ #define fsbBodyCollision KoerperKollision /* void fsbColListClear(TCollision **k); *************************************/ #define fsbColListClear KolListeLoeschen /* void fsbColListMemoryFree(TCollision **k); ********************************/ #define fsbColListMemoryFree KolListeSpeicherfreigabe

Equations of Motion

This module contains the basic Equations of Motion which are at the heart of this library. These determine how a body will move, based on its physical characteristics and its motion parameters.


Integrator

This module handles the actual numerical integration required for the simulations. While this module is of key importance to the library, the GreenSpace code does not directly interface with it.

Linear Equation Solver

Like the Integrator module, there is no direct interaction between the primary modules of the GreenSpace system and this level of the FSB library.


Conclusions

While the AERO package does provide a wealth of rigid body dynamics support, there is a substantial cost in terms of cpu time to compute each time step of the simulation. Using our current system configuration, we could only allow a few objects to interact, before the simulation time fell below real time.

However, with a more powerful hardware system, we may find that we can afford the cpu time and achieve a superior level of interactive rigid body simulation than something like sensor-actuator networks can provide. The english language translation files will provide support for further exploration of the AERO system once our hardware platform is expanded.


Aaron Kaleva Pulkka, GreenSpace Project, Human Interface Technology Laboratory