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

Posture Blending Service

Felix Gaisbauer edited this page Dec 16, 2020 · 1 revision

Posture Blending Service

Overall Data

Property Values
Name PostureBlendingService
Nature The posture blending service allows to estimate in-between posture between a specified start and end posture, as well as a blending weight.
Programming Language C#
Development Tools Visual Studio 2017
Additional Libraries -
Databases -
License MIT

Functionalities

The Posture Blending Service is a core service provided as part of the MMI framework. The service allows to create intermediate postures given a start and end-posture (also being referred as posture blending).

Interface

The provided service offers two functions as part of the interface. Whereas the first function (Blend) allows to create an intermediate posture between a given start posture and a target posture, BlendMany allows to perform multiple blends using a single instructions. This is especially beneficial if multiple blends are required, since potential network traffic and latency might be minimized. The methods use the MAvatarPostureValues for transfering the posture information. In addition a blending weight [0;1] must be specified. The weight corresponds to the interpolation weight between the postures. Moreover, the methods allow to specify a blend mask to solely consider particular joints.

service MPostureBlendingService extends MMIServiceBase
{
   scene.MAvatarPostureValues Blend (1: scene.MAvatarPostureValues startPosture, 2: scene.MAvatarPostureValues targetPosture, 3: double weight, 4: map<scene.MJointType, double> mask, 5:map<string,string> properties),
   list<scene.MAvatarPostureValues> BlendMany (1: scene.MAvatarPostureValues startPosture, 2: scene.MAvatarPostureValues targetPosture, 3: list<double> weights, 4: map<scene.MJointType, double> mask, 5:map<string,string> properties)
}

Before beeing applicable, the service must be setup using the setup method. In particular, the service uses the MAvatarDescription and internally stores the mapping id <-> MAvatarDescription. When the service is executed using Blend or BlendMany, the startPosture must have the respective AvatarID. Otherwise the service is not able to reconstruct the avatar posture from the posture values.

Examples

The following represents an exemplary utilization within a C# MMU.

...
///First the service is set up in the initialize/assign instruction using the MAvatarDescription of the MMU
this.ServiceAccess.PostureBlendingService.Setup(this.AvatarDescription, new Dictionary<string, string>());

//Get the start posture (for instance, the current posture of the MSimulationState)
MAvatarPostureValues startPosture = state.Current;

//Get the end posture (for instance, the initial posture of the MSimulationState)
MAvatarPostureValues endPosture = state.Initial;

//Perform a blending with the weight 0.5 (produces an in-between posture)
MAvatarPostureValues result = this.ServiceAccess.PostureBlendingService.Blend(startPosture, endPosture, 0.5f, new Dictionary<MJointType, double>(), new Dictionary<string, string>());

//Perform a blending with multiple weights (0.25,0.50,0.75). The methods returns in total three postures corresponding to the interpolation weight
List<MAvatarPostureValues> results = this.ServiceAccess.PostureBlendingService.BlendMany(startPosture, endPosture, new List<double>() { 0.25,0.50f,0.75}, new Dictionary<MJointType, double>(), new Dictionary<string, string>());

The service also allows to specifiy the interpolation weight of individual joints using the blending mask.

...

//Create a new dictionary which represents the blendingMask
//In this case, the headjoint and pelvis centre should be excluded from the blending (weight 0)
Dictionary<MJointType, double> blendMask = new Dictionary<MJointType, double>()
{
   {  MJointType.HeadJoint, 0},
   { MJointType.PelvisCentre,0}
};

//Perform a blending with the weight 0.5 (produces an in-between posture) and the blend mask
MAvatarPostureValues result = this.ServiceAccess.PostureBlendingService.Blend(startPosture, endPosture, 0.5f, blendMask);

//Perform a blending with multiple weights (0.25,0.50,0.75). The methods returns in total three postures corresponding to the interpolation weight
List<MAvatarPostureValues> results = this.ServiceAccess.PostureBlendingService.BlendMany(startPosture, endPosture, new List<double>() { 0.25,0.50f,0.75}, new Dictionary<MJointType, double>(), blendMask);

Known Issues

Technical Information

Licensing