In the following subsections a detailed specification of the components that form PEL is given.
3.2.2. PEL Specification
The design of a language involves the definition of the three following aspects:
The lexicon, which establishes the vocabulary of the language.
The syntactic rules, which describe the form of the language sentences.
The semantic rules, which define the meaning of the syntactically correct sentences of the language.
Because glTF uses the JSON format and PEL will be integrated into it by means of extensions, PEL lexical and syntactic aspects are conditioned by the use of data objects structured in attribute-value pairs and arrays. In this sense, the use of special symbols to delimit values and the use of list and dictionary structures are noteworthy. The reader is referred to review the JSON formal grammar [
37].
The lexical component of PEL establishes the low-level language constructions (tokens), such as keywords, strings, punctuators, numbers, and special characters. With regard to keywords, they will be well-known terms that have been taken from the therapeutic area, the gamification area, the game mechanics area, and from the 3D graphics area. To describe the rules that define each one of the tokens, the Extended Bakus–Naur form (EBNF), a notation for specifying languages, is used. The definition of the lexicon will be shown together with the specification of the language syntax.
Next, PEL syntax will be presented, while using the EBNF notation. Moreover, the meaning and semantic constraints of each one of the language constructions, which is, their semantic aspects, are simultaneously explained.
General structure of an input
At a global level, the participation view of an exergame defined in PEL comprises the following general components: (1) description, (2) setup, (3) virtual_nodes, (4) trajectories, (5) gameplay, (6) constraints, and metrics.
Therefore, the structure of any PEL string is as follows:
PEL | ::= | DESCRIPTION ‘,’ SETUP ‘,’ VIRTUAL_NODES ‘,’ |
| | TRAJECTORIES ‘,’ GAMEPLAY ‘,’ CONSTRAINTS ‘,’ |
| | METRICS |
Each of these blocks will be specified below, highlighting lexical (especially keywords), syntax (phrase structure), and semantic (meaning) aspects. This description will be supported by the listings shown in this paper, which can be potentially used for the specification of personalized exergames.
Description component
In the description block, a descriptive information of the exergame will be included. The EBNF grammar for description block is the following:
DESCRIPTION | ::= | “‘’ description ‘”’ ‘:’ |
| | BLOCK_DESCRIPTION |
BLOCK_DESCRIPTION | ::= | ‘{’ “‘’ text ‘”’ ‘:’ string ‘}’ |
The terms description and text are PEL keywords. With the attribute text, a textual description of the exergame is stored. string is a token defined, as follows:
string | ::= | “‘’ { alphanumeric ∣ whitespace } ‘”’ |
alphanumeric | ::= | alphabetic ∣ numeric |
alphabetic | ::= | lower_case ∣ upper_case |
lower_case | ::= | a ∣ b ∣ c ∣ d ∣ e ∣ f ∣ g ∣ h ∣ i ∣ j ∣ k ∣ l ∣ m ∣ n ∣ o ∣ p ∣ q ∣ r ∣ |
| | s ∣ t ∣ u ∣ v ∣ w ∣ x ∣ y ∣ z |
upper_case | ::= | A ∣ B ∣ C ∣ D ∣ E ∣ F ∣ G ∣ H ∣ I ∣ J ∣ K ∣ L ∣ M ∣ N ∣ |
| | O ∣ P ∣ Q ∣ R ∣ S ∣ T ∣ U ∣ V ∣ W ∣ X ∣ Y ∣ Z |
numeric | ::= | 0 ∣ 1 ∣ 2 ∣ 3 ∣ 4 ∣ 5 ∣ 6 ∣ 7 ∣ 8 ∣ 9 |
whitespace | ::= | ‘’ |
|
Setup component
In the setup block, the information about the exergame configuration will be included, such as the used avatar, the camera information, the clock restrictions, the required repetitions, and the score to address the integration of this simple gamification technique to reward patients.
The EBNF grammar for the setup block is specified above, where the terms setup, avatar,
id_avatar, posture, positions, rotation, camera,
id_camera, repetitions,
max_number_repetitions, score, clock, activated, and
countdown_time, are keywords; and, the tokens
type_posture, real, integer, and boolean are defined, as follows:
type_posture | ::= | standing ∣ seated ∣ lying-down |
real | ::= | numeric { numeric } ‘.’ numeric { numeric } |
integer | ::= | numeric { numeric } |
boolean | ::= | true ∣ false |
With respect to the component setup, avatar allows for specifying what virtual avatar will be used in the exergame, through the attribute id_avatar. Moreover, the avatar placed in the 3D space by means of the attributes posture (standing, seated or lying-down), positions, and rotation.
The element camera allows to define, in a similar way, what camera will be used (
id_camera), along with its position and orientation. On the other hand, the element clock contains the attribute activated, whose boolean value makes it possible to activate the timer in the exergame. If that is the case, the attribute
countdown_time represents the maximum time in seconds that the patient will have to perform the exergame. Secondly, the object repetitions allows to establish whether the patient must perform a certain number of repetitions, specified in
max_number_repetitions, or whether, on the contrary,
SETUP | ::= | “‘’ setup ‘”’ ‘:’ BLOCK_SETUP |
BLOCK_SETUP | ::= | ‘{’ LIST_ATTRIBUTES ‘}’ |
LIST_ATTRIBUTES | ::= | AVATAR ‘,’ CAMERA ‘,’ CLOCK ‘,’ |
| | REPETITIONS ‘,’ SCORE |
AVATAR | ::= | “‘’ avatar ‘”’ ‘:’ BLOCK_AVATAR |
BLOCK_AVATAR | ::= | ‘{’ DEFINITION_AVATAR ‘}’ |
DEFINITION_AVATAR | ::= | ID_AVATAR ‘,’ POSTURE ‘,’ POSITION |
| | ‘,’ ROTATION |
ID_AVATAR | ::= | “‘’ id_avatar ‘”’ ‘:’ string |
POSTURE | ::= | “‘’ posture‘”’ ‘:’ type_posture |
POSITION | ::= | “‘’ position ‘”’ ‘:’ VECTOR3 |
ROTATION | ::= | “‘’ rotation ‘”’ ‘:’ VECTOR4 |
VECTOR3 | ::= | ‘[’ real ‘,’ real ‘,’ real ‘]’ |
VECTOR4 | ::= | ‘[’ real ‘,’ real ‘,’ real ‘,’ real ‘]’ |
CAMERA | ::= | “‘’ camera ‘”’ ‘:’ BLOCK_CAMERA |
BLOCK_CAMERA | ::= | ‘{’ DEFINITION_CAMERA ‘}’ |
DEFINITION_CAMERA | ::= | ID_CAMERA ‘,’ POSITION ‘,’ ROTATION |
ID_CAMERA | ::= | “‘’ id_camera ‘”’ ‘:’ string |
CLOCK | ::= | “‘’ clock ‘”’ ‘:’ BLOCK_CLOCK |
BLOCK_CLOCk | ::= | ‘{’ DEFINITION_CLOCK ‘}’ |
DEFINITION_CLOCK | ::= | ACTIVATED ‘,’ COUNTDOWNTIME |
ACTIVATED | ::= | “‘’ activated ‘”’ ‘:’ boolean |
COUNTDOWNTIME | ::= | “‘’ countdown_time ‘”’ ‘:’ integer |
REPETITIONS | ::= | “‘’ repetitions ‘”’ ‘:’ |
| | BLOCK_REPETITIONS |
BLOCK_REPETITIONS | ::= | ‘{’ DEFINITION_REPT ‘}’ |
DEFINITION_REPT | ::= | ACTIVATED ‘,’ MAXNUM_REPT |
MAXNUM_REPT | ::= | “‘’ max_number_repetitions ‘”’ ‘:’ |
| | integer |
SCORE | ::= | “‘’ score ‘”’ ‘:’ BLOCK_SCORE |
BLOCK_SCORE | ::= | ‘{’ DEFINITION_SCORE ‘}’ |
DEFINITION_SCORE | ::= | ACTIVATED |
the exergame simply contemplates the possibility of the patient performing as many repetitions as possible in the time stored in
countdown_time. Finally, the object score allows tfor controlling the activation of the exergame score through the attribute activated.
Listing 1 in
Section 4 shows an example of PEL definitions regarding the description and setup components.
Virtual_nodes component
In the virtual_nodes block, the collision spheres in the 3D space are defined. They will be used as trigger events in certain types of exergames, specifically in those where the patient interacts with with elements of the scene displayed in fixed positions. An example would be the classic exergame, where targets appear, in predetermined positions, which move towards the player, so he/she must take his/her hand to one of those positions.
The EBNF grammar for the
virtual_nodes block is the following:
VIRTUAL_NODES | ::= | “‘’ virtual_nodes ‘”’ ‘:’ BLOCK_VNODES |
BLOCK_VNODES | ::= | ‘[’ LIST_NODES ‘{’ NODE ‘}’ ‘]’ |
LIST_NODES | ::= | { ‘{’ NODE ‘}’ ‘,’ } |
NODE | ::= | ID_ACTOR ‘,’ CLASS_ACTOR ‘,’ |
| | POSITION ‘,’ RADIUS |
ID_ACTOR | ::= | “‘’ id_actor ‘”’ ‘:’ string |
CLASS_ACTOR | ::= | “‘’ class_actor ‘”’ ‘:’ type_actor |
RADIUS | ::= | “‘’ radius ‘”’ ‘:’ real |
The terms
virtual_nodes,
id_actor,
class_actor, and radius are keywords.
id_actor uniquely identifies the associated virtual node, while
type_actor is a token defined, as follows:
type_actor | ::= | up ∣ upper-left ∣ upper-right ∣ |
| | bottom ∣ bottom-left ∣ bottom-right |
The component virtual_nodes hosts a list of 3D nodes, and each one of them contains, in turn, a unique identifier (attribute id_actor), the values of a coordinate in the 3D space (attribute position), and the radius of the collision sphere associated to the node (attribute radius).
Trajectories component
The component trajectories is used to store the trajectories associated with the movements that a patient will make when performing an exergame. In this case, and unlike the component virtual_nodes, the points or nodes in the 3D space do not need a unique identifier, since the identity of the element is represented by each path (id_trajectory), and not by individual points in 3D space. As an example, an element defined by the component trajectories would be the route or path associated to a shoulder abduction exercise. Thus, the component trajectories stores a list of individual paths, each one of them being identified by the value of the attribute id_trajectory and defined by the attribute 3d_path. This attribute will contain an ordered list or sequence of points in 3D space that form the path. Single nodes can be used as part of a path.
The EBNF grammar for trajectories block is the following:
TRAJECTORIES | ::= | “‘’ trajectories ‘”’ ‘:’ |
| | BLOCK_TRAJECTORIES |
BLOCK_TRAJECTORIES | ::= | ‘[’ LIST_TRAJECTORIES |
| | ‘{’ TRAJECTORY ‘}’ ‘]’ |
LIST_TRAJECTORIES | ::= | { ‘{’ TRAJECTORY ‘}’ ‘,’ } |
TRAJECTORY | ::= | ID_TRAJECTORY ‘,’ PATH ‘,’ RADIUS |
ID_TRAJECTORY | ::= | “‘’ id_trajectory ‘”’ ‘:’ string |
PATH | ::= | “‘’ 3d_path ‘”’ ‘:’ |
| | ‘[’ VECTOR3 { ‘,’ VECTOR3 } ‘]’ |
The terms trajectories, 3d_path, and id_trajectory are PEL keywords.
The
Listing 1 in
Section 4 shows an example of the two components associated to the elements of the 3D space used to represent virtual nodes or paths:
virtual_nodes and trajectories.
Gameplay component
The gameplay component contains the information related to the game dynamics, which is based on the interaction between joints and virtual nodes in the 3D space. A game dynamics establishes the relationships between three fundamental aspects in an exergame:
Trajectory or virtual path associated to the movement of the exergame.
Interaction mechanism used by the patient to perform the exergame, associated, in turn, to (i) the parts of the body that the patient must exercise and (ii) the interaction mode.
Feedback provided to the patient as he/she performs or completes a repetition of the exergame.
The EBNF grammar for
gameplay block is the following:
GAMEPLAY | ::= | “‘’ gameplay ‘”’ ‘:’ |
| | BLOCK_GAMEPLAY |
BLOCK_GAMEPLAY | ::= | ‘[’ LIST_GAMES_DYNAMIC |
| | ‘{’ GAME_DYNAMIC ‘}’ ‘]’ |
LIST_GAMES_DYMAMIC | ::= | { ‘{’ GAME_DYNAMIC ‘}’ ‘,’ } |
GAME_DYNAMIC | ::= | ID_GAME_DYNAMIC ‘,’ |
| | ID_TRAJECTORY ‘,’ |
| | MAXTIME ‘,’ INVOLVED_JOINTS ‘,’ |
| | INTERACTION ‘,’ |
| | ON_REPT_COMPLETED ‘,’ |
| | ON_REPT_FAILED |
The terms gameplay,
id_game_dynamic,
max_time_between_path_nodes,
involved_joint, interaction, type,
interaction_time,
on_repetition_completed,
repetition_increment,
score_increment,
on_repetition_failed, and
action, introduced next, are keywords. The tokens
type_joint,
type_interaction, and
type_action are defined, as follows:
type_joint | ::= | hip-center ∣ spine ∣ shoulder-center ∣ head ∣ |
| | shoulder-left ∣ elbow-left ∣ wrist-left ∣ hand-left ∣ |
| | shoulder-right ∣ elbow-right ∣ wrist-right ∣ |
| | hand-right ∣ hip-left ∣ knee-left ∣ ankle-left ∣ |
| | foot-left ∣ hip-right ∣ knee-right ∣ ankle-right ∣ |
| | foot-right |
type_interaction | ::= | on-touch ∣ hold |
type_action | ::= | retry ∣ skip |
ID_GAME_DYNAMIC | ::= | “‘’ id_game_dynamic ‘”’ ‘:’ string |
MAXTIME | ::= | “‘’ max_time_between_path_nodes ‘”’ ‘:’ |
| | integer |
INVOLVED_JOINTS | ::= | “‘’ involved_joint ‘”’ ‘:’ type_joint |
INTERACTION | ::= | “‘’ interaction ‘”’ ‘:’ |
| | BLOCK_INTERACTION |
BLOCK_INTERACTION | ::= | ‘{’ DEFINITION_INTERACTION ‘}’ |
DEFINITION_INTERACTION | ::= | TYPE ‘,’ INTERACTION_TIME |
TYPE | ::= | “‘’ type ‘”’ ‘:’ type_interaction |
INTERACTION_TIME | ::= | “‘’ interaction_time ‘”’ ‘:’ integer |
ON_REPT_COMPLETED | ::= | “‘’ on_repetition_completed ‘”’ ‘:’ |
| | BLOCK_ORC |
BLOCK_ORC | ::= | ‘{’ REPETITION_INCR ‘,’ |
| | SCORE_INCR ‘}’ |
REPETITION_INCR | ::= | “‘’ repetition_increment ‘”’ ‘:’ |
| | integer |
SCORE_INCR | ::= | “‘’ score_increment ‘”’ ‘:’ integer |
ON_REPT_FAILED | ::= | ‘“’ on_repetition_failed ‘”’ ‘:’ |
| | BLOCK_ORF |
BLOCK_ORF | ::= | ‘{’ ACTION ‘}’ |
ACTION | ::= | “‘’ action ‘”’ ‘:’ type_action |
The attribute id_game_dynamic identifies each one of the game dynamics available in the exergame. id_trajectory and max_time_between_path_nodes, contained in the each game dynamic, are related to its trajectory. The attribute id_trajectory contains the unique identifier of a virtual path previously defined in PEL (trajectories component). PEL allows to set what should happen if this restriction is not met. To do this, the element on_repetition_failed allows to set an callback action (attribute action), such as informing the patient that he/she must start the repetition again (value retry).
The attribute involved_joint and the element interaction are associated with the interaction mechanism. Thus, involved_joint allows for registering the joint that the system must monitor, while interaction is used for specifying the type of interaction (on-touch for a simple interaction, or hold for one that requires the patient to hold the position during a time defined in the attribute interaction_time).
Finally, PEL allows to define what happens when a repetition is completed or not in a game dynamic, thus providing feedback to the patient. The elements on_repetition_completed and on_repetition_failed specify it. The current PEL version considers two possible values for on_repetition_completed: repetition_increment to indicate the update of the number of repetitions in the exergame, and score_increment to indicate the update of the patient’s score. On the other hand, on_repetition_failed, as introduced above, determines what happens when the patient does not perform a repetition in a correct way.
Constraints component
The constraints components stores information regarding the defined restrictions in the exergame, typically associated with those parts of the body that the patient should not ideally move to compensate for the lack of mobility or strength of the body part to be rehabilitated.
The EBNF grammar for constraints block is the following:
CONSTRAINTS | ::= | “‘’ constraints ‘”’ ‘:’ |
| | BLOCK_CONSTRAINTS |
BLOCK_CONSTRAINTS | ::= | ‘{’ JOINTS ‘}’ |
JOINTS | ::= | “‘’ joints ‘”’ ‘:’ |
| | ‘[’ LIST_JOINTS ‘]’ |
LIST_JOINTS | ::= | type_joint { ‘,’ type_joint } |
The terms constraints and joints are keywords. Although this component may seem to be very specific and there is a change in the abstraction level with respect to the other components, the fact is that most virtual rehabilitation commercial tools allow for explicitly indicating which parts of the body a patient should not move when doing rehabilitation. In this sense, the current PEL version considers the element joints as a list of specific joints associated to this restriction.
Metrics component
The metrics block stores information about those aspects of the patient’s exergame execution that need to be assessed by the therapists. This component represents a list of key performance indicators (KPIs) to monitor the performance and evolution of the patient. Depending on the indicator, PEL contemplates the definition of some attributes or others. Currently, the KPIs that are considered in the current PEL version are five:
performance, which allows the definition of a patient’s performance in an exergame, using the values specified in the attribute labels and the ranges contemplated in the attribute score. Note that the value of the score in an exergame will be conveniently updated according to the value of the element on_repetition_completed included in the component gameplay. As an example, and internally in the parsing module of the automatic exergame generation system, the label not-bad would be associated to a score lower or equal to 300 points (in this example), the label good to a score higher than 300 and lower or equal to 700, and the label perfect to a score higher than 700 points.
rehabilitation_time, which allows for recording the time that it takes for a patient to complete certain parts of the exergame when evaluating the exercise. This component defines several KPIs, such as the time that elapses between a limb passes through the virtual nodes, the time employed by the patient in order to complete a repetition, and the time that is needed by a patient to rest after completing a repetition. Another KPI is defined to record the time it takes for a patient to complete the activity, which is added in the listing shown below.
mobility, which allows for specifying and monitoring a list of joints to measure their degree of abduction, adduction, extension, and flexion, respectively. Furthermore, this component allows to record the velocity of the joints. This list is defined by the attribute points.
displacement, which allows measuring aspects that are related to exercises that involve gestures of movement. In other words, exercises that mimic the gesture of static walking and exercises that require the execution of lateral steps. The defined KPIs allow to evaluate walking measuring, the amount of static steps or the amount of lateral steps. Furthermore, there are two KPIs for recording both the highest and the widest step.
balance control, which allows for evaluating aspects that are related to balance. This component defines a KPI to measure and evaluate the base support of a patient. Apart from this, another KPI is established to measure and evaluate the patient’s gravity center.
The EBNF grammar for metrics block is specified next:
METRICS | ::= | “‘’ metrics ‘”’ ‘:’ BLOCK_METRICS |
BLOCK_METRICS | ::= | ‘[’ KPI { ‘,’ KPI } ‘]’ |
KPI | ::= | REHAB_TIME ∣ MOBILITY ∣ |
| | BALANCE_CTRL ∣ DISPLACEMENT ∣ |
| | PERFORMANCE |
REHAB_TIME | ::= | “‘’ rehabilitation_time ‘”’ ‘:’ |
| | BLOCK_REHABTIME |
BLOCK_REHABTIME | ::= | ‘{’ DEFINITION_REHABTIME ‘}’ |
DEFINITION_REHABTIME | ::= | TIME_ACTIVITY ‘,’ TIME_VNODE ‘,’ |
| | TIME_REPETITION ‘,’ TIME_REST |
TIME_ACTIVITY | ::= | “‘’ time_activity ‘”’ ‘:’ BLOCK_TIME |
TIME_VNODE | ::= | “‘’ time_vnodes ‘”’ ‘:’ BLOCK_TIME |
TIME_REPETITION | ::= | “‘’ time_repetition ‘”’ ‘:’ BLOCK_TIME |
TIME_REST | ::= | “‘’ time_rest ‘”’ ‘:’ BLOCK_TIME |
BLOCK_TIME | ::= | ‘{’ DEFINITION_TIME ‘}’ |
DEFINITION_TIME | ::= | TIME ‘,’ LABELS |
TIME | ::= | “‘’ time ‘”’ ‘:’ VALUES |
VALUES | ::= | ‘[’ integer ‘,’ integer ‘,’ integer ‘]’ |
LABELS | ::= | “‘’ labels ‘”’ ‘:’ ‘’ LABELS ‘’ |
LIST_LABELS | ::= | type_label { ‘,’ type_label } |
MOBILITY | ::= | “‘’ mobility ‘”’ ‘:’ BLOCK_MOBILITY |
BLOCK_MOBILITY | ::= | ‘{’ DEFINITION_MOBILITY ‘}’ |
DEFINITION_MOBILITY | ::= | EXTENSION ‘,’ FLEXION ‘,’ |
| | ABDUCTION ‘,’ ADDUCTION ‘,’ |
| | JOINT_VELOCITY |
EXTENSION | ::= | “‘’ extension_degree ‘”’ ‘:’ real |
FLEXION | ::= | “‘’ flexion_degree ‘”’ ‘:’ BLOCK_JOINTS |
ABDUCTION | ::= | “‘’ abduction_degre ‘”’ ‘:’ BLOCK_JOINTS |
ADDUCTION | ::= | “‘’ adduction_degre ‘”’ ‘:’ BLOCK_JOINTS |
JOINT_VELOCITY | ::= | “‘’ joint_velocity ‘”’ ‘:’ BLOCK_JOINTS |
BLOCK_JOINTS | ::= | ‘{’ JOINTS ‘}’ |
BALANCE_CTRL | ::= | “‘’ balance_control ‘”’ ‘:’ BLOCK_BCTRL |
BLOCK_BCTRL | ::= | ‘{’ DEFINITION_BCTRL ‘}’ |
DEFINITION_BCTRL | ::= | BASE_SUPPORT ‘,’ GRAVITY_CENTER |
BASE_SUPPORT | ::= | “‘’ base_support ‘”’ ‘:’ BLOCK_DEF_BCTRL |
GRAVITY_CENTER | ::= | “‘’ gravity_center ‘”’ ‘:’ BLOCK_DEF_BCTRL |
BLOCK_DEF_BCTRL | ::= | ‘{’ DEF_BASE_SUPPORT ‘}’ |
DEF_BASE_SUPPORT | ::= | 2D_POSITIONS ‘,’ LABELS |
2D_POSITIONS | ::= | “‘’ 2d_coords‘”’ ‘:’ VECTOR2 |
VECTOR2 | ::= | ‘[’ real ‘,’ real ‘]’ |
DISPLACEMENT | ::= | “‘’ displacement “‘’ ‘:’ |
| | BLOCK_DISPLACEMENT |
BLOCK_DISPLACEMENT | ::= | ‘{’ DEFINITION_BLOCKDISP ‘}’ |
DEFINITION_BLOCKDIS | ::= | STATIC_STEP ‘,’ LATERAL_STEP ‘,’ |
| | HEIGHT_STEP ‘,’ WIDTH_STEP |
STATIC_STEP | ::= | “‘’ static_steps ‘”’ ‘:’ BLOCK_STEP |
LATERAL_STEP | ::= | “‘’ lateral_steps ‘”’ ‘:’ BLOCK_STEP |
HEIGHT_STEP | ::= | “‘’ height_step ‘”’ ‘:’ BLOCK_STEP |
WIDTH_STEP | ::= | “‘’ width_step ‘”’ ‘:’ BLOCK_STEP |
BLOCK_STEP | ::= | ‘{’ DEFINITION_STEP ‘}’ |
DEFINITION_STEP | ::= | JOINTS ‘,’ AMOUNT ‘,’ LABELS |
AMOUNT | ::= | “‘’ amount ‘”’ ‘:’ VALUES |
PERFORMANCE | ::= | “‘’ performance ‘”’ ‘:’ |
| | BLOCK_PERFORMANCE |
BLOCK_PERFORMANCE | ::= | ‘{’ DEFINITION_PERFORMANCE ‘}’ |
DEFINITION_PERFORMANCE | ::= | SCORE_PERFORMANCE |
SCORE_PERFORMANCE | ::= | “‘’ score_performance ‘”’ |
| | ‘:’ BLOCK_DEF_PERF |
BLOCK_DEF_PERF | ::= | ‘{’ DEF_SCORE_PERF ‘}’ |
DEF_SCORE_PERF | ::= | SCORE ‘,’ LABELS |
SCORE | ::= | “‘’ score ‘”’ ‘:’ VALUES |
The terms metrics,
rehabilitation_time,
time_activity,
time_vnodes,
time_repetition,
time_rest,
time,
mobility,
extension_degree,
flexion_degree,
abduction_degree,
adbuction_degre,
joint_velocity,
balance_control,
base_support,
gravity_center,
displacement,
static_steps,
lateral_steps,
height_step,
width_step,
2d_coords, amount, performance,
score_performance, score, and labels are keywords. The token
type_label is defined, as follows:
type_label | ::= | not-bad ∣ good ∣ perfect |
3.2.3. Automatic Exergame Generation and Authoring Tools for Therapists
When the specification of the exergame has been completed, the system can be requested in order to automatically generate the exergame, considering the final deployment hardware platform. This generation depends on a game engine on which to execute the source code generated from PEL sentences. In the current version of this work, the Unity 3D (
https://unity3d.com/) game engine is used. This choice is based on its portability and the large amount of multimedia resources available for its integration in exergames.
The automatic generation of an exergame is carried out through a software module of hierarchical analysis of the exergame information in PEL/glTF. This module receives through a URI (Uniform Resource Identifier) the location of the .gltf file with all the content of the exergame, that is, both the multimedia resources and the design itself through PEL sentences. Note that PEL makes use of the glTF extensions, particularly through the field extras, in which the specific behavior linked to the exergame design methodology previously introduced is specified. The automatic analysis process of this field extras is integrated in a sub-module that is responsible for parsing in the form of a syntactic analyzer. This is supported by the implementation of glTF to make the de-serialization of the glTF coded elements as efficient as possible.
The idea of providing a language for the definition of personalized exergames, whose sentences can be automatically processed by a software program, has a great impact on the process of adapting physical rehabilitation according to the needs of each patient. Taking this language as a reference, it is possible to build both software modules that work on top of it and authoring tools that make it possible for therapists to easily design exergames in a visual way.
It should be noted that, although the language proposed in this work is simple enough, the therapist is not intended to be the one that use it. As already mentioned, the idea is to have an intermediate language that can be manipulated by advanced subsystems, according to various aspects, such as the interaction of the patient with the exercise. In this context, the therapist may need a high-level authoring tool that facilitates the design of the exergame. This tool would integrate a software module in order to generate the PEL sentences that are equivalent to the graphic definition of the exergame. Although the development and evaluation of this tool is beyond the scope of this article, a first design has been addressed in order to complement the proposed approach.
For the definition of the exercise and rehabilitation objectives specific to each patient, the therapist will be provided with a graphical definition tool that facilitates the definition of key positions, as well as the specification of the different variables and options available in the exergame. This graphic editor encapsulates the glTF and JSON components that will be automatically exported and used by the other components of the tool. Internally, the graphical editor module would employ a description based on the H-Anim standard (ISO/IEC IS 19774-1:2019). As for the bone hierarchy, each animation chain is composed of several articulated elements that define transformations from the root of the hierarchy.
There are several specific avatars for rehabilitation, such as [
38] or [
39], which, however, are not focused on the creation of exercises by non-technical staff without using motion capture techniques. The precise configuration of the positions and rotations of each part of the animation hierarchy is essential when defining rehabilitation exercises. The definition of movement must allow for both rapid definition of movements, using in our proposal inverse kinematics (IK), and subsequent fine tuning, using direct kinematics methods.
In the virtual avatar integrated in the proposed tool, every element of the kinematic chain can be positioned and rotated while using realistic human limitations. This is the most time consuming phase in the generation of a new exergame. As detailed next, a new approach has been devised in order to increase the adaptability and the ease of use by the therapist. The graphic editor will allow defining start and end positions in three different ways:
Use a set of predefined key positions. This option allows to directly input common positioning settings for each limb.
Use of a high level adjustment by employing high-level reverse kinematics manipulators.
Definition, if needed, of the position and rotation details of each bone using direct kinematics.
The skeleton that is defined in the graphical editing module consists of 103 bones (see
Figure 2), of which 19 are inverse kinematic manipulators and high-level controls (they influence a set of bones). The use of inverse kinematics and spherical quaternary interpolation [
40] facilitates the therapist’s work in defining the key poses of the starting and ending positions of the rehabilitation exercises.
In relation to the methods of inverse kinematics, there are three concepts to which special attention is paid: the description of the joints, the angle of rotation, and the degrees of freedom. The physical characteristics of the joints themselves determine the final movement, the angle of rotation describes the rotation allowed for each joint, and the degrees of freedom involve the directions in which each joint moves. In most kinematic configurations, it is essential to define the rotation restrictions in order to avoid constrained configurations and simulate only physically correct positions. There are two ways of dealing with IK: analytical or iterative methods. Analytical methods require prior analysis of the animation hierarchy and, in the case of body movements in humans (like in the proposed tool), the resulting equations are very complex. To face this problem, the proposed graphic editor uses the iterative method Cyclic Coordinate Descent (CCD) [
41]. CCD is an iterative method for calculating the IK that minimizes the error of the kinematic configuration for each joint.
Thus, each kinematic chain defines its own set of rotation changes, so that the final composition of the animation is obtained using non-linear animation (NLA) techniques [
41]. In NLA, each piece of animation (action) is focused on the definition of a certain action (e.g., moving the right arm). These actions are combined with others, each of them defining a certain animation layer. When generating PEL sentences, this independent treatment will allow exporting the restrictions that are defined by the therapist in a simple way. On the other hand, each exergame is defined by several actions (or animation channels). Basic SLERP interpolation [
40] will be used to concatenate the different defined sub-actions (e.g., raising the whole arm and then rotating the forearm 90
around the torso).
Obtaining realistic movements is probably the most important element to consider in the representation of rehabilitation exergames. The animation must faithfully represent the exercise to be performed by the patient. The results obtained related to the proposed approach will generate high quality results, which are independent of the final representation. In addition, an approach that is based on keyframe animations produces more accurate, clean, and understandable results than motion capture based techniques, with a lower computational cost in the context of high-demand application domains [
42].
The pose editor
One of the main problems related to the creation of rehabilitation exercises is the time needed for their definition and the level of knowledge regarding 3D animation tools. Despite the development of new techniques to facilitate the animation of virtual characters (such as inverse kinematic controls and key poses), an experienced user may require between five and 10 min. to define a realistic movement. Because of the initial knowledge that is required to work with these types of tools, this phase requires special attention in the proposal.
An exercise editing module has been designed (see
Figure 3) to facilitate the definition of rehabilitation exergames. The therapist will be requested in order to choose basic settings of shape and orientation of the extremities in a direct way. Firstly, he/she will choose the joint, and then he/she will pick, from a catalog of key poses, the one that is most similar to the one he/she wants to perform. This configuration can be refined later while using reverse kinematics controls and, if necessary, direct kinematics controllers for the final tuning.
In the current proposal, 48 basic positions were defined for the arms and 12 basic positions for the legs. By using an exercise editor like this, the time that is needed to specify a new exercise can be reduced by a 90%, obtaining results of similar quality.
Finally, the exercise definition system has been designed to be handled as a plug-in within the Blender animation suite. Blender existing functionalities can be used for animation, keyframe definition, or playback, among others, which facilitate the subsequent export process to glTF + JSON (see
Figure 4).