Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Motion Model Unit

Janis Sprenger edited this page Feb 18, 2021 · 1 revision

Motion Model Unit

The Motion Model Units form the basic element in which the actual simulation approach is embedded. For usage across multiple programming languages and technologies, a unified interface, which fulfills the requirements of these heterogeneous approaches, is necessary. Figure 7 visualizes the basic interface as an UML class diagram. Furthermore, a detailed description of the available parameters and functions is given below.

<<interface>>
MotionModelUnit
+ID : string
+SceneAccess: MSceneAccess
+ServiceAccess : MServiceAccess
+SkeletonAccess : MSkeletonAccess
+Initialize ( avater : MAvatarDescription, properties: map<string,string> ) : MBoolResponse
+AssignInstruction(instruction: MInstruction, state: MSimulationState): MBoolResponse
+DoStep(time: double, state: MSimulationState): MSimulationResult
+CheckPrerequisites(instruction: MInstruction): MBoolResponse
+GetBoundaryConstraints(instruction: MInstruction): list<MConstraint>
+Abort(instructionID: string): MBoolResponse
+Dispose(properties: map<string,string>): MBoolResponse
+CreateCheckpoint() : binary
+RestoreCheckpoint(data : binary) : MBoolResponse
+ExecuteFunction(name: string, parameters: map<string,string>): map<string,string>

Detailed Descirption of Available Parameters / Functions

Function/ Parameter Name Description
ID Unique id of the MMU. The ID is defined by the MMU developer during the MMU development process.
SceneAccess Instance provides access to the scene (automatically set by the adapter).
ServiceAccess Instance provides access to the services (automatically set by the adapter).
SkeletonAccess Instance provides access to the helper functions of the avatar (automatically set by the adapter).
Initialize Method to initialize the MMU. The function provides the description of the utilized avatar and additional properties as input. Within the function, the internal model of the MMU can be setup. The MMU needs to return the information whether the initialization was successful.
DoStep The DoStep method is called once a frame in order to trigger the computation of a new posture. In particular, the simulation frame time, as well as the current simulation state (MSimulationState) are provided as input. The MMU returns the computed results (MSimulationResult).
CheckPrerequisites Based on a given MInstruction and the present state the MMU internally checks whether the instruction can be executed.
GetBoundaryConstraints The method returns the boundary constraints for executing the MMU. In particular, these constraints can contain a full body posture. For instance, a data-driven MMU might return the first posture as start-boundary condition. The previous MMU can adjust the internal model to achieve the desired starting posture.
Abort The method aborts the specified instruction.
Dispose The Method disposes the full MMU including all ongoing computations.
CreateCheckpoint Creats a checkpoint/snapshot of the present (internal) state of the MMU (e.g., the values of internally used variables). The checkpoint is realized in a binary format.
RestoreCheckpoint Restores the internal state based on a binary checkpoint.
ExecuteFunction Debug functionality to call additional functions. This method should be only used for debugging purposes.

In particular, the Motion Model Unit comprises eight different functions, which must be provided by all implementations. Via the Initialize function, the unit is set up given the characteristics of the utilized avatar. These characteristics are provided within the MAvatarDescription class. Within the given class, the neutral posture of the utilized (intermediate) avatar is contained, as well as additional anthropometric values. This information can be utilized to adjust the internal model and skeleton to the used reference skeleton in the MMI framework. Furthermore, a map of additional properties can be specified for the initialization. These properties can be used for specification of additional initialization parameters. The MMU returns a Boolean flag (MBoolResponse) indicating whether the initialization was successful.

To define the instruction/motions to be computed by the MMUs, the AssignInstruction method is used. Within this function, a MInstruction, which is strongly inspired by the BML language, is utilized (see 3.2.4). This class type allows to formulate specific instruction such as “pick up object 1”, being performed by the MMU. Additionally, the present state of the Avatar/simulation (MSimulationState) is used as input for the method. The method returns a Boolean status flag (MBoolResponse) that indicates whether the assignment was successful.

The main function for providing and generating the actual motion is the DoStep method. This function takes as an input the relative time to be simulated (e.g. 30 ms), as well as the current state of the simulation (MSimulationState). The output is the actual computed posture, actions and notifications for the given frame. In particular, the output is represented as MSimulationResult and contains further information. Despite the computed posture, the class also offers to specify posture constraints such as “fix position of left hand at (1, 1, 1)”. A detailed overview of all available constraints is given in the MConstraint section 3.2.4.3. Moreover, each MMU can return events that are an essential aspect for the co-simulation and the further workflow. Each MMU must provide an event of type end, if the last frame of the motion has been reached, and the MMU is finished. The list of the available events as well as the utilized MSimulationEvent class are described in 3.2.4.6. Additionally, each MMU can return proposals for manipulating the scene by using the MSceneManipulation class. For further debugging, it is possible to use MDrawingCalls for visualization and LogData.

For determining whether an instruction can be executed given the present state of the scene and the avatar the CheckPrerequisites method is provided. Each MMU can implement this method using internal starting criteria such as “left arm in range” for grasping.

To allow a simplified transition modeling between consecutive MMUs, each MMU can specify additional boundary constraints via the GetBoundaryConstraints method. A boundary constraint could be for instance the start posture of the generated motion. Therewith the previous MMU can adjust the generated motion with respect to the given transition constraint.

To terminate the currently active instruction the Abort method is used. The method resets the MMU to the initial state before the assign instruction took place.

To terminate a given MMU, the Dispose method is utilized. In particular, the allocated resources within the MMU are cleared.

Finally, to increase the flexibility of the provided framework, a further method named ExecuteFunction is suggested. This function can be used for debugging or for future extensions of the framework.

Parameters

The MParameter is an important format for the MMUDescription. The class defines the properties of a specific parameter that can be used by the MMU consumer.

MParameter
+Name: string
+Type: string
+Description: string
+Required: bool

Detailed description of available parameters/functions:

Parameter Name Required Description
Name
Type
Description
Required

Version

MVersion
+Major: i16
+Minor: i16
+Sub: i16
+Subsub: i16

Detailed description of available parameters/functions:

Parameter Name Required Description
Major
Minor
Sub
Subsub

Dependencies

MDependency
+ID: string
+Type: MDependencyType
+MinVersion: MVersion
+MaxVersion: MVersion
+ExcludedVersions: list
+Name: string

Detailed description of available parameters/functions:

Parameter Name Required Description
ID
Type
MinVersion
MaxVersion
ExcludedVersions
Name

Dependency Type

MDependencyType
+Service
+MMU
+ProgramLibrary
+MMIFramework
+Other

Detailed description of available parameters/functions:

Parameter Name Required Description
Service
MMU
ProgramLibrary
MMIFramework
Other

MOSIM Documentation

Introduction

Documentation

Known Issues

Clone this wiki locally